Remove obsolete connection template context
This commit is contained in:
parent
1c230ce0d6
commit
5272956050
9 changed files with 423 additions and 229 deletions
|
|
@ -57,38 +57,47 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% set connection_direction = 'St Pancras → Paddington' if journey_type == 'inbound' else 'Paddington → St Pancras' %}
|
||||
{% if journey_type != 'return' %}
|
||||
<div class="filter-row">
|
||||
<div>
|
||||
<label for="min_conn_select" class="filter-label">Min connection:</label>
|
||||
<label for="min_conn_select" class="filter-label">Min connection ({{ connection_direction }}):</label>
|
||||
<select id="min_conn_select" onchange="applyConnectionFilter()" class="select-inline">
|
||||
{% for mins in valid_min_connections %}
|
||||
<option value="{{ mins }}" {% if mins == min_connection %}selected{% endif %}>{{ mins }} min</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="max_conn_select" class="filter-label">Max connection:</label>
|
||||
<select id="max_conn_select" onchange="applyConnectionFilter()" class="select-inline">
|
||||
{% for mins in valid_max_connections %}
|
||||
<option value="{{ mins }}" {% if mins == max_connection %}selected{% endif %}>{{ mins }} min</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if journey_type == 'return' %}
|
||||
{% for section in sections %}
|
||||
<div class="filter-row" style="margin-top:0.5rem">
|
||||
<div class="filter-row" style="margin-top:0.5rem;gap:0.75rem">
|
||||
<span class="filter-label" style="min-width:5.5rem">{{ 'Outbound' if section.direction == 'outbound' else 'Return' }}:</span>
|
||||
{% if section.direction == 'inbound' %}
|
||||
<div>
|
||||
<label for="min_conn_in_select" class="filter-label">Min connection:</label>
|
||||
<select id="min_conn_in_select" onchange="applyConnectionFilter()" class="select-inline">
|
||||
{% for mins in valid_inbound_return_min_connections %}
|
||||
<option value="{{ mins }}" {% if mins == inbound_min_connection %}selected{% endif %}>{{ mins }} min</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<span class="filter-label">ES:</span>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn-group-option {% if es_classes[section.id] == 'standard' %}active{% endif %}" data-section="{{ section.id }}" data-es-class="standard" onclick="setEsClass('standard', '{{ section.id }}')">Standard</button>
|
||||
<button type="button" class="btn-group-option {% if es_classes[section.id] == 'plus' %}active{% endif %}" data-section="{{ section.id }}" data-es-class="plus" onclick="setEsClass('plus', '{{ section.id }}')">Standard Premier</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{% if section.direction == 'inbound' %}
|
||||
<label for="min_conn_in_select" class="filter-label">Min connection:</label>
|
||||
<select id="min_conn_in_select" onchange="applyConnectionFilter()" class="select-inline">
|
||||
{% for mins in valid_inbound_return_min_connections %}
|
||||
<option value="{{ mins }}" {% if mins == inbound_min_connection %}selected{% endif %}>{{ mins }} min</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% else %}
|
||||
<label for="min_conn_select" class="filter-label">Min connection:</label>
|
||||
<select id="min_conn_select" onchange="applyConnectionFilter()" class="select-inline">
|
||||
{% for mins in valid_min_connections %}
|
||||
<option value="{{ mins }}" {% if mins == min_connection %}selected{% endif %}>{{ mins }} min</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div>
|
||||
<span class="filter-label">NR:</span>
|
||||
<div class="btn-group">
|
||||
|
|
@ -97,13 +106,6 @@
|
|||
<button type="button" class="btn-group-option {% if nr_classes[section.id] == 'advance_1st' %}active{% endif %}" data-section="{{ section.id }}" data-nr-class="advance_1st" onclick="setNrClass('advance_1st', '{{ section.id }}')">Advance 1st</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span class="filter-label">Eurostar:</span>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn-group-option {% if es_classes[section.id] == 'standard' %}active{% endif %}" data-section="{{ section.id }}" data-es-class="standard" onclick="setEsClass('standard', '{{ section.id }}')">Standard</button>
|
||||
<button type="button" class="btn-group-option {% if es_classes[section.id] == 'plus' %}active{% endif %}" data-section="{{ section.id }}" data-es-class="plus" onclick="setEsClass('plus', '{{ section.id }}')">Standard Premier</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div style="font-size:0.82rem;color:#718096;margin-top:0.4rem">
|
||||
|
|
@ -126,7 +128,7 @@
|
|||
<span id="advance-loading" style="display:none"><span class="spinner spinner-inline" aria-hidden="true"></span>Loading advance fares</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="filter-label">Eurostar:</span>
|
||||
<span class="filter-label">ES:</span>
|
||||
<span id="es-type-select" style="display:none"></span>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn-group-option {% if es_classes[section.id] == 'standard' %}active{% endif %}" data-section="{{ section.id }}" data-es-class="standard" onclick="setEsClass('standard', '{{ section.id }}')">Standard</button>
|
||||
|
|
@ -136,26 +138,25 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
<script>
|
||||
const RESULTS_BASE = '{{ results_base_url }}';
|
||||
const DEFAULT_MIN_CONN = {{ default_min_connection }};
|
||||
const DEFAULT_MAX_CONN = {{ default_max_connection }};
|
||||
const DEFAULT_MIN_CONN_IN = {{ default_inbound_min_connection }};
|
||||
let TRIP_FARES = {};
|
||||
let ADVANCE_FARES = null;
|
||||
let WALKON_CACHED_FARES = {};
|
||||
let WALKON_API_URLS = {};
|
||||
let ADVANCE_API_URLS = {};
|
||||
let ADVANCE_STREAM_URLS = {};
|
||||
let TIMETABLE_REFRESH_URL = null;
|
||||
let HAS_PROVISIONAL_TIMETABLE = false;
|
||||
let eurostarRefreshPending = false;
|
||||
let cachedAdvanceFares = null;
|
||||
let currentNrClasses = {{ nr_classes_json | safe }};
|
||||
let currentEsClasses = {{ es_classes_json | safe }};
|
||||
const SECTION_DIRECTIONS = {{ section_directions_json | safe }};
|
||||
let advanceLoadingSections = {};
|
||||
let walkonLoadingSections = {};
|
||||
let selectedRowKeys = {};
|
||||
var RESULTS_BASE = '{{ results_base_url }}';
|
||||
var DEFAULT_MIN_CONN = {{ default_min_connection }};
|
||||
var DEFAULT_MIN_CONN_IN = {{ default_inbound_min_connection }};
|
||||
var TRIP_FARES = {};
|
||||
var ADVANCE_FARES = null;
|
||||
var WALKON_CACHED_FARES = {};
|
||||
var WALKON_API_URLS = {};
|
||||
var ADVANCE_API_URLS = {};
|
||||
var ADVANCE_STREAM_URLS = {};
|
||||
var TIMETABLE_REFRESH_URL = null;
|
||||
var HAS_PROVISIONAL_TIMETABLE = false;
|
||||
var eurostarRefreshPending = false;
|
||||
var cachedAdvanceFares = null;
|
||||
var currentNrClasses = {{ nr_classes_json | safe }};
|
||||
var currentEsClasses = {{ es_classes_json | safe }};
|
||||
var SECTION_DIRECTIONS = {{ section_directions_json | safe }};
|
||||
var advanceLoadingSections = {};
|
||||
var walkonLoadingSections = {};
|
||||
var selectedRowKeys = {};
|
||||
|
||||
function updateAdvanceLoadingStatus() {
|
||||
var loading = Object.keys(advanceLoadingSections).some(function(sectionId) {
|
||||
|
|
@ -167,10 +168,8 @@
|
|||
|
||||
function buildUrl() {
|
||||
var min = parseInt(document.getElementById('min_conn_select').value);
|
||||
var max = parseInt(document.getElementById('max_conn_select').value);
|
||||
var params = [];
|
||||
if (min !== DEFAULT_MIN_CONN) params.push('min_connection=' + min);
|
||||
if (max !== DEFAULT_MAX_CONN) params.push('max_connection=' + max);
|
||||
var minInEl = document.getElementById('min_conn_in_select');
|
||||
if (minInEl) {
|
||||
var minIn = parseInt(minInEl.value);
|
||||
|
|
@ -260,10 +259,19 @@
|
|||
for (var rowKey in TRIP_FARES) {
|
||||
var row = TRIP_FARES[rowKey];
|
||||
if (rowKey !== key && row.eurostar_key !== key) continue;
|
||||
if (prices[key].es_standard) row.es_standard = prices[key].es_standard;
|
||||
if (prices[key].es_standard_status !== undefined) row.es_standard_status = prices[key].es_standard_status;
|
||||
if (prices[key].es_plus) row.es_plus = prices[key].es_plus;
|
||||
if (prices[key].es_plus_status !== undefined) row.es_plus_status = prices[key].es_plus_status;
|
||||
var price = prices[key];
|
||||
if (price.es_standard) {
|
||||
row.es_standard = price.es_standard;
|
||||
row.es_standard_status = price.es_standard_status;
|
||||
} else if (!row.es_standard && price.es_standard_status !== undefined) {
|
||||
row.es_standard_status = price.es_standard_status;
|
||||
}
|
||||
if (price.es_plus) {
|
||||
row.es_plus = price.es_plus;
|
||||
row.es_plus_status = price.es_plus_status;
|
||||
} else if (!row.es_plus && price.es_plus_status !== undefined) {
|
||||
row.es_plus_status = price.es_plus_status;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -450,7 +458,7 @@
|
|||
totalSpan.innerHTML = '';
|
||||
} else if (!nrFare) {
|
||||
totalSpan.innerHTML = '<span class="text-xs text-muted" title="National Rail fare data is not available for this service">NR fare not available</span>';
|
||||
} else if (eurostarRefreshPending) {
|
||||
} else if (eurostarRefreshPending && !row.es_standard_status && !row.es_plus_status) {
|
||||
totalSpan.innerHTML = '<span class="text-xs text-muted" title="Checking exact Eurostar data for this service">Checking Eurostar price</span>';
|
||||
} else {
|
||||
totalSpan.innerHTML = '<span class="text-xs text-muted" title="' + eurostarMissingTitle(row, esClass) + ' Check eurostar.com.">' + eurostarMissingText(row, esClass) + '</span>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue