indent_size à 4
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
.content {
|
||||
height: 90vh;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
flex-direction: column;
|
||||
align-items: initial;
|
||||
height: 90vh;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
flex-direction: column;
|
||||
align-items: initial;
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
<div class="content">
|
||||
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Name of gear</mat-label>
|
||||
<input matInput type="text" formControlName="name">
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Manufacturer</mat-label>
|
||||
<input matInput type="text" formControlName="manufacturer">
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Min size of canopy</mat-label>
|
||||
<input matInput type="text" formControlName="minSize">
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Max size of canopy</mat-label>
|
||||
<input matInput type="text" formControlName="maxSize">
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>AAD system</mat-label>
|
||||
<input matInput type="text" formControlName="aad">
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Main Canopy</mat-label>
|
||||
<input matInput type="text" formControlName="mainCanopy">
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Reserve canopy</mat-label>
|
||||
<input matInput type="text" formControlName="reserveCanopy">
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<form [formGroup]="addForm" (ngSubmit)="onSubmit(addForm.value)">
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Name of gear</mat-label>
|
||||
<input matInput type="text" formControlName="name" />
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Manufacturer</mat-label>
|
||||
<input matInput type="text" formControlName="manufacturer" />
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Min size of canopy</mat-label>
|
||||
<input matInput type="text" formControlName="minSize" />
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Max size of canopy</mat-label>
|
||||
<input matInput type="text" formControlName="maxSize" />
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>AAD system</mat-label>
|
||||
<input matInput type="text" formControlName="aad" />
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Main Canopy</mat-label>
|
||||
<input matInput type="text" formControlName="mainCanopy" />
|
||||
</mat-form-field>
|
||||
</p>
|
||||
<p>
|
||||
<mat-form-field>
|
||||
<mat-label>Reserve canopy</mat-label>
|
||||
<input matInput type="text" formControlName="reserveCanopy" />
|
||||
</mat-form-field>
|
||||
</p>
|
||||
|
||||
<button mat-raised-button color="accent" type="submit">Add</button>
|
||||
</form>
|
||||
<button mat-raised-button color="accent" type="submit">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import {
|
||||
FormControl,
|
||||
FormGroup,
|
||||
ReactiveFormsModule,
|
||||
Validators,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
ReactiveFormsModule,
|
||||
Validators,
|
||||
} from "@angular/forms";
|
||||
import { MatFormFieldModule } from "@angular/material/form-field";
|
||||
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||
@@ -15,85 +15,85 @@ import { GearService } from "../../services/gear.service";
|
||||
import { AddAction } from "../../models/add-action.enum";
|
||||
|
||||
@Component({
|
||||
selector: "app-new-gear",
|
||||
templateUrl: "./new-gear.component.html",
|
||||
styleUrls: ["./new-gear.component.css"],
|
||||
imports: [
|
||||
TranslateModule,
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
selector: "app-new-gear",
|
||||
templateUrl: "./new-gear.component.html",
|
||||
styleUrls: ["./new-gear.component.css"],
|
||||
imports: [
|
||||
TranslateModule,
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
})
|
||||
export class NewGearComponent implements OnInit {
|
||||
public addForm: FormGroup;
|
||||
public addForm: FormGroup;
|
||||
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApi: GearService,
|
||||
private translateService: TranslateService,
|
||||
) {
|
||||
this.addForm = new FormGroup(
|
||||
{
|
||||
name: new FormControl("", Validators.required),
|
||||
manufacturer: new FormControl("", Validators.required),
|
||||
minSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320),
|
||||
]),
|
||||
maxSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320),
|
||||
]),
|
||||
aad: new FormControl("", Validators.required),
|
||||
mainCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320),
|
||||
]),
|
||||
reserveCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320),
|
||||
]),
|
||||
},
|
||||
{ updateOn: "blur" },
|
||||
);
|
||||
}
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApi: GearService,
|
||||
private translateService: TranslateService,
|
||||
) {
|
||||
this.addForm = new FormGroup(
|
||||
{
|
||||
name: new FormControl("", Validators.required),
|
||||
manufacturer: new FormControl("", Validators.required),
|
||||
minSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320),
|
||||
]),
|
||||
maxSize: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320),
|
||||
]),
|
||||
aad: new FormControl("", Validators.required),
|
||||
mainCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320),
|
||||
]),
|
||||
reserveCanopy: new FormControl("", [
|
||||
Validators.required,
|
||||
Validators.min(60),
|
||||
Validators.max(320),
|
||||
]),
|
||||
},
|
||||
{ updateOn: "blur" },
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||
if (data === true) {
|
||||
this.updateTitle();
|
||||
}
|
||||
});
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||
if (data === true) {
|
||||
this.updateTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.updateTitle();
|
||||
}
|
||||
onSubmit(formData) {
|
||||
this.serviceApi
|
||||
.addGear(
|
||||
formData.name,
|
||||
formData.manufacturer,
|
||||
+formData.minSize,
|
||||
+formData.maxSize,
|
||||
formData.aad,
|
||||
formData.mainCanopy,
|
||||
formData.reserveCanopy,
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.serviceComm.refreshData(AddAction.Gear);
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit(formData) {
|
||||
this.serviceApi
|
||||
.addGear(
|
||||
formData.name,
|
||||
formData.manufacturer,
|
||||
+formData.minSize,
|
||||
+formData.maxSize,
|
||||
formData.aad,
|
||||
formData.mainCanopy,
|
||||
formData.reserveCanopy,
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.serviceComm.refreshData(AddAction.Gear);
|
||||
});
|
||||
}
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("NewGear_Title").subscribe((data) => {
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
});
|
||||
}
|
||||
private updateTitle() {
|
||||
this.translateService.get("NewGear_Title").subscribe((data) => {
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user