Skip to content

Commit

Permalink
Merge pull request #101 from sinfo/feature/company-infos
Browse files Browse the repository at this point in the history
Feature: Deck2
  • Loading branch information
PMax5 authored Sep 18, 2023
2 parents caea0bb + a9a7202 commit 7e7f9d6
Show file tree
Hide file tree
Showing 8 changed files with 10,427 additions and 7,762 deletions.
18,015 changes: 10,262 additions & 7,753 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 24 additions & 8 deletions src/app/admin/infos/info.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
export class Info {
info?: MiscInfo;
titles?: Titles;
info?: MiscInfo;
titles?: Titles;

constructor(info?: MiscInfo, titles?: Titles) {
this.info = info;
this.titles = titles;
}
}

class MiscInfo {
numberOfPeople?: Number;
licensePlates?: String[];
numberOfPeople?: Number;
licensePlates?: String[];

constructor(numberOfPeople?: Number, licensePlates?: String[]) {
this.numberOfPeople = numberOfPeople;
this.licensePlates = licensePlates;
}
}

class Titles {
presentation?: String;
lunchTalk?: String;
workshop?: String;
}
presentation?: String;
lunchTalk?: String;
workshop?: String;

constructor(presentation?: String, workshop?: String, lunchTalk?: String) {
this.presentation = presentation;
this.workshop = workshop;
this.lunchTalk = lunchTalk;
}
}
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatButtonModule } from '@angular/material';
import { ActivityDisplayPipe } from './company/company-reservations/reservation-card/activity-display.pipe';
import { InfosComponent } from './admin/infos/infos.component';
import { CompanyInfosComponent } from './company/company-infos/company-infos.component';

library.add(fas);

Expand Down Expand Up @@ -100,6 +101,7 @@ library.add(fas);
ActivityDialogComponent,
ActivityDisplayPipe,
InfosComponent,
CompanyInfosComponent
],
imports: [
BrowserModule,
Expand Down
6 changes: 6 additions & 0 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ReservationsComponent } from 'src/app/admin/reservations/reservations.c
import { WelcomeComponent } from 'src/app/company/welcome/welcome.component';
import { CompanyReservationsComponent } from 'src/app/company/company-reservations/company-reservations.component';
import { InfosComponent } from './admin/infos/infos.component';
import { CompanyInfosComponent } from './company/company-infos/company-infos.component';

const appRoutes: Routes = [
{
Expand Down Expand Up @@ -69,6 +70,11 @@ const appRoutes: Routes = [
path: 'reservations',
component: CompanyReservationsComponent,
canActivate: [CompanyGuard]
},
{
path: 'infos',
component: CompanyInfosComponent,
canActivate: [CompanyGuard]
}
]
},
Expand Down
Empty file.
104 changes: 104 additions & 0 deletions src/app/company/company-infos/company-infos.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<div class="container">
<div [hidden]="submitted">
<h1>Company Information Form</h1>
<form (ngSubmit)="onSubmit()" #companyInfoForm="ngForm">
<div class="form-group">
<label for="numberOfPeople">Número de pessoas no stand</label>
<select
class="form-control"
id="numberOfPeople"
required
[(ngModel)]="model.info.numberOfPeople"
name="numberOfPeople"
#numberOfPeople="ngModel"
>
<option *ngFor="let num of peopleStandOptions" [value]="num">
{{ num }}
</option>
</select>
<div
[hidden]="numberOfPeople.valid || numberOfPeople.pristine"
class="alert alert-danger"
>
Número de pessoas no stand é obrigatório
</div>
</div>

<!-- TODO: FINISH THIS FIELD -->
<!-- <div class="form-group">
<label for="name">Matrícula do carro</label>
<input type="text" class="form-control" id="name"
required
[(ngModel)]="model.name" name="name"
#name="ngModel">
<div [hidden]="name.valid || name.pristine"
class="alert alert-danger">
Matrícula do carro é obrigatório
</div>
</div> -->

<!-- TODO: THIS FIELD SHOULD ONLY APPEAR DEPENDING ON THE COMPANY -->
<div class="form-group">
<label for="name">Título da apresentação</label>
<input
type="text"
class="form-control"
id="name"
required
[(ngModel)]="model.titles.presentation"
name="name"
#name="ngModel"
/>
<div [hidden]="name.valid || name.pristine" class="alert alert-danger">
Título da apresentação é obrigatório
</div>
</div>

<!-- TODO: THIS FIELD SHOULD ONLY APPEAR DEPENDING ON THE COMPANY -->
<div class="form-group">
<label for="name">Título do workshop</label>
<input
type="text"
class="form-control"
id="name"
required
[(ngModel)]="model.titles.workshop"
name="name"
#name="ngModel"
/>
<div [hidden]="name.valid || name.pristine" class="alert alert-danger">
Título do workshop é obrigatório
</div>
</div>

<!-- TODO: THIS FIELD SHOULD ONLY APPEAR DEPENDING ON THE COMPANY -->
<div class="form-group">
<label for="name">Título da lunch talk</label>
<input
type="text"
class="form-control"
id="name"
required
[(ngModel)]="model.titles.lunchTalk"
name="name"
#name="ngModel"
/>
<div [hidden]="name.valid || name.pristine" class="alert alert-danger">
Título da lunch talk é obrigatório
</div>
</div>

<button
type="submit"
class="btn btn-success"
[disabled]="!companyInfoForm.form.valid"
>
Submit
</button>
</form>
</div>

<div [hidden]="!submitted">
{{ model }}
</div>
</div>
28 changes: 28 additions & 0 deletions src/app/company/company-infos/company-infos.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component } from "@angular/core";

import { Info } from "../../admin/infos/info";

@Component({
selector: "company-infos",
templateUrl: "./company-infos.component.html",
styleUrls: ["./company-infos.component.css"],
})
export class CompanyInfosComponent {

maxPeopleStand = 3;
maxCars = 3;

peopleStandOptions = Array.from({length:this.maxPeopleStand},(_,k)=>k+1);

model = new Info();

submitted = false;

onSubmit() {
this.submitted = true;
}

newCompanyInfo() {
this.model = new Info();
}
}
2 changes: 1 addition & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export const environment = {
production: false,
corlief: 'http://localhost:8888',
deck: 'http://localhost:8080',
deck: 'https://deck-staging.sinfo.org',
frontend: 'http://localhost:4200'
};

Expand Down

0 comments on commit 7e7f9d6

Please sign in to comment.