-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinfoUtente.html
138 lines (127 loc) · 6.75 KB
/
infoUtente.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>L.I.F.E | Info Utente</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Karantina:wght@400&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inder&display=swap">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Style nostri -->
<link rel="stylesheet" href="styles/general.css">
<link rel="stylesheet" href="styles/dashboard.css">
<link rel="stylesheet" href="styles/loginRegistrazione.css">
<!-- Scripts nostri -->
<script src="scripts/importHeaderNavbar.js"></script> <!-- Importa la Navbar e la Headbar -->
<script src="scripts/caricaJSON.js"></script>
<script src="scripts/utils.js"></script>
<script src="scripts/gestioneUtente.js"></script>
<script src="scripts/logout.js"></script>
</head>
<body>
<div class="container custom-container mt-5 px-md-5">
<!--TITOLO PAGINA -->
<div class="row mb-4 align-items-center mx-5">
<div class="col-12">
<h1 class="titoloPagina fw-bold">INFO UTENTE</h1>
</div>
<div class="col-12 text-right pb-1">
<button class="bottoneApriPannelloAggiungi bottonePersonalizzato px-4 py-1 mb-2 text-center fw-bold"
id="logoutBtn"><i class="bi bi-box-arrow-right me-2"></i> Logout</button>
</div>
</div>
<div class="row justify-content-center">
<div class="col-md-6">
<div class="container">
<form>
<div class="row">
<div class="col-md-6 mb-4">
<label for="nomeInput">Nome</label>
<input type="text" class="form-control formInput" id="nomeInput" placeholder="Nome"
aria-label="Nome">
</div>
<div class="col-md-6 mb-4">
<label for="cognomeInput">Cognome</label>
<input type="text" class="form-control formInput" id="cognomeInput"
placeholder="Cognome" aria-label="Cognome">
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<label for="etaInput">Età</label>
<input type="number" class="form-control formInput" id="etaInput" placeholder="Età"
aria-label="Età">
</div>
<div class="col-md-6 mb-4">
<label for="sessoInput">Sesso</label>
<select class="form-control formInput" id="sessoInput" aria-label="Sesso">
<option value="" disabled selected>Sesso</option>
<option value="M">Maschio</option>
<option value="F">Femmina</option>
<option value="ALTRO">Altro</option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<label for="altezzaInput">Altezza</label>
<input type="number" class="form-control formInput" id="altezzaInput"
placeholder="Altezza (cm)" aria-label="Altezza">
</div>
<div class="col-md-6 mb-4">
<label for="pwdInput">Password</label>
<input type="password" class="form-control formInput" id="pwdInput"
placeholder="Password" aria-label="Password">
</div>
</div>
<div class="row">
<div class="col-12 mb-4">
<label for="obbiettivoPassiInput">Obbiettivo Passi Giornalieri</label>
<input type="number" class="form-control formInput" id="obbiettivoPassiInput"
placeholder="Obbiettivo Passi Giornalieri" aria-label="obbiettivoPassiInput">
</div>
</div>
<div class="row mb-3">
<div class="col-md-12 text-center">
<button class="bottonePersonalizzato px-4 py-1 mb-1 text-center fw-bold fs-4 mt-3"
id="modificaInfoBtn">Modifica</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
<!-- Scripts nostri -->
<script src="scripts/logout.js"></script>
<script src="scripts/gestioneInfoUtente.js"></script>
<script>
let pathToJson = 'data/utenti.json';
// Carica il file JSON e mostra il form popolato
fetchJSONFile(pathToJson, function (data) {
let utenteCompleto = getUserSession(data, idSessione);
// Popola il form con i dati dell'utente
document.getElementById('nomeInput').value = utenteCompleto.nomeUtente;
document.getElementById('cognomeInput').value = utenteCompleto.cognomeUtente;
document.getElementById('etaInput').value = utenteCompleto.etaUtente;
document.getElementById('sessoInput').value = utenteCompleto.sessoUtente;
document.getElementById('altezzaInput').value = utenteCompleto.altezzaUtente;
document.getElementById('pwdInput').value = utenteCompleto.passwordUtente;
document.getElementById('obbiettivoPassiInput').value = utenteCompleto.obbiettivoPassi;
// Imposta il valore del campo sesso
let sessoInput = document.getElementById('sessoInput');
for (let i = 0; i < sessoInput.options.length; i++) {
if (sessoInput.options[i].value === utenteCompleto.sessoUtente) {
//console.log(sessoInput.options[i].value);
sessoInput.selectedIndex = i;
break;
}
}
});
userId = getIdSessione();
modificaInfoUtenteFormPHP();
</script>
</html>