<link rel="stylesheet" href="<?php echo base_url();?>assets/js/jquery-ui/css/smoothness/jquery-ui-1.9.2.custom.css" />
<script type="text/javascript" src="<?php echo base_url()?>assets/js/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script>
<script src="<?php echo base_url() ?>assets/js/dayjs.min.js"></script>

<script src="<?php echo base_url()?>assets/js/jquery.mask.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert2.all.min.js"></script>
<script src="<?php echo base_url()?>assets/js/funcoes.js"></script>
<style>
   /* Hiding the checkbox, but allowing it to be focused */
   .badgebox {
   opacity: 0;
   }
   .badgebox+.badge {
   /* Move the check mark away when unchecked */
   text-indent: -999999px;
   /* Makes the badge's width stay the same checked and unchecked */
   width: 27px;
   }
   .badgebox:focus+.badge {
   /* Set something to make the badge looks focused */
   /* This really depends on the application, in my case it was: */
   /* Adding a light border */
   box-shadow: inset 0px 0px 5px;
   /* Taking the difference out of the padding */
   }
   .badgebox:checked+.badge {
   /* Move the check mark back when checked */
   text-indent: 0;
   }
</style>
<div class="row-fluid" style="margin-top:0">
   <div class="span12">
      <div class="widget-box">
         <div class="widget-title">
            <span class="icon">
            <i class="fas fa-headphones"></i>
            </span>
            <h5>Cadastro de Funcionario</h5>
            <div class="buttons">
               <a title="Voltar" class="btn btn-mini btn-inverse" href="<?php echo site_url() ?>/funcionarios"><i class="fas fa-arrow-left"></i> Voltar</a>
            </div>
         </div>
         <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#home"><i class=" fas fa-list-alt"></i> Informações Pessoais</a></li>
            <li><a data-toggle="tab" href="#menu2"><i class=" fas fa-map-marker-alt"></i> Endereço</a></li>
			<li><a data-toggle="tab" href="#menu3"><i class=" fas fa-history"></i> Documentos</a></li>
			<li><a data-toggle="tab" href="#menu4"><i class=" fas fa-link"></i> Vínculos</a></li>
         </ul>
         <form action="<?php echo current_url(); ?>" id="formCliente" method="post" class="form-horizontal">
            <div class="widget-content nopadding tab-content">
               <?php if ($custom_error != '') {
                  echo '<div class="alert alert-danger">' . $custom_error . '</div>';
                  } ?>
               <div id="home" class="tab-pane fade in active">
                  
                  <div class="control-group">
                     <label for="nomeFuncionario" class="control-label">Nome/Sobrenome<span class="required">*</span></label>
                     <div class="controls">
                        <input id="nomeFuncionario" type="text" autocomplete="off" name="nomeFuncionario" value="<?php echo set_value('nomeFuncionario'); ?>" />
                     </div>
                  </div>
                  <div class="control-group">
                     <label for="contato" class="control-label">Nome Conhecido:</label>
                     <div class="controls">
                        <input class="nomeFuncionario" type="text" autocomplete="off" name="contato" value="<?php echo set_value('contato'); ?>" />
                     </div>
                  </div>
                  <div class="control-group">
                     <label for="telefone" class="control-label">Telefone</label>
                     <div class="controls">
                        <input id="telefone" type="text" autocomplete="off" name="telefone" value="<?php echo set_value('telefone'); ?>" />
                     </div>
                  </div>
                  <div class="control-group">
                     <label for="celular" class="control-label">Celular</label>
                     <div class="controls">
                        <input id="celular" type="text" autocomplete="off" name="celular" value="<?php echo set_value('celular'); ?>" />
                     </div>
                  </div>
                  <div class="control-group">
                     <label for="email" class="control-label">Email</label>
                     <div class="controls">
                        <input id="email" type="text" autocomplete="off" name="email" value="<?php echo set_value('email'); ?>" />
                     </div>
                  </div>
				 
                  <div class="control-group">
                     <label class="control-label">Ativo</label>
                     <div class="controls">
                        <label for="fornecedor" class="btn btn-default" style="margin-top: 5px;">Ativo
                        <input type="checkbox" id="fornecedor" name="fornecedor" class="badgebox" value="0">
                        <span class="badge">&check;</span>
                        </label>
                     </div>
                  </div>
                  <div class="form-actions">
                     <div class="span12">
                        <div class="span6 offset3">
                           <button type="submit" class="btn btn-success">Salvar</button>
                        </div>
                     </div>
                  </div>
               </div>
               <!-- Menu Endereços -->
               <div id="menu2" class="tab-pane fade">
                  <div class="control-group" class="control-label">
                     <label for="cep" class="control-label">CEP</label>
                     <div class="controls">
                        <input id="cep" type="text" autocomplete="off" name="cep" value="<?php echo set_value('cep'); ?>" />
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="rua" class="control-label">Rua</label>
                     <div class="controls">
                        <input id="rua" type="text" autocomplete="off" name="rua" value="<?php echo set_value('rua'); ?>" />
                     </div>
                  </div>
                  <div class="control-group">
                     <label for="numero" class="control-label">Número</label>
                     <div class="controls">
                        <input id="numero" type="text" autocomplete="off" name="numero" value="<?php echo set_value('numero'); ?>" />
                     </div>
                  </div>
                  <div class="control-group">
                     <label for="complemento" class="control-label">Complemento</label>
                     <div class="controls">
                        <input id="complemento" autocomplete="off" type="text" name="complemento" value="<?php echo set_value('complemento'); ?>" />
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="bairro" class="control-label">Bairro</label>
                     <div class="controls">
                        <input id="bairro" type="text" autocomplete="off" name="bairro" value="<?php echo set_value('bairro'); ?>" />
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="cidade" class="control-label">Cidade</label>
                     <div class="controls">
                        <input id="cidade" type="text" autocomplete="off" name="cidade" value="<?php echo set_value('cidade'); ?>" />
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="estado" class="control-label">Estado</label>
                     <div class="controls">
                        <select id="estado" name="estado">
                           <option value="">Selecione...</option>
                        </select>
                     </div>
                  </div>
                  <div class="form-actions">
                     <div class="span12">
                        <div class="span6 offset3">
                           <button type="submit" class="btn btn-success">Salvar</button>
                        </div>
                     </div>
                  </div>
			 </div>
			<!-- Menu Documentos -->
               <div id="menu3" class="tab-pane fade">
                  <div class="control-group">
                     <label for="cpf" class="control-label">CPF</label>
                     <div class="controls">
                        <input id="cpf" class="cpfcnpj" type="text" autocomplete="off" name="cpf" value="<?php echo set_value('cpf'); ?>"  />
                        
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="rg" class="control-label">RG</label>
                     <div class="controls">
                        <input id="rg" type="text" autocomplete="off" name="rg" value="<?php echo set_value('rg'); ?>" />
                     </div>
                  </div>
                  <div class="control-group">
                     <label for="cnh" class="control-label">CNH</label>
                     <div class="controls">
                        <input id="cnh" type="text" autocomplete="off" name="cnh" value="<?php echo set_value('cnh'); ?>" />
                     </div>
                  </div>
                  <div class="control-group">
                     <label for="carteiraTrabalho" class="control-label">Carteira de Trabalho</label>
                     <div class="controls">
                        <input id="carteiraTrabalho" type="text" autocomplete="off" name="carteiraTrabalho" value="<?php echo set_value('carteiraTrabalho'); ?>" />
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="dataNascimennto" class="control-label">Data de Nascimento</label>
                     <div class="controls">
                        
                        <input id="dataNascimennto" class="datepicker" autocomplete="off" type="text" name="dataNascimennto" value=""  />
					 </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="naturalidade" class="control-label">Naturalidade</label>
                     <div class="controls">
                        <input id="naturalidade" type="text" name="naturalidade" value="<?php echo set_value('naturalidade'); ?>" />
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="estadoNascimento" class="control-label">Estado</label>
                     <div class="controls">
                        <select id="estadoNascimento" name="estadoNascimento">
                           <option value="">Selecione...</option>
                        </select>
                     </div>
                  </div>
				  <div class="control-group" class="control-label">
                     <label for="nacionalidade" class="control-label">Nacionalidade</label>
                     <div class="controls">
                        <input id="nacionalidade" type="text" name="nacionalidade" value="<?php echo set_value('nacionalidade'); ?>" />
                     </div>
                  </div>
				 
                  <div class="form-actions">
                     <div class="span12">
                        <div class="span6 offset3">
                           <button type="submit" class="btn btn-success">Salvar</button>
                        </div>
                     </div>
                  </div>
				</div>
			 <!-- Vinculos -->
               <div id="menu4" class="tab-pane fade">
                   <div class="control-group" class="control-label">
                     <label for="cargo" class="control-label">Cargo</label>
                     <div class="controls">
                        <input id="cargo" type="text" autocomplete="off" name="cargo" value="<?php echo set_value('cargo'); ?>" />
                     </div>
                  </div>
				  <div class="control-group" class="control-label">
                     <label for="salario" class="control-label">Salario R$</label>
                     <div class="controls">
                        <input id="salario" type="text" autocomplete="off" name="salario" value="<?php echo set_value('salario'); ?>" />
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="dataAdmitido" class="control-label">Data de Admissão</label>
                     <div class="controls">
                        
                        <input id="dataAdmitido" class="datepicker" autocomplete="off" type="text" name="dataAdmitido" value=""  />
					 </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="dataDemitido" class="control-label">Data de Demissão</label>
                     <div class="controls">
                        
                        <input id="dataDemitido" class="datepicker" autocomplete="off" type="text" name="dataDemitido" value=""  />
					 </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="ultimoEmprego" class="control-label">Último Emprego</label>
                     <div class="controls">
                        <input id="ultimoEmprego" type="text" autocomplete="off" name="ultimoEmprego" value="<?php echo set_value('ultimoEmprego'); ?>" />
                     </div>
                  </div>
                  <div class="control-group" class="control-label">
                     <label for="ultimoSalario" class="control-label">Último Salario R$</label>
                     <div class="controls">
                        <input id="ultimoSalario" type="text" autocomplete="off" name="ultimoSalario" value="<?php echo set_value('ultimoSalario'); ?>" />
                     </div>
                  </div>
                 
                  <div class="form-actions">
                     <div class="span12">
                        <div class="span6 offset3">
                           <button type="submit" class="btn btn-success">Salvar</button>
                        </div>
                     </div>
                  </div>
			 </div>
         </form>
         
		 </div>
         </div>
      </div>
   </div>
</div>
<script src="<?php echo base_url() ?>assets/js/jquery.validate.js"></script>
<script type="text/javascript">
   $(document).ready(function() {
       $.getJSON('<?php echo base_url() ?>assets/json/estados.json', function(data) {
           for (i in data.estados) {
                  $('#estado').append(new Option(data.estados[i].nome, data.estados[i].sigla));
                  var curState = '<?php echo set_value('estado'); ?>';
                  if (curState) { $("#estado option[value=" + curState + "]").prop("selected",true); }
           }
       });
	   
	   $.getJSON('<?php echo base_url() ?>assets/json/estados.json', function(data) {
           for (i in data.estados) {
                  $('#estadoNascimento').append(new Option(data.estados[i].nome, data.estados[i].sigla));
                  var curState = '<?php echo set_value('estadoNascimento'); ?>';
                  if (curState) { $("#estadoNascimento option[value=" + curState + "]").prop("selected",true); }
           }
       });
	   
       $('#formCliente').validate({
           rules: {
               nomeFuncionario: {
                   required: true
               },
           },
           messages: {
               nomeFuncionario: {
                   required: 'Campo Requerido.'
               },
           },
   
           errorClass: "help-inline",
           errorElement: "span",
           highlight: function(element, errorClass, validClass) {
               $(element).parents('.control-group').addClass('error');
           },
           unhighlight: function(element, errorClass, validClass) {
               $(element).parents('.control-group').removeClass('error');
               $(element).parents('.control-group').addClass('success');
           }
       });
   });
   $(".datepicker" ).datepicker({ dateFormat: 'dd/mm/yy' });
   
</script>
