Remove obsolete connection template context
This commit is contained in:
parent
1c230ce0d6
commit
5272956050
9 changed files with 423 additions and 229 deletions
|
|
@ -1,6 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<style>
|
||||
.form-row[hidden] { display: none !important; }
|
||||
|
||||
/* ── Calendar ───────────────────────────────────────────────────── */
|
||||
.cal-wrap { margin-top: .5rem; }
|
||||
|
||||
|
|
@ -127,10 +129,10 @@
|
|||
<input type="hidden" id="return_date" name="">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-row" id="outbound-connection-fields">
|
||||
<div class="form-group">
|
||||
<label for="min_connection" class="field-label">
|
||||
Minimum connection time (Paddington → St Pancras)
|
||||
Minimum outbound connection (Paddington → St Pancras)
|
||||
</label>
|
||||
<select id="min_connection" name="min_connection" class="form-control">
|
||||
{% for mins in valid_min_connections %}
|
||||
|
|
@ -138,14 +140,29 @@
|
|||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="back-connection-fields" hidden>
|
||||
<div class="form-group">
|
||||
<label for="max_connection" class="field-label">
|
||||
Maximum connection time (Paddington → St Pancras)
|
||||
<label for="min_connection_back" class="field-label">
|
||||
Minimum back connection (St Pancras → Paddington)
|
||||
</label>
|
||||
<select id="max_connection" name="max_connection" class="form-control">
|
||||
{% for mins in valid_max_connections %}
|
||||
<option value="{{ mins }}" {% if mins == default_max_connection %}selected{% endif %}>{{ mins }} min</option>
|
||||
<select id="min_connection_back" class="form-control" disabled>
|
||||
{% for mins in valid_inbound_min_connections %}
|
||||
<option value="{{ mins }}" {% if mins == default_inbound_min_connection %}selected{% endif %}>{{ mins }} min</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="return-connection-fields" hidden>
|
||||
<div class="form-group">
|
||||
<label for="min_connection_in" class="field-label">
|
||||
Minimum return-leg connection (St Pancras → Paddington)
|
||||
</label>
|
||||
<select id="min_connection_in" class="form-control" disabled>
|
||||
{% for mins in valid_inbound_return_min_connections %}
|
||||
<option value="{{ mins }}" {% if mins == default_inbound_min_connection %}selected{% endif %}>{{ mins }} min</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -207,6 +224,28 @@
|
|||
}
|
||||
}
|
||||
|
||||
function setConnectionSelect(id, enabled, name) {
|
||||
var el = document.getElementById(id);
|
||||
if (!el) return;
|
||||
el.disabled = !enabled;
|
||||
el.name = enabled ? name : '';
|
||||
}
|
||||
|
||||
function syncConnectionFields() {
|
||||
var selected = document.querySelector('input[name="journey_type"]:checked');
|
||||
var journeyType = selected ? selected.value : 'outbound';
|
||||
var isBack = journeyType === 'inbound';
|
||||
var isRet = journeyType === 'return';
|
||||
|
||||
document.getElementById('outbound-connection-fields').hidden = isBack;
|
||||
document.getElementById('back-connection-fields').hidden = !isBack;
|
||||
document.getElementById('return-connection-fields').hidden = !isRet;
|
||||
|
||||
setConnectionSelect('min_connection', !isBack, 'min_connection');
|
||||
setConnectionSelect('min_connection_back', isBack, 'min_connection_back');
|
||||
setConnectionSelect('min_connection_in', isRet, 'min_connection_in');
|
||||
}
|
||||
|
||||
/* ── day click ───────────────────────────────────────────────────── */
|
||||
|
||||
function onDayClick(d) {
|
||||
|
|
@ -448,6 +487,7 @@
|
|||
retPhase = false;
|
||||
}
|
||||
syncInputs();
|
||||
syncConnectionFields();
|
||||
render();
|
||||
});
|
||||
});
|
||||
|
|
@ -475,6 +515,7 @@
|
|||
retPhase = isReturn && outDate !== null;
|
||||
|
||||
syncInputs();
|
||||
syncConnectionFields();
|
||||
render();
|
||||
}());
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue