Skip to content

Commit

Permalink
Merge pull request #16 from UdL-EPS-SoftArch/route_crud
Browse files Browse the repository at this point in the history
swap type from input to selector
  • Loading branch information
rogargon authored Nov 24, 2023
2 parents d6ef282 + 7f9cda8 commit dd1a9cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
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

0 comments on commit dd1a9cc

Please sign in to comment.