I have a table with several employees and it counts the plate of each hum.
I created a modal that when the manager clicks on the employee's name is called a modal where you can enter the number of the plate.
Reason: there are situations that this plate number can change.
Please try again later.
How do I when I click on the table I can store the employee's plate that was clicked so I can update the table?
Here are my codes:
Modal script:
<script type="text/javascript">
$(document).ready(function(){
$("a[rel=modal]").click( function(ev){
ev.preventDefault();
var id = $(this).attr("href");
var alturaTela = $(document).height();
var larguraTela = $(window).width();
//colocando o fundo preto
$('#mascara').css({'width':larguraTela,'height':alturaTela});
$('#mascara').fadeIn(1000);
$('#mascara').fadeTo("slow",0.8);
var left = ($(window).width() /2) - ( $(id).width() / 2 );
var top = ($(window).height() / 2) - ( $(id).height() / 2 );
$(id).css({'top':top,'left':left});
$(id).show();
});
$("#mascara").click( function(){
$(this).hide();
$(".window").hide();
});
$('.fechar').click(function(ev){
ev.preventDefault();
$("#mascara").hide();
$(".window").hide();
});
});
</script>
<style type="text/css">
.window{
display:none;
width:300px;
height:300px;
position:absolute;
left:0;
top:0;
background:#FFF;
z-index:9900;
padding:10px;
border-radius:10px;
}
#mascara{
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#000;
display:none;
}
.fechar{display:block; text-align:right;}
</style>
My table:
<?php
$query_pesquisa = mysql_query("SELECT
func_chapa AS CODIGO,
func_nome AS NOME
FROM
funcionarios
WHERE
func_status='1'")or die(mysql_error());
if (empty($query_pesquisa)) {
echo "Nenhum registro encontrado.";
}
?>
<table class='datatable table table-hover table-bordered table-responsiv'>
<thead>
<tr>
<th>CODIGO</th>
<th>NOME</th>
</tr>
</thead>
<?php
echo"<tbody>";
while ($row = mysql_fetch_array($query_pesquisa)) {
echo" <tr>";
echo"<td>".$row['CODIGO']."</td>";
echo"<td><a href='#usuario' rel ='modal'>".$row['NOME']."</a></td>";
echo" </tr>";
}
echo" </tbody>";
echo" </table>";
?>
Modal:
<div class="window" id="usuario">
<a href="atualiza.php" class="fechar">X Fechar</a>
<h4>ATUALIZA CHAPA:</h4>
<center><form action="atualizar.php" method="POST">
<label for="chapa">CHAPA:</label>
<input type="text" name="chapa" id="chapa">
<br />
<br />
<button type="submit" class="btn btn-primary">ATUALIZAR</button>
</form>
</center>
</div>
<!-- mascara para cobrir o site -->
<div id="mascara"></div>