9 changed files with 160 additions and 2 deletions
@ -0,0 +1,16 @@ |
|||
<div class="signInForm"> |
|||
<h1 mat-dialog-title>Edit</h1> |
|||
<mat-form-field class="full-width"> |
|||
<mat-label>Nickname</mat-label> |
|||
<input matInput type="text" id="nickname" [formControl]="nickname" name="nickname" required> |
|||
</mat-form-field> |
|||
<br/> |
|||
<mat-form-field class="full-width"> |
|||
<mat-label>Real Name</mat-label> |
|||
<input matInput type="text" id="realname" [formControl]="realname" name="realname" required> |
|||
</mat-form-field> |
|||
<mat-dialog-actions align="end"> |
|||
<button mat-button mat-dialog-close>Cancel</button> |
|||
<button mat-button mat-dialog-close (click)="onClickSubmit()">Submit</button> |
|||
</mat-dialog-actions> |
|||
</div> |
|||
@ -0,0 +1,12 @@ |
|||
.signInForm { |
|||
width: 400px; |
|||
padding: 12px 24px 24px; |
|||
|
|||
igx-input-group + igx-input-group { |
|||
margin-top: 24px; |
|||
} |
|||
} |
|||
|
|||
.full-width { |
|||
width: 100%; |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { EditUserDetailsDialogComponent } from './edit-user-details-dialog.component'; |
|||
|
|||
describe('EditUserDetailsDialogComponent', () => { |
|||
let component: EditUserDetailsDialogComponent; |
|||
let fixture: ComponentFixture<EditUserDetailsDialogComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
imports: [EditUserDetailsDialogComponent] |
|||
}) |
|||
.compileComponents(); |
|||
|
|||
fixture = TestBed.createComponent(EditUserDetailsDialogComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,62 @@ |
|||
import { Component, Inject } from '@angular/core'; |
|||
import { CommonModule } from '@angular/common'; |
|||
import { ReactiveFormsModule, FormControl } from '@angular/forms'; |
|||
import { FormsModule } from '@angular/forms'; |
|||
|
|||
import { MatDialog, MAT_DIALOG_DATA, MatDialogRef, MatDialogTitle, |
|||
MatDialogContent, MatDialogActions, MatDialogClose,} from '@angular/material/dialog'; |
|||
|
|||
import { MatButtonModule } from '@angular/material/button'; |
|||
import { MatDialogModule } from '@angular/material/dialog'; |
|||
import { MatInputModule } from '@angular/material/input'; |
|||
import { MatFormFieldModule } from '@angular/material/form-field'; |
|||
import { MatIconModule } from '@angular/material/icon'; |
|||
import { UsersService } from '../../services/users.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-edit-user-details-dialog', |
|||
standalone: true, |
|||
imports: [ |
|||
CommonModule, |
|||
ReactiveFormsModule, |
|||
MatButtonModule, |
|||
MatDialogModule, |
|||
MatInputModule, |
|||
MatFormFieldModule, |
|||
FormsModule, |
|||
MatDialogTitle, |
|||
MatDialogContent, |
|||
MatDialogActions, |
|||
MatDialogClose, |
|||
MatIconModule, |
|||
], |
|||
templateUrl: './edit-user-details-dialog.component.html', |
|||
styleUrl: './edit-user-details-dialog.component.scss' |
|||
}) |
|||
export class EditUserDetailsDialogComponent { |
|||
nickname = new FormControl(''); |
|||
realname = new FormControl(''); |
|||
additionalData: any; |
|||
|
|||
constructor( |
|||
@Inject(MAT_DIALOG_DATA) additionalData: any, |
|||
private usersService: UsersService |
|||
) |
|||
{ |
|||
this.additionalData = additionalData; |
|||
} |
|||
|
|||
ngOnInit() { |
|||
this.nickname.setValue(this.additionalData.currentNickName); |
|||
this.realname.setValue(this.additionalData.currentRealName); |
|||
} |
|||
|
|||
onClickSubmit() { |
|||
let nickname = this.nickname.value != undefined ? this.nickname.value : ""; |
|||
let realname = this.realname.value != undefined ? this.realname.value : ""; |
|||
|
|||
this.usersService.updateUserDetails(nickname, realname).subscribe(data =>{ |
|||
console.log(data); |
|||
}); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue