added upload doc

This commit is contained in:
2024-09-20 21:21:35 +02:00
parent 31e76e40cf
commit d0698f2a6a
12 changed files with 486 additions and 15 deletions
+51 -4
View File
@@ -29,7 +29,7 @@ if (!$isNew) {
$postal_code = $ownerData['postal_code'];
$city = $ownerData['city'];
$province = $ownerData['province'];
$country = $ownerData['country'];
$country = $ownerData['country']; // ID della tabella auth_countries
$owner_type = $ownerData['owner_type'];
$role = $ownerData['role'];
} else {
@@ -37,6 +37,11 @@ if (!$isNew) {
$first_name = $last_name = $company_name = $tax_code = $email = $phone = $address = $postal_code = $city = $province = $country = $role = '';
$owner_type = 'individual';
}
// Recupera la lista dei paesi dalla tabella auth_countries
$countriesQuery = $conn->prepare("SELECT id, name FROM auth_countries ORDER BY name ASC");
$countriesQuery->execute();
$countriesResult = $countriesQuery->get_result();
?>
<!DOCTYPE html>
@@ -57,6 +62,13 @@ if (!$isNew) {
<!-- Custom CSS -->
<link href="assets/css/style.css" rel="stylesheet" type="text/css">
<!-- Select2 CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet" />
<!-- Select2 JS -->
</head>
<body class="fixed-left">
@@ -155,10 +167,16 @@ if (!$isNew) {
<input type="text" name="province" class="form-control" value="<?php echo htmlspecialchars($province); ?>">
</div>
<!-- Nazione -->
<!-- Nazione (Dropdown con valori da auth_countries) -->
<div class="form-group">
<label>Nazione</label>
<input type="text" name="country" class="form-control" value="<?php echo htmlspecialchars($country); ?>" readonly>
<select name="country" class="form-control">
<?php while ($row = $countriesResult->fetch_assoc()) { ?>
<option value="<?php echo $row['id']; ?>" <?php echo $country == $row['id'] ? 'selected' : ''; ?>>
<?php echo htmlspecialchars($row['name']); ?>
</option>
<?php } ?>
</select>
</div>
<!-- Ruolo -->
@@ -182,7 +200,7 @@ if (!$isNew) {
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
<script>
$(document).ready(function() {
function toggleOwnerFields() {
@@ -204,6 +222,35 @@ if (!$isNew) {
});
});
</script>
<script>
$(document).ready(function() {
// Inizializza Select2 per il campo country
$('select[name="country"]').select2({
placeholder: 'Seleziona una nazione',
allowClear: true
});
// Funzione per mostrare/nascondere i campi in base al tipo di proprietario
function toggleOwnerFields() {
if ($('#owner_type').val() === 'individual') {
$('.individual-field').show();
$('.company-field').hide();
} else {
$('.individual-field').hide();
$('.company-field').show();
}
}
// Inizializza la visualizzazione corretta dei campi
toggleOwnerFields();
// Cambia la visualizzazione dei campi quando cambia il tipo di proprietario
$('#owner_type').change(function() {
toggleOwnerFields();
});
});
</script>
</body>
</html>