<?php $this->load->view("main/drs/header"); ?>
<?php
 if($this->session->userdata("per") == 1){
  $value_of_text = "مشتری";
   $bimeh_value = "تخفیف ها";
 }else{
  $value_of_text = "بیمار";
  $bimeh_value = "بیمه";
 }
?>
<style>
	.search_holder button{
		
	}
	.icons{
		text-align: center;
		word-spacing: 7px;
	}
	.modal-body
	{
		padding: 10px 20px;
	}
	.modal-body h3{
		margin-top:7px;
		margin-bottom:14px;
	}
</style>
<div tabindex="-1" class="modal fade in" id="myModal-1" role="dialog" aria-hidden="false" aria-labelledby="myModalLabel" style="display: none;">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button class="close" aria-hidden="true" type="button" data-dismiss="modal">×</button>
                                                <h4 class="modal-title">پاک کردن اطلاعات <?php echo $value_of_text; ?></h4>
                                            </div>
                                            <div class="modal-body">

                                                <h3>آیا از پاک کردن اطلاعات <?php echo $value_of_text; ?> اطمینان دارید؟</h3>
												<button class="btn btn-danger submit_delete" data-dismiss="modal" data_id="">بله</button>
												<button class="btn btn-defult" data-dismiss="modal">خیر</button>
                                            </div>

                                        </div>
                                    </div>
                                </div>
<div class="col-lg-12 rtl" style="height: 60px">
	<div class="col-lg-6 col-sm-6 rtl">
		 <div class="search_holder">
                                                <button class="col-lg-3"><i class="icon-search icon-flip-horizontal" aria-hidden="true"></i> جستجو</button>
                                                <div style="float: left;width: 60%;">
												<input class="form-control" type="text" placeholder="جستجو بر اساس نام <?php echo $value_of_text; ?>">
												</div>
                                            </div>
		  </div>
</div>
<div class="col-lg-12 rtl">
	
                   
                 
<section class="panel">
        <header class="panel-heading">لیست <?php echo $value_of_text; ?></header>
                            <div class="panel-body">
								<div id="sample_1_wrapper" class="dataTables_wrapper form-inline" role="grid"><div class="row"><div class="col-sm-6"><div id="sample_1_length" class="dataTables_length"><label><select size="1" name="sample_1_length" aria-controls="sample_1" class="form-control"><option value="10" selected="selected">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option></select> نمایش رکورد در صفحه</label></div></div>
								</div><table class="table table-striped border-top dataTable" id="sample_1" aria-describedby="sample_1_info">
                                <thead>
                                    <tr role="row"><th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Username: activate to sort column ascending" style="width: 210px;">ردیف</th><th class="hidden-phone sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" style="width: 396px;">شماره پرونده</th><th class="hidden-phone sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Points: activate to sort column ascending" style="width: 146px;">نام <?php echo $value_of_text; ?></th>
									<th class="hidden-phone sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label=": activate to sort column ascending" style="width: 225px;"></th>
									<th class="hidden-phone sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label=": activate to sort column ascending" style="width: 225px;"></th>
									</tr>
                                </thead>
                                
                            <tbody role="alert" aria-live="polite" aria-relevant="all">
								<?php $counter=1; foreach($datalist as $data){ ?>
								<?php if($counter % 2 == 1){ ?>
								<tr class="gradeX odd" data_id="<?php echo $data->id; ?>" >
                                <?php }else{ ?>
								<tr class="gradeX even" data_id="<?php echo $data->id; ?>" >
								<?php } ?>
                                        <td class="radife"><?php echo $counter;  ?></td>
                                        <td class="hidden-phone "><?php echo $data->shomare_parvandeh; ?></td>
										<td class="hidden-phone "><?php echo $data->full_name; ?></td>
                                        <td class="center hidden-phone "></td>
                                        
										<td class="icons">
											<a href="./Patient_document?id=<?php echo $data->id;  ?>&whattype=documents&root=yes"><button class="btn btn-success btn-xs"><i class="icon-folder-close"></i></button></a>
											<a href="./Patient_document?id=<?php echo $data->id;  ?>&whattype=finance&root=yes"><button class="btn btn-warning btn-xs"><i class="icon-dollar"></i></button></a>
											<a href="./Patient_document?id=<?php echo $data->id;  ?>&whattype=edit&root=yes"><button class="btn btn-primary btn-xs"><i class="icon-pencil"></i></button></a>
											<button class="btn btn-danger btn-xs" href="#myModal-1" data-toggle="modal"><i class="icon-trash "></i></button>
										</td>
                                    </tr>
								<?php $counter++; } ?>
								
							
							</div>
							</tbody></table><div class="row"><div class="col-sm-6"><div class="dataTables_info" id="sample_1_info">نمایش <?php echo $first; ?> تا <?php echo $last; ?> از <?php echo $countof; ?> رکرد</div></div>
							<div class="col-sm-6">
								<div class="dataTables_paginate paging_bootstrap pagination">
									<ul><li class="prev <?php echo $this->input->get("page") -1 == 0 ? 'disabled' : ""; ?>"><a href="<?php echo $this->input->get("page") -1 == 0 ? '#' : base_url().'panel/list_Patient?limit='.$this->input->get("limit").'&page='.($this->input->get("page") -1); ?>"> → قبلی </a></li>
									<?php for($i=1;$i<=$numberofpage;$i++){?>
									<li <?php echo $this->input->get("page")== $i ? 'class="active"' : ""; ?> ><a href="<?php echo base_url(); ?>panel/list_Patient?limit=<?php echo $this->input->get("limit"); ?>&page=<?php echo $i; ?>"><?php echo $i; ?></a></li>
									<?php } ?>
									<li class="next <?php echo $this->input->get("page") +1 > $numberofpage ? 'disabled' : ""; ?>"><a href="<?php echo $this->input->get("page") +1 > $numberofpage ? '#' : base_url().'panel/list_Patient?limit='.$this->input->get("limit").'&page='.($this->input->get("page") +1); ?>">بعدی ←</a></li></ul></div></div></div></div>
								</section>
</div>
<?php $this->load->view("main/drs/footer"); ?>
<script>
	$(document).ready(function(){
		//for delete data
		$(".btn-danger").click(function(){
			$(".submit_delete").attr({"data_id":$(this).parent().parent().attr("data_id")});
			});
		$(".submit_delete").click(function(){
			$value = $('.gradeX[data_id="'+$(this).attr("data_id")+'"]');
			$.post("./delete_Patient_control",{getid:$(this).attr("data_id")},function(e){
				if (e == "done") {
					$value.remove();
				}
				
				});
			
			});
		$(".search_holder button").click(function(){
			var $value = $(this).parent().find("input").val();
			window.location = "<?php echo base_url(); ?>panel/list_Patient?search="+$value;
			});
		$(".search_holder input").keypress(function(e){
			if(e.keyCode == 13){
				$(".search_holder button").click();
			}
			});
		});
</script>