<?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>
	   .title{
			  display: block;
			  color: #ccc;
			  margin:7px;
			  width: 120px;
			  text-align: left;
			  float: right;
			 
	   }
	   .value{
			  float: right;
			  line-height: 33px;
	   }
	   .col-lg-6{
		margin-bottom:10px;	  
	   }
	   .col-lg-3 img{
			  width: 60%;
			  float: left;
	   }
	   thead tr{
			  border: 2px solid #ccc;
	   }
	   thead td,thead th{
			  border-left:1px solid #ccc;
			  text-align: center;
			  color: rgb(112,146,190);
	   }
	   tbody td,tbody th{
			border-left:1px solid #ccc;  
	   }
	   .odd{
			  background: #eee;
	   }
	   /*for editing*/
	   .left{
		float: left;
	}
	.right{
		float: right;
	}
	.img-holder img{
		width: 100%;
	}
	.icon_folder , .icon_camera,.icon_remove{
		font-size:17pt;
		margin-left:8px;
		margin-top:10px;
		color: #bbb;
		cursor: pointer;
	}
	.pvt_imge{
		position:fixed;
		top: 0;
		left: 0;
		z-index:10000;
		width: 100%;
		height: 100%;
		background: rgba(0,0,0,0.8);
	}
	#webcam{
		width: 400px;
		height: 385px;
		margin: 100px auto;
		background: #000;
	}
	#video ,canvas{
		width: 100%;
		height: 300px;
	}
	.button_panel{
		float: right;
		margin-right:9px;
	}
	.button_panel button{
		margin-left:4px;
	}
	.close_cam{
		font-size: 26px;
		color: #f00;
		float: right;
		cursor: pointer;
		margin-right:10px;
	}
	.close_cam:hover{
		color: #eee;
	}
.folder{
	   width: 130px;
	   height: 130px;
	   padding: 10px;
	   border: 1px solid #ddd;
	   float: right;
	   margin-left:15px;
	   cursor: pointer;
	   border-radius: 5px;
	   margin-bottom:10px;
}
.folder:hover{
	   border: 1px solid rgb(112,146,190);
	   color: rgb(112,146,190) !important;
}
.add:hover,.back:hover{
	 border: 1px solid green;
	   color: green !important;   
}
.folder i {
	   font-size: 85px;
	   text-align: center;
	   margin-right:5px;
}
.add i
{
	   margin-right:20px !important;
}
.folder span{
	   width: 100%;
	   display: block;
	   text-align: center;
	   font-size: 12px;
}
.folder img{
	   width: 100%;
	   height: 90px;
}
.add_folder,.display_images,.change_name{
	   width: 100%;
	   height: 100%;
	   position: fixed;
	   top: 0;
	   left: 0;
	   z-index: 3000;
	   background: rgba(0,0,0,0.5);
}
.display_images img{
	   width: 100%;
	   max-height:520px;
}
#addfolder{
	   width: 300px;
	   height: 200px;
	   background: #fff;
	   margin: 40px auto;
	   border-radius: 6px;
}
.display_images .modal-dialog{
	   width: 800px;
}
textarea{
	   height: 120px !important;
	   resize: none;
}
.submitrec{
	   margin-top:110px;
}
.right_click
{
	 width: 100px;
	 background: #eee;
	 position: absolute;
	 z-index:1000;
	 box-shadow: 2px 2px 2px #ccc;
	 
}

.right_click span{
	   display: block;
	   width: 100%;
	   text-align: center;
	  border-bottom:1px solid #fff;
	   padding: 10px 0;
	   background: #eee;
	   cursor: pointer;
	   
}
.right_click span b{

	   padding: 4px;
	   vertical-align:sub;
}
.right_click span:hover{
	background: rgb(220,237,244) !important;   
}

</style>
<div class="right_click" style="display:none;">
	   <span class="edit"><b><i class="icon-edit"></i></b> ویرایش</span>
	   <span class="delete"><b><i class="icon-trash"></i></b> پاک کردن</span>
</div>
<div class="display_images" style="display: none;">
	   <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">نام تصویر</h4>
                                            </div>
                                            <div class="modal-body">
										  <img src="http://127.0.0.1/viara_teb/assets/data_images/drs/pationt_doc/1/324345433.jpg">
                                            </div>
                                        </div>
                                    </div>
</div>
<div class="change_name" style="display: none;">
	   <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">ویرایش نام</h4>
                                            </div>
                                            <div class="modal-body">
										  <input type="text" name="filename" class="form-control" id="exampleInputEmail3">
										   <button type="submit" class="btn btn-default editname" style="margin-top:15px;">ویرایش</button>
                                            </div>
                                        </div>
                                    </div>
</div>
<div class="add_folder" style="display: none;">
	   <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">ایجاد پوشه و یا تصویر</h4>
                                            </div>
                                            <div class="modal-body">

                                                <form role="form" action="./add_folder_control_bimaran" method="post" enctype="multipart/form-data" >
												 <input type="hidden" id="hidden_path" name="path" value="" />
												 <?php if($this->session->userdata("isroot") == "no"){ ?>
												 <input type="hidden" id="hidden_parent" name="parent" value="sess" />
												 <?php }else{ ?>
												 <input type="hidden" id="hidden_parent" name="parent" value="root" />
												 <?php } ?>
												 <input type="hidden" name="bid" value="<?php echo $this->input->get("id"); ?>" />
												 <div class="radio">
                                                <label>
                                                    <input type="radio" name="optionsRadios" checked="checked" class="optionsRadios1" value="option1">
                                                  ایجاد پوشه
                                             
                                                </label>
                                            </div>
										   <div class="radio">
                                                <label>
                                                    <input type="radio" name="optionsRadios" class="optionsRadios1" value="option2">
                                                  آپلود تصاویر
                                             
                                                </label>
                                            </div>
										   <div id="folder">
                                                    <div class="form-group">
                                                        <label for="exampleInputEmail1">نام پوشه</label>
                                                        <input type="text" name="foldername" class="form-control" id="exampleInputEmail3">
                                                    </div>
                                                   </div>
										   <div id="piture" style="display:none">
												   <div class="form-group">
                                                        <label for="exampleInputEmail1">نام تصویر</label>
                                                        <input type="text" name="filename" class="form-control" id="exampleInputEmail3">
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="exampleInputFile">تصویر مورد نظر خود را باگذاری کنید</label>
                                                        <input type="file" name="uploadfile" id="exampleInputFile3">
                                                    </div>
                                            </div>       
                                                    <button type="submit" class="btn btn-default">ایجاد</button>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
</div>
<div class="pvt_imge" style="display:none">
	<div id="webcam">
		<span class="close_cam"><i class="icon-remove"></i></span>
		<canvas id="canvas" style="display:none;"></canvas>
		<video id="video"></video>
		<div class="button_panel">
		<button id="startbutton" class="btn btn-success"><i class="icon-camera"></i> گرفتن عکس</button>
		<button class="btn save" data_pos="0"><i class="icon-save"></i> ذخیره</button>
		</div>
	</div>
	
</div>
<section class="panel">
       <section class="panel">
                            <header class="panel-heading tab-bg-dark-navy-blue ">
                                <ul class="nav nav-tabs">
                                    <li <?php echo !$whattype ? 'class="active"'  : '' ;?>>
                                        <a href="#home" data-toggle="tab">سوابق <?php echo $value_of_text; ?></a>
                                    </li>
                                    <li <?php echo $whattype == "recordhistori" ? 'class="active"'  : '' ;?>>
                                        <a href="#about" data-toggle="tab">ثبت سوابق</a>
                                    </li>
                                    <li <?php echo $whattype == "documents" ? 'class="active"'  : '' ;?>>
                                        <a href="#profile" data-toggle="tab">تصاویر</a>
                                    </li>
                                    <li <?php echo $whattype == "finance" ? 'class="active"'  : '' ;?>>
                                        <a href="#contact" data-toggle="tab">اسناد مالی</a>
                                    </li>
									<li <?php echo $whattype == "edit" ? 'class="active"'  : '' ;?>>
                                        <a href="#edit" data-toggle="tab">ویرایش</a>
                                    </li>
                                </ul>
                            </header>
                            <div class="panel-body">
                                <div class="tab-content">
                                    <div class="tab-pane <?php echo !$whattype ? "active" : "" ?>" id="home">
										  <div class="col-lg-9">
										<div class="col-lg-6">
                                       <span class="title">کد:</span><b class="value"><?php echo $data[0]->shomare_parvandeh ?></b>
										</div>
										<div class="col-lg-6">
										<span class="title">سن:</span><b class="value"><?php echo $data[0]->age ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">نام و نام خانوادگی:</span><b class="value"><?php echo $data[0]->full_name ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">نام پدر:</span><b class="value"><?php echo $data[0]->father_name ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">شماره شناسنامه:</span><b class="value"><?php echo $data[0]->no_shenasnameh ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">عنوان:</span><b class="value"><?php echo $data[0]->title ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">کد ملی:</span><b class="value">><?php echo $data[0]->meli_code ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">تلفن ضروری:</span><b class="value"><?php echo $data[0]->important_phone ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">تلفن محل کار:</span><b class="value"><?php echo $data[0]->work_phone ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">تلفن منزل:</span><b class="value"><?php echo $data[0]->home_phone ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">همراه:</span><b class="value"><?php echo $data[0]->cell_phone ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">تاریخ تولد:</span><b class="value"><?php echo $data[0]->date_tavaload ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">محل تولد:</span><b class="value"><?php echo $data[0]->tavaload_place ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">پست الکترونیکی:</span><b class="value"><?php echo $data[0]->email ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">تاریخ ثبت:</span><b class="value"><?php echo $data[0]->submit_date ?></b>
										</div>
										<div class="col-lg-6">
                                       <span class="title">آدرس منزل</span><b class="value"><?php echo $data[0]->home_address ?></b>
										</div>
										
										
										<div class="col-lg-6">
                                       <span class="title">آدرس محل کار:</span><b class="value"><?php echo $data[0]->work_address ?></b>
										</div>
										</div>
										  <div class="col-lg-3">
												 <img src="<?php echo base_url(); ?>assets/data_images/drs/Patient_profile_pictures/<?php echo $data[0]->image_name ?>" >
										  </div>
										  <div class="col-lg-12">
                          
                            <table class="table table-hover">
                                <thead>
                                    <tr>
                                        
                                        <th>تاریخ</th>
                                        <th>دلیل مراجعه ی <?php echo $value_of_text; ?></th>
                                        <th>شرح</th>
                                    </tr>
                                </thead>
                                <tbody>
								   <?php $count=1; foreach($record_data as $value){ ?>
                                    <tr class="<?php echo $count % 2 == 0 ? "even" : "odd" ?>">
                                        <td><?php echo $value->date; ?></td>
                                        <td><?php echo $value->dalileh_moragee; ?></td>
                                        <td><?php echo $value->sharh; ?></td>
                                    </tr>
                                    <?php $count++; } ?>
                                </tbody>
                            </table>
                       
										  </div>
                                    </div>
										
                                    <div class="tab-pane <?php echo $whattype == "recordhistori" ? "active" : "" ?>" id="about">
										  <div class="col-lg-2 left img-holder">
																	  <?php if($data[0]->image_name != "null"){ ?>
								   <img src="<?php echo base_url(); ?>assets/data_images/drs/Patient_profile_pictures/<?php echo $data[0]->image_name ?>"  >
								   <?php }else{ ?>
									 <img src="<?php echo base_url(); ?>assets/main/img/no_profile_img.jpg" >
									 <?php } ?>
									
								</div>
										  <form action="./add_history_control_bimaran" method="post">
										  <div class="col-lg-10">
								   <div class="form-group col-lg-12 left">
                                        <label for="name">تاریخ</label>
                                        <input type="text" class="form-control" name="date" value="<?php echo $today; ?>"  id="name" >
                                    </div>
								   <div class="form-group col-lg-12 left">
                                        <label for="name">دلیل مراجعه</label>
										<select class="form-control" name="visitresun" id="name" style="padding:0px">
										<?php foreach($fresun as $value){ ?>
                                        <option>
										  <?php echo $value->khdamat_name; ?>
										</option>
										<?php } ?>
										</select>
                                    </div>
								   <div class="form-group col-lg-12 left">
                                        <?php if($this->session->userdata("per") == 1){ ?>
										<label for="name">شرح مشتری</label>
										<?php }else{ ?>
										<label for="name">شرح نسخه</label>
										<?php } ?>
										
                                        <textarea  class="form-control" name="discriptiontype" placeholder=""  id="name" ></textarea>
                                    </div> 
										  </div>
										  <input type="hidden" name="pationtid" value="<?php echo $this->input->get("id") ?>">
							    <div class="col-lg-2 left submitrec">
									<button class="btn btn-info">ذخیره</button>
								</div>	 
										 
										  </form>
									</div>
									 <div class="tab-pane <?php echo $whattype == "finance" ? "active" : "" ?>"  id="contact">
										  <div class="col-lg-2 left img-holder">
																	  <?php if($data[0]->image_name != "null"){ ?>
								   <img src="<?php echo base_url(); ?>assets/data_images/drs/Patient_profile_pictures/<?php echo $data[0]->image_name ?>"  >
								   <?php }else{ ?>
									 <img src="<?php echo base_url(); ?>assets/main/img/no_profile_img.jpg">
									 <?php } ?>
									
								</div>
										    <div class="col-lg-10">
												 <form action="./add_noskheh_control_bimaran" method="post" >
								   <div class="form-group col-lg-12 left">
                                        <label for="name">تاریخ مراجعه</label>
                                        <input type="text" class="form-control date" name="visitd" value="<?php echo $today ?>"  id="name" >
                                    </div>
								   <div class="form-group col-lg-12 left">
                                        <label for="name">دلیل مراجعه</label>
										<select class="form-control" name="visitresun" id="name" style="padding:0px">
										<?php foreach($fresun as $value){ ?>
                                        <option>
										  <?php echo $value->khdamat_name; ?>
										</option>
										<?php } ?>
										</select>
                                    </div>
								   <div class="form-group col-lg-12 left">
                                        <label for="name">هزینه ی ویزیت</label>
                                        <input type="text" class="form-control visit" name="visitp" placeholder=""  id="" >
                                    </div>
								   <div class="form-group col-lg-12 left">
                                        <label for="name">هزینه ی جراحی</label>
                                        <input type="text" class="form-control sergury" value="0" name="segp" placeholder=""  id="name" >
                                    </div>
								   <div class="form-group col-lg-12 left">
                                        <label for="name">سایر هزینه ها</label>
                                        <input type="text" class="form-control another" name="otherp" placeholder=""  id="name" >
                                    </div>
								   <div class="form-group col-lg-12 left">
                                        <label for="name">نوع بیمه</label>
										<input type="hidden"  name="bimarname" value="<?php echo $data[0]->full_name ?>">
										<input type="hidden" class="insurename" name="insurename" value="بدون بیمه">
										<input type="hidden"  name="bimarid" value="<?php echo $this->input->get("id"); ?>">
                                        <select type="text" class="form-control typeofinsure" name="peybycustomer" style="padding:0px;" id="name">
										  <option value="0">بدون بیمه</option>
										  <?php foreach($bimeh as $value){ ?>
										  <option value="<?php echo $value->percent; ?>"><?php echo $value->name; ?></option>
										  <?php }  ?>
										  
										</select>
                                    </div>
								    <div class="form-group col-lg-12 left">
                                        <label for="name">هزینه ی پرداختی توسط بیمه</label>
                                        <input type="text" class="form-control bimehshow" name="peybyinsure" >
                                    </div>
								   <div class="form-group col-lg-12 left">
                                        <label for="name">هزینه ی پرداختی توسط مشتری</label>
                                        <input type="text" class="form-control clientshow" name="peybycustomer" >
                                    </div>
								   <div class="form-group col-lg-12 left">
								   <button class="btn btn-info left">ذخیره</button>
								   </div>
								   </form>
												
										  </div>
											<table class="table table-striped border-top dataTable" id="sample_1" aria-describedby="sample_1_info">
                                <thead>
                                    <tr role="row">
										  <th tabindex="0" class="sorting" role="columnheader" aria-controls="sample_1" style="width: 214px;" aria-label="Username: activate to sort column ascending" rowspan="1" colspan="1">تاریخ مراجعه</th>
										  <th tabindex="0" class="sorting" role="columnheader" aria-controls="sample_1" style="width: 214px;" aria-label="Username: activate to sort column ascending" rowspan="1" colspan="1">دلیل مراجعه</th>
                                            <th tabindex="0" class="sorting" role="columnheader" aria-controls="sample_1" style="width: 214px;" aria-label="Username: activate to sort column ascending" rowspan="1" colspan="1">هزینه ویزیت</th>
											<th tabindex="0" class="hidden-phone sorting" role="columnheader" aria-controls="sample_1" style="width: 301px;" aria-label="Email: activate to sort column ascending" rowspan="1" colspan="1">هزینه ی جراحی</th>
											<th tabindex="0" class="hidden-phone sorting" role="columnheader" aria-controls="sample_1" style="width: 301px;" aria-label="Points: activate to sort column ascending" rowspan="1" colspan="1">سایر هزینه ها</th>
											<th tabindex="0" class="hidden-phone sorting" role="columnheader" aria-controls="sample_1" style="width: 301px;" aria-label="Points: activate to sort column ascending" rowspan="1" colspan="1">نوع بیمه</th>
											<th tabindex="0" class="hidden-phone sorting" role="columnheader" aria-controls="sample_1" style="width: 301px;" aria-label="Points: activate to sort column ascending" rowspan="1" colspan="1">مبلغ پرداختی توسط بیمه</th>
											<th tabindex="0" class="hidden-phone sorting" role="columnheader" aria-controls="sample_1" style="width: 328px;" aria-label="Points: activate to sort column ascending" rowspan="1" colspan="1">مبلغ پرداختی توسط مشتری</th>
											<th tabindex="0" class="hidden-phone sorting" role="columnheader" aria-controls="sample_1" style="width: 301px;" aria-label="Points: activate to sort column ascending" rowspan="1" colspan="1">جمع کل</th>
									</tr>
                                </thead>
                                
                            <tbody role="alert" aria-live="polite" aria-relevant="all">
                                        <?php $counter=1; foreach($f_data as $value){ ?>
										<?php if($counter % 2 == 0){ ?>
										<tr class="gradeX even">
										  <?php }else{ ?>
										 <tr class="gradeX odd"> 
										  <?php } ?>
										<td class="sorting_1"><?php echo $value->visit_date ?></td>
										<td class="hidden-phone "><?php echo $value->morage_res ?></td>
										  <td class="hidden-phone "><?php echo $value->visit_pay ?></td>
										  <td class="hidden-phone "><?php echo $value->surgery_pay ?></td>
										  <td class="hidden-phone "><?php echo $value->other_pay ?></td>
										  <td class="hidden-phone "><?php echo $value->insure_type ?></td>
										  <td class="hidden-phone "><?php echo $value->insure_pay ?></td>
										  <td class="hidden-phone "><?php echo $value->client_pay ?></td>
										  <td class="hidden-phone "><?php echo ($value->client_pay+$value->insure_pay) ?></td>
										 </tr>
										<?php $counter++; } ?>
										
                                    
                       </tbody>
					 <tfoot>
							
					 </tfoot>
											</table>
									 </div>
                                    <div class="tab-pane <?php echo $whattype == "documents" ? "active" : "" ?>" id="profile">
										  <div class="folder back"><i class="icon-share-alt"></i><span>بازگشت</span></div>
							<div id="folder_hold_er">
										 <?php foreach($dmap as $value){ ?>
										 
										 <?php if($value->type =='folder') { ?>
										 <div class="folder" data_type="folder" real_name="<?php echo $value->real_name; ?>" data_fid="<?php echo $value->id; ?>"><i class="icon-folder-open"></i><span><?php echo $value->name; ?></span></div>
										 <?php }else if($value->type =='image'){ ?>
										 <div class="folder" data_type="image" real_name="<?php echo $value->real_name; ?>" data_fid="<?php echo $value->id; ?>"><img src="<?php echo base_url(); ?>assets/data_images/drs/pationt_doc/<?php echo $value->userid; ?>/<?php echo $value->real_name; ?>"><span><?php echo $value->name; ?></span></div>
										 <?php } ?>
										 <?php } ?>
							</div>
										   <div class="folder add"><i class="icon-plus"></i><span>اضافه کردن</span></div>
									</div>
                                    <div class="tab-pane <?php echo $whattype == "edit" ? "active" : "" ?>" id="edit">
										  							 <div class="col-lg-2 left img-holder">
																	  <?php if($data[0]->image_name != "null"){ ?>
								   <img src="<?php echo base_url(); ?>assets/data_images/drs/Patient_profile_pictures/<?php echo $data[0]->image_name ?>" id="blah" >
								   <?php }else{ ?>
									 <img src="<?php echo base_url(); ?>assets/main/img/no_profile_img.jpg" id="blah">
									 <?php } ?>
									 <input type="file" id="imgInp" style="display:none" >
									 <span class="icon_folder left"><i class="icon-folder-open"></i></span>
									 <span class="icon_camera left"><i class="icon-camera"></i></span>
									 <span class="icon_remove left"><i class="icon-remove"></i></span>
								</div>
												<form action="./data_edit_information_control" method="post" >
								   <input type="hidden" name="id" value="<?php echo $this->input->get("id"); ?>" >
									<input type="hidden" name="image" class="imageget">
								<div class="col-lg-5">
								<div class="form-group col-lg-6">
                                        <label for="code">کد</label>
                                        <input type="text" class="form-control" name="shomareh_parvandeh" placeholder="<?php echo $data[0]->shomare_parvandeh ?>" id="code">
                                    </div>
									<div class="form-group col-lg-6">
                                        <label>جنسیت</label>
                                        <select class="form-control" name="sex" style="padding:0px;">
										<option vlaue="1" <?php echo $data[0]->sex == 0 ? 'selected=selected' : "" ?>>مرد</option>
										<option vlaue="0" <?php echo $data[0]->sex == 1 ? 'selected=selected' : "" ?>>زن</option>
										</select>
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="name">نام و نام خانوادگی</label>
                                        <input type="text" class="form-control" name="name" value="<?php echo $data[0]->full_name ?>"  id="name" placeholder="">
                                    </div>
									
									<div class="form-group col-lg-12 left">
                                        <label for="title">عنوان</label>
                                        <input type="text" class="form-control" name="title"  id="title" value="<?php echo $data[0]->title ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="emphone">تلفن ضروری</label>
                                        <input type="text" class="form-control" name="emphone"  id="emphone" value="<?php echo $data[0]->important_phone ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="homephone">تلفن منزل</label>
                                        <input type="text" class="form-control" name="homephone"  id="homephone" value="<?php echo $data[0]->home_phone ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="brith">تاریخ تولد</label>
                                        <input type="text" class="form-control" name="brithday"  id="brith" value="<?php echo $data[0]->date_tavaload ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="email">پست الکترونیک</label>
                                        <input type="text" class="form-control" name="email"  id="email" value="<?php echo $data[0]->email ?>" >
                                    </div>
									</div>
								<div class="col-lg-5">
									<div class="form-group col-lg-6">
                                        <label for="group">گروه</label>
                                         <input type="text" class="form-control" name="group" id="group" value="<?php echo $data[0]->group_by ?>" >
                                    </div>
									<div class="form-group col-lg-6">
                                        <label for="age">سن</label>
                                         <input type="text" class="form-control" name="age" id="age" value="<?php echo $data[0]->age ?>" >
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="group">نام پدر</label>
                                         <input type="text" class="form-control" name="fathername" id="group" value="<?php echo $data[0]->father_name ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="group">شماره شناسنامه</label>
                                         <input type="text" class="form-control" name="shensnameh" id="group" value="<?php echo $data[0]->no_shenasnameh ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="group">کد ملی</label>
                                         <input type="text" class="form-control" name="melicode" id="group" value="<?php echo $data[0]->meli_code ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="group">محل کار</label>
                                         <input type="text" class="form-control" name="phonework" id="group" value="<?php echo $data[0]->work_phone ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="group">همراه</label>
                                         <input type="text" class="form-control" name="cellphone" id="group" value="<?php echo $data[0]->cell_phone ?>">
                                    </div>
									<div class="form-group col-lg-12 left">
                                        <label for="group">محل تولد</label>
                                         <input type="text" class="form-control" name="placeofb" id="group" value="<?php echo $data[0]->tavaload_place ?>">
                                    </div>
									
								</div>
								<div class="col-lg-10">
									<div class="form-group col-lg-12 left">
                                        <label for="group">آدرس منزل</label>
                                         <input type="text" class="form-control" name="home_address" id="group" value="<?php echo $data[0]->home_address ?>">
                                    </div>
								</div>
								<div class="col-lg-10">
									<div class="form-group col-lg-12 left">
                                        <label for="group">آدرس محل کار</label>
                                         <input type="text" class="form-control" name="work_address" id="group" value="<?php echo $data[0]->work_address ?>">
                                    </div>
								</div>
								<div class="col-lg-2 left">
									<button class="btn btn-info">ذخیره</button>
								</div>
								</form>
									</div>
                                </div>
                            </div>
                        </section>
                            
</section>
<?php $this->load->view("main/drs/footer"); ?>
<script>
function take_image(){
 var streaming = false,
    video = document.querySelector('#video'),
    canvas = document.querySelector('#canvas'),
    buttoncontent = document.querySelector('#webcam'),
    photo = document.querySelector('#photo'),
    startbutton = document.querySelector('#startbutton'),
    width = 520,
    height = 0;

  navigator.getMedia = (navigator.getUserMedia ||
    navigator.webkitGetUserMedia ||
    navigator.mozGetUserMedia ||
    navigator.msGetUserMedia);

  navigator.getMedia({
      video: true,
      audio: false
    },
    function(stream) {
      if (navigator.mozGetUserMedia) {
        video.mozSrcObject = stream;
      } else {
        var vendorURL = window.URL || window.webkitURL;
        video.src = vendorURL.createObjectURL(stream);
      }
      video.play();
    },
    function(err) {
      console.log("An error occured! " + err);
    }
  );

  video.addEventListener('canplay', function(ev) {
    if (!streaming) {
      height = video.videoHeight / (video.videoWidth / width);
      video.setAttribute('width', width);
      video.setAttribute('height', height);
      canvas.setAttribute('width', width);
      canvas.setAttribute('height', height);
      streaming = true;
    }
  }, false);

  function takepicture() {
	$(".button_panel").css({"margin-top":"5px"});
	$(".save").addClass("btn-info").attr({"data_pos":"1"});;
  	video.style.display = "none";
    canvas.style.display = "block";
    startbutton.innerHTML= '<i class="icon-camera"></i> گرفتن مجدد عکس';
  	canvas.width = width;
    canvas.height = height;
    canvas.getContext('2d').drawImage(video, 0, 0, width, height);
    var data = canvas.toDataURL('image/png');
    sessionStorage.setItem("imageformcapture",data);
    photo.setAttribute('src', data);
  }

  startbutton.addEventListener('click', function(ev) {
  	if(startbutton.innerHTML==='<i class="icon-camera"></i> گرفتن عکس')
    {
    	takepicture();
    }
    else
    {
		$(".save").removeClass("btn-info").attr({"data_pos":"0"});
    	video.style.display = "block";
    	canvas.style.display = "none";
      startbutton.innerHTML= '<i class="icon-camera"></i> گرفتن عکس';
    }
    ev.preventDefault();
  }, false);	

}	
	 
	//endd 
	 function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();

        reader.onload = function (e) {
            $('#blah').attr('src', e.target.result);
			$(".imageget").val(e.target.result);
            $('input[name="image_base"]').val(e.target.result);
        }

        reader.readAsDataURL(input.files[0]);
    }
}
$("#imgInp").change(function(){
    readURL(this);
	
});
$(".icon_folder").click(function(){
    $("#imgInp").click();
    });

$(".close_cam").click(function(){
	$(".pvt_imge").css({"display":"none"});
	});
$(".save").click(function(){
	if ($(this).attr("data_pos") == 1)  {
		$(".pvt_imge").css({"display":"none"});
		$(".img-holder img").attr({"src":sessionStorage.getItem("imageformcapture")});
	$(".imageget").val(sessionStorage.getItem("imageformcapture"));
	}
	
	});
</script>
//for webcam
<script>
	$(".icon_camera").click(
		function() {
$(".pvt_imge").css({"display":"block"});
});
	(function (){
		take_image();
	})();
</script>
<script>
	   $(".optionsRadios1").change(function(){
			 if ($(this).val() == "option1") {
				$("#piture").css({"display":"none"});
				$("#folder").css({"display":"block"});
			 }else if ($(this).val() == "option2") {
				$("#piture").css({"display":"block"});
				$("#folder").css({"display":"none"})
			 }
			  });
	   $(".add").click(function(){
			  $(".add_folder").css({"display":"block"});
			  });
	   $(".close").click(function(){
			  $(".add_folder").css({"display":"none"});
			  $(".display_images").css({"display":"none"});
			  $(".change_name").css({"display":"none"});
			  });
$('body').on('click', '.folder', function() {
    if ($(this).attr("data_type") == "image") {
					 $(".display_images img").attr({"src":$(this).find("img").attr("src")});
				 $(".display_images .modal-title").text($(this).find("span").text());
				 $(".display_images").css({"display":"block"});
			  }else if ($(this).attr("data_type") == "folder") {
				$id = $(this).attr("data_fid");
				$.post("./check_folder_control",{id:$id,uid:<?php echo $this->input->get("id"); ?>,lastparent:$("#hidden_parent").val(),realname:$(this).attr("real_name")},function(e){
					var $array = JSON.parse(e);
					$html = '<div id="folder_hold_er">';
					for ($i =0; $i<$array.length;$i++){
					   if($array[$i]["type"] =='folder'){
			  $html += '<div class="folder" data_type="folder" data_fid="'+ $array[$i]['id'] +'"><i class="icon-folder-open"></i><span>'+$array[$i]['name']+'</span></div>'		
					 
					 } else if($array[$i]["type"] =='image'){ 
			  $html +=	'<div class="folder" data_type="image" data_fid="'+$array[$i]["id"]+'"><img src="<?php echo base_url(); ?>assets/data_images/drs/pationt_doc/'+ $array[$i]['userid'] +'/'+ $array[$i]['real_name'] +'"><span>'+  $array[$i]['name'] +'</span></div>';
					 }
					
					}
					 $html += "</div>"
					 $("#hidden_parent").val($id);
					 $("#folder_hold_er").remove();
					 $(".add").before($html);
					 });
			  }
});
$('body').on('click', '.back',function(){
	  				$.post("./check_folder_control_back",{uid:"<?php echo $this->input->get("id"); ?>"},function(e){
				 
					var $array = JSON.parse(e);
					$html = '<div id="folder_hold_er">';
					for ($i =0; $i<$array.length;$i++){
					   if($array[$i]["type"] =='folder'){
			  $html += '<div class="folder" data_type="folder" data_fid="'+ $array[$i]['id'] +'"><i class="icon-folder-open"></i><span>'+$array[$i]['name']+'</span></div>'		
					 
					 } else if($array[$i]["type"] =='image'){ 
			  $html +=	'<div class="folder" data_type="image" data_fid="'+$array[$i]["id"]+'"><img src="<?php echo base_url(); ?>assets/data_images/drs/pationt_doc/'+ $array[$i]['userid'] +'/'+ $array[$i]['real_name'] +'" ><span>'+  $array[$i]['name'] +'</span></div>';
					 }
					
					}
					 $html += "</div>"
					 $("#hidden_parent").val();
					 $("#folder_hold_er").remove();
					 $(".add").before($html);
					 }); 
	   });
document.oncontextmenu = function() {return false;};
$(document).click(function(){
	   $(".right_click").css({"display":"none"});
});
$('body').on('mousedown', '.folder',function(e){
    if( e.button == 2 ) {
	   if (!$(this).hasClass("back") && !$(this).hasClass("add")) {
	$(".right_click").css({"left":e.pageX,"top":e.pageY}).attr({"data_fid":$(this).attr("data_fid"),"text":$(this).text()}).css({"display":"block"});; 	
	   }
     
      return false; 
    } 
    return true; 
  });

$(".delete").click(function(){
	   $id = $(this).parent().attr("data_fid");
	   $.post("./check_folder_control_delete",{id:$id,bid:"<?php echo $this->input->get("id"); ?>"},function(e){
	  if (e == "done") {
		$('.folder[data_fid = "'+ $id +'"]').remove();
	   }
	   });
	   });
$(".edit").click(function(){
	   $(".change_name").attr({"data_fid":$(this).parent().attr("data_fid")}).css({"display":"block"});
	   $(".change_name input").val($(this).parent().attr("text"));
	   });
$(".editname").click(function(){
	  $id = $(this).parent().parent().parent().parent().attr("data_fid");
	  $value = $(this).parent().find("input").val();
	   $.post("./check_folder_control_editname",{id:$id,value:$value},function(e){
			  if (e == "done") {
				$('.folder[data_fid = "'+ $id +'"]').find("span").text($value);
				$(".change_name").css({"display":"none"});
			  }
	   }); 
	   });
</script>
<script>
	   $("#contact input").change(function(){
			  $kol =  Number($(".sergury").val()) + Number($(".another").val()) + Number($(".visit").val());
			  $bimeh = ($kol * Number($(".typeofinsure").val()))/100;
			  $moshtari = $kol -$bimeh;
			  $(".clientshow").val($moshtari);
			  $(".bimehshow").val($bimeh);
			  });
	   $("#contact select").change(function(){
			  $(".insurename").val($(this).find('option[value="'+ $(".typeofinsure").val() +'"]').html());
			  $kol =  Number($(".sergury").val()) + Number($(".another").val()) + Number($(".visit").val());
			  $bimeh = ($kol * Number($(".typeofinsure").val()))/100;
			  $moshtari = $kol -$bimeh;
			  $(".clientshow").val($moshtari);
			  $(".bimehshow").val($bimeh);
			  });
</script>