This commit is contained in:
Flatlogic Bot 2026-04-07 22:52:15 +00:00
parent a5f381a658
commit c327468bd8

View File

@ -53,9 +53,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$mining_id = (int)$_POST['mining_id'];
$scan_value = (int)$_POST['scan_value'];
$max_occurrence = (int)$_POST['max_occurrence'];
$can_manual = isset($_POST['can_manual']) ? 1 : 0;
$can_land = isset($_POST['can_land']) ? 1 : 0;
$can_space = isset($_POST['can_space']) ? 1 : 0;
$stmt = $db->prepare("UPDATE tbl_scmining SET cl_scmining_scan_value = :scan, cl_scmining_max_occurrence = :occ WHERE cl_scmining_id = :id");
$stmt->execute(['scan' => $scan_value, 'occ' => $max_occurrence, 'id' => $mining_id]);
$stmt = $db->prepare("UPDATE tbl_scmining SET cl_scmining_scan_value = :scan, cl_scmining_max_occurrence = :occ, cl_scmining_can_manual = :manual, cl_scmining_can_land = :land, cl_scmining_can_space = :space WHERE cl_scmining_id = :id");
$stmt->execute([
'scan' => $scan_value,
'occ' => $max_occurrence,
'manual' => $can_manual,
'land' => $can_land,
'space' => $can_space,
'id' => $mining_id
]);
auth_flash_set('success', 'Valeurs mises à jour.');
header('Location: scmining.php');
@ -283,6 +293,26 @@ $current_session_user = $_SESSION['user'] ?? '';
.search-result-meta { display: block; font-size: 0.75rem; color: #888; }
.val-input { width: 100px; text-align: center; }
.recovery-options {
display: flex;
flex-direction: column;
gap: 2px;
font-size: 0.75rem;
text-align: left;
}
.recovery-options label {
display: flex;
align-items: center;
gap: 5px;
cursor: pointer;
color: #ccc;
}
.recovery-options label:hover { color: var(--primary); }
.recovery-options input[type="checkbox"] {
accent-color: var(--primary);
cursor: pointer;
}
</style>
</head>
<body>
@ -326,7 +356,6 @@ $current_session_user = $_SESSION['user'] ?? '';
<p style="text-align: center; color: #666;">Aucun objet non listé trouvé.</p>
<?php else: ?>
<?php foreach ($search_results as $res):
// Check if $res is an array and has the expected keys before accessing them
if (is_array($res) && isset($res['cl_scobjs_uuid']) && isset($res['cl_scobjs_name']) && isset($res['cl_scobjs_type']) && isset($res['cl_scobjs_subtype']) && isset($res['cl_scobjs_id'])) {
?>
<div class="search-result-item">
@ -359,6 +388,7 @@ $current_session_user = $_SESSION['user'] ?? '';
<tr>
<th style="width: 60px;">Aperçu</th>
<th>Nom / Type</th>
<th style="text-align: center;">Récupération</th>
<th style="text-align: center;">Valeur Scan</th>
<th style="text-align: center;">Max Occur.</th>
<th style="text-align: right;">Actions</th>
@ -366,10 +396,9 @@ $current_session_user = $_SESSION['user'] ?? '';
</thead>
<tbody>
<?php if (empty($mining_list)): ?>
<tr><td colspan="5" style="text-align: center; padding: 3rem; color: #666;">Aucun minéral configuré.</td></tr>
<tr><td colspan="6" style="text-align: center; padding: 3rem; color: #666;">Aucun minéral configuré.</td></tr>
<?php else: ?>
<?php foreach ($mining_list as $item):
// Check if $item is an array and has the expected keys before accessing them
if (is_array($item) && isset($item['cl_scobjs_uuid']) && isset($item['cl_scobjs_name']) && isset($item['cl_scobjs_type']) && isset($item['cl_scobjs_subtype']) && isset($item['cl_scmining_id']) && isset($item['cl_scmining_scan_value']) && isset($item['cl_scmining_max_occurrence'])) {
?>
<tr>
@ -384,6 +413,13 @@ $current_session_user = $_SESSION['user'] ?? '';
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrf_token); ?>">
<input type="hidden" name="action" value="update_mineral">
<input type="hidden" name="mining_id" value="<?php echo $item['cl_scmining_id']; ?>">
<td style="text-align: center;">
<div class="recovery-options">
<label><input type="checkbox" name="can_manual" <?php echo ($item['cl_scmining_can_manual'] ?? 0) ? 'checked' : ''; ?>> Manuel</label>
<label><input type="checkbox" name="can_land" <?php echo ($item['cl_scmining_can_land'] ?? 0) ? 'checked' : ''; ?>> Terrestre</label>
<label><input type="checkbox" name="can_space" <?php echo ($item['cl_scmining_can_space'] ?? 0) ? 'checked' : ''; ?>> Spatial</label>
</div>
</td>
<td style="text-align: center;">
<input type="number" name="scan_value" class="form-control val-input" required value="<?php echo $item['cl_scmining_scan_value']; ?>">
</td>
@ -413,4 +449,4 @@ $current_session_user = $_SESSION['user'] ?? '';
</div>
</div>
</body>
</html>
</html>