<?php $this->load->view('admin/message'); ?>
<?php $this->load->view('admin/error'); ?>

<div class="row">
    
    <div class="col-md-6">
		<div class="box box-success">
			<div class="box-header with-border">
				<h3 class="box-title"><i class="fa fa-home"></i>&nbsp;Administrator Home</h3>
				<div class="box-tools pull-right">
					<button class="btn btn-box-tool" type="button" data-widget="collapse"><i class="fa fa-minus"></i></button>
					<button class="btn btn-box-tool" type="button" data-widget="remove"><i class="fa fa-times"></i></button>
				</div>
			</div>
			<div class="box-body">
				<p>
					Selamat datang <strong><?php echo $session; ?></strong>, silahkan melanjutkan pekerjaan Anda.<br>
					Jangan lupa untuk <a href="<?php echo site_url('admin/login/logout'); ?>">Logout</a> setelah selesai, Terima kasih.
				</p>
			</div>
		</div>

		<div class="box box-primary">
			<div class="box-header with-border">
				<i class="fa fa-users"></i>
				<h3 class="box-title">User</h3>
            	<a class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#newuser">New</a><br>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
				<table class="table table-bordered table-striped">
					<tbody>
						<tr>
							<th>Username</th>
							<th>Access Level</th>
							<th>Action</th>
						</tr>
						<?php if (empty($list_user)) { ?>
						<tr>
							<td colspan="3"><center><h4>no data</h4></center></td>
						</tr>
						<?php }
						else {
							foreach ($list_user as $row) { ?>
							<tr>
								<td><?php echo $row->username; ?></td>
								<td><?php if ($row->access_level == 1) { echo "Superadmin"; } else { echo "Admin";} ?></td>
								<td width="30px" align="center">
									<a href="<?php echo site_url('admin/config/edit_user/'.$row->userid.'');?>" data-toggle="tooltip" data-placement="bottom" data-original-title="Edit"><i class="fa fa-edit"></i>&nbsp;&nbsp;</a>
									<a href="<?php echo site_url('admin/config/delete_user/'.$row->userid.'');?>" onclick="return confirm('Apakah Anda benar - benar akan menghapus data ini?\n\n' + '> <?php echo $row->username; ?>' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Delete"><i class="fa fa-trash"></i></a>
								</td>
							</tr>
							<?php } 
						} ?>
					</tbody>
				</table>
			</div>
		</div>
<!--
		<div class="box box-danger">
			<div class="box-header with-border">
				<i class="fa  fa-circle-o-notch fa-spin"></i>
				<h3 class="box-title">Sinkronisasi Data</h3>
            </div>
            <div class="box-body">
				<?php $succsess = $this->input->get('succsess');
					if($succsess) { ?>
					<span style="color:red;">Data berhasil disinkronisasi.</span><br>
				<?php } ?>
				<ul>
					<li>[2], <a href="<?php echo site_url('admin/config/bed');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> Bed' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi Bed">Tempat Tidur (Bed)</a></li>
					<li>[1], <a href="<?php echo site_url('admin/config/penyakit_irja');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> 10 Besar Penyakit IRJA' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi 10 Besar Penyakit IRJA">10 Besar Penyakit IRJA</a></li>
					<li>[1], <a href="<?php echo site_url('admin/config/penyakit_irna');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> 10 Besar Penyakit IRNA' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi 10 Besar Penyakit IRNA">10 Besar Penyakit IRNA</a></li>
					<li>[1], <a href="<?php echo site_url('admin/config/kunjungan_irja');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> Kunjungan IRJA' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi Kunjungan IRJA">Kunjungan IRJA</a></li>
					<li>[1], <a href="<?php echo site_url('admin/config/kunjungan_irna_ruang');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> Kunjungan IRNA by RUANG' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi Kunjungan IRNA by RUANG">Kunjungan IRNA by RUANG</a></li>
					<li>[2], <a href="<?php echo site_url('admin/config/kunjungan_irna_kelas');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> Kunjungan IRNA by KELAS' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi Kunjungan IRNA by KELAS">Kunjungan IRNA by KELAS</a></li>
					<li>[1], <a href="<?php echo site_url('admin/config/alkes');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> Alat Kesehatan' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi Alkes">Alkes</a></li>
					<li>[1], <a href="<?php echo site_url('admin/config/obat');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> Obat' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi Obat">Obat</a></li>
					<li>[1], <a href="<?php echo site_url('admin/config/selisihdiagnosa');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> Selisih Biaya Diagnosa' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi Selisih Biaya Diagnosa">Selisih Biaya Diagnosa</a></li>
					<li>[1], <a href="<?php echo site_url('admin/config/selisihdokter');?>" onclick="return confirm('Apakah Anda akan mensinkronisasi data ini?\n\n' + '> Selisih Biaya Dokter' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Sinkronisasi Selisih Biaya Dokter">Selisih Biaya Dokter</a></li>
				</ul>
            </div>
		</div>
-->
	</div>

	<div class="col-md-6">
		<div class="box box-warning">
			<div class="box-header with-border">
				<i class="fa fa-link"></i>
				<h3 class="box-title">IP Config</h3>
            	<a class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#newip">New</a><br>
            </div>
            <div class="box-body">
				<table class="table table-bordered table-striped">
					<tbody>
						<tr>
							<th>IP</th>
							<th>Port</th>
							<th>Keterangan</th>
							<th>Status</th>
							<th>Action</th>
						</tr>
						<?php if (empty($list_ip)) { ?>
						<tr>
							<td colspan="4"><center><h4>no data</h4></center></td>
						</tr>
						<?php }
						else {
							foreach ($list_ip as $row) { ?>
							<tr>
								<td><?php echo $row->nomorip; ?></td>
				        		<td><?php echo $row->port; ?></td>
	                            <td><?php echo $row->keterangan; ?></td>
	                            <td><?php if ($row->aktif == 1) { echo "<span style='color:red'>Aktif</span>"; } else { echo "Nonaktif";} ?></td>
				        		<td>
				        		    <?php if ($row->aktif == 1) { ?>
				        		    	<a href="<?php echo site_url('admin/config/nonaktifkan_ip/'.$row->id.'');?>" data-toggle="tooltip" data-placement="bottom" data-original-title="Nonaktifkan"><i class="fa fa-check-square"></i>&nbsp;&nbsp;</a>
				        		    <?php } else { ?>
				        		    	<a href="<?php echo site_url('admin/config/aktifkan_ip/'.$row->id.'');?>" data-toggle="tooltip" data-placement="bottom" data-original-title="Aktifkan"><i class="fa fa-close"></i>&nbsp;&nbsp;</a>
				        		    <?php }?>
				        		    <a href="<?php echo site_url('admin/config/edit_ip/'.$row->id.'');?>" data-toggle="tooltip" data-placement="bottom" data-original-title="Edit"><i class="fa fa-edit"></i>&nbsp;&nbsp;</a>
				            		<a href="<?php echo site_url('admin/config/delete_ip/'.$row->id.'');?>" onclick="return confirm('Apakah Anda benar - benar akan menghapus data ini?\n\n' + '> <?php echo $row->nomorip; ?>' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Delete"><i class="fa fa-trash"></i></a>
				        		</td>
						    </tr>
				        	<?php } 
				    	} ?>
					</tbody>
				</table>
            </div>
		</div>
<!--		
		<div class="box box-info">
			<div class="box-header with-border">
				<i class="fa  fa-list"></i>
				<h3 class="box-title">Menu</h3>
				<a class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#newmenu">New</a><br>
            </div>
            <div class="box-body">
				<table class="table table-bordered table-striped">
					<tbody>
						<tr>
							<th>Nama</th>
							<th>URL</th>
							<th>Superadmin</th>
							<th>Admin</th>
							<th>Limit</th>
							<th>Action</th>
						</tr>
						<?php if (empty($list_menu)) { ?>
						<tr>
							<td colspan="6"><center><h4>no data</h4></center></td>
						</tr>
						<?php }
						else {
							foreach ($list_menu as $row) { ?>
							<tr>
								<td><?php echo $row->nama; ?></td>
				        		<td><?php echo $row->url; ?></td>
	                            <td><?php if ($row->superadmin == 1) { echo "<span style='color:red'>Ya</span>"; } else { echo "Tidak";} ?></td>
	                            <td><?php if ($row->admin == 1) { echo "<span style='color:red'>Ya</span>"; } else { echo "Tidak";} ?></td>
	                            <td><?php if ($row->limit == 1) { echo "<span style='color:red'>Ya</span>"; } else { echo "Tidak";} ?></td>
				        		<td>
				        		    <a href="<?php echo site_url('admin/config/edit_ip/'.$row->id.'');?>" data-toggle="tooltip" data-placement="bottom" data-original-title="Edit"><i class="fa fa-edit"></i>&nbsp;&nbsp;</a>
				            		<a href="<?php echo site_url('admin/config/delete_ip/'.$row->id.'');?>" onclick="return confirm('Apakah Anda benar - benar akan menghapus data ini?\n\n' + '> <?php echo $row->nama; ?>' )" data-toggle="tooltip" data-placement="bottom" data-original-title="Delete"><i class="fa fa-trash"></i></a>
				        		</td>
						    </tr>
				        	<?php } 
				    	} ?>
					</tbody>
				</table>
            </div>
		</div>
-->		
	</div>

</div>

<!-- MODAL -->
<div class="modal fade" tabindex="-1" role="dialog" id="newuser">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">New User</h4>
      </div>
      <div class="modal-body">
							<form action="<?php echo site_url('admin/config/input_user'); ?>" method="post">
								<fieldset>
				                    <div class="form-group">
				                        <label>Username :</label>
				                  		<input class="form-control" type="text" name="username" required="required">
				        			</div>
				                    <div class="form-group">
				                        <label>Password :</label>
				                  		<input class="form-control" type="text" name="password" required="required">
				        			</div>
									<div class="form-group">
				                      	<label>Access Level :</label>
			    	                    <select class="form-control" name="access_level" required="required" >
	                						<option value="2">Admin</option>
				    	            		<option value="1">Superadmin</option>
				            			</select>
					                </div>
	                                <hr />
	                                <div class="form-group">
				                        <label>Realname :</label>
				                  		<input class="form-control" type="text" name="realname">
				        			</div>
				                    <div class="form-group">
				                        <label>Email :</label>
				                  		<input class="form-control" type="email" name="email" required="required">
				        			</div>
				                    <div class="form-group">
				                        <label>Alamat :</label>
				                  		<textarea class="form-control" name="address"></textarea>
				        			</div>
				                    <div class="form-group">
				                        <label>Telephone :</label>
				                  		<input class="form-control" type="text" name="phone">
				        			</div>
					    			<div class="form-group">
				                        <input type="submit" class="btn btn-primary" value="Simpan"></input>
				                	</div>
				    			</fieldset>
							</form>
      </div>
    </div>
  </div>
</div>

<div class="modal fade" tabindex="-1" role="dialog" id="newip">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">New IP</h4>
      </div>
      <div class="modal-body">
							<form action="<?php echo site_url('admin/config/input_ip'); ?>" method="post">
								<fieldset>
				                    <div class="form-group">
				                        <label>Nomor IP :</label>
				                  		<input class="form-control" type="text" name="nomorip" required="required">
				        			</div>
				                    <div class="form-group">
				                        <label>Port :</label>
				                  		<input class="form-control" type="text" name="port" required="required">
				        			</div>
	                                <div class="form-group">
				                        <label>Keterangan :</label>
				                  		<input class="form-control" type="text" name="keterangan" required="required">
				        			</div>
					    			<div class="form-group">
				                        <input type="submit" class="btn btn-primary" value="Simpan"></input>
				                	</div>
				    			</fieldset>
							</form>

      </div>
    </div>
  </div>
</div>

<div class="modal fade" tabindex="-1" role="dialog" id="newmenu">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">New IP</h4>
      </div>
      <div class="modal-body">
							<form action="<?php echo site_url('admin/config/input_menu'); ?>" method="post">
								<fieldset>
				                    <div class="form-group">
				                        <label>Nama Menu :</label>
				                  		<input class="form-control" type="text" name="nama" required="required">
				        			</div>
				                    <div class="form-group">
				                        <label>URL :</label>
				                  		<input class="form-control" type="text" name="url" required="required">
				        			</div>
	                                <div class="form-group">
				                        <label>Access :</label>
				                  		<div class="checkbox"><label><input type="checkbox" name="superadmin" value="1">Superadmin</label></div>
                    					<div class="checkbox"><label><input type="checkbox" name="admin" value="1">Admin</label></div>
                    					<!--<div class="checkbox"><label><input type="checkbox" name="limit" value="1">Limit</label></div>-->
				        			</div>
					    			<div class="form-group">
				                        <input type="submit" class="btn btn-primary" value="Simpan"></input>
				                	</div>
				    			</fieldset>
							</form>

      </div>
    </div>
  </div>
</div>
