Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swap type from input to selector #16

Merged
merged 4 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/app/routes/route-create/route-create.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
#description="ngModel">
</div>

<!-- Type input -->
<!-- Type selection -->
<div class="form-group mb-3">
<label class="control-label" for="type">Type</label>
<input id="type" name="type" type="text" class="form-control" [(ngModel)]="route.type"
#type="ngModel">
<select class="form-select" aria-label="type" id="type" name="type" [(ngModel)]="route.type" #type="ngModel" required>
<option *ngFor="let typ of types" value="{{typ}}">{{typ}}</option>
</select>
</div>

<!-- Buttons -->
Expand Down
10 changes: 7 additions & 3 deletions src/app/routes/route-create/route-create.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { AuthenticationBasicService } from 'src/app/login-basic/authentication-b
import { User } from 'src/app/login-basic/user';
import { Route } from '../route';
import { RouteService } from '../route.service';
import { Input } from '@angular/core';
import { UserService } from 'src/app/user/user.service';
import { PagedResourceCollection } from '@lagoshny/ngx-hateoas-client';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClient} from '@angular/common/http';
import {environment} from "../../../environments/environment";

@Component({
selector: 'app-routes-create',
Expand All @@ -27,6 +27,7 @@ export class RouteCreateComponent implements OnInit {
public page = 1;
public totalUsers = 0;
public authserv: AuthenticationBasicService;
public types: [];

constructor(private router: Router,
private authenticationService: AuthenticationBasicService,
Expand All @@ -37,7 +38,10 @@ export class RouteCreateComponent implements OnInit {
ngOnInit(): void {
this.createdBy.id = this.getCurrentUserName();
this.creationDate = new Date();

this.http.get<any>(`${environment.API}/profile/routes`)
.subscribe(data => {
this.types = (data.alps.descriptor[0].descriptor[2].doc.value).split(',');
});

this.userService.getPage({ pageParams: { size: this.pageSize }, sort: { username: 'ASC' } }).subscribe(
(page: PagedResourceCollection<User>) => {
Expand Down
Loading