<?php
include("../../../functions.inc.php");
checkLogin('adm');
include("../functions.inc.php");

dbConnect();
?>
<div>
    <div class="modal-d-title">Utente iscritto</div>
    <div class="modal-body modal-body-diag">    

		<?php if($user = get_users($_GET['id'])) : ?>
            <div class="form-group-inline form-horizontal">
                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="control-label">Nome</label>
                        <input class="form-control" type="text" maxlength="40" name="nome" value="<?php echo entities($user['user_nome']);?>" />
                    </div>
                    <div class="col-sm-6">
                        <label class="control-label">Cognome</label>
                        <input class="form-control" type="text" maxlength="40" name="cognome" value="<?php echo entities($user['user_cognome']);?>" />
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="control-label">Indirizzo di Residenza</label>
                        <input class="form-control" type="text" maxlength="40" name="indirizzo" value="<?php echo entities($user['user_ind']);?>" />
                    </div>
                    <div class="col-sm-6">
                        <label class="control-label">Provincia di Residenza</label>
                        <select data-live-search="true" name="provincia" onChange="selXmlPop('#sel_comune','comuni',this.value)">
                            <?php 
							print_province_opts($user['provincia_id']);
							?>
                        </select>
					</div>
                </div>
                
                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="control-label">Comune di Residenza</label>
                        <select data-live-search="true" name="comune" id="sel_comune">
                        	<option value=""></option>
                            <?php 
							print_comuni_opts($user['provincia_id'],$user['comune_id']);
							?>
                        </select>
                    </div>
                	<div class="col-sm-6">
                            <label class="control-label">Codice fiscale</label>
                            <input class="form-control" type="text" maxlength="16" name="codfis" value="<?php echo entities($user['user_codfis']);?>" />
                	</div>
                </div>
                
			
            	<!-- CI block -->
                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="control-label">N. Carta d'identit&agrave;</label>
                        <input class="form-control" type="text" maxlength="15" name="ci" value="<?php echo entities($user['user_ci']);?>" />
                    </div>
                    <div class="col-sm-6">
                    	<div class="row">
                            <label class="control-label col-sm-12">Rilasciata in data</label>
                            <div class="col-sm-6 col-md-5">
                                <input class="form-control" type="text" maxlength="10" name="ci_data" value="<?php echo date_ita($user['user_ci_data']);?>" />
                            </div>
                        </div>
                    </div>
                </div>
    
                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="control-label">Provincia rilascio</label>
                        <select name="ci_provincia" onChange="selXmlPop('#ci_comune','comuni',this.value)" data-live-search="true">
                            <option value=""></option>
                            <?php print_province_opts($user['user_ci_prov']) ;?>
                        </select>
                    </div>
                    <div class="col-sm-6">
                        <label class="control-label">Comune rilascio</label>
                        <select name="ci_comune" id="ci_comune" data-live-search="true">
                            <option value=""></option>
                            <?php print_comuni_opts($user['user_ci_prov'],$user['user_ci_com']) ;?>
                        </select>
                    </div>
                </div>
            
            
                <div class="form-group">
                    <div class="col-sm-6 has-feedback">
                        <label class="control-label">Indirizzo e-mail</label>
                        <div class="row">
                        	<div class="col-xs-12 has-feedback">
		                        <input class="form-control" type="text" maxlength="255" name="email" value="<?php echo entities($user['user_email']);?>" />
        		                <span class="glyphicon glyphicon-mail form-control-feedback"></span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6">
                    	<div class="row">
                            <label class="control-label col-sm-12">N. Cellulare</label>
                            <div class="col-sm-6 has-feedback">
                                <input class="form-control" type="text" maxlength="10" name="cellulare" value="<?php echo entities($user['user_cell']);?>" />
                            	<span class="glyphicon glyphicon-phone form-control-feedback"></span>
                            </div>
                        </div>
                    </div>
                </div>
			</div>   	
        <?php 
		else :
			printMsg("Non e' un tuo iscritto!","warning",false);
        
        endif 
		?>


    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Chiudi</button>
    </div>
    
</div>