Skip to content

Commit

Permalink
add isSymmetric to Trainrun
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Greiner <[email protected]>
  • Loading branch information
louisgreiner committed Mar 6, 2025
1 parent d705946 commit 1dcbd42
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/data-structures/business.data.structures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export interface TrainrunDto {
trainrunTimeCategoryId: number; // reference to the trainrun time category

labelIds: number[];
isSymmetric?: boolean;
}

/**
Expand Down
12 changes: 12 additions & 0 deletions src/app/models/trainrun.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class Trainrun {
private trainrunTimeCategory: TrainrunTimeCategory;
private isSelected: boolean;
private labelIds: number[];
private isSymmetric: boolean;

constructor(
{
Expand All @@ -39,6 +40,7 @@ export class Trainrun {
frequencyId: Trainrun.DEFAULT_TRAINRUN_FREQUENCY,
trainrunTimeCategoryId: Trainrun.DEFAULT_TRAINRUN_TIME_CATEGORY,
labelIds: [],
isSymmetric: true,
},
) {
this.id = id;
Expand All @@ -48,6 +50,7 @@ export class Trainrun {
this.isSelected = false;
this.trainrunTimeCategoryId = trainrunTimeCategoryId;
this.labelIds = labelIds;
this.isSymmetric = true;

if (Trainrun.currentId < this.id) {
Trainrun.currentId = this.id;
Expand Down Expand Up @@ -148,6 +151,14 @@ export class Trainrun {
this.labelIds = labelIds;
}

getIsSymmetric(): boolean {
return this.isSymmetric;
}

setIsSymmetric(isSymmetric: boolean) {
this.isSymmetric = isSymmetric;
}

getDto(): TrainrunDto {
return {
id: this.id,
Expand All @@ -156,6 +167,7 @@ export class Trainrun {
frequencyId: this.trainrunFrequency.id,
trainrunTimeCategoryId: this.trainrunTimeCategory.id,
labelIds: this.labelIds,
isSymmetric: this.isSymmetric,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@
</div>
</div>
</div>
<div class="row">
<div class="column" style="float: left; width: auto">
<div class="sbb-checkbox-group-vertical">
<sbb-checkbox
[(ngModel)]="getIsSymmetric"
(change)="setIsSymmetric()"
style="padding-top: 10px;"
>
{{ 'app.view.dialogs.trainrun-and-section-dialog.trainrun-tab.enableSymmetry' | translate }}
</sbb-checkbox>
</div>
</div>
</div>
</div>
<ng-container *ngIf="toolbarVisible">
<div sbbDialogActions [class]="getContentFooterClassTag()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ export class TrainrunTabComponent implements OnDestroy {
this.initializeWithCurrentSelectedTrainrun();
}

getIsSymmetric(): boolean {
return this.selectedTrainrun.getIsSymmetric();
}

setIsSymmetric() {
this.selectedTrainrun.setIsSymmetric(!this.selectedTrainrun.getIsSymmetric());
}

private initializeWithCurrentSelectedTrainrun() {
this.selectedTrainrun = this.trainrunService.getSelectedTrainrun();
if (this.selectedTrainrun !== null) {
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@
"category": "Kategorie",
"frequency": "Takt",
"verkehrt": "verkehrt",
"symmetry": "Symmetrie",
"enableSymmetry": "Symmetrie aktivieren",
"trainrunDuplicate": "Zuglauf duplizieren",
"trainrunDelete": "Zuglauf löschen",
"delete": "Löschen",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@
"category": "Category",
"frequency": "Frequency",
"verkehrt": "Operates",
"symmetry": "Symmetry",
"enableSymmetry": "Enable symmetry",
"trainrunDuplicate": "Duplicate trainrun",
"trainrunDelete": "Delete trainrun",
"delete": "Delete",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@
"category": "Catégorie",
"frequency": "Fréquence",
"verkehrt": "Fonctionnement",
"symmetry": "Symétrie",
"enableSymmetry": "Activer la symétrie",
"trainrunDuplicate": "Dupliquer le trajet de train",
"trainrunDelete": "Supprimer le trajet de train",
"delete": "Supprimer",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@
"category": "Category",
"frequency": "Frequency",
"verkehrt": "Operates",
"symmetry": "Symmetry",
"enableSymmetry": "Enable symmetry",
"trainrunDuplicate": "Duplicate trainrun",
"trainrunDelete": "Delete trainrun",
"delete": "Delete",
Expand Down

0 comments on commit 1dcbd42

Please sign in to comment.