<?php
 include_once('conexao.php');
 include_once('controller.php');
 include_once('funcao.php');
 include_once('DAO/DAOcliente.php');
 include_once('classes/cliente.php');
 
 $instance     = new funcao();
 $conn         = new Conexao();
 $cliente  = new DAOcliente();
 $z  = new cliente();
 //$encoding = mb_internal_encoding();
 
 if($_GET["acao"] == 'editar'){
	 $acao = 'atulizado';
	 $id_insercao = $_GET["cli_id"];
 }else{
	  $acao = 'gravado'; 
	  $result =  $cliente->ProximoId();
      foreach($result as $row){
		  $id_insercao = str_pad($row['PROXIMO_REGISTRO'],5,0,STR_PAD_LEFT);
	  }
 }

	
	if(!empty($_GET["cli_id"])){

		$result = $cliente->pesquisarcliente($_GET["cli_id"]);
		foreach($result as $row){

			$cli_id = $row["cli_id"]; 
			$cli_nm = $row["cli_nm"]; 			
			$cli_rg = $row["cli_rg"]; 			
			$cli_cpf = $row["cli_cpf"]; 			
			$cli_cnpj = $row["cli_cnpj"]; 			
			$cli_fone = $row["cli_fone"]; 	
			$cli_cel = $row["cli_cel"]; 			
			$cli_fax = $row["cli_fax"]; 
			$cli_email = $row["cli_email"]; 			
			$cli_cep = $row["cli_cep"]; 
			$cli_uf = $row["cli_uf"]; 
			$cli_cidade = $row["cli_cidade"]; 			
			$cli_end = $row["cli_end"]; 	
			$cli_bairro = $row["cli_bairro"]; 
			$cli_numero = $row["cli_numero"]; 			
			$cli_situacao_moradia = $row["cli_situacao_moradia"]; 			
			$cli_moradia = $row["cli_moradia"]; 			
			$cli_tempo_moradia = $row["cli_tempo_moradia"];		
			$cli_nm_conhecido1 = $row["cli_nm_conhecido1"]; 			
			$cli_cel_conh1 = $row["cli_cel_conh1"]; 			
			$cli_fone_conh1 = $row["cli_fone_conh1"]; 			
			$cli_nm_conhecido2 = $row["cli_nm_conhecido2"]; 
            $cli_cel_conh2 = $row["cli_cel_conh2"]; 			
			$cli_fone_conh2 = $row["cli_fone_conh2"];				
			$cli_conjugue = $row["cli_conjugue"];			
			$cli_rg_conj = $row["cli_rg_conj"];			
			$cli_oe_conj = $row["cli_oe_conj"];			
			$cli_cpf_conj = $row["cli_cpf_conj"];			
			$cli_pai = $row["cli_pai"];			
			$cli_mae = $row["cli_mae"];			
						
		}

	} 
	
	if (isset($_POST["cli_id"])) {
		
		$z->setCli_id($_GET["cli_id"]);
		$z->setCli_nm($_POST["cli_nm"]);
		$z->setCli_rg($_POST["cli_rg"]);
		$z->setCli_cpf($_POST["cli_cpf"]);
		$z->setCli_cnpj($_POST["cli_cnpj"]);
		$z->setCli_fone($_POST["cli_fone"]);
		$z->setCli_cel($_POST["cli_cel"]);
		$z->setCli_fax($_POST["cli_fax"]);
		$z->setCli_email($_POST["cli_email"]);
		$z->setCli_cep($_POST["cli_cep"]);
		$z->setCli_uf($_POST["cli_uf"]);
		$z->setCli_cidade($_POST["cli_cidade"]);
		$z->setCli_end($_POST["cli_end"]);
		$z->setCli_bairro($_POST["cli_bairro"]);
		$z->setCli_numero($_POST["cli_numero"]);
		$z->setCli_situacao_moradia($_POST["cli_situacao_moradia"]);
		$z->setCli_moradia($_POST["cli_moradia"]);
		$z->setCli_tempo_moradia($_POST["cli_tempo_moradia"]);
		$z->setCli_nm_conhecido1($_POST["cli_nm_conhecido1"]);
		$z->setCli_cel_conh1($_POST["cli_cel_conh1"]);
		$z->setCli_fone_conh1($_POST["cli_fone_conh1"]);
		$z->setCli_nm_conhecido2($_POST["cli_nm_conhecido2"]);
		$z->setCli_cel_conh2($_POST["cli_cel_conh2"]);
		$z->setCli_fone_conh2($_POST["cli_fone_conh2"]);
		$z->setCli_conjugue($_POST["cli_conjugue"]);
		$z->setCli_rg_conj($_POST["cli_rg_conj"]);
		$z->setCli_oe_conj($_POST["cli_oe_conj"]);
		$z->setCli_cpf_conj($_POST["cli_cpf_conj"]);
		$z->setCli_pai($_POST["cli_pai"]);
		$z->setCli_mae($_POST["cli_mae"]);
		$cliente->Atualizar($z);
		
		

		/*
		if ($cliente->Atualizar($z)){
			 $msg = "cliente Atualizado com Sucesso!";
		}else{
			$msg = "ERRO: ao cadastrar META!";
		}
			$instance->alerta("cliente Cadastrado com Sucesso!","view-cliente.php");
			*/
			$link_destino = $_POST['link_destino'];
			header("Location: $link_destino");

		
	}
?>
<!DOCTYPE html>
<html class="loading" lang="pt-br" data-textdirection="ltr">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
      <meta name="description" content="Micromaq Soluções em Impressão">
      <meta name="keywords" content="admin template, robust admin template, dashboard template, flat admin template, responsive admin template, web app, crypto dashboard, bitcoin dashboard">
      <!--<meta name="author" content="PIXINVENT">-->
      <title><?php include "titulo.php" ?></title>
      <link rel="apple-touch-icon" href="images/ico/apple-icon-120.png">
      <!--Favicon-->
      <link rel="icon" href="images/favicon.png">
      <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i%7CMuli:300,400,500,700" rel="stylesheet">
	  	
		<link rel="stylesheet" type="text/css" href="fonts/feather/style.min.css">
		<link rel="stylesheet" type="text/css" href="fonts/simple-line-icons/style.min.css">
		<link rel="stylesheet" type="text/css" href="fonts/flag-icon-css/css/flag-icon.min.css">
		<link rel="stylesheet" type="text/css" href="vendors/css/extensions/pace.css">
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
		
      <!-- BEGIN VENDOR CSS-->
      <link rel="stylesheet" href="assets/font-awesome-4.7.0/css/font-awesome.min.css">
	
	  
	  <!--<link rel="stylesheet" type="text/css" href="vendors/css/extensions/sweetalert.css">-->
     
	 <link rel="stylesheet" type="text/css" href="vendors/css/forms/selects/select2.min.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/forms/icheck/icheck.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/forms/icheck/custom.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/charts/morris.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/extensions/unslider.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/weather-icons/climacons.min.css">
      <!-- END VENDOR CSS-->
      <!-- BEGIN ROBUST CSS-->
      <link rel="stylesheet" type="text/css" href="css/app.min.css">
      <!-- END ROBUST CSS-->
      <!-- BEGIN Page Level CSS-->
      <link rel="stylesheet" type="text/css" href="css/core/menu/menu-types/horizontal-top-icon-menu.min.css">
      <link rel="stylesheet" type="text/css" href="css/core/colors/palette-climacon.css">
      <link rel="stylesheet" type="text/css" href="css/pages/users.min.css">
      <!-- END Page Level CSS-->
      <!-- BEGIN Custom CSS-->
      <link rel="stylesheet" type="text/css" href="assets/css/style.css">
      <!-- END Custom CSS-->
      <style>
         .card.card-fullscreen {
		display: block;
		z-index: 9999;
		position: fixed;
		width: 100% !important;
		height: 100% !important;
		top: 99px;
		right: 0;
		left: 0;
		bottom: 0;
		overflow: auto;
		}
		 
		 form .form-actions {
		 border-top: 1px solid #FFF;
		 padding: 1px 0;
		 margin-top: 20px;
		 }	
		 
		 @media screen and (max-width: 700px) {
			div.dt-buttons {
				float: none;
				width: 100%;
				text-align: center;
				margin-bottom: 3.5em;
			}	
}
		 
			 
      </style>
   </head>
   <body class="horizontal-layout horizontal-top-icon-menu 2-columns   menu-expanded" data-open="hover" data-menu="horizontal-menu" data-col="2-columns">
      <!-- Menu-->
      <?php include "menu.php" ?>
	  
	  
	   <?php
	   function selected( $value, $selected ){
			return $value==$selected ? ' selected="selected"' : '';
			}
	   ?>
   
      <!-- Horizontal navigation-->
      <div class="app-content content">
         <div class="content-wrapper">		
		   <div class="content-header row">
			  <div class="content-header-left col-md-6 col-12 mb-2">
				<h3 class="content-header-title"><i class="icon-note"></i>Cadastros</h3>
				<h5 class="content-header-title" style="margin-left: 7px;"><i class="ft-corner-down-right"></i><a href="view-lista-cliente.php" style="font-size: 12px;">Listar cliente</a></h5>
				<h5 class="content-header-title" style="margin-left: 17px;"><i class="ft-corner-down-right"></i><a href="view-cliente.php" style="font-size: 12px;">Cadastro de cliente</a></h5>      
			  </div>        
			</div>
			
       <div class="content-body">
               <!-- Basic form layout section start -->
               <section id="basic-form-layouts">
                  <div class="row justify-content-md-center">
                     <div class="col-md-8">
                        <div class="card" style="margin-top: -100px;">
                           <div class="card-header">
                              <h4 class="card-title" id="basic-layout-card-center">Cadastro de cliente</h4>
                              <a class="heading-elements-toggle"><i class="fa fa-ellipsis-v font-medium-3"></i></a>
                              <div class="heading-elements">
                                 <ul class="list-inline mb-0">
								 
								    <li><a href="view-lista-cliente.php"><i class="ft-eye" style="font-size: 19px;"></i>
									<li><a data-action="collapse"><i class="ft-minus" style="font-size: 19px;"></i></a></li>
									<li><a data-action="reload"><i class="ft-rotate-cw" style="font-size: 19px;"></i></a></li>
									<li><a data-action="expand"><i class="ft-maximize" style="font-size: 19px;"></i></a></li>
									<li><a data-action="close"><i class="ft-x" style="font-size: 19px;"></i></a></li>
                                 </ul>
                              </div>
                           </div>
                           <div class="card-content collapse show">
                              <div class="card-body">	

									<script>
									//FUNÇÃO QUE CHECA FOMRULÁRIO ANTES DE ENVIAR

										function check_form(destino){
											
											if(destino == '1'){
												$("#link_destino").val('view-cliente.php');
											}else{
												$("#link_destino").val('view-lista-cliente.php');
											};
											
											if(!$("#cli_nm").val()){
												Swal.fire({
												  icon: 'error',
												  title: 'Oops...',
												  text: 'Preencher todos os campos obrigatórios!'
												  });
												return false;
											}
											
											Swal.fire({
											  position: 'center',
											  icon: 'success',
											  title: 'cliente <?php echo $acao; ?> com sucesso!',
											  showConfirmButton: false,
											  timer: 1200
											});
											
											setTimeout(function(){ 
												document.getElementById("myForm").submit();
											}, 1200);
											
										}

									</script>		

								<div class="row">
								<div class="col-md-12">
			<div class="card">
				
				<div class="card-content">
					<div class="card-body">
						
						<ul class="nav nav-tabs nav-justified">
							<li class="nav-item">
							<a class="nav-link active" id="active-tab" data-toggle="tab" href="#active" aria-controls="active" aria-expanded="true">Principal</a>
							</li>
							<li class="nav-item">
								<a class="nav-link" id="link-tab" data-toggle="tab" href="#link" aria-controls="link" aria-expanded="false">Endereço</a>
							</li>
							
							<li class="nav-item">
								<a class="nav-link" id="linkOpt-tab" data-toggle="tab" href="#linkOpt" aria-controls="linkOpt">Referência</a>
							</li>
							
							<li class="nav-item">
								<a class="nav-link" id="linkPar-tab" data-toggle="tab" href="#linkPar" aria-controls="linkPar">Parentesco</a>
							</li>
							<li class="nav-item">
								<a class="nav-link" id="linkPar-tab" data-toggle="tab" href="#linkBan" aria-controls="linkPar">Dados Bancário</a>
							</li>
							
						</ul>
									
								<form id="myForm" method="post" enctype="multipart/form-data" style="line-height: 1.2;">
                                 <!--<form class="form" style="line-height: 1.2;">-->
                                    <div class="form-body">
                                       
									   
									   <div class="tab-content px-1 pt-1">
											<div role="tabpanel" class="tab-pane active" id="active" aria-labelledby="active-tab" aria-expanded="true">
								
										<div class="row">
									   
									   <!--INPUT SERVA PARA GRAVAR O LINK DE DESTINO DO LOCATION APOS INSERÇÃO-->
									   <input type="hidden" id="link_destino" name="link_destino" value="" >
									   								 
									   
									    <div class="col-md-2">
                                             <div class="form-group">
                                                <label for="Codigo">Código</label>												
                                                <input type="text" class="form-control" id="cli_id" name="cli_id" readonly value="<?php echo $id_insercao;?>" style="font-size: 12px;">
                                             </div>
                                          </div>
                                          <div class="col-md-10">
                                             <div class="form-group">
                                                <label for="Nome">Nome</label>
                                                <input type="text" class="form-control" id="cli_nm" name="cli_nm" value="<?php echo $cli_nm; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 									  
										  </div>
										  
										  <div class="row">									  
										   <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="cep">RG</label>
                                                <input type="text" class="form-control" id="cli_rg" name="cli_rg" value="<?php echo $cli_rg; ?>" style="font-size: 12px;" placeholder="">
                                             </div>
                                          </div> 
										  
										    <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">CPF</label>
                                                <input type="text" class="form-control cpf-inputmask" id="cli_cpf" name="cli_cpf" value="<?php echo $cli_cpf; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div>
										  
										  <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="cep">CNPJ</label>
                                                <input type="text" class="form-control cnpj-inputmask" id="cli_cnpj" name="cli_cnpj" value="<?php echo $cli_cnpj; ?>" style="font-size: 12px;" placeholder="">
                                             </div>
                                          </div>
										  
										    <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">Telefone</label>
                                                <input type="text" class="form-control phone-inputmask2" id="cli_fone" name="cli_fone" value="<?php echo $cli_fone; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
			                           </div>
									   
									    <div class="row">	      
									    <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">Celular</label>
                                                <input type="text" class="form-control phone-inputmask" id="cli_cel" name="cli_cel" value="<?php echo $cli_cel; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
										  
										  <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">Fax</label>
                                                <input type="text" class="form-control phone-inputmask" id="cli_fax" name="cli_fax" value="<?php echo $cli_fax; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
										  
										   <div class="col-md-6">
                                             <div class="form-group">
                                                <label for="Nome">E-mail</label>
                                                <input type="text" class="form-control" id="cli_email" name="cli_email" value="<?php echo $cli_email; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 						   
									   </div>							
									</div>
							
							
							
							<div class="tab-pane" id="link" role="tabpanel" aria-labelledby="link-tab" aria-expanded="false">							
									<div class="row">										 
										    <div class="col-md-2">
                                             <div class="form-group">
                                                <label for="cep">CEP</label>
                                                <input type="text" class="form-control cep-inputmask" id="cli_cep" name="cli_cep" value="<?php echo $cli_cep; ?>" style="font-size: 12px;" placeholder="">
                                             </div>
                                          </div> 
										  
										    <div class="col-md-4">
                                             <div class="form-group">
                                                <label for="cep">UF</label>
                                                <select name="cli_uf" id="cli_uf" class="form-control">
												<option value=""> --- Selecione a UF --- </option>
												<option value="AC"<?php echo selected('AC', $cli_uf); ?>>Acre</option>
												<option value="AL"<?php echo selected('AL', $cli_uf); ?>>Alagoas</option>
												<option value="AP"<?php echo selected('AP', $cli_uf); ?>>Amapá</option>
												<option value="AM"<?php echo selected('AM', $cli_uf); ?>>Amazonas</option>
												<option value="BA"<?php echo selected('BA', $cli_uf); ?>>Bahia</option>
												<option value="CE"<?php echo selected('CE', $cli_uf); ?>>Ceará</option>
												<option value="DF"<?php echo selected('DF', $cli_uf); ?>>Distrito Federal</option>
												<option value="ES"<?php echo selected('ES', $cli_uf); ?>>Espírito Santo</option>
												<option value="GO"<?php echo selected('GO', $cli_uf); ?>>Goiás</option>
												<option value="MA"<?php echo selected('MA', $cli_uf); ?>>Maranhão</option>
												<option value="MT"<?php echo selected('MT', $cli_uf); ?>>Mato Grosso</option>
												<option value="MS"<?php echo selected('MS', $cli_uf); ?>>Mato Grosso do Sul</option>
												<option value="MG"<?php echo selected('MG', $cli_uf); ?>>Minas Gerais</option>
												<option value="PA"<?php echo selected('PA', $cli_uf); ?>>Pará</option>
												<option value="PB"<?php echo selected('PB', $cli_uf); ?>>Paraíba</option>
												<option value="PR"<?php echo selected('PR', $cli_uf); ?>>Paraná</option>
												<option value="PE"<?php echo selected('PE', $cli_uf); ?>>Pernambuco</option>
												<option value="PI"<?php echo selected('PI', $cli_uf); ?>>Piauí</option>
												<option value="RJ"<?php echo selected('RJ', $cli_uf); ?>>Rio de Janeiro</option>
												<option value="RN"<?php echo selected('RN', $cli_uf); ?>>Rio Grande do Norte</option>
												<option value="RS"<?php echo selected('RS', $cli_uf); ?>>Rio Grande do Sul</option>
												<option value="RO"<?php echo selected('RO', $cli_uf); ?>>Rondônia</option>
												<option value="RR"<?php echo selected('RR', $cli_uf); ?>>Roraima</option>
												<option value="SC"<?php echo selected('SC', $cli_uf); ?>>Santa Catarina</option>
												<option value="SP"<?php echo selected('SP', $cli_uf); ?>>São Paulo</option>
												<option value="SE"<?php echo selected('SE', $cli_uf); ?>>Sergipe</option>
												<option value="TO"<?php echo selected('TO', $cli_uf); ?>>Tocantins</option>
											</select>  
                                             </div>
                                            </div> 
										   
										    <div class="col-md-6">
                                             <div class="form-group">
                                                <label for="Nome">Cidade</label>
                                                <input type="text" class="form-control" id="cli_cidade" name="cli_cidade" value="<?php echo $cli_cidade; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 										  
                                          </div> 
								
								
									  <div class="row">
									     <div class="col-md-5">
                                             <div class="form-group">
                                                <label for="Nome">Endereço</label>
                                                <input type="text" class="form-control" id="cli_end" name="cli_end" value="<?php echo $cli_end; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
										  
										    <div class="col-md-5">
                                             <div class="form-group">
                                                <label for="Nome">Bairro</label>
                                                <input type="text" class="form-control" id="cli_bairro" name="cli_bairro" value="<?php echo $cli_bairro; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
										 
										   <div class="col-md-2">
                                             <div class="form-group">
                                                <label for="Nome">Número</label>
                                                <input type="text" class="form-control" id="cli_numero" name="cli_numero" value="<?php echo $cli_numero; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
										</div>
										  
										<div class="row">									  
											<div class="col-md-4">
                                             <div class="form-group">
                                                <label>Moradia</label>
                                                <div class="form-group">
                                                   <select class="select form-control" id="cli_moradia" name="cli_moradia" value="<?php echo $cli_moradia; ?>" >
                                                      <optgroup label="">
                                                         <option value="">Selecione</option>
                                                         <option value="CASA"<?php echo selected( 'CASA', $cli_moradia); ?>>CASA</option>
                                                         <option value="APARTAMENTO"<?php echo selected( 'APARTAMENTO', $cli_moradia); ?>>APARTAMENTO</option>
                                                         <option value="OUTRA"<?php echo selected( 'OUTRA', $cli_moradia); ?>>OUTRA</option>
                                                      </optgroup>
                                                   </select>
                                                </div>
                                             </div>
                                          </div> 
										  
										    <div class="col-md-4">
                                             <div class="form-group">
                                                <label>Situação</label>
                                                <div class="form-group">
                                                   <select class="select form-control" id="cli_situacao_moradia" name="cli_situacao_moradia" value="<?php echo $cli_situacao_moradia; ?>">
                                                      <optgroup label="">
                                                         <option value="">Selecione</option>
                                                         <option value="PRÓPRIA"<?php echo selected( 'PRÓPRIA', $cli_situacao_moradia); ?>>PRÓPRIA</option>
                                                         <option value="ALUGADA"<?php echo selected( 'ALUGADA', $cli_situacao_moradia); ?>>ALUGADA</option>
                                                         <option value="OUTRA"<?php echo selected( 'OUTRA', $cli_situacao_moradia); ?>>OUTRA</option>
                                                      </optgroup>
                                                   </select>
                                                </div>
                                             </div>
                                          </div> 
										   
										   <div class="col-md-4">
                                             <div class="form-group">
                                                <label for="Nome">Tempo</label>
                                                <input type="text" class="form-control" id="cli_tempo_moradia" name="cli_tempo_moradia" value="<?php echo $cli_tempo_moradia; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
									  </div>
							</div>
						
							<div class="tab-pane" id="linkOpt" role="tabpanel" aria-labelledby="linkOpt-tab" aria-expanded="false">
								<div class="row">
								 <div class="col-md-6">
                                             <div class="form-group">
                                                <label for="Nome">Chonhecido 1</label>
                                                <input type="text" class="form-control" id="cli_nm_conhecido1" name="cli_nm_conhecido1" value="<?php echo $cli_nm_conhecido1; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
											   <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">Celular</label>
                                                <input type="text" class="form-control phone-inputmask" id="cli_cel_conh1" name="cli_cel_conh1" value="<?php echo $cli_cel_conh1; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
										  
										     <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">Telefone</label>
                                                <input type="text" class="form-control phone-inputmask" id="cli_fone_conh1" name="cli_fone_conh1" value="<?php echo $cli_fone_conh1; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
								
								</div>
								
									<div class="row">
								 <div class="col-md-6">
                                             <div class="form-group">
                                                <label for="Nome">Chonhecido 2</label>
                                                <input type="text" class="form-control" id="cli_nm_conhecido2" name="cli_nm_conhecido2" value="<?php echo $cli_nm_conhecido2; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
											   <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">Celular</label>
                                                <input type="text" class="form-control phone-inputmask" id="cli_cel_conh2" name="cli_cel_conh2" value="<?php echo $cli_cel_conh2; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
										  
										     <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">Telefone</label>
                                                <input type="text" class="form-control phone-inputmask" id="cli_fone_conh2" name="cli_fone_conh2" value="<?php echo $cli_fone_conh2; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
								
										  </div>
								
								</div>
								
								
								
								<div class="tab-pane" id="linkPar" role="tabpanel" aria-labelledby="linkPar-tab" aria-expanded="false">
								<div class="row">
								 <div class="col-md-12">
                                             <div class="form-group">
                                                <label for="Nome">Cônjugue</label>
                                                <input type="text" class="form-control" id="cli_conjugue" name="cli_conjugue" value="<?php echo $cli_conjugue; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
                                          </div> 
										  
										  <div class="row">
											   <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">RG</label>
                                                <input type="text" class="form-control" id="cli_rg_conj" name="cli_rg_conj" value="<?php echo $cli_rg_conj; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
										  
										   
										  
										  <div class="col-md-3">
                                             <div class="form-group">
                                                <label for="Nome">CPF</label>
                                                <input type="text" class="form-control cpf-inputmask" id="cli_cpf_conj" name="cli_cpf_conj" value="<?php echo $cli_cpf_conj; ?>" style="font-size: 12px;" placeholder="" >
                                             </div>
                                          </div> 
								
								</div>
								
									<div class="row">
								 <div class="col-md-6">
                                             <div class="form-group">
                                                <label for="Nome">Pai</label>
                                                <input type="text" class="form-control" id="cli_pai" name="cli_pai" value="<?php echo $cli_pai; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
											   <div class="col-md-6">
                                             <div class="form-group">
                                                <label for="Nome">Mãe</label>
                                                <input type="text" class="form-control" id="cli_mae" name="cli_mae" value="<?php echo $cli_mae; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
										  
										
								
										  </div>
								
								</div>
								
								
								
								<div class="tab-pane" id="linkBan" role="tabpanel" aria-labelledby="linkPar-tab" aria-expanded="false">
								<div class="row">
								 <div class="col-md-12">
                                             <div class="form-group">
                                                <label for="Nome">Geral</label>
                                                <input type="textarea" class="form-control" id="cli_oe_conj" name="cli_oe_conj" value="<?php echo $cli_oe_conj; ?>" style="font-size: 12px;" placeholder="" style="text-transform: uppercase;" onkeyup="maiuscula(this)" >
                                             </div>
                                          </div> 
                                          </div> 
										  
										  
								
								
								</div>
								
								
								
								
							</div>
						</div>
					</div>
					
					
					       <div class="form-actions center">
									

									 <?php if($acao == 'gravado'){ ?>
                                       <button onClick="check_form(1)" type="button" name="enviar_inc_novo" id="" class="btn btn-success">
                                       <i class="fa fa-check-square-o"></i> Salvar e Incluir Novo
                                       </button>
									 <?}?> 
									  
									   <button onClick="check_form(2)" type="button" name="enviar" id="" class="btn btn-success">
									   <i class="fa fa-check-square-o"></i> Salvar
									   </button>
									 
									   
									   <a href="view-lista-cliente.php">
                                       <button type="button" class="btn btn-danger mr-1">
                                       <i class="ft-x"></i> Cancelar
                                       </button>
									</a>
                                    </div>
									</form>
                              </div>
					
					
					
					
					
					
				</div>
			</div>
		</div>
		</div>
									   
									  									  					   						   
                          </div>
						  
						  
                             
                           </div>
                        </div>
                     </div>
                  </div>
               </section>
               <!-- // Basic form layout section end -->
            </div>
         </div>
      </div>
      </div>
      <!-- ////////////////////////////////////////////////////////////////////////////-->
      <?php include "footer.php" ?>
	  	  
	  <script src="js/sweetalert2@10.js"></script>
      <!-- BEGIN VENDOR JS-->
      <script src="vendors/js/vendors.min.js"></script>
      <!-- BEGIN VENDOR JS-->
      <!-- BEGIN PAGE VENDOR JS--> 
      <script src="vendors/js/ui/jquery.sticky.js"></script>
      <script src="vendors/js/charts/jquery.sparkline.min.js"></script>
	  <!--<script src="vendors/js/extensions/sweetalert.min.js"></script>-->
      <script src="vendors/js/forms/select/select2.full.min.js"></script>
      <!-- END PAGE VENDOR JS-->
      <!-- BEGIN ROBUST JS-->
      <script src="js/core/app-menu.min.js"></script>
      <script src="js/core/app.min.js"></script>
      <script src="js/scripts/customizer.min.js"></script>
      <!-- END ROBUST JS-->
      <!-- BEGIN PAGE LEVEL JS-->
      <script src="js/scripts/ui/breadcrumbs-with-stats.min.js"></script>
	  <script src="js/scripts/extensions/sweet-alerts.min.js"></script>
      <script src="js/scripts/forms/select/form-select2.min.js"></script>
	  <script src="js/scripts/navs/navs.min.js"></script>
      <!-- END PAGE LEVEL JS-->
	  <!--Máscara-->
	   <script src="vendors/js/forms/extended/inputmask/jquery.inputmask.bundle.min.js"></script>
	   <script src="js/scripts/forms/extended/form-inputmask.min.js"></script>
	   
	   
	   <!--<script src="js/jquery.3.2.1.min.js"></script>-->
	   
	   
   </body>
   <!-- Mirrored from pixinvent.com/bootstrap-admin-template/robust/html/ltr/horizontal-top-icon-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 12 Feb 2021 19:25:59 GMT -->
</html>
	
	  
	  <script>
	 // INICIO FUNÇÃO DE MASCARA MAIUSCULA
	function maiuscula(z){
		v = z.value.toUpperCase();
		z.value = v;
						 }
	//FIM DA FUNÇÃO MASCARA MAIUSCULA
	</script>
	
	<script>
	function limpa_formulario_cep() {
			//Limpa valores do formulário de cep.
			$("#cli_end").val("");
			$("#cli_bairro").val("");
			$("#cli_cidade").val("");
			$("#cli_uf").val("");
		}
		
		//Quando o campo cep perde o foco.
		$("#cli_cep").blur(function() {
			
			//alert('aqui');
	   
			//Nova variável "cep" somente com dígitos.
			var cep = $(this).val().replace(/\D/g, '');
		   
			//Verifica se campo cep possui valor informado.
			if (cep != "") {
		   
				//Expressão regular para validar o CEP.
				var validacep = /^[0-9]{8}$/;
		   
				//Valida o formato do CEP.
				if(validacep.test(cep)) {
		   
		   
					//Preenche os campos com "..." enquanto consulta webservice.
					$("#cli_end").val("...")
					$("#cli_bairro").val("...")
					$("#cli_cidade").val("...")
					$("#cli_uf").val("...")
				 
					
		   
					//Consulta o webservice viacep.com.br/
					$.getJSON("//viacep.com.br/ws/"+ cep +"/json/?callback=?", function(dados) {
		   
						if (!("erro" in dados)) {
							//Atualiza os campos com os valores da consulta.
							//alert(ados.ibge);
							$("#cli_end").val(dados.logradouro);
							$("#cli_bairro").val(dados.bairro);
							$("#cli_cidade").val(dados.localidade);
							$("#cli_uf").val(dados.uf);
							//$("#end_cidade1").val(dados.cliente);
							//$("#end_uf1").val(dados.uf);
							//$("#end_cid_id").val(dados.ibge);
							
							/**********************************************/
							
							//document.getElementById('enviar').disabled = false;  //habilita o botão salvar
							//$('#end_numero').focus();
							
						} //end if.
						else {
							//CEP pesquisado não foi encontrado.
							limpa_formulario_cep();
							//alert("CEP não encontrado.");
							alert("CEP não encontrado.");//Altera o nome da tag HTML5
							//$('#modal_numero').openModal();
							//document.getElementById('enviar').disabled = false;  //habilita o botão salvar
						
						}
					});
				} //end if.
				else {
					//cep é inválido.
					limpa_formulario_cep();
				 	alert("Formato de CEP inválido.");//Altera o nome da tag HTML5
				//	$('#modal_numero').openModal();
					//alert("Formato de CEP inválido.");
				}
			} 
			else {
				//cep sem valor, limpa formulário.
				limpa_formulario_cep();
			}
		});
	</script>
