new commit and update
This commit is contained in:
@@ -9,23 +9,36 @@ $emailuser = $_SESSION['emailuser'];
|
||||
|
||||
// Query per ottenere gli immobili condivisi con l'utente loggato
|
||||
$sql = "
|
||||
SELECT
|
||||
hs.idhome,
|
||||
h.name,
|
||||
h.address,
|
||||
h.zip,
|
||||
h.city,
|
||||
h.country,
|
||||
hs.sharing_type,
|
||||
hs.expiration_date,
|
||||
au.first_name,
|
||||
au.last_name
|
||||
FROM home_sharing hs
|
||||
LEFT JOIN home h ON hs.idhome = h.idhome
|
||||
LEFT JOIN auth_users au ON hs.iduser = au.id
|
||||
WHERE
|
||||
(hs.idshareduser = ? OR hs.shared_email = ?)
|
||||
AND hs.status = 'accepted'
|
||||
SELECT
|
||||
hs.idhome,
|
||||
h.name,
|
||||
h.address,
|
||||
h.zip,
|
||||
h.city,
|
||||
h.country,
|
||||
hs.sharing_type,
|
||||
hs.expiration_date,
|
||||
au.first_name,
|
||||
au.last_name,
|
||||
COUNT(ho.owner_id) AS owner_count
|
||||
FROM home_sharing hs
|
||||
LEFT JOIN home h ON hs.idhome = h.idhome
|
||||
LEFT JOIN auth_users au ON hs.iduser = au.id
|
||||
LEFT JOIN home_owners ho ON hs.idhome = ho.home_id
|
||||
WHERE
|
||||
(hs.idshareduser = ? OR hs.shared_email = ?)
|
||||
AND hs.status = 'accepted'
|
||||
GROUP BY
|
||||
hs.idhome,
|
||||
h.name,
|
||||
h.address,
|
||||
h.zip,
|
||||
h.city,
|
||||
h.country,
|
||||
hs.sharing_type,
|
||||
hs.expiration_date,
|
||||
au.first_name,
|
||||
au.last_name;
|
||||
";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param('is', $iduserlogin, $emailuser);
|
||||
@@ -91,7 +104,7 @@ $result = $stmt->get_result();
|
||||
<th>Città</th>
|
||||
<th>Nazione</th>
|
||||
<th>Condiviso da</th>
|
||||
<th>Tipo Condivisione</th>
|
||||
<th>Proprietari</th>
|
||||
<th>Data Scadenza</th>
|
||||
<th>Azioni</th>
|
||||
</tr>
|
||||
@@ -105,16 +118,43 @@ $result = $stmt->get_result();
|
||||
<td><?php echo htmlspecialchars($row['city']); ?></td>
|
||||
<td><?php echo htmlspecialchars($row['country']); ?></td>
|
||||
<td><?php echo htmlspecialchars($row['first_name'] . ' ' . $row['last_name']); ?></td>
|
||||
<td><?php echo htmlspecialchars(ucfirst($row['sharing_type'])); ?></td>
|
||||
<td>
|
||||
<?php if ($row['owner_count'] == 0) { ?>
|
||||
<!-- Pulsante rosso per nessun proprietario -->
|
||||
<a href="assign-owners.php?idhome=<?php echo $row['idhome']; ?>&editpage=nochange" class="btn btn-danger btn-sm" title="Nessun Proprietario">
|
||||
<i class="fas fa-user-times"></i> <!-- Icona per nessun proprietario -->
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
<!-- Pulsante verde con il numero dei proprietari -->
|
||||
<a href="assign-owners.php?idhome=<?php echo $row['idhome']; ?>&editpage=nochange" class="btn btn-success btn-sm" title="<?php echo $row['owner_count']; ?> Proprietari">
|
||||
<i class="fas fa-user-check"></i> <!-- Icona per proprietari presenti -->
|
||||
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $row['expiration_date'] ? htmlspecialchars($row['expiration_date']) : 'Nessuna'; ?>
|
||||
</td>
|
||||
<td>
|
||||
<!-- Pulsante per modificare i dettagli della casa -->
|
||||
<a href="manage-home.php?idhome=<?php echo $row['idhome']; ?>" class="btn btn-info btn-sm" title="Dettagli">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
</a>
|
||||
<!-- Pulsante per visualizzare i dettagli -->
|
||||
<a href="documents-home-shared.php?idhome=<?php echo $row['idhome']; ?>" class="btn btn-primary btn-sm" title="Documenti">
|
||||
<i class="fas fa-folder-open"></i>
|
||||
</a>
|
||||
<!-- Pulsante per scaricare zip -->
|
||||
<a href="download-zip.php?idhome=<?php echo $row['idhome']; ?>" class="btn btn-warning btn-sm" title="Scarica ZIP">
|
||||
<i class="fas fa-file-archive"></i>
|
||||
</a>
|
||||
<!-- Pulsante per scaricare report -->
|
||||
<a href="download-report.php?idhome=<?php echo $row['idhome']; ?>" class="btn btn-danger btn-sm" title="Scarica Report">
|
||||
<i class="fas fa-file-alt"></i>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
@@ -122,6 +162,11 @@ $result = $stmt->get_result();
|
||||
</div><!-- end table-responsive -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<button onclick="history.back()" class="btn btn-dark">
|
||||
<i class="fas fa-arrow-left"></i> Torna indietro
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- container -->
|
||||
|
||||
Reference in New Issue
Block a user