<?php
include("common/connection.php");
login_check();

$Lead_Req_Id=$_REQUEST['Lid'];
$user_type_sql="select User_Type from user_master where User_Name='".$_SESSION['user']."'";
$user_type_query=mysqli_query($con,$user_type_sql);
$user_type=mysqli_fetch_array($user_type_query);
?>

<!doctype html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Patient Assessment | Buurtzorg</title>
    <?php include("headerlink.php"); ?> 
    <link rel="stylesheet" href="css/pa.css">
    
     
    
    
    
    
    
    
    
    
    
     <link rel="stylesheet" href="css/form/all-type-forms.css">
    <!-- x-editor CSS
		============================================ -->
    <link rel="stylesheet" href="css/editor/select2.css">
    <link rel="stylesheet" href="css/editor/datetimepicker.css">
    <link rel="stylesheet" href="css/editor/bootstrap-editable.css">
    <link rel="stylesheet" href="css/editor/x-editor-style.css">

    
    <script>
	function unlock_form() {
	 
	$('#edit_c_form  input'). prop("disabled", false);
	//$('#not_editable  input'). prop("disabled", true);
	$('#edit_c_form  textarea'). prop("disabled", false);
	$('#edit_c_form  select'). prop("disabled", false);
	$('#update_btn').show();
	$('#edit_btn_1').hide();
	
 
	}
	</script>
    
    <script>
	function personaliz_label(per) {
	 
	
	 $('#ps').text(per);
	
	}
	
 
	</script> 
    <?php
	 $lead_basic_sql="select * from lead_master where Lead_ID='".$Lead_Req_Id."'";
	 $lead_basic_query=mysqli_query($con,$lead_basic_sql);
	 $lead_details=mysqli_fetch_array($lead_basic_query);
	 
	 $FetchLocation=GetLocationName($con,$lead_details['Control_Location']);
	?>   
    
    <script type="text/javascript">
	function ShowPersonalize()
	{
	   if(document.getElementById("personalize").checked==true)
	   {
	   
	      $('#personalize_div').show();
	   }
	   else
	   {
	      $('#personalize_div').hide();
	   }
	
	}
	</script> 
    
<script>
function isNumberKey(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode;
    if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
    {
        return false;
    }
    else
    {
        return true;
    }
}

</script>    
</head>

<body>
    <!--[if lt IE 8]>
		<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
	<![endif]-->
    <!-- Start Left menu area -->
    
    
             
										<style>
                                        input { border:0 !important; border-bottom:1px solid #ccc !important; padding-left:0 !important; padding-top:0px !important;  padding-bottom:3px !important;  height:auto !important; } label { font-weight:normal !important; font-size:12px !important;} textarea {border:0 !important; border-bottom:1px solid #ccc !important; padding-left:0 !important; padding-top:3px !important;  padding-bottom:3px !important; text-transform:uppercase } 
                                        select { border:0 !important; border-bottom:1px solid #ccc !important; padding-left:0 !important; padding-top:0px !important;  padding-bottom:3px !important;  height:auto !important; } .panel-body {padding:0 !important; padding-top:10px !important;  } option, select {font-size:12px !important;  }
                                        </style>
    <?php include("left-menu.php"); ?>
    
    
    
    <!-- End Left menu area -->
    <!-- Start Welcome area -->
    <div class="all-content-wrapper" style="padding-bottom:100px">
        
        
       <?php include("header-menu.php"); ?> 
        
       
                                        	
        <!-- Static Table Start -->
        <div class="static-table-area">
        
       
        
        
        
            <div class="container-fluid">
                <div class="row">
                
                
                    
                    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" >
                         
                        <div class="row" style="margin:0"> 
                         
                        <?php include 'progress.php' ?> 
                          
                          </div>
                         
                         
                         <div class="panel-group" id="accordion">
    <div class="panel panel-default">
      <div class="panel-heading" >
        <h4 class="panel-title">
          <a>Patient Assessment</a>
        </h4>
      </div>
      <div id="collapse1" class="panel-collapse collapse in">
        <div class="panel-body">
            <?php
			if($_REQUEST['patient_assessment'])
			{ 
			
			$CheckPatAss=Numrow_Chk($con,'patient_assessment','Lead_ID',$_REQUEST['Lid']); 
			  
			if($CheckPatAss==0)
			{
	        $patient_master="insert into patient_assessment(Lead_ID,Patient_Name,Enq_Date,Contact_Person_Name,Phone_No,Patient_Status,Probable_Service_Start_Date,Probable_Service_Duration,Visit_By,Summary_Of_Visit,Price_Discussion,Price_Agreed,Visit_Done)values('".$_REQUEST['Lid']."','".$_REQUEST['Patient_Name']."','".$_REQUEST['Enq_Date']."','".$_REQUEST['Contact_Person_Name']."','".$_REQUEST['Phone_No']."','".$_REQUEST['Patient_Status']."','".$_REQUEST['Probable_Service_Start_Date']."','".$_REQUEST['Probable_Service_Duration']."','".$_REQUEST['Visit_By']."','".$_REQUEST['Summary_Of_Visit']."','".$_REQUEST['Price_Discussion']."','".$_REQUEST['Price_Agreed']."','".$_REQUEST['Visit_Done']."')";
			   mysqli_query($con,$patient_master);
		    }
			else
			{
			 $UpdatePatAss="update patient_assessment set Patient_Name='".$_REQUEST['Patient_Name']."', Enq_Date='".$_REQUEST['Enq_Date']."',Contact_Person_Name='".$_REQUEST['Contact_Person_Name']."',Phone_No='".$_REQUEST['Phone_No']."',Patient_Status='".$_REQUEST['Patient_Status']."',Probable_Service_Start_Date='".$_REQUEST['Probable_Service_Duration']."',Probable_Service_Duration='".$_REQUEST['Probable_Service_Duration']."',Visit_By='".$_REQUEST['Visit_By']."',Summary_Of_Visit='".$_REQUEST['Summary_Of_Visit']."',Price_Discussion='".$_REQUEST['Price_Discussion']."',Price_Agreed='".$_REQUEST['Price_Agreed']."',Visit_Done='".$_REQUEST['Visit_Done']."' where Lead_ID='".$_REQUEST['Lid']."'";
			 mysqli_query($con,$UpdatePatAss);
			}
			?>
            <script>window.location.href="patient_assessment_1.php?Lid=<?php echo $_REQUEST['Lid']; ?>"</script>
            <?php

          }
		   
		   $FetchPatientAss=FetchData($con,'patient_assessment','Lead_ID',$_REQUEST['Lid']);
		   $FetchLead=FetchData($con,'lead_master','Lead_ID',$_REQUEST['Lid']);
		   
		   if($FetchPatientAss['Patient_Name']!='')
		   {
		      $Patient_Name=$FetchPatientAss['Patient_Name'];
		   }
		   else
		   { 
		      $Patient_Name=$FetchLead['Lead_Name'];
		   }
		   
		   
		   if($FetchPatientAss['Contact_Person_Name']!='')
		   {
		      $Contact_Person_Name=$FetchPatientAss['Contact_Person_Name'];
		   }
		   else
		   { 
		      $Contact_Person_Name=$FetchLead['Lead_Name'];
		   }
		   
		   
		   if($FetchPatientAss['Phone_No']!='')
		   {
		      $Phone_No=$FetchPatientAss['Phone_No'];
		   }
		   else
		   { 
		      $Phone_No=$FetchLead['Phone'];
		   }
		   
		   
		   if($FetchPatientAss['Enq_Date']!='')
		   {
		      $Enq_Date=$FetchPatientAss['Enq_Date'];
		   }
		   else
		   { 
		      $Enq_Date=$FetchLead['Lead_Creation_Date'];
		   }


?>
        <form method="post" id="form_s_1">
                                           
                                              <div class="col-sm-6 col-xs-6" >
                                               <div class="form-group">
                                                    <label>Patient name</label>
                                                    <input name="Patient_Name" id="Patient_Name" type="text" value="<?php echo $Patient_Name; ?>" class="form-control"  
                                                     data-rule-required="true" data-msg-required="Please enter patient name">
                                                </div>
                                               </div>
                                               
                                               
                                               
                                               
                                               <div class="col-sm-6  col-xs-6" >
                                               <div class="form-group">
                                                    <label>ENQ. Date</label>
                                                    <input name="Enq_Date" id="finish12" type="text" value="<?php echo $Enq_Date; ?>" class="form-control"  
                                                    data-rule-required="true" data-msg-required="Please enter enquiry date">
                                                </div>
                                               </div>
                                               
                                               
                                               
                                               
                                               <div class="col-sm-6  col-xs-6" >
                                               <div class="form-group">
                                                    <label>Contact Person Name</label>
                                                    <input name="Contact_Person_Name" id="Contact_Person_Name" type="text" value="<?php echo $Contact_Person_Name; ?>" class="form-control"  
                                                     data-rule-required="true" data-msg-required="Please enter contact person name">
                                                </div>
                                               </div>
                                               
                                               
                                            
                                               
                                               
                                               <div class="col-sm-6  col-xs-6" >
                                               <div class="form-group">
                                                    <label>Phone No</label>
                                                     <input name="Phone_No" id="Phone_No" type="text" value="<?php echo $Phone_No; ?>"  class="form-control"    maxlength="10"
                                                     onKeyPress="return isNumberKey(event)" data-msg-required="Please enter your phone number"
                                                     data-rule-required="true" data-rule-maxlength="10" data-rule-minlength="10" >
                                                </div>
                                               </div>
                                               
                                               
                                               
                                               
                                               
                                               <div class="col-sm-12 col-xs-12" >
                                               <div class="form-group">
                                                    <label>Patient Status</label>
                                                    <textarea name="Patient_Status" id="Patient_Status" type="text" class="form-control"  
                                                    data-rule-required="true" data-msg-required="Please enter patient status"
                                                    style="height:50px"><?php echo $FetchPatientAss['Patient_Status']; ?></textarea>
                                                </div>
                                               </div>
                                               
                                               
                                               
                                               
                                               <div class="col-sm-4 col-xs-6" >
                                               <div class="form-group">
                                                    <label >Probable Service start date</label>
                                                    <input name="Probable_Service_Start_Date" id="start12" type="text" value="<?php echo $FetchPatientAss['Probable_Service_Start_Date']; ?>" class="form-control"  
                                                     data-rule-required="true" data-msg-required="Please enter service start date">
                                                </div>
                                               </div>
                                               
                                               
                                               
                                               
                                               <div class="col-sm-4 col-xs-6" >
                                               <div class="form-group">
                                                    <label >Probable Service Duration</label>
                                                    <input name="Probable_Service_Duration" id="" type="text" value="<?php echo $FetchPatientAss['Probable_Service_Duration']; ?>" class="form-control"  
                                                    data-rule-required="true" data-msg-required="Please enter probable service duration">
                                                </div>
                                               </div>
                                               
                                               
                                               <div class="col-sm-4 col-xs-12" id="call_later_div">
                                              
                                            
                                              
                                              
                                              <div class="form-group"><label>Visit By</label>
                                                   <?php
												    $sqlN="select SLN,First_Name,Last_Name from employee_master where Status='Active' and (Designation='Head Nurse' or Designation='Doctor') and Office_Location_City='".$FetchLocation['Location_Name']."'";
												   ?>
                                                     <select name="Visit_By" class="form-control" id="Visit_By">
                                                     <option value="">Select Visit By</option>
                                                  <?php
													
													$rsN=mysqli_query($con,$sqlN);
													while($RowN=mysqli_fetch_array($rsN))
													{
													$NurseName=$RowN['First_Name']." ".$RowN['Last_Name'];
													?>
													<option value="<?php echo $NurseName; ?>"><?php echo $NurseName; ?></option>
													<?php
													}
													?>

                                                     </select>
                                                             
                                                           </div>
                                                          
                                                           
                                                        </div>
                                               
                                               <div class="col-sm-12 col-xs-12" >
                                               <div class="form-group">
                                                    <label>Summery  Of the Visit</label>
                                                    <textarea name="Summary_Of_Visit" id="Summary_Of_Visit" type="text" class="form-control"  
                                                     data-rule-required="true" data-msg-required="Please enter summery of visit"
                                                    style="height:50px"><?php echo $FetchPatientAss['Summary_Of_Visit']; ?></textarea>
                                                </div>
                                               </div>
                                               
                                               
                                               <div class="col-sm-2 col-xs-12" >
                                               <div class="form-group">
                                               <div>
                                                    <label style="text-transform:uppercase">Price Discussion Done</label></div>
                                                    
                                                   <label class="radio-inline">
                                                      <input type="radio" name="Price_Discussion" value="Yes" <?php if($FetchPatientAss['Price_Discussion']=="Yes"){ echo "checked";} ?> >Yes
                                                    </label>
                                                    <label class="radio-inline">
                                                      <input type="radio" name="Price_Discussion" value="No" <?php if($FetchPatientAss['Price_Discussion']=="No"){ echo "checked";} ?>>No
                                                    </label> 
                                                </div>
                                               </div>
                                               
                                               
                                               
                                               
                                               
                                               <div class="col-sm-2  col-xs-6" >
                                               <div class="form-group">
                                               <div>
                                                    <label style="text-transform:uppercase">Price Agreed Upon</label></div>
                                                    
                                                   <label class="radio-inline">
                                                      <input type="radio" name="Price_Agreed" value="Yes" <?php if($FetchPatientAss['Price_Agreed']=="Yes"){ echo "checked";} ?>>Yes
                                                    </label>
                                                    <label class="radio-inline">
                                                      <input type="radio" name="Price_Agreed" value="No" <?php if($FetchPatientAss['Price_Agreed']=="No"){ echo "checked";} ?>>No
                                                    </label> 
                                                </div>
                                               </div>
                                               
                                               
                                               <div class="col-sm-2 col-xs-6" >
                                               <div class="form-group">
                                               <div>
                                                    <label style="text-transform:uppercase">S&M Visit done</label></div>
                                                    
                                                   <label class="radio-inline">
                                                      <input type="radio" name="Visit_Done" value="Yes" <?php if($FetchPatientAss['Visit_Done']=="Yes"){ echo "checked";} ?>>Yes
                                                    </label>
                                                    <label class="radio-inline">
                                                      <input type="radio" name="Visit_Done" value="No" <?php if($FetchPatientAss['Visit_Done']=="No"){ echo "checked";} ?>>No
                                                    </label> 
                                                </div>
                                               </div>
                                               
                                  
                                          <div align="right" class="col-sm-6 col-xs-12" >
                                           <div align="right"   class="form-group"> 
                                                 <input type="submit" class="btn  btn-primary btn_fix" name="patient_assessment" value="Save and Next" style="margin-top:10px; float:right; padding-left:10px !important; margin-bottom:12px !important; padding:5px 8px !important"  >
                                             </div>                                                       
                                           </div>             
                                         </form>
        </div>
      </div>
    </div>


    
     
 

    
     
  </div> 
                         
                    </div> 
                    
                    
                 
                 
                              
                                      
                        </div>
                    </div>
                </div>
                
                
            </div>
        </div>
        <!-- Static Table End -->
        <div class="footer-copyright-area"  >
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="footer-copy-right">
                            <p>Copyright © 2019. All rights reserved. </p>
                           
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

     <!-- jquery
		============================================ -->
     
       <script src="js/vendor/jquery-1.12.4.min.js"></script>
    <!-- bootstrap JS
		============================================ -->
    <script src="js/bootstrap.min.js"></script>
    <!-- wow JS
		============================================ -->
    <script src="js/wow.min.js"></script>
    <!-- price-slider JS
		============================================ -->
    <script src="js/jquery-price-slider.js"></script>
    <!-- meanmenu JS
		============================================ -->
    <script src="js/jquery.meanmenu.js"></script>
    <!-- owl.carousel JS
		============================================ -->
    <script src="js/owl.carousel.min.js"></script>
    <!-- sticky JS
		============================================ -->
    <script src="js/jquery.sticky.js"></script>
    <!-- scrollUp JS
		============================================ -->
    <script src="js/jquery.scrollUp.min.js"></script>
    
    <script src="js/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
    <script src="js/scrollbar/mCustomScrollbar-active.js"></script>

     
    
     <!--  editable JS
		============================================ -->
    <script src="js/editable/jquery.mockjax.js"></script>
    <script src="js/editable/mock-active.js"></script>
    <script src="js/editable/select2.js"></script>
    <script src="js/editable/moment.min.js"></script>
    <script src="js/editable/bootstrap-datetimepicker.js"></script>
    <script src="js/editable/bootstrap-editable.js"></script>
    <script src="js/editable/xediable-active.js"></script>
 	
    
    <!-- datepicker JS
		============================================ -->
    <script src="js/datepicker/jquery-ui.min.js"></script>
    <script src="js/datepicker/datepicker-active.js"></script>
    
    <!-- mCustomScrollbar JS
		============================================ -->
    <script src="js/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
    <script src="js/scrollbar/mCustomScrollbar-active.js"></script>
    <!-- metisMenu JS
		============================================ -->
    <script src="js/metisMenu/metisMenu.min.js"></script>
    <script src="js/metisMenu/metisMenu-active.js"></script>
    <!-- peity JS
		============================================ -->
    <script src="js/peity/jquery.peity.min.js"></script>
    <script src="js/peity/peity-active.js"></script>
    <!-- sparkline JS
		============================================ -->
    <script src="js/sparkline/jquery.sparkline.min.js"></script>
    <script src="js/sparkline/sparkline-active.js"></script>
    <!-- tab JS
		============================================ -->
    <script src="js/tab.js"></script>
    <!-- plugins JS
		============================================ -->
    <script src="js/plugins.js"></script>
    <!-- main JS
		============================================ -->
    <script src="js/main.js"></script>
    <!-- tawk chat JS
		============================================ -->
    <script src="js/tawk-chat.js"></script>
   <!-- form validate JS
		============================================ -->
    <script src="js/form-validation/jquery.form.min.js"></script>
    <script src="js/form-validation/jquery.validate.min.js"></script>
    <script src="js/form-validation/form-active.js"></script>
    
    
    
    
   
      <script>
				function Reffered_opt_function() {
				 var Reffered_opt = $("#Reffered_Buurtzorg_From").val();
				 
				 //alert(Reffered_opt);
				 if(Reffered_opt=="Doctor") {
				 $("#Doctor_div").show(400);
					}
					
					if(Reffered_opt!="Doctor") {
				 $("#Doctor_div").hide(400);
					}
				}
				</script>   
    
    
    
    <script>
$(document).ready(function() {
   $("body").tooltip({ 
   	selector: '[data-toggle=tooltip]' 
	 });
});
 
</script> 
  
               
                                               <script>
 
$('button.call_btn_1').click(function() {
    //var text = $(this).text();
	var text = $(this).data('value_santanu');
	//alert(text)
	$('#hidden_call_box').val(text);
	$('#response').val(text);
    // do something with the text
});
												</script> 
                                                
                                                
                                                
                                                
       <!-- bootstrap-clockpicker -->
      <link rel="stylesheet" type="text/css" href="css/bootstrap-clockpicker.min.css">
    <script type="text/javascript" src="js/bootstrap-clockpicker.min.js"></script>


 <!--<script type="text/javascript">
$('.clockpicker').clockpicker()
	.find('input').change(function(){
		console.log(this.value);
	});
var input = $('#single-input').clockpicker({
	placement: 'bottom',
	align: 'left',
	autoclose: true,
	'default': 'now'
});

$('.clockpicker-with-callbacks').clockpicker({
		donetext: 'Done',
		init: function() { 
			console.log("colorpicker initiated");

		},
		beforeShow: function() {
			console.log("before show");
		},
		afterShow: function() {
			console.log("after show");
		},
		beforeHide: function() {
			console.log("before hide");
		},
		afterHide: function() {
			console.log("after hide");
		},
		beforeHourSelect: function() {
			console.log("before hour selected");
		},
		afterHourSelect: function() {
			console.log("after hour selected");
		},
		beforeDone: function() {
			console.log("before done");
		},
		afterDone: function() {
			console.log("after done");
		}
	})
	.find('input').change(function(){
		console.log(this.value);
	});

// Manually toggle to the minutes view
$('#check-minutes').click(function(e){
	// Have to stop propagation here
	e.stopPropagation();
	input.clockpicker('show')
			.clockpicker('toggleView', 'minutes');
});
if (/mobile/i.test(navigator.userAgent)) {
	$('input').prop('readOnly', true);
}
</script>-->   



<script type="text/javascript">
$("form#form_s_1").validate({
          
      showErrors: function(errorMap, errorList) {
          // Clean up any tooltips for valid elements
          $.each(this.validElements(), function (index, element) {
              var $element = $(element);
              $element.data("title", "") // Clear the title - there is no error associated anymore
                  .removeClass("error")
                  .tooltip("destroy");
          });
          // Create new tooltips for invalid elements
          $.each(errorList, function (index, error) {
              var $element = $(error.element);

              $element.tooltip("destroy") // Destroy any pre-existing tooltip so we can repopulate with new tooltip content
                  .data("title", error.message)
                  .addClass("error")
                  .tooltip(); // Create a new tooltip based on the error messsage we just set in the title
          });
      },

     
	  
});

$("form#form_s_2").validate({
          
      showErrors: function(errorMap, errorList) {
          // Clean up any tooltips for valid elements
          $.each(this.validElements(), function (index, element) {
              var $element = $(element);
              $element.data("title", "") // Clear the title - there is no error associated anymore
                  .removeClass("error")
                  .tooltip("destroy");
          });
          // Create new tooltips for invalid elements
          $.each(errorList, function (index, error) {
              var $element = $(error.element);

              $element.tooltip("destroy") // Destroy any pre-existing tooltip so we can repopulate with new tooltip content
                  .data("title", error.message)
                  .addClass("error")
                  .tooltip(); // Create a new tooltip based on the error messsage we just set in the title
          });
      },

     
	  
});


$("form#form_s_3").validate({
          
      showErrors: function(errorMap, errorList) {
          // Clean up any tooltips for valid elements
          $.each(this.validElements(), function (index, element) {
              var $element = $(element);
              $element.data("title", "") // Clear the title - there is no error associated anymore
                  .removeClass("error")
                  .tooltip("destroy");
          });
          // Create new tooltips for invalid elements
          $.each(errorList, function (index, error) {
              var $element = $(error.element);

              $element.tooltip("destroy") // Destroy any pre-existing tooltip so we can repopulate with new tooltip content
                  .data("title", error.message)
                  .addClass("error")
                  .tooltip(); // Create a new tooltip based on the error messsage we just set in the title
          });
      },

     
	  
});
</script>                                          
                                                
                                                
 <!-- <script>
		CKEDITOR.replace( 'editor1', {
			height: 150,
			width: 700,
		} );
	</script> -->                                             
                                                
    
</body>

</html>