-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
538 additions
and
36 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
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
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,9 @@ | ||
/** | ||
* Car types enum. | ||
*/ | ||
export enum CarType { | ||
Offroad = "Off-road", | ||
Basic = "Osobné", | ||
Suv = "SUV", | ||
Van = "Úžitkové", | ||
} |
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,91 @@ | ||
import type { PipeTransform } from "@angular/core"; | ||
import { Pipe } from "@angular/core"; | ||
import { CarType } from "./app.car-type.enum"; | ||
|
||
/** | ||
* Pipe for price calculation. | ||
*/ | ||
@Pipe({ | ||
name: "appPrice", | ||
standalone: true, | ||
}) | ||
export class AppPricePipe implements PipeTransform { | ||
/** | ||
* Calculates the price based on settings. | ||
* @param carType Car type. | ||
* @param complete Flag for complete change of tires. | ||
* @param diskSize Disk size. | ||
* @returns Calculated price. | ||
*/ | ||
public transform( | ||
carType: CarType, | ||
complete: boolean, | ||
diskSize: number, | ||
): number { | ||
diskSize = Math.min(Math.max(diskSize, 14), 22); | ||
|
||
switch (carType) { | ||
case CarType.Basic: | ||
switch (diskSize) { | ||
case 14: | ||
return complete ? 34 : 25; | ||
case 15: | ||
return complete ? 35 : 25; | ||
case 16: | ||
return complete ? 37 : 27; | ||
case 17: | ||
return complete ? 39 : 27; | ||
case 18: | ||
return complete ? 41 : 28; | ||
case 19: | ||
return complete ? 45 : 30; | ||
case 20: | ||
return complete ? 51 : 32; | ||
case 21: | ||
return complete ? 56 : 35; | ||
case 22: | ||
return complete ? 63 : 40; | ||
default: | ||
return NaN; | ||
} | ||
|
||
case CarType.Offroad: | ||
return diskSize <= 15 | ||
? complete | ||
? 64 | ||
: 44 | ||
: complete | ||
? 70 | ||
: 46; | ||
|
||
case CarType.Suv: | ||
switch (diskSize) { | ||
case 14: | ||
case 15: | ||
case 16: | ||
case 17: | ||
return complete ? 42 : 30; | ||
case 18: | ||
case 19: | ||
return complete ? 50 : 35; | ||
case 20: | ||
return complete ? 58 : 40; | ||
case 21: | ||
return complete ? 65 : 45; | ||
case 22: | ||
return complete ? 72 : 45; | ||
default: | ||
return NaN; | ||
} | ||
|
||
case CarType.Van: | ||
return diskSize <= 15 | ||
? complete | ||
? 45 | ||
: 31 | ||
: complete | ||
? 48 | ||
: 33; | ||
} | ||
} | ||
} |
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,78 @@ | ||
<div | ||
mat-dialog-title | ||
class="mat-elevation-z5"> | ||
<span>Prezutie (4 kolesá)</span> | ||
</div> | ||
|
||
<mat-dialog-content> | ||
<!-- Typ auta --> | ||
<div class="row"> | ||
<mat-button-toggle-group | ||
[name]="'carType'" | ||
[hideSingleSelectionIndicator]="true" | ||
[(ngModel)]="carType"> | ||
@for (t of carTypes; track $index) { | ||
<mat-button-toggle [value]="t"> | ||
{{ t }} | ||
</mat-button-toggle> | ||
} | ||
</mat-button-toggle-group> | ||
</div> | ||
|
||
<!-- Komplet --> | ||
<div class="row"> | ||
<mat-button-toggle-group | ||
[name]="'completeChange'" | ||
[hideSingleSelectionIndicator]="true" | ||
[(ngModel)]="completeChange"> | ||
<mat-button-toggle [value]="false"> | ||
Prehodenie kolies | ||
</mat-button-toggle> | ||
<mat-button-toggle [value]="true"> | ||
Kompletné prezutie | ||
</mat-button-toggle> | ||
</mat-button-toggle-group> | ||
</div> | ||
|
||
<!-- Disk --> | ||
<div class="row"> | ||
<div class="label-value-container"> | ||
<span>Veľkosť diskov:</span> | ||
<span>{{ diskSize }}''</span> | ||
</div> | ||
<mat-slider | ||
[discrete]="false" | ||
[min]="14" | ||
[max]="22" | ||
[step]="1" | ||
[showTickMarks]="true"> | ||
<input | ||
matSliderThumb | ||
[(ngModel)]="diskSize" /> | ||
</mat-slider> | ||
</div> | ||
|
||
<!-- Cena --> | ||
<mat-divider /> | ||
<div> | ||
<div class="label-value-container"> | ||
<button mat-flat-button> | ||
<b>{{ carType | appPrice: completeChange : diskSize }} €</b> | ||
</button> | ||
</div> | ||
<div> | ||
<p>*Zahŕňa vyváženie diskov, výmenu a hustenie</p> | ||
<mat-divider /> | ||
</div> | ||
<mat-divider /> | ||
|
||
<!-- Footer --> | ||
<mat-dialog-actions [align]="'center'"> | ||
<button | ||
mat-button | ||
mat-dialog-close> | ||
Zavrieť | ||
</button> | ||
</mat-dialog-actions> | ||
</div> | ||
</mat-dialog-content> |
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,39 @@ | ||
p { | ||
opacity: 0.8; | ||
margin: 0; | ||
font-size: 0.8rem; | ||
} | ||
|
||
mat-dialog-content { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
padding: 1em !important; | ||
font-size: 1rem !important; | ||
--mat-checkbox-label-text-size: 1rem; | ||
--mat-standard-button-toggle-label-text-size: 1rem; | ||
|
||
.label-value-container { | ||
display: flex; | ||
justify-content: center; | ||
gap: 1rem; | ||
font-size: 1rem; | ||
} | ||
|
||
.row { | ||
display: block; | ||
margin-right: auto; | ||
margin-left: auto; | ||
min-width: 60%; | ||
max-width: 90%; | ||
} | ||
|
||
mat-slider { | ||
margin: unset; | ||
width: 100%; | ||
} | ||
|
||
mat-dialog-actions { | ||
padding: 0; | ||
} | ||
} |
Oops, something went wrong.