-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
front: create stdcm simulation sheet
- Loading branch information
Showing
8 changed files
with
583 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"applicationDate": "Date d'application", | ||
"code":"CH", | ||
"conventionalSign":"signe conv.", | ||
"crossedATE":"ATE croisé", | ||
"endStop":"arrivée", | ||
"operationalPoint":"jalon", | ||
"passageStop":"passage", | ||
"referenceEngine":"engin de réf.", | ||
"referencePath": "Sillon de référence", | ||
"simulation": "Simulation", | ||
"startStop":"départ", | ||
"stdcm":"ST DCM", | ||
"stdcmCreation": "Création de sillon de dernière minute", | ||
"stdcmSimulationSheet": "Fiche Simulation", | ||
"track":"Voie", | ||
"warningMessage": "Cette fiche a été générée par un outil de simulation. Elle ne dispense pas l’horairiste des vérifications inhérentes au tracé de SDM.", | ||
"weight":"tonnage" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
front/src/applications/stdcm/components/SimulationSheet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import React from 'react'; | ||
|
||
import { Alert } from '@osrd-project/ui-icons'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import logoSNCF from 'assets/pictures/misc/sncf.svg'; | ||
import type { ReportTrain } from 'common/api/osrdEditoastApi'; | ||
import type { Regime } from 'reducers/osrdsimulation/types'; | ||
import { formatKmValue } from 'utils/strings'; | ||
|
||
interface Props { | ||
base_data: ReportTrain | Regime | undefined; | ||
} | ||
|
||
const SimulationSheet: React.FC<Props> = ({ base_data }) => { | ||
const { t } = useTranslation('stdcm-simulation-sheet'); | ||
|
||
function getStopTime(sec: number) { | ||
const timeplus = new Date(sec * 1000); | ||
const hours = timeplus.getUTCHours().toString().padStart(2, '0'); | ||
const minutes = timeplus.getUTCMinutes().toString().padStart(2, '0'); | ||
return `${hours}:${minutes}`; | ||
} | ||
|
||
return ( | ||
<div className="simualtion_sheet"> | ||
<div className="alert-banner"> | ||
<div className="alert-icon"> | ||
<Alert variant="fill" /> | ||
</div> | ||
<div className="simulation ml-3">{t('simulation')}</div> | ||
<div className="message pl-3">{t('warningMessage')}</div> | ||
</div> | ||
<div className="number-date-banner"> | ||
<div className="stdcm"> | ||
<div className="title">{t('stdcm')}</div> | ||
<div className="creation">{t('stdcmCreation')}</div> | ||
</div> | ||
<div className="numeric-info"> | ||
<div className="number ml-2 pt-2">n°243-024-004</div> | ||
<div className="creation-date ml-2">le 14/03/2024 à 10:04</div> | ||
</div> | ||
{/* <img src={logoSNCF} alt="SNCF LOGO" className="sncf-logo" /> */} | ||
</div> | ||
<div className="rc-information"> | ||
<div> | ||
<div className="rc-name">Super Fret</div> | ||
<div className="person">Stéphanie Martin-Duclotte</div> | ||
</div> | ||
<div> | ||
<div className="phone-number">04 12 34 56 78</div> | ||
<div className="mail">stephanie.martin-duclotte@superfret.fr</div> | ||
</div> | ||
<div className="stdcm-application"> | ||
<div className="application-date">{t('applicationDate')}</div> | ||
<div className="date mb-3">vendredi 15 mars 2024</div> | ||
<div className="reference-path">{t('referencePath')}</div> | ||
<div className="path-number">n°123456</div> | ||
</div> | ||
</div> | ||
<div className="simulation m-3"> | ||
<div className="simulation_uppercase">{t('simulation')}</div> | ||
<div className="simulation_length"> | ||
{base_data?.head_positions && base_data.head_positions.length > 0 && ( | ||
<> | ||
{formatKmValue( | ||
base_data.head_positions[base_data.head_positions.length - 1][ | ||
base_data.head_positions[base_data.head_positions.length - 1].length - 1 | ||
].position / 1000 | ||
)} | ||
</> | ||
)} | ||
</div> | ||
</div> | ||
<div className="table-container ml-3 mr-3 pr-3 pb-3"> | ||
<table className="ml-2"> | ||
<thead> | ||
<tr> | ||
<th aria-label="line-count" /> | ||
<th>{t('operationalPoint')}</th> | ||
<th>{t('code')}</th> | ||
<th>{t('track')}</th> | ||
<th>{t('endStop')}</th> | ||
<th>{t('passageStop')}</th> | ||
<th>{t('startStop')}</th> | ||
<th>{t('weight')}</th> | ||
<th>{t('referenceEngine')}</th> | ||
<th>{t('conventionalSign')}</th> | ||
<th>{t('crossedATE')}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{base_data?.stops.map((stop, index) => ( | ||
<tr key={index}> | ||
<td className="index-column">{index + 1}</td> | ||
<td> | ||
{index === 0 || | ||
stop.name !== base_data.stops[index - 1].name || | ||
index === base_data.stops.length - 1 | ||
? stop.name || 'Unknown' | ||
: '='} | ||
</td> | ||
<td className="ch-column">{stop.ch}</td> | ||
<td>{stop.track_name}</td> | ||
<td className="stop-column"> | ||
{index === base_data.stops.length - 1 ? getStopTime(stop.time) : ''} | ||
</td> | ||
<td className="stop-column"> | ||
{index !== 0 && index !== base_data.stops.length - 1 | ||
? getStopTime(stop.time) | ||
: ''} | ||
</td> | ||
<td className="stop-column">{index === 0 ? getStopTime(stop.time) : ''}</td> | ||
<td aria-label="weight" /> | ||
<td aria-label="referenceEngine" /> | ||
<td aria-label="conventionalSign" /> | ||
<td aria-label="crossedATE" /> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
<div className="horizontal-bar ml-3 mt-3" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SimulationSheet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.