<?php include ('header1f.php');?>
<script src="js/jquery-3.5.1.min.js"></script>
<link rel="stylesheet" href="jquery-ui.css">
<script src="jquery.min.js"></script>
<script src="jquery-ui.js"></script>
<?php 
ob_start();   
session_start();
include ('connection.php') ;

  if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
	date_default_timezone_set('Asia/Calcutta');
$today = date("d/m/Y");
$today3 = date("Y-m-d");
$today1 = date("d/m");

?>
<script>
$(document).ready(function(){
    $("#booking").change(function(){
        $(this).find("option:selected").each(function(){
            var optionValue = $(this).attr("value");
            if(optionValue){
                $(".boxbook").not("." + optionValue).hide();
                $("." + optionValue).show();
            } else{
                $(".boxbook").hide();
            }
        });
    }).change();
});
</script>
<script>
$(document).ready(function(){
    $("#social").change(function(){
        $(this).find("option:selected").each(function(){
            var optionValue = $(this).attr("value");
			
            if(optionValue){
                $(".box").not("." + optionValue).hide();
				if(optionValue=='Appointment'){
				           $('.PFinputbox').attr('required','required');

				}else {
				           $('.PFinputbox').removeAttr('required');

				}
				if(optionValue=='NotInterested'){
				           $('.NIinputbox').attr('required','required');

				}else {
				           $('.NIinputbox').removeAttr('required');

				}
				
				if(optionValue=='Call_Later'){
				           $('.CLinputbox').attr('required','required');

				}else {
				           $('.CLinputbox').removeAttr('required');

				}
				
			if(optionValue=='Not_Answer'){
							           $('.NIinputbox').removeAttr('required');
				           $('.PFinputbox').removeAttr('required');

												           $('.CLinputbox').removeAttr('required');				}
                $("." + optionValue).show();
            } else{
                $(".box").hide();
            }
        });
    }).change();
});
</script>
<div class="content-page">
<div class="content">
<div class="container">
<form name="chkForm" id="chkForm" action="insert_customer_followup_notes.php"  method="post" >
<input type="hidden" value="<?php echo $_REQUEST['program_id'];?>" name="program_id" />
<input type="hidden" value="<?php echo  $_REQUEST['program_name'];?>" name="program_name" />
<input type="hidden" value="<?php echo  $_REQUEST['patient_name'];?>" name="patient_name" />
<input type="hidden" value="<?php echo  $_REQUEST['tablename'];?>" name="tablename" />
<input type="hidden" value="<?php echo  $_REQUEST['registration_id'];?>" name="registration_id" />

<?php 
$tablename = $_REQUEST['tablename'];

$query1a = "select * from $tablename";
$result1a = mysqli_query($conn,$query1a);
while($row=mysqli_fetch_array($result1a))
{		
$mobile_no = $row['mobile_no'];
$location = $row['city'];
}?>



<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Follow-up :: <?php echo $_REQUEST['program_name']?>

<input type=submit value="CALL" onclick="allOn();" class="btn btn-primary" />
</h3>
</div>
<div class="panel-body">
<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label><b>Call Type<span class="style1">*</span></b></label>
<select  class="form-control" data-style="py-0" name="call_type" id="social" required>
<option value="" selected="selected">Select call type</option>
<?php 
$querynp = "select * from call_type where status='1'";
$resultmp = mysqli_query($conn,$querynp);
while($row=mysqli_fetch_array($resultmp))
{
$call_type = $row['call_type'];
$display_type = $row['display_type'];
?>
<option value="<? echo $call_type ?>"><? echo $display_type ?> </option>
<?php 	}?>
</select>
</div>
</div>
<div class="Call_Later box" >
<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label class="form-label" for="mobno">Next Reminder Date:</label>
<input type="text" class="dt1 form-control CLinputbox"  name="Nreminder_date" >
<script>
$(".dt1").datepicker({
inline: true,
minDate: 0,

nextText: '?',
prevText: '?',
showOtherMonths: true,
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd',
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
showAnim: "slide"

});
</script>
</div>
</div>
<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label class="form-label" for="mobno">Time:</label>
<input type="time" class="form-control"  name="Nreminder_time" >
</div>
</div>
</div>


<div class="Appointment box">

<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label><b>Doctor</b></label>
<select name="doctor_id" class="form-control" id="state">
<option value="">Select Doctor</option>
<?php
$queryls = "select * from doctor_master where status ='1' ";
$resultls = mysqli_query($conn,$queryls);	
while($row=mysqli_fetch_array($resultls))
{
$doctor_name = $row['doctor_name'];
$doctor_id = $row['doctor_id'];
?>
<option value="<? echo $doctor_id; ?>"><? echo $doctor_name;?></option>
<? }?>
</select>
</div>
</div>

<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label><b>Branch</b></label>
<select name="branch_id" class="form-control">
<option value="">Select Branch</option>
<?php
$queryls = "select * from branch_master where status ='1' ";
$resultls = mysqli_query($conn,$queryls);	
while($row=mysqli_fetch_array($resultls))
{
$branch_name = $row['branch_name'];
$branch_id = $row['branch_id'];
?>
<option value="<?php echo $branch_id; ?>"><? echo $branch_name;?></option>
<? }?>
</select>
</div>
</div>


<div class="col-sm-3 col-xs-12" id="business" >
<div class="form-group">
<label class="form-label" for="mobno">Appointment Date:</label>
<input type="text" class="form-control" id="datepicker" name="appointment_date">
<script>
$(".dt1").datepicker({
inline: true,
minDate: 0,

nextText: '?',
prevText: '?',
showOtherMonths: true,
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd',
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
showAnim: "slide"

});
</script>
</div>
</div>
<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label class="form-label" for="mobno">Time:</label>
<input type="time" class="form-control"  name="appointment_time" >
</div>
</div>
<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label class="form-label" for="mobno">Patient Name</label>
<input type="text" class="form-control"  name="patient_name" value="<?php echo $_REQUEST['patient_name']?>">
</div>
</div>

<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label class="form-label" for="mobno">Location</label>
<input type="text" class="form-control"  name="location" value="<?php echo $location?>">
</div>
</div>
<div class="col-sm-3 col-xs-12">
<div class="form-group">
<label class="form-label" for="mobno">Mobile No</label>
<input type="text" class="form-control"  name="mobile_no" value="<?php echo $mobile_no?>">
</div>
</div>
<div class="col-sm-9 col-xs-12">
<div class="form-group"  id="city">

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


 <div class="clearfix"></div>
<div class="col-sm-12 col-xs-12">
<div class="form-group">
<label class="form-label" for="fname">Notes</label>
<textarea class="form-control" id="uname" name="note"></textarea>
</div>
</div>


<div class="col-sm-12 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<input type="submit" name="Submit" class="btn waves-light" value="Submit" style="float:right; background-color:#65bd77; color: #FFFFFF">
</div>
</div>
</div>
<script>
        $(document).ready(function() {
           
			
			
            $("#datepicker").on('change', function() {
                var stateid = $(this).val();
                $.ajax({
                    method: "POST",
                    url: "appointments1.php",
                    data: {
                        sid: stateid
                    },
                    datatype: "html",
                    success: function(data) {
                        $("#city").html(data);

                    }

                });
				
				});
				
		
        });
    </script>
</div>
</div>
</div>
</div></form>

<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Follow up History</h3>
</div>
<div class="panel-body">
<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sr.No.</th>
<th>Type</th>
<th>Activity Notes</th>
<th>Appointment Date - Time</th>
<th>Doctor Name/Place </th>
<th>Follow up</th>
<th>Next Reminder Date &amp; time </th>
</tr>
</thead>
<tbody>
<?php
$i=1;

$querys = "select * from   quotation_follow_up where call_follow_up_id ='".$_REQUEST['call_follow_up_id']."'";
$results = mysqli_query($conn,$querys);	
while($row=mysqli_fetch_array($results))
{
$call_type = $row['call_type'];
$program_name = $row['program_name'];
$appointment_date = $row['appointment_date'];
$appointment_time = $row['appointment_time'];
$Nreminder_date = $row['Nreminder_date'];
$Nreminder_time = $row['Nreminder_time'];
$conversation_details = $row['conversation_details'];
$patient_name = $row['patient_name'];
$branch_name = $row['branch_name'];
$doctor_name = $row['doctor_name'];

if($Nreminder_time!=''){ $next_remainder_date1 = date('d-m-Y', strtotime($Nreminder_time));}else{ $Nreminder_time=''; }				
					?>
<tr>
<td><?php echo $i?></td>
<td><?php echo $call_type?></td>
<td><?php echo $conversation_details?></td>
<td><?php echo $appointment_date?><br /><?php echo $appointment_time?></td>
<td><?php echo $doctor_name?><br /><?php echo $branch_name?></td>
<td><?php echo $program_name?></td>
<td><?php echo $next_remainder_date1?><br /><?php echo $remainder_time?></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
<script type="text/javascript">

    function allOn(){

    var myWindow = window.open('call1.php?Customer_PhNo=<?php echo $mobile_no?>&&program_id<?php echo $_REQUEST['program_id']?>&&program_name=<?php echo $_REQUEST['program_name']?>&&call_follow_up_id=<?php echo $_REQUEST['call_follow_up_id']?>&&patient_name=<?php echo $_REQUEST['patient_name']?>&&registration_id=<?php echo $_REQUEST['registration_id']?>&&tablename=<?php echo $_REQUEST['tablename']?>','1366002941508','width=48,height=48,left=0,top=0,center window')

    setTimeout(function() { myWindow.close();}, 10000);

    }

  </script>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include 'footer1a.php';?>
