Skip to content

Commit

Permalink
update for diff categories
Browse files Browse the repository at this point in the history
  • Loading branch information
harshbaldwa committed Sep 28, 2019
1 parent 300d3ce commit 746c793
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export class LadderService {
this.http.post<string>(BackendURLNotifications + 'challenges/', myId)
.subscribe((notification) => {
this.challengesN = Number(notification[0]);
console.log(this.challengesN);
this.challengesP = Number(notification[1]);
this.challengesC = Number(notification[2]);
// tslint:disable: triple-equals
Expand Down
5 changes: 4 additions & 1 deletion src/app/auth/auth-data.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ export interface AuthData {
roll: string;
hostel: string;
gender: string;
category: string;
categorySquash: string;
categoryTT: string;
categoryTennis: string;
categoryBadminton: string;
preferred: string;
contact: string;
password: string;
Expand Down
8 changes: 6 additions & 2 deletions src/app/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ export class AuthService {
roll: string,
hostel: string,
gender: string,
category: string,
categorySquash: string,
categoryTT: string,
categoryTennis: string,
categoryBadminton: string,
preferred: string,
contact: string,
password: string) {
const authData: AuthData = {name, roll, hostel, gender, category, preferred, contact, password};
// tslint:disable-next-line: max-line-length
const authData: AuthData = {name, roll, hostel, gender, categorySquash, categoryTT, categoryTennis, categoryBadminton, preferred, contact, password};
this.http.post(environment.apiUrl + 'signup', authData)
.subscribe();
this.openSnackBar('Successfully signed up!', 'OK');
Expand Down
48 changes: 39 additions & 9 deletions src/app/auth/signup/signup.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,52 @@
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Category</mat-label>
<mat-select name="category" [(ngModel)]="category" placeholder="Category" required>
<mat-label>Preferred Sport</mat-label>
<mat-select name="preferred" [(ngModel)]="preferred" required multiple>
<mat-option value="squash">Squash</mat-option>
<mat-option value="tt">Table Tennis</mat-option>
<mat-option value="tennis">Lawn Tennis</mat-option>
<mat-option value="badminton">Badminton</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="this.preferred.includes('squash')">
<mat-label>Category - Squash</mat-label>
<mat-select name="categorySquash" [(ngModel)]="categorySquash" placeholder="Category - Squash" required>
<mat-option value="Inter IIT Team">Inter IIT Team</mat-option>
<mat-option value="Inter IIT Camp">Inter IIT Camp</mat-option>
<mat-option value="Intermediate">Intermediate</mat-option>
<mat-option value="NSO">NSO</mat-option>
<mat-option value="Beginner">Beginner</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Preferred Sport</mat-label>
<mat-select name="preferred" [(ngModel)]="preferred" required multiple>
<mat-option value="squash">Squash</mat-option>
<mat-option value="tt">Table Tennis</mat-option>
<mat-option value="tennis">Lawn Tennis</mat-option>
<mat-option value="badminton">Badminton</mat-option>
<mat-form-field *ngIf="this.preferred.includes('tt')">
<mat-label>Category - Table Tennis</mat-label>
<mat-select name="categoryTT" [(ngModel)]="categoryTT" placeholder="Category - Table Tennis" required>
<mat-option value="Inter IIT Team">Inter IIT Team</mat-option>
<mat-option value="Inter IIT Camp">Inter IIT Camp</mat-option>
<mat-option value="Intermediate">Intermediate</mat-option>
<mat-option value="NSO">NSO</mat-option>
<mat-option value="Beginner">Beginner</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="this.preferred.includes('tennis')">
<mat-label>Category - Lawn Tennis</mat-label>
<mat-select name="categoryTennis" [(ngModel)]="categoryTennis" placeholder="Category - Lawn Tennis" required>
<mat-option value="Inter IIT Team">Inter IIT Team</mat-option>
<mat-option value="Inter IIT Camp">Inter IIT Camp</mat-option>
<mat-option value="Intermediate">Intermediate</mat-option>
<mat-option value="NSO">NSO</mat-option>
<mat-option value="Beginner">Beginner</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="this.preferred.includes('badminton')">
<mat-label>Category - Badminton</mat-label>
<mat-select name="categoryBadminton" [(ngModel)]="categoryBadminton" placeholder="Category - Badminton" required>
<mat-option value="Inter IIT Team">Inter IIT Team</mat-option>
<mat-option value="Inter IIT Camp">Inter IIT Camp</mat-option>
<mat-option value="Intermediate">Intermediate</mat-option>
<mat-option value="NSO">NSO</mat-option>
<mat-option value="Beginner">Beginner</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
Expand Down
13 changes: 9 additions & 4 deletions src/app/auth/signup/signup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component } from '@angular/core';
import { NgForm } from '@angular/forms';

import { AuthService } from '../auth.service';
import { invalid } from '@angular/compiler/src/render3/view/util';

@Component({
templateUrl: './signup.component.html',
Expand All @@ -13,8 +12,11 @@ export class SignupComponent {
public roll: string;
public hostel: string;
public gender: string;
public category: string;
public preferred: string;
public categorySquash = '';
public categoryTT = '';
public categoryTennis = '';
public categoryBadminton = '';
public preferred = '';
public contact: number;
public pass: string;
public pass1: string;
Expand Down Expand Up @@ -45,7 +47,10 @@ export class SignupComponent {
form.value.roll,
form.value.hostel,
form.value.gender,
form.value.category,
form.value.categorySquash,
form.value.categoryTT,
form.value.categoryTennis,
form.value.categoryBadminton,
sports,
form.value.contact,
form.value.password
Expand Down

0 comments on commit 746c793

Please sign in to comment.