

<div class="box">
	       <div class="box-body">
			<div class="panel panel-success">
			    
			    
			    
			    
			    
			    
			   
			    
			    
            <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-user"></i> Novo Mutuário</h3>
            </div>
             <div class="box-body">
               <!--  <form class="form-horizontal" method="post" enctype="multipart/form-data" action="">-->
               <!--      <div class="form-group">-->
                        
            			<!--	<div class="col-sm-10">-->
              	<!--	  			<h3>Inserir Varios Mutuarios</h3><br>-->
              	<!--	  			<p>Carregue uma planilha excel com o numero de campos equivalente a tabela na base de dados</p>-->
            			<!--	</div>-->
            			<!--</div>-->
               <!--       <div class="form-group">-->
                        
            			<!--	<div class="col-sm-10">-->
              	<!--	  			<input type='file' name="ficheiro" />-->
            			<!--	</div>-->
            			<!--</div>-->
            			<!--<div align="right">-->
               <!--           	<div class="box-footer">-->
               <!--             	<button type="reset" class="btn btn-primary btn-flat"><i class="fa fa-times">&nbsp;Reset</i></button>-->
               <!--             	<button name="saveExcel" type="submit" class="btn btn-success btn-flat"><i class="fa fa-save">&nbsp;Gravar</i></button>-->
            
               <!--          		 </div>-->
            			<!--  </div>-->
               <!-- </form>-->
            
			 <form class="form-horizontal" method="post" enctype="multipart/form-data" action="">
			  <?php echo '<div class="alert alert-info fade in" >
			  <a href = "#" class = "close" data-dismiss= "alert"> &times;</a>
  				<strong>Note que&nbsp;</strong> &nbsp;&nbsp;Os campos obrigatorios estao assinalados por <span style="color:red"> *</span>.
				</div>'?>
             <div class="box-body">
                 
<?php
if(isset($_POST['save']))
{
$fname =  mysqli_real_escape_string($link, $_POST['fname']);
$lname = mysqli_real_escape_string($link, $_POST['lname']);
$data_nascimento = mysqli_real_escape_string($link, $_POST['data_nascimento']);
$sexo = mysqli_real_escape_string($link, $_POST['sexo']);
$naturalidade = mysqli_real_escape_string($link, $_POST['naturalidade']);
$filiacao = mysqli_real_escape_string($link, $_POST['filiacao']);
$estado_civil = mysqli_real_escape_string($link, $_POST['estado_civil']);
$residencia = mysqli_real_escape_string($link, $_POST['residencia']);
$documento = mysqli_real_escape_string($link, $_POST['documento']);
$numero_documento = mysqli_real_escape_string($link, $_POST['numero_documento']);
$nuit = mysqli_real_escape_string($link, $_POST['nuit']);
$emissao = mysqli_real_escape_string($link, $_POST['emissao']);
$validade = mysqli_real_escape_string($link, $_POST['validade']);
$localEmit = mysqli_real_escape_string($link, $_POST['localEmit']);
$email = mysqli_real_escape_string($link, $_POST['email']);
$phone = mysqli_real_escape_string($link, $_POST['phone']);
$phone2 = mysqli_real_escape_string($link, $_POST['phone2']);
$distrito = mysqli_real_escape_string($link, $_POST['distrito']);
$state = mysqli_real_escape_string($link, $_POST['state']);
$zip = mysqli_real_escape_string($link, $_POST['zip']);
$country = mysqli_real_escape_string($link, $_POST['country']);
$beneficiario = mysqli_real_escape_string($link, $_POST['beneficiario']);
$membros = mysqli_real_escape_string($link, $_POST['membros']);
$comment = mysqli_real_escape_string($link, $_POST['comment']);
$account = mysqli_real_escape_string($link, $_POST['account']);
$status = "Pendente";

$insert;

$insert = mysqli_query($link, "INSERT INTO borrowers(fname, lname, data_nascimento, sexo, naturalidade, filiacao, estado_civil, residencia, documento, numero_documento, nuit, emissao, validade, localEmit, email, phone,contacto_alternativo,distrito, state, zip, country,beneficiario,membros, comment, account, balancE, image, date_time, status) VALUES('$fname','$lname', '$data_nascimento', '$sexo', '$naturalidade', '$filiacao', '$estado_civil', '$residencia', '$documento', '$numero_documento','$nuit', '$emissao', '$validade','$localEmit','$email','$phone','$phone2','$distrito','$state','$zip','$country','$beneficiario','$membros','$comment','$account','0.0','$location',NOW(),'$status')") or die (mysqli_error($link));
if(!$insert)
{
echo "<div class='alert alert-info'>impossivel inserir.....Por favor </div>";
}
else{
echo "<div class='alert alert-success'>Mutuario Criado Com Sucesso!</div>";
}
}
// }
?>		
			
<div class="alert-danger">&nbsp;DADOS PESSOAIS</div>
<hr>
			<div class="form-group">
                <label for="" class="col-sm-2 control-label" style="color:#009900">Numero de Conta</label>
            <div class="col-sm-10">
<?php
$account = '013'.rand(1000000,10000000);
?>
                  <input name="account" type="text" class="form-control" value="<?php echo $account; ?>" placeholder="Numero de Conta" readonly>
                  </div>
                  </div>
				  
			<div class="form-group">
			    
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Nome</label>
                  <div class="col-sm-10">
                      
                  <input name="fname" type="text" class="form-control" placeholder="Nome" required>
                  </div>
                  </div>
				  
		<div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Apelido</label>
                  <div class="col-sm-10">
                  <input name="lname" type="text" class="form-control" placeholder="Apelido" required>
                  </div>
                  </div>
				  <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Data de Nascimento</label>
                <div class="col-sm-10">
                  <input name="data_nascimento" type="date" class="form-control" placeholder="Data de Nascimento" required>
                </div>
            </div>
            <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Sexo</label>
                <div class="col-sm-10">
                  <select name="sexo" class="form-control" required>
                  	<option value="Masculino" selected="">Masculino</option>
                  	<option value="Femenino">Femenino</option>
                  </select>
                </div>
            </div>
			<div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Naturalidade</label>
                <div class="col-sm-10">
                  <input name="naturalidade" type="text" class="form-control" placeholder="Naturalidade" required>
                </div>
            </div>
            <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Filiação</label>
                <div class="col-sm-10">
                  <input name="filiacao" type="text" class="form-control" placeholder="Nomes do pai e da mae" required>
                </div>
            </div> 
             <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b>  Estado Civil</label>
                <div class="col-sm-10">
                  <select name="estado_civil" class="form-control" required>
                  	<option value="Solteiro/a" selected="">Solteiro/a</option>
                  	<option value="Casado/a">Casado/a</option>
                  	<option value="Divorciado/a">Divorciado/a</option>
					<option value="Viuvo/a">Viuvo/a</option>
                  </select>
                </div>
            </div>
            <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Local de Residência</label>
                <div class="col-sm-10">
                  <input name="residencia" type="text" class="form-control" placeholder="Residencia" required>
                </div>
            </div>
            
            <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Documento</label>
                <div class="col-sm-10">
                  <select name="documento" class="form-control" id="documento" required>
                      <option selected="">Selecione o documento</option>
                  	<option value="BI">BI</option>
                  	<option value="Carta de Conducao">Carta de Condução</option>
                  	<option value="Passaporte">Passaporte</option>
                  </select>
                </div>
            </div>
            <script>
                $(function(){
                   $("#documento").on('change', function(){
                      var a = $(this).val();
                      if(a == "BI"){
                          $("#numero_documento").attr("maxlength", "13");
                      }else{
                          $("#numero_documento").attr("maxlength", "9");
                      }
                   });
                });
            </script>
            <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Número do Documento</label>
                <div class="col-sm-10">
                  <input name="numero_documento" type="text" class="form-control" placeholder="Numero" required min="0" id="numero_documento">
                </div>
            </div>
           
            <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Data da Emissão</label>
                <div class="col-sm-10">
                  <input name="emissao" type="date" class="form-control" placeholder="Data da Emissao" required>
                </div>
            </div>
            <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Validade</label>
                <div class="col-sm-10">
                  <input name="validade" type="date" class="form-control" placeholder="Validade" required>
                </div>
            </div>
            <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Local de Emissão</label>
                <div class="col-sm-10">
                  <input name="localEmit" type="text" class="form-control" placeholder="Local de Emissao" required>
                </div>
            </div>  
             <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Nuit</label>
                <div class="col-sm-10">
                  <input name="nuit" type="text" class="form-control" placeholder="Nuit" required min="0" maxlength="9" onkeypress="return event.charCode >= 48 && event.charCode <= 57">
                </div>
            </div>
		<div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900">Email</label>
                  <div class="col-sm-10">
                  <input type="email" name="email" type="text" class="form-control" placeholder="Email">
                  </div>
                  </div>
				  
		<div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Telemóvel</label>
                  <div class="col-sm-10">
                  <input name="phone" type="number" maxlength="9" minlength="9" class="form-control" placeholder="Numero de Telemovel" required min="0">
                  </div>
                  </div>
                  <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900">Telemóvel Alternativo</label>
                  <div class="col-sm-10">
                  <input name="phone2" type="number" maxlength="9" minlength="9" class="form-control" placeholder="Numero de Telemovel Alternativo" min="0">
                  </div>
                  </div>
				  
	<hr>	
<div class="alert-danger">&nbsp;DADOS DE IMPLEMENTAÇÃO DO PROJECTO</div>
<hr>			
			
			<div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> País</label>
                <div class="col-sm-10">
				<select name="country"  class="form-control" required>
										<option value="">Selecione País&hellip;</option>
										<option value="AX">&#197;land Islands</option>
										<option value="BB">Barbados</option>
										<option value="BY">Belarus</option>
										<option value="MZ" selected='selected'>Moçambique</option>
										<option value="MM">Myanmar</option>
										<option value="NA">Namibia</option>
										<option value="NR">Nauru</option>
										<option value="NP">Nepal</option>
										<option value="NL">Netherlands</option>
										<option value="AN">Netherlands Antilles</option>
										<option value="NC">New Caledonia</option>
										<option value="NZ">New Zealand</option>
										<option value="NI">Nicaragua</option>
										<option value="NE">Niger</option>
										<option value="Nigeria">Nigeria</option>
										<option value="NU">Niue</option>
										<option value="NF">Norfolk Island</option>
										<option value="KP">North Korea</option>
										<option value="NO">Norway</option>
										<option value="OM">Oman</option>
										<option value="PK">Pakistan</option>
										<option value="PS">Palestinian Territory</option>
										<option value="PA">Panama</option>
										<option value="PG">Papua New Guinea</option>
										<option value="PY">Paraguay</option>
										<option value="PE">Peru</option>
										<option value="PH">Philippines</option>
										<option value="PN">Pitcairn</option>
										<option value="PL">Poland</option>
										<option value="PT">Portugal</option>
										<option value="QA">Qatar</option>
										<option value="IE">Republic of Ireland</option>
										<option value="RE">Reunion</option>
										<option value="RO">Romania</option>
										<option value="RU">Russia</option>
										<option value="RW">Rwanda</option>
										<option value="ST">S&atilde;o Tom&eacute; and Pr&iacute;ncipe</option>
										<option value="BL">Saint Barth&eacute;lemy</option>
										<option value="SH">Saint Helena</option>
										<option value="KN">Saint Kitts and Nevis</option>
										<option value="LC">Saint Lucia</option>
										<option value="SX">Saint Martin (Dutch part)</option>
										<option value="MF">Saint Martin (French part)</option>
										<option value="PM">Saint Pierre and Miquelon</option>
										<option value="VC">Saint Vincent and the Grenadines</option>
										<option value="SM">San Marino</option>
										<option value="SA">Saudi Arabia</option>
										<option value="SN">Senegal</option>
										<option value="RS">Serbia</option>
										<option value="SC">Seychelles</option>
										<option value="SL">Sierra Leone</option>
										<option value="SG">Singapore</option>
										<option value="SK">Slovakia</option>
										<option value="SI">Slovenia</option>
										<option value="SB">Solomon Islands</option>
										<option value="SO">Somalia</option>
										<option value="ZA">South Africa</option>
										<option value="GS">South Georgia/Sandwich Islands</option>
										<option value="KR">South Korea</option>
										<option value="SS">South Sudan</option>
										<option value="ES">Spain</option>
										<option value="LK">Sri Lanka</option>
										<option value="SD">Sudan</option>
										<option value="SR">Suriname</option>
										<option value="SJ">Svalbard and Jan Mayen</option>
										<option value="SZ">Swaziland</option>
										<option value="SE">Sweden</option>
										<option value="CH">Switzerland</option>
										<option value="SY">Syria</option>
										<option value="TW">Taiwan</option>
										<option value="TJ">Tajikistan</option>
										<option value="TZ">Tanzania</option>
										<option value="TH">Thailand</option>
										<option value="TL">Timor-Leste</option>
										<option value="TG">Togo</option>
										<option value="TK">Tokelau</option>
										<option value="TO">Tonga</option>
										<option value="TT">Trinidad and Tobago</option>
										<option value="TN">Tunisia</option>
										<option value="TR">Turkey</option>
										<option value="TM">Turkmenistan</option>
										<option value="TC">Turks and Caicos Islands</option>
										<option value="TV">Tuvalu</option>
										<option value="UG">Uganda</option>
										<option value="UA">Ukraine</option>
										<option value="AE">United Arab Emirates</option>
										<option value="GB">United Kingdom (UK)</option>
										<option value="US" >United States (US)</option>
										<option value="ZM">Zambia</option>
										<option value="ZW">Zimbabwe</option>
									</select>                 
									</div>
                </div>
                <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Provincia</label>
                  <div class="col-sm-10">
                 
                  <select name="state" class="form-control" id="state" required>
                  	<option selected="">Selecione a provincia</option>
                  	<option value="Tete">Tete</option>
                  	<option value="Niassa">Niassa</option>
                  	<option value="Cabo Delgado">Cabo Delgado</option>
                  	<option value="Nampula">Nampula</option>
                  	<option value="Zambezia">Zambezia</option>
                  	<option value="Manica">Manica</option>
                  	<option value="Sofala">Sofala</option>
                  	<option value="Gaza">Gaza</option>
                  	<option value="Inhambane">Inhambane</option>
                  	<option value="Maputo">Maputo</option>
                  </select>
                  </div>
                  </div>
				  <script>
				      $(function(){
				         $("#state").on('click', function(){
				            var a = $(this).val();
				            if(a == "Tete"){
				                $("#cod").val(2300);
				            }else if(a == "Niassa"){
				                $("#cod").val(3300);
				            }else if(a == "Cabo Delgado"){
				                $("#cod").val(3200);
				            }else if(a == "Nampula"){
				                $("#cod").val(3100);
				            }else if(a == "Zambezia"){
				                $("#cod").val(2400);
				            }else if(a == "Manica"){
				                $("#cod").val(2200);
				            }else if(a == "Sofala"){
				                $("#cod").val(2100);
				            }else if(a == "Gaza"){
				                $("#cod").val(1200);
				            }else if(a == "Inhambane"){
				                $("#cod").val(1300);
				            }else if(a == "Maputo"){
				                $("#cod").val(1100);
				            }
				         });
				      });
				  </script>
            <div class="form-group">
             <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Distrito/Cidade</label>
                <div class="col-sm-10">
                <input name="distrito" type="text" class="form-control" placeholder="Distrito" required>
             </div>
            </div>
				  <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900">Código Postal</label>
                  <div class="col-sm-10">
                  <input name="zip" type="number" id="cod" class="form-control" placeholder="Codigo Postal" readonly>
                  </div>
                  </div>
				  
		
									 
				<div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="color:#009900"><b style="color:red">*</b> Categoria de Beneficiario</label>
                <div class="col-sm-10">
                  <select name="beneficiario" class="form-control" required>
                  	<option value="Empreendedores" selected="">Empreendedores</option>
                  	<option value="Estudantes">Estudantes</option>
                  	<option value="MPMEs">MPMEs</option>
                  </select>
                </div>
                </div>					 
				<div class="form-group">
                  	<label for="" class="col-sm-2 control-label" style="color:#009900">Membros do Grupo (Opcional)</label>
                  	<div class="col-sm-10"><textarea name="membros"  class="form-control" rows="4" cols="80"></textarea></div>
          		</div>
          		<div class="form-group">
                  	<label for="" class="col-sm-2 control-label" style="color:#009900">Comentários</label>
                  	<div class="col-sm-10"><textarea name="comment"  class="form-control" rows="4" cols="80"></textarea></div>
          		</div>

			 </div>
            </div>					 
				

			 </div>
			 
			  <div align="right">
              	<div class="box-footer">
                	<button type="reset" class="btn btn-primary btn-flat"><i class="fa fa-times">&nbsp;Limpar</i></button>
                	<button name="save" type="submit" class="btn btn-success btn-flat"><i class="fa fa-save">&nbsp;Gravar</i></button>

             		 </div>
			  </div>

			 </form> 


</div>	
</div>	
</div>
</div>