autowp/autowp-frontend

View on GitHub
src/app/cars/specifications-editor/engine/engine.component.html

Summary

Maintainability
Test Coverage
<h2 i18n>Engine from catalogue</h2>
 
@if (item$ | async; as item) {
@if (isAllowedEditEngine$ | async) {
<div>
@if (engine$ | async; as engine) {
<div>
<p>
<a [routerLink]="['/moder/items/item', engine.id]" [innerHTML]="engine.nameHtml"></a>
</p>
@if (item.engineInherit) {
<!--TODO: h6 *ngFor="let car of engineInheritedFrom">
<em>
<ng-container i18n>Inherited from</ng-container>
<a [href]="car.url" [innerHTML]="car.name_html"></a>
</em>
</h6-->
}
<a routerLink="/cars/select-engine" [queryParams]="{item_id: item.id}" class="btn btn-primary" i18n
>Select another engine</a
>
@if (item.engineItemId) {
<button class="btn btn-warning" (click)="cancelInheritance(item)" i18n>Cancel engine</button>
}
@if (!item.engineInherit) {
<button class="btn btn-warning" (click)="inheritEngine(item)" i18n>Inherit engine</button>
}
</div>
} @else {
<p i18n>[not selected]</p>
<a routerLink="/cars/select-engine" [queryParams]="{item_id: item.id}" class="btn btn-primary" i18n
>Select engine</a
>
@if (!item.engineInherit) {
<button class="btn btn-warning" (click)="inheritEngine(item)" i18n>Inherit engine</button>
} @else {
<button class="btn btn-warning" (click)="cancelInheritance(item)" i18n>Don't inherit engine</button>
}
}
</div>
}
@if (engine$ | async; as engine) {
@if (engine && (isAllowedEditEngine$ | async) === false) {
<div>
<p [innerHTML]="engine.nameHtml"></p>
@if (item.engineInherit) {
<!--TODO: h6 *ngFor="let car of engineInheritedFrom">
<em>
<ng-container i18n>Inherited from</ng-container>
<span [innerHTML]="car.name_html"></span>
</em>
</h6-->
}
</div>
}
}
} @else {
<div class="spinner-border" role="status"><span class="visually-hidden" i18n>Loading…</span></div>
}