first upload
This commit is contained in:
131
view_territory.php
Normal file
131
view_territory.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* Visualizzazione Territorio tramite Link Temporaneo
|
||||
* Territory Manager
|
||||
*/
|
||||
|
||||
require_once 'config.php';
|
||||
require_once 'db.php';
|
||||
|
||||
$token = $_GET['token'] ?? '';
|
||||
$db = getDB();
|
||||
|
||||
if (empty($token)) {
|
||||
die('Link non valido');
|
||||
}
|
||||
|
||||
// Recupera l'assegnazione
|
||||
$assignment = $db->fetchOne("
|
||||
SELECT
|
||||
a.*,
|
||||
t.numero,
|
||||
t.zona,
|
||||
t.tipologia,
|
||||
t.image_path,
|
||||
t.note as territory_note
|
||||
FROM assignments a
|
||||
INNER JOIN territories t ON a.territory_id = t.id
|
||||
WHERE a.link_token = ?
|
||||
", [$token]);
|
||||
|
||||
if (!$assignment) {
|
||||
die('Link non valido o scaduto');
|
||||
}
|
||||
|
||||
// Verifica scadenza
|
||||
if (strtotime($assignment['link_expires_at']) < time()) {
|
||||
$expired = true;
|
||||
} else {
|
||||
$expired = false;
|
||||
}
|
||||
|
||||
function formatDate($date) {
|
||||
if (empty($date)) return '-';
|
||||
return date('d/m/Y', strtotime($date));
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Territorio <?php echo htmlspecialchars($assignment['numero']); ?> - <?php echo APP_NAME; ?></title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body class="public-page">
|
||||
<div class="container">
|
||||
<?php if ($expired): ?>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>Link Scaduto</h1>
|
||||
<p class="alert alert-error">
|
||||
Questo link è scaduto il <?php echo formatDate($assignment['link_expires_at']); ?>.
|
||||
Contatta l'amministratore per ottenere un nuovo link.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="page-header">
|
||||
<h1>Territorio: <?php echo htmlspecialchars($assignment['numero']); ?></h1>
|
||||
<p class="subtitle">Visualizzazione Territorio</p>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Informazioni Territorio</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="detail-grid">
|
||||
<div class="detail-item">
|
||||
<strong>Numero:</strong> <?php echo htmlspecialchars($assignment['numero']); ?>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<strong>Zona:</strong> <?php echo htmlspecialchars($assignment['zona']); ?>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<strong>Tipologia:</strong> <?php echo htmlspecialchars($assignment['tipologia']); ?>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<strong>Assegnato a:</strong> <?php echo htmlspecialchars($assignment['assigned_to']); ?>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<strong>Data Assegnazione:</strong> <?php echo formatDate($assignment['assigned_date']); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($assignment['territory_note']): ?>
|
||||
<div class="detail-item" style="margin-top: 20px;">
|
||||
<strong>Note:</strong>
|
||||
<p><?php echo nl2br(htmlspecialchars($assignment['territory_note'])); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($assignment['image_path']): ?>
|
||||
<div class="detail-item" style="margin-top: 20px;">
|
||||
<strong>Piantina:</strong><br>
|
||||
<a href="<?php echo htmlspecialchars($assignment['image_path']); ?>" target="_blank">
|
||||
<img src="<?php echo htmlspecialchars($assignment['image_path']); ?>"
|
||||
alt="Piantina Territorio"
|
||||
style="max-width: 100%; margin-top: 10px; border: 1px solid #ddd;">
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<p class="help-text">
|
||||
<strong>Nota:</strong> Questo link è valido fino al
|
||||
<?php echo date('d/m/Y H:i', strtotime($assignment['link_expires_at'])); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="footer" style="margin-top: 40px; text-align: center;">
|
||||
<p>© <?php echo date('Y'); ?> <?php echo APP_NAME; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user