add train type information to journeyView

This commit is contained in:
Milan Pässler 2020-09-11 18:50:19 +02:00
parent 1c9fde6bfd
commit 1d5b4f2f7c
2 changed files with 37 additions and 3 deletions

View file

@ -65,11 +65,32 @@ const legTemplate = (element) => {
<thead>
<tr>
<td colspan="4">
<span>${element.line.name} ${element.line.additionalName ? '('+element.line.additionalName+')' : ''} ${element.direction} ${element.cancelled ? html`<b class="cancelled-text">${t('cancelled-ride')}</b>` : ''}
<span>${element.line.name}
${element.direction}
${element.cancelled ? html`<b class="cancelled-text">${t('cancelled-ride')}</b>` : ''}
${Object.entries(remarks).map(remarksTemplate)}
${travelynxTemplate(element)}</span>
</td>
</tr>
<tr>
<td colspan="4">
<div class="train-details">
${element.line.additionalName ? html`
<div class="train-detail">
Trip: ${element.line.additionalName}
</div>
` : ''}
${element.line.trainType ? html`
<div class="train-detail">
Train type: ${element.line.trainType}
</div>
` : ''}
<div class="train-detail">
Duration: ${formatDuration((element.arrival.prognosedTime || element.arrival.plannedTime) - (element.departure.prognosedTime || element.departure.plannedTime))}
</div>
</div>
</td>
</tr>
<tr>
<th>${t('arrival')}</th>
<th>${t('departure')}</th>
@ -97,8 +118,8 @@ const journeyTemplate = (data, requestId, journeyId) => {
const departure = data.legs[0].departure;
const arrival = data.legs[data.legs.length - 1].arrival;
const departureTime = departure.prognosedTime ? departure.prognosedTime : departure.plannedTime;
const arrivalTime = arrival.prognosedTime ? arrival.prognosedTime : arrival.plannedTime;
const departureTime = departure.prognosedTime || departure.plannedTime;
const arrivalTime = arrival.prognosedTime || arrival.plannedTime;
const duration = arrivalTime - departureTime;
const legs = [];

View file

@ -957,3 +957,16 @@ form>div.history {
header h3 {
margin-right: 1.5em;
}
.train-details {
display: flex;
justify-content: center;
}
.journey thead>tr:nth-child(2) {
border-bottom: 2px solid #ccc;
}
.train-detail {
margin: .4em 2em;
}