Autosave: 20260225-173952
This commit is contained in:
parent
6e4209f588
commit
6c082f267d
@ -38,6 +38,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
$slot_num = (int)($_POST['slot_num'] ?? 0);
|
||||
$name = $_POST['name'] ?? 'Inconnu';
|
||||
$type = $_POST['type'] ?? 'empty';
|
||||
$manual_status = $_POST['manual_status'] ?? '';
|
||||
|
||||
// Orbital control is now detailed by faction
|
||||
$orbital_controls = $_POST['orbital_controls'] ?? [];
|
||||
@ -51,7 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
}
|
||||
|
||||
// Derive Status and Faction from Settlements
|
||||
$status = 'sta_empty';
|
||||
$status = 'sta_inhabited';
|
||||
$faction_id = null;
|
||||
$total_non_aucun = 0;
|
||||
$active_factions = [];
|
||||
@ -93,10 +94,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
}
|
||||
}
|
||||
} else if ($type !== 'empty') {
|
||||
$status = 'sta_empty';
|
||||
$status = 'sta_inhabited';
|
||||
$faction_id = null;
|
||||
}
|
||||
|
||||
// Manual status override
|
||||
if (!empty($manual_status)) {
|
||||
$status = $manual_status;
|
||||
}
|
||||
|
||||
if ($type === 'empty') {
|
||||
if ($slot_id > 0) {
|
||||
$db->prepare("DELETE FROM cities WHERE planet_id = ?")->execute([$slot_id]);
|
||||
@ -420,6 +426,11 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<?php if (isset($_GET["success"])): ?>
|
||||
<div style="background: rgba(163, 190, 140, 0.2); border: 1px solid #a3be8c; color: #a3be8c; padding: 15px; border-radius: 4px; margin-bottom: 20px; width: 100%; max-width: 840px; text-align: center;">
|
||||
<i class="fa-solid fa-circle-check"></i> Modifications enregistrées avec succès !
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($view === 'galaxy'): ?>
|
||||
<h3 style="color: #88c0d0; margin-bottom: 30px;">Navigateur de Galaxie</h3>
|
||||
<div class="sector-grid">
|
||||
@ -509,7 +520,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
<div style="display: flex; gap: 15px;">
|
||||
<div class="form-group" style="flex: 2;">
|
||||
<label>Nom de l'objet / Planète</label>
|
||||
<input type="text" name="name" id="form_name" placeholder="Ex: Terra Nova..." required>
|
||||
<input type="text" name="name" id="form_name" placeholder="Ex: Terra Nova...">
|
||||
</div>
|
||||
<div class="form-group" style="flex: 1;">
|
||||
<label>Type d'objet</label>
|
||||
@ -522,6 +533,16 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Statut (Automatique si non spécifié)</label>
|
||||
<select name="manual_status" id="form_status">
|
||||
<option value="">-- Automatique --</option>
|
||||
<?php foreach($statuses_db as $s): ?>
|
||||
<option value="<?php echo $s["slug"]; ?>"><?php echo $s["name"]; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Orbital Faction Control Section -->
|
||||
<div style="background: rgba(0,0,0,0.1); padding: 15px; border-radius: 6px; border: 1px solid #334155; margin-bottom: 20px;">
|
||||
<label style="font-size: 11px; color: #88c0d0; font-weight: bold; display: block; margin-bottom: 15px; text-align: center; border-bottom: 1px solid #334155; padding-bottom: 8px;">CONTRÔLE ORBITAL PAR FACTION (%)</label>
|
||||
@ -625,7 +646,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
|
||||
html += `<div class="compact-row">`;
|
||||
html += `<div class="form-group" style="flex: 2;"><label>Nom</label>`;
|
||||
html += `<input type="text" name="cities[${index}][name]" value="${data ? data.name : ''}" placeholder="Ex: New Hope" required></div>`;
|
||||
html += `<input type="text" name="cities[${index}][name]" value="${data ? data.name : ''}" placeholder="Ex: New Hope"></div>`;
|
||||
|
||||
html += `<div class="form-group" style="flex: 1;"><label>Type</label><select name="cities[${index}][type_id]">`;
|
||||
settlementTypes.forEach(t => {
|
||||
@ -738,6 +759,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
if (data) {
|
||||
document.getElementById('form_name').value = data.name;
|
||||
document.getElementById('form_type').value = data.type;
|
||||
document.getElementById('form_status').value = data.status;
|
||||
|
||||
// Load orbital sliders
|
||||
initOrbitalSliders(data.orbital_controls);
|
||||
@ -751,6 +773,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
} else {
|
||||
document.getElementById('form_name').value = '';
|
||||
document.getElementById('form_type').value = 'empty';
|
||||
document.getElementById('form_status').value = '';
|
||||
initOrbitalSliders(null);
|
||||
document.getElementById('settlementsContainer').innerHTML = '';
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user