Lock the timepicker button

0

<?php
include('ligabd.php');
$id=$_GET["id"];
session_start();

if(isset($_SESSION["id_cliente"])){
	
}else{
	header("location:login.php",  true,  301 );
}
$successMsg='';

$consulta = 'SELECT * FROM marcacoes';
$consulta2 = "SELECT * FROM clientes WHERE id_cliente='$id'";
$result2 = mysqli_query($ligabd,$consulta2);
if (isset($_POST['send'])) {
	
$target_dir = "imagens_clientes/";	
$thisimage1 = "imagem";
  if(is_uploaded_file($_FILES[$thisimage1]['tmp_name'])) {
 

                  $filename = $_FILES[$thisimage1]["name"];
                        $file_basename = substr($filename, 0,
strripos($filename, '.')); // get file extention
                        $file_ext = substr($filename,
strripos($filename, '.')); // get file name
        //$ficheiro_nome = "doc_" . $id . "" . $file_ext;

  //$ficheiro_nome = $_FILES[$thisimage1]['name'];
  $temporario = $_FILES[$thisimage1]['tmp_name'];
  $destino = $target_dir .  $filename;
  if(!move_uploaded_file($temporario, $destino)) {
      // $msgInserirNoticiaNeg = $msgInserirNoticiaNeg . "<P
       
	  
          }
            }
			
	


      
      $title = mysqli_real_escape_string($ligabd,$_POST['nome']);
      $image = $thisimage1;
     // $contacto = mysqli_real_escape_string($ligabd,$_POST['contacto']);
	  $sugestoes = mysqli_real_escape_string($ligabd,$_POST['sugestoes']);
	  $data = mysqli_real_escape_string($ligabd,$_POST['data']);
	  $hora = mysqli_real_escape_string($ligabd,$_POST['horario']);
	  
	  $fim = date("H:i",strtotime(" $hora + 60 minutes"));
	  
	  
	  
	  
	  $cont=0;	  
$query = "SELECT * FROM marcacoes";
$result = $ligabd->query($query);
while ($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
{
if ($row['data']==$data && $row['hora']==$hora){
	$cont=1;
	$successMsg='<font color="#ec1c24">Não é possível efetuar a marcação neste horário.</font>';
}
}

if ($cont==0){
	$sql = "INSERT INTO marcacoes (nome, imagem,sugestoes,data,hora,fim)
	  VALUES ('$title', '$destino', '$sugestoes','$data','$hora','$fim')";
	  $ligabd->query($sql);
	  echo ($ligabd->error);
	$successMsg='<font color="#0ed145">Marcação efetuada com sucesso.</font>';  
	  
	
}
}
?>

<html>
<head>
<link href='CSS/estilos.css' rel='stylesheet' media="screen" />
<link rel="stylesheet" type="text/css" href="CSS/jquery-ui.css">
	<script src="js/jquery-1.8.2.js"></script>
	<script src="js/jquery-ui.js"></script>
<script>
$(function() {
    $( "#calendario" ).datepicker({
		minDate: 0,
		beforeShowDay:
	function(dt){
		return [dt.getDay() == 0 ? false : true];
	},
		dateFormat: 'yy-mm-dd',
        dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado','Domingo'],
        dayNamesMin: ['D','S','T','Q','Q','S','S','D'],
        dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb','Dom'],
        monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
        monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez']});
});
    $( function() {
        $("#horario").timepicker({
            timeFormat    : 'HH:mm',
            interval: 60,
            minTime       : '08:00',
            maxTime       : '17:00',
            defaultTime   : '',
            startTime     : '08:00',
            dynamic       : false,
            modal         : true,
            scrollbar     : true});
    } );
	
	
	
</script>



<title>
Agendamento
</title>
</head>
<body> 
	

<div class="content" id="content">
<a href="logout2.php" class="linkbotao" style="position:relative;top:-20px;left:85%;">
Logout
</a>
<form action="pagina_marcacoes.php" method="POST"  enctype="multipart/form-data" class="form" >
<a href="pagina_principal.php"><img src="imagens/logo.png" class="img"></a>
<p style="position: relative;left:22%;color:#fecb1d;" >AGENDAMENTO</p>

<?php while ($dado = mysqli_fetch_array($result2,MYSQLI_ASSOC)){ ?>
	 Nome:<input type="text" name="nome" class="input" value="<?php echo $dado["nome"]; ?>"/>
<?php } ?>


	
	<br>
	 <p>Data:<input type="text" id="calendario" name="data" autocomplete="off" class="input" readonly /></p>
	 <div>
                
                        
              <p>Hora:<input type="text" id="horario" name="horario" autocomplete="off" class="input" readonly /></p>
                   
                    </div>
                    
	<br>
	Sugestões:<input type="text" name="sugestoes" maxlength="500" class="input">
	<br>
	<br>
	<input type="file" name="imagem" style="border-radius:15px;">
	<br>
	<br>
	<button name="send" id="login" class="btn">
							Efetuar marcação
						</button>
	<br>
	<?php echo $successMsg;?>
	</form>
	</div>
<!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery-1.8.2.js"><\/script>')</script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script src="js/docs.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="js/ie10-viewport-bug-workaround.js"></script>

</body>
</html>

Good morning,

Can someone help me?

I have a datePicker and a timePicker and wanted it when I clicked on a datePicker date it blocked me an hour from the timePicker that is already inserted in the database that day instead of giving me a warning after clicking the button to send the data to the database.

Do you think it's too complicated?

Thank you in advance

    
asked by anonymous 29.11.2018 / 10:15

0 answers