0
Good morning,
Could you help me? I would like to center a Div(id="newServic") that is displayed by clicking on a Btn(id="newServicoBtn").
Follow the code below
<?php
session_start();
if(isset($_SESSION['User'])){
?>
<!DOCTYPE html>
<html>
<link rel="stylesheet" type="text/css" href="../css/ERP.css">
<head>
<title>ERP Nserv</title>
<?php require_once "menu.php"; ?>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-12" align="center">
<span class="btn btn-default" id="novoServicoBtn">Cadastrar Novo</span>
<span class="btn btn-default" id="servicosFeitosBtn">Lista de Serviços</span>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="centralizarERP" id="novoServico"></div>
<div id="servicosFeitos"></div>
</div>
</div>
<div class="row">
<br>
<h3 align="center">ENTRADA DE SERVIÇOS</h3>
<br>
<div class="col-sm-12" align="center">
<div id="tabelaServicosEntrada"></div>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
$('#tabelaServicosEntrada').load('servicos/tabelaServicosEntrada.php');
$('#novoServicoBtn').click(function(){
esconderSessao();
$('#novoServico').load('servicos/cadastrarServico.php');
$('#novoServico').show();
});
$('#servicosFeitosBtn').click(function(){
esconderSessao();
$('#servicosFeitos').load('#');
$('#servicosFeitos').show();
});
});
function esconderSessao(){
$('#novoServico').hide();
$('#servicosFeitos').hide();
}
</script>
<?php
}else{
header("location:../index.php");
}
?>
This Div is inherited from another class, follows below the code:
<?php
require_once "../../Classes/Conexao.php";
$c= new conectar();
$conexao=$c->conexao();
?>
<br>
<div class="row">
<div class="col-md-6 offset-md-3" align="center">
<form id="frmNovoServico">
<label>Cliente</label>
<select class="form-control input-sm" id="clienteSelect" name="clienteSelect">
<option value="A">Selecionar</option>
<option value="0">Sem Cliente</option>
<?php
$sql="SELECT ID_Cliente, Nome, Sobrenome FROM clientes";
$result=mysqli_query($conexao,$sql);
while ($cliente=mysqli_fetch_row($result)):
?>
<option value="<?php echo $cliente[0] ?>"><?php echo $cliente[1]." ".$cliente[2] ?></option>
<?php endwhile; ?>
</select>
<br>
<label>Equipamento</label>
<input type="text" class="form-control input-sm" id="equipamento" name="equipamento">
<br>
<label>Informação</label>
<textarea type="text" class="form-control input-sm" id="informacao" name="informacao" rows="5" />
<br>
<label>Número Serial</label>
<input type="text" class="form-control input-sm" id="serialnumber" name="serialnumber">
<p></p>
<span class="btn btn-primary" id="btnAddServico">Cadastrar Serviço</span>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#btnAddServico').click(function(){
vazios=validarFormVazio('frmNovoServico');
if(vazios > 0){
alertify.alert("ATENÇÃO","Preencha todos os Campos");
return false;
}
dados=$('#frmNovoServico').serialize();
$.ajax({
type:"POST",
data:dados,
url:"../Procedimentos/servicos/cadastrarServico.php",
success:function(r){
if(r==1){
$('#frmNovoServico')[0].reset();
alertify.success("Cadastro com Sucesso");
$('#tabelaServicosEntrada').load('servicos/tabelaServicosEntrada.php');
}else{
alertify.error("Não foi possível Cadastrar");
}
}
});
});
});
</script>
Which version of bootstrap you are using ?
– hugocsl
Version 4, but I removed the link from the Page. Code corrected above
– NCesar