usermangement userprofile access
This commit is contained in:
parent
17a78672a1
commit
f1eb384b9a
@ -393,14 +393,14 @@ export class AwsService {
|
||||
if (userData.type.entity_type_id == 1) {
|
||||
|
||||
params = {
|
||||
GroupName: role.value /* required */,
|
||||
GroupName: role.GroupName /* required */,
|
||||
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||
};
|
||||
|
||||
} else if (userData.type.entity_type_id == 2) {
|
||||
params = {
|
||||
GroupName: role.value /* required */,
|
||||
GroupName: role.GroupName /* required */,
|
||||
UserPoolId: lender_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||
};
|
||||
@ -435,14 +435,14 @@ export class AwsService {
|
||||
if (userData.fk_entity_id == 1) {
|
||||
|
||||
params = {
|
||||
GroupName: cognitodata.value /* required */,
|
||||
GroupName: cognitodata.GroupName /* required */,
|
||||
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||
Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||
};
|
||||
|
||||
} else if (userData.fk_entity_id == 2) {
|
||||
params = {
|
||||
GroupName: cognitodata.value /* required */,
|
||||
GroupName: cognitodata.GroupName /* required */,
|
||||
UserPoolId: lender_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||
Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||
};
|
||||
@ -494,7 +494,13 @@ export class AwsService {
|
||||
{
|
||||
Name: 'locale', /* required */
|
||||
Value: cognitosdata.toString()
|
||||
},
|
||||
},{
|
||||
Name:"email_verified",
|
||||
Value:"true"
|
||||
},{
|
||||
Name:"phone_number_verified",
|
||||
Value:"true"
|
||||
}
|
||||
/* more items */
|
||||
],
|
||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||
@ -506,7 +512,13 @@ export class AwsService {
|
||||
{
|
||||
Name: 'locale', /* required */
|
||||
Value: cognitosdata.toString()
|
||||
},
|
||||
},{
|
||||
Name:"email_verified",
|
||||
Value:"true"
|
||||
},{
|
||||
Name:"phone_number_verified",
|
||||
Value:"true"
|
||||
}
|
||||
/* more items */
|
||||
],
|
||||
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||
@ -598,11 +610,20 @@ adminremoveGroup(roles,users){
|
||||
|
||||
let session:any = this.shared.getAccessToken() ||"";
|
||||
this.getconfig();
|
||||
var params = {
|
||||
GroupName: roles.value, /* required */
|
||||
let params:any;
|
||||
if(users.fk_entity_id ==1){
|
||||
params = {
|
||||
GroupName: roles.GroupName, /* required */
|
||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||
Username: users.aws_name//'2c64866e-e96f-453b-903f-2b6f831688af' /* required */
|
||||
};
|
||||
}else if(users.fk_entity_id ==2){
|
||||
params = {
|
||||
GroupName: roles.GroupName, /* required */
|
||||
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||
Username: users.aws_name//'2c64866e-e96f-453b-903f-2b6f831688af' /* required */
|
||||
};
|
||||
}
|
||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||
cognitoidentityserviceprovider.adminRemoveUserFromGroup(params, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
@ -610,4 +631,104 @@ adminremoveGroup(roles,users){
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
adminresetpassword(awsuser){
|
||||
this.getconfig();
|
||||
let params:any;
|
||||
if(awsuser.fk_entity_id ==1){
|
||||
params= {
|
||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||
Username: awsuser.email /* required */
|
||||
};
|
||||
}else if(awsuser.fk_entity_id ==2){
|
||||
params= {
|
||||
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||
Username: awsuser.email /* required */
|
||||
};
|
||||
}
|
||||
return Observable.create(observe=>{
|
||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||
cognitoidentityserviceprovider.changePassword(params, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else { console.log(data);
|
||||
observe.next(data);
|
||||
} // successful response
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
changepassword(passData) {
|
||||
let session:any = this.shared.getAccessToken() || "";
|
||||
console.log(session);
|
||||
this.getconfig();
|
||||
var params = {
|
||||
AccessToken: session.accessToken.jwtToken, /* required */
|
||||
PreviousPassword: passData.oldPassword, /* required */
|
||||
ProposedPassword: passData.newPassword /* required */
|
||||
};
|
||||
return Observable.create(observe => {
|
||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||
cognitoidentityserviceprovider.changePassword(params, function (err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
console.log(data);
|
||||
observe.next(data);
|
||||
// successful response
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
admindelete(aws){
|
||||
this.getconfig();
|
||||
let params:any;
|
||||
if(aws.fk_entity_id ==1){
|
||||
params= {
|
||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||
Username: aws.email /* required */
|
||||
};
|
||||
}else if(aws.fk_entity_id ==2){
|
||||
params= {
|
||||
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||
Username: aws.email /* required */
|
||||
};
|
||||
}
|
||||
return Observable.create(observe=>{
|
||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||
cognitoidentityserviceprovider.adminDeleteUser(params, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else { console.log(data);
|
||||
observe.next(data);
|
||||
} // successful response
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
adminlistgroup(enitiy){
|
||||
// console.log(enitiy);
|
||||
this.getconfig();
|
||||
let params:any;
|
||||
if(enitiy ==1){
|
||||
params = {
|
||||
UserPoolId:sineedgedev_poolData.UserPoolId,
|
||||
}
|
||||
}else if(enitiy ==2){
|
||||
params = {
|
||||
UserPoolId:lender_poolData.UserPoolId
|
||||
}
|
||||
}
|
||||
//console.log(enitiy);
|
||||
return Observable.create(observe=>{
|
||||
|
||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||
cognitoidentityserviceprovider.listGroups(params,function(err,data){
|
||||
if(err) alert(err.stack);
|
||||
else {console.log(data);observe.next(data.Groups);}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
// waiting for image api
|
||||
getpicurl(userid){
|
||||
let users = {'userid':userid}
|
||||
return this.http.post(apiurl+'getSingedProfilePicURL',users);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ import {MatCheckboxModule} from '@angular/material/checkbox';
|
||||
import {MatProgressBarModule} from '@angular/material/progress-bar';
|
||||
import {MatSelectModule} from '@angular/material/select';
|
||||
import {MatCardModule} from '@angular/material/card';
|
||||
import { ChangePasswordDialog } from './settings/users/'
|
||||
|
||||
import { AppRoutes } from './app.routing';
|
||||
import { AppComponent } from './app.component';
|
||||
@ -56,7 +57,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
||||
AppComponent,
|
||||
AdminLayoutComponent,
|
||||
AuthLayoutComponent,
|
||||
NewPasswordDialog,ForgotPass
|
||||
NewPasswordDialog,ForgotPass,ChangePasswordDialog
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -104,7 +105,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
||||
multi: true
|
||||
}
|
||||
],
|
||||
entryComponents: [NewPasswordDialog,ForgotPass],
|
||||
entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@ import {TranslateService} from '@ngx-translate/core';
|
||||
import PerfectScrollbar from 'perfect-scrollbar';
|
||||
import { PerfectScrollbarConfigInterface,
|
||||
PerfectScrollbarComponent, PerfectScrollbarDirective } from 'ngx-perfect-scrollbar';
|
||||
import { UserService } from '../../settings/service/user.service';
|
||||
|
||||
import { AwsService } from '../../AwsService/aws.service';
|
||||
|
||||
@ -18,6 +19,9 @@ import { AwsService } from '../../AwsService/aws.service';
|
||||
})
|
||||
export class AdminLayoutComponent implements OnInit, OnDestroy {
|
||||
|
||||
userDep: string;
|
||||
fullName: any;
|
||||
currentUser: any;
|
||||
private _router: Subscription;
|
||||
|
||||
today: number = Date.now();
|
||||
@ -39,9 +43,26 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
|
||||
@ViewChild('sidemenu') sidemenu;
|
||||
public config: PerfectScrollbarConfigInterface = {};
|
||||
|
||||
constructor(private router: Router, public menuItems: MenuItems, public horizontalMenuItems : HorizontalMenuItems, public translate: TranslateService,public aws:AwsService ) {
|
||||
constructor(private router: Router, public menuItems: MenuItems, public horizontalMenuItems : HorizontalMenuItems, public translate: TranslateService,public aws:AwsService,public users:UserService ) {
|
||||
const browserLang: string = translate.getBrowserLang();
|
||||
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
|
||||
this.users.getroles().subscribe(res=>{
|
||||
this.currentUser = res;
|
||||
if(this.currentUser.dataStatus == true){
|
||||
this.currentUser = this.currentUser.records[0];
|
||||
this.fullName = this.currentUser.user_full_name;
|
||||
console.log(this.currentUser);
|
||||
if(this.currentUser.fk_entity_id == 1 ){
|
||||
this.userDep = "SINEEGDE";
|
||||
}else if(this.currentUser.fk_entity_id ==2){
|
||||
this.userDep = "LENDOR";
|
||||
|
||||
}else{
|
||||
this.userDep = "VENDOR";
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -201,6 +222,9 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
|
||||
]
|
||||
});
|
||||
}
|
||||
userprofile(){
|
||||
this.router.navigate(['setting/users/userprofile']);
|
||||
}
|
||||
logout(){
|
||||
//alert();
|
||||
this.aws.logout().subscribe(res=>{
|
||||
|
||||
@ -107,7 +107,7 @@ export class UserService {
|
||||
let roles:any=[];
|
||||
for(var role of users.role){
|
||||
|
||||
roles.push({ "user_role": role.value });
|
||||
roles.push({ "user_role": role.GroupName });
|
||||
}
|
||||
let designation:any;
|
||||
if(users.type.entity_type_id ==2){
|
||||
@ -125,8 +125,8 @@ export class UserService {
|
||||
"last_name": users.lastName,
|
||||
"mobile_no": users.phone,
|
||||
"email": users.email,
|
||||
"alt_email":users.alt_email,
|
||||
"alt_mobile_no":users.alt_mobile_no,
|
||||
"alt_email":users.altemail,
|
||||
"alt_mobile_no":users.altphone,
|
||||
"addressline1":users.address1,
|
||||
"addressline2":users.address2,
|
||||
"addressline3":users.address3,
|
||||
@ -146,7 +146,7 @@ export class UserService {
|
||||
formData.append('records',JSON.stringify(records));
|
||||
formData.append('roles',JSON.stringify(roles));
|
||||
formData.append('profilepic',users.userpic);
|
||||
|
||||
console.log(records);
|
||||
//new Response(formData).text().then(console.log);
|
||||
//let headers = this.shared.headercofig('');
|
||||
|
||||
@ -173,6 +173,13 @@ export class UserService {
|
||||
observe.next(this.localUserId);
|
||||
})
|
||||
}
|
||||
|
||||
getroles(){
|
||||
// alert();
|
||||
let cogusers:any = this.aws.getlocale();
|
||||
//console.log(cogusers.idToken.payload.locale);
|
||||
let roles = {'userid':cogusers};
|
||||
|
||||
return this.http.post(apiurl+'getUsersDetails',roles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,30 +1,35 @@
|
||||
|
||||
|
||||
<mat-card>
|
||||
|
||||
<mat-card-title> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon button" (click)="back()"><mat-icon>chevron_left</mat-icon></button> User Registration</mat-card-title>
|
||||
|
||||
<mat-card-title>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon button" (click)="back()">
|
||||
<mat-icon>chevron_left</mat-icon>
|
||||
</button> User Registrations</mat-card-title>
|
||||
<!-- <div class="profile-avatar">
|
||||
|
||||
<img fxFlexOffset="50px" [src]="'https://www.google.co.in/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&ved=2ahUKEwi8qsnv7NPdAhWFWysKHZIZBDcQjRx6BAgBEAU&url=https%3A%2F%2Fwww.facebook.com%2FProfilePictures%2F&psig=AOvVaw12u0YbndUEVORSODg1OWeg&ust=1537885714967641'" style="width: 70px;height: 100px;border-radius: 50%;">
|
||||
</div> -->
|
||||
<!-- <mat-card-subtitle>Angular2 custom validation</mat-card-subtitle> -->
|
||||
<form [formGroup]="regForm" (ngSubmit)="register(regForm.value)">
|
||||
<mat-card-content>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
<input matInput placeholder="First name" [formControl]="regForm.controls['firstName']">
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('required') && regForm.controls['firstName'].touched" class="mat-text-warn">You must include a first name.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('minlength') && regForm.controls['firstName'].touched" class="mat-text-warn">Your first name must be at least 5 characters long.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('maxlength') && regForm.controls['firstName'].touched" class="mat-text-warn">Your first name cannot exceed 10 characters.</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<input matInput placeholder="First name" [formControl]="regForm.controls['firstName']">
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('required') && regForm.controls['firstName'].touched" class="mat-text-warn">You must include a first name.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('minlength') && regForm.controls['firstName'].touched" class="mat-text-warn">Your first name must be at least 5 characters long.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('maxlength') && regForm.controls['firstName'].touched" class="mat-text-warn">Your first name cannot exceed 10 characters.</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
<input matInput placeholder="Last name" [formControl]="regForm.controls['lastName']">
|
||||
<mat-error *ngIf="regForm.controls['lastName'].hasError('required') && regForm.controls['lastName'].touched" class="mat-text-warn">You must include a last name.</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <mat-error *ngIf="regForm.controls['lastName'].hasError('minlength') && regForm.controls['lastName'].touched" class="mat-text-warn">Your first name must be at least 5 characters long.</mat-error>
|
||||
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
<input matInput placeholder="Last name" [formControl]="regForm.controls['lastName']">
|
||||
<mat-error *ngIf="regForm.controls['lastName'].hasError('required') && regForm.controls['lastName'].touched" class="mat-text-warn">You must include a last name.</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <mat-error *ngIf="regForm.controls['lastName'].hasError('minlength') && regForm.controls['lastName'].touched" class="mat-text-warn">Your first name must be at least 5 characters long.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['lastName'].hasError('maxlength') && regForm.controls['lastName'].touched" class="mat-text-warn">Your first name cannot exceed 10 characters.</mat-error> -->
|
||||
<mat-form-field style="display: none;">
|
||||
<input matInput placeholder="User Id" [formControl]="regForm.controls['userid']">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="display: none;">
|
||||
<input matInput placeholder="User Id" [formControl]="regForm.controls['userid']">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
|
||||
@ -32,14 +37,14 @@
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
<input matInput placeholder="Email address" [formControl]="regForm.controls['email']" type="email">
|
||||
<mat-error *ngIf="regForm.controls['email'].hasError('required') && regForm.controls['email'].touched" class="mat-text-warn">You must include an email address.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['email'].errors?.email && regForm.controls['email'].touched" class="mat-text-warn">You must include a valid email address.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['email'].errors?.email && regForm.controls['email'].touched" class="mat-text-warn">You must include a valid email address.</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
<input matInput placeholder="Alt Email address" [formControl]="regForm.controls['altemail']" type="email">
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-error *ngIf="regForm.controls['email'].errors?.email && regForm.controls['altemail'].touched" class="mat-text-warn">You must include a valid email address.</mat-error>
|
||||
</div>
|
||||
|
||||
|
||||
@ -51,19 +56,19 @@
|
||||
<input matInput placeholder="Phone number" [formControl]="regForm.controls['phone']" type="text">
|
||||
<mat-error *ngIf="regForm.controls['phone'].hasError('required') && regForm.controls['phone'].touched" class="mat-text-warn">You must include phone number.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['phone'].errors?.phone && regForm.controls['phone'].touched" class="mat-text-warn">You must include a valid phone number.</mat-error>
|
||||
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
<input matInput placeholder="Alt Phone number" [formControl]="regForm.controls['altphone']" type="text">
|
||||
<mat-error *ngIf="regForm.controls['altphone'].errors?.phone && regForm.controls['phone'].touched" class="mat-text-warn">You must include a valid phone number.</mat-error>
|
||||
|
||||
|
||||
</mat-form-field>
|
||||
<!-- <mat-error *ngIf="regForm.controls['phone'].hasError('required') && regForm.controls['phone'].touched" class="mat-text-warn">You must include phone number.</mat-error> -->
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
|
||||
<input matInput placeholder="Address 1" [formControl]="regForm.controls['address1']">
|
||||
</mat-form-field>
|
||||
<input matInput placeholder="Address 1" [formControl]="regForm.controls['address1']">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
@ -82,36 +87,51 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||
<mat-select matInput placeholder="Select Role" [formControl]="regForm.controls['role']" required multiple>
|
||||
<!-- <mat-option #allSelected (click)="toggleAllSelection()" [value]="0">ALL</mat-option> -->
|
||||
<mat-option *ngFor="let role of roles" [value]="role" (onSelectionChange)="toggleAllSelection($event)" >
|
||||
{{role.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
||||
<mat-error *ngIf="regForm.controls['role'].hasError('required') && regForm.controls['role'].touched" class="mat-text-warn">Select User Role</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['role'].errors?.phone && regForm.controls['role'].touched" class="mat-text-warn">Select User Role</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <pre>{{regForm.controls['role'].value | json}}</pre> -->
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||
<mat-select matInput placeholder="Select type" (selectionChange)="checktype($event.value)"[formControl]="regForm.controls['type']" required>
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="usersData ===undefined">
|
||||
<mat-select matInput placeholder="Select type" (selectionChange)="checktype($event.value)" [formControl]="regForm.controls['type']"
|
||||
required>
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let types of types" [value]="types" >
|
||||
{{types.name}}
|
||||
<mat-option *ngFor="let types of types" [value]="types">
|
||||
{{types.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="regForm.controls['type'].hasError('required') && regForm.controls['type'].touched" class="mat-text-warn">Select User Role</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['type'].errors?.phone && regForm.controls['type'].touched" class="mat-text-warn">Select User Role</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="usersData !==undefined">
|
||||
<mat-select matInput placeholder="Select type" (selectionChange)="checktype($event.value)" [formControl]="regForm.controls['type']"
|
||||
readonly>
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let types of types" [value]="types">
|
||||
{{types.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error *ngIf="regForm.controls['type'].hasError('required') && regForm.controls['type'].touched" class="mat-text-warn">Select User Role</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['type'].errors?.phone && regForm.controls['type'].touched" class="mat-text-warn">Select User Role</mat-error> -->
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||
<mat-select matInput placeholder="Select Role" [formControl]="regForm.controls['role']" required multiple>
|
||||
<!-- <mat-option #allSelected (click)="toggleAllSelection()" [value]="0">ALL</mat-option> -->
|
||||
<mat-option *ngFor="let role of roles" [value]="role" (onSelectionChange)="toggleAllSelection($event)">
|
||||
{{role.GroupName}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
||||
<mat-error *ngIf="regForm.controls['role'].hasError('required') && regForm.controls['role'].touched" class="mat-text-warn">Select User Role</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['role'].errors?.phone && regForm.controls['role'].touched" class="mat-text-warn">Select User Role</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <pre>{{regForm.controls['role'].value | json}}</pre> -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||
<mat-select matInput placeholder="Select State" [formControl]="regForm.controls['state']" required>
|
||||
<mat-select matInput placeholder="Select State" [formControl]="regForm.controls['state']" required (selectionChange)="getcity($event)">
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let s of State" [value]="s">
|
||||
<mat-option *ngFor="let s of State" [value]="s" >
|
||||
{{s.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
@ -124,7 +144,7 @@
|
||||
{{c.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="typeValue == '1'">
|
||||
@ -143,32 +163,32 @@
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||
UserProfile
|
||||
<input type="file" (change)="onFileChange($event)" [formControl]="regForm.controls['userpic']"/>
|
||||
|
||||
<span *ngIf="usersData!=''">{{img}}</span>
|
||||
</div>
|
||||
|
||||
UserProfile
|
||||
<input type="file" (change)="onFileChange($event)" [formControl]="regForm.controls['userpic']" />
|
||||
|
||||
<mat-slide-toggle color="primary" [formControl]="regForm.controls['isactive']">
|
||||
Isactive
|
||||
</mat-slide-toggle>
|
||||
<span *ngIf="usersData!=''">{{img}}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<mat-slide-toggle color="primary" [formControl]="regForm.controls['isactive']">
|
||||
Isactive
|
||||
</mat-slide-toggle>
|
||||
</mat-card-content>
|
||||
<hr>
|
||||
<!-- <pre>{{regForm.controls['userid'].value | json}}</pre> -->
|
||||
|
||||
<mat-card-actions >
|
||||
|
||||
|
||||
<button mat-raised-button color="primary" type="submit">Submit</button>
|
||||
<mat-card-actions>
|
||||
|
||||
|
||||
<button mat-raised-button color="primary" type="submit">Submit</button>
|
||||
</mat-card-actions>
|
||||
</form>
|
||||
<!-- <button mat-raised-button color="primary" (click)="userupdate()" >Submit</button> -->
|
||||
</mat-card>
|
||||
<div *ngIf="loader">
|
||||
<mat-progress-bar mode="indeterminate" color="accent" class="mb-1"></mat-progress-bar>
|
||||
|
||||
<mat-progress-bar mode="indeterminate" color="accent" class="mb-1"></mat-progress-bar>
|
||||
|
||||
</div>
|
||||
@ -17,7 +17,7 @@ import { ifStmt } from '@angular/compiler/src/output/output_ast';
|
||||
export class RegisterComponent implements OnInit {
|
||||
img: any;
|
||||
roles: any;
|
||||
types: any;
|
||||
types: any = [];
|
||||
loader:boolean = false;
|
||||
public regForm: FormGroup;
|
||||
|
||||
@ -26,7 +26,7 @@ export class RegisterComponent implements OnInit {
|
||||
// password: string;
|
||||
// passwordConfirm: string;
|
||||
entityType: any;
|
||||
City: any;
|
||||
City: any = [];
|
||||
State: any;
|
||||
designation: any;
|
||||
hierarchy:any=[];
|
||||
@ -46,14 +46,11 @@ export class RegisterComponent implements OnInit {
|
||||
} else {
|
||||
this.regdata();
|
||||
}
|
||||
this.roles = [
|
||||
{ name: 'Admin', value: 'ADMIN' },
|
||||
{ name: 'Audit', value: 'AUDIT' }
|
||||
];
|
||||
|
||||
|
||||
this.regForm = this.fb.group({
|
||||
userid: [null],
|
||||
firstName: [null, Validators.compose([Validators.required, Validators.minLength(2), Validators.maxLength(10)])],
|
||||
firstName: [null, Validators.compose([Validators.required, Validators.minLength(2)])],
|
||||
lastName: [null, Validators.compose([Validators.required])],
|
||||
phone: [null, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(12)])],
|
||||
altphone: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(12)])],
|
||||
@ -127,6 +124,7 @@ export class RegisterComponent implements OnInit {
|
||||
//console.log(this.files);
|
||||
}
|
||||
register(userData) {
|
||||
// console.log(userData);
|
||||
let data:any;
|
||||
console.log(this.usersData);
|
||||
// console.log(this.files);
|
||||
@ -197,19 +195,25 @@ this.loader = true;
|
||||
}
|
||||
|
||||
}
|
||||
getcity(e){
|
||||
// console.log(e)
|
||||
// this.City =[]= this.City.filter(city=>city.fk_state == e.state_id)[0];
|
||||
}
|
||||
userupdate() {
|
||||
|
||||
if (this.users.localUserId != '' && this.users.localUserId != null && this.users.localUserId !== undefined) {
|
||||
this.usersData = this.users.localUserId;
|
||||
console.log(this.usersData);
|
||||
console.log(this.usersData);
|
||||
|
||||
this.users.entityType().subscribe(res => {
|
||||
this.types = res;
|
||||
if (this.types.status == 200) {
|
||||
this.types = this.types.records;
|
||||
let type = this.types.filter(type => type.entity_type_id == this.usersData.fk_entity_id)[0];
|
||||
this.regForm.controls['type'].setValue(type);
|
||||
this.checktype(type);
|
||||
let type = this.types.records;
|
||||
this.types= type.filter(type => type.entity_type_id == this.usersData.fk_entity_id);
|
||||
this.checktype(this.types[0]);
|
||||
|
||||
this.regForm.controls['type'].setValue(this.types[0]);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
this.users.City().subscribe(res => {
|
||||
@ -248,13 +252,8 @@ this.loader = true;
|
||||
|
||||
}
|
||||
})
|
||||
let userRole: any = [];
|
||||
//console.log(this.usersData.profilepic);
|
||||
for (let role of this.usersData[0]) {
|
||||
//console.log(role);
|
||||
userRole.push(this.roles.filter(roles => roles.value == role.user_role)[0]);
|
||||
//console.log(userRole);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//console.log(userRole);
|
||||
// this.regForm.controls['firstName'].setValue({'firstName':'sriram'});
|
||||
@ -273,18 +272,32 @@ this.loader = true;
|
||||
} else {
|
||||
this.regForm.controls['isactive'].setValue(false);
|
||||
}
|
||||
this.regForm.controls['role'].setValue(userRole);
|
||||
|
||||
// this.regForm.controls['userpic'].setValue(this.usersData.profilepic);
|
||||
this.regForm.controls['pincode'].setValue(this.usersData.pincode);
|
||||
this.img = this.usersData.profilepic;
|
||||
}
|
||||
}
|
||||
checktype(e){
|
||||
console.log(e);
|
||||
//console.log(e);
|
||||
let userRole:any = [];
|
||||
if(e !== undefined){
|
||||
this.AWS.adminlistgroup(e.entity_type_id).subscribe(res=>{
|
||||
this.roles = res;
|
||||
if(this.usersData !==undefined){
|
||||
for (let role of this.usersData[0]) {
|
||||
//console.log(role);
|
||||
userRole.push(this.roles.filter(roles => roles.GroupName == role.user_role)[0]);
|
||||
//console.log(userRole);
|
||||
this.regForm.controls['role'].setValue(userRole);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
switch (e.entity_type_id) {
|
||||
case "1":
|
||||
this.typeValue =1;
|
||||
|
||||
break;
|
||||
case "2":
|
||||
this.typeValue =2;
|
||||
@ -296,7 +309,10 @@ this.loader = true;
|
||||
this.typeValue = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
back(){
|
||||
delete this.users.localUserId;
|
||||
|
||||
@ -40,66 +40,67 @@
|
||||
</mat-card> -->
|
||||
|
||||
<mat-card-content>
|
||||
<div style="text-align: right;">
|
||||
<button mat-raised-button color="primary" (click)="add()"> + Add Register</button>
|
||||
</div>
|
||||
<br>
|
||||
<div *ngIf="loader">
|
||||
<mat-progress-bar mode="indeterminate" color="accent" class="mb-1"></mat-progress-bar>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<button mat-raised-button color="primary" (click)="add()"> + Add Register</button>
|
||||
</div>
|
||||
<br>
|
||||
<div *ngIf="loader">
|
||||
<mat-progress-bar mode="indeterminate" color="accent" class="mb-1"></mat-progress-bar>
|
||||
</div>
|
||||
|
||||
<div class="example-header">
|
||||
<mat-form-field>
|
||||
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="example-container mat-elevation-z8">
|
||||
|
||||
<mat-table [dataSource]="dataSource" matSort >
|
||||
|
||||
<ng-container matColumnDef="SerialNo">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header>Sl </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row; let i = index;"> {{i+1}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="FullName">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Full Name </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.user_first_name}} {{us.user_last_name}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Email">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Email Id </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.email}} </mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Mobile">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Mobile No </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.mobile_no}} </mat-cell>
|
||||
<div class="example-header">
|
||||
<mat-form-field>
|
||||
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="example-container mat-elevation-z8">
|
||||
|
||||
<mat-table [dataSource]="dataSource" matSort >
|
||||
|
||||
<ng-container matColumnDef="SerialNo">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header>Sl </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row; let i = index;"> {{i+1}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="IsActive">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Is Active </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"><!--{{row.isactive}}-->
|
||||
<a (click)="isactive(us.userid,us.aws_name)"><mat-icon *ngIf="us.isactive == 1;else notactive;" class="active" matTooltip="Active" matTooltipPosition="above">done</mat-icon></a>
|
||||
<a (click)="isactive(us.userid,us.aws_name)"><ng-template #notactive ><mat-icon class="deactive" matTooltip="Inactive" matTooltipPosition="above">close</mat-icon></ng-template></a>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Actions">
|
||||
<mat-header-cell *matHeaderCellDef> Actions </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us">
|
||||
<a mat-icon-button class="hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editUserDetails(us.userid,us.aws_name)"><mat-icon>edit</mat-icon></a>
|
||||
<a mat-icon-button class="hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="deleteuser(us)"><mat-icon>delete_forever</mat-icon></a>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns;">
|
||||
</mat-row>
|
||||
</mat-table>
|
||||
<ng-container matColumnDef="FullName">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Full Name </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.user_first_name}} {{us.user_last_name}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Email">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Email Id </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.email}} </mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Mobile">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Mobile No </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.mobile_no}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="IsActive">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Is Active </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"><!--{{row.isactive}}-->
|
||||
<a (click)="isactive(us.userid,us.aws_name)"><mat-icon *ngIf="us.isactive == 1;else notactive;" class="active" matTooltip="Active" matTooltipPosition="above">done</mat-icon></a>
|
||||
<a (click)="isactive(us.userid,us.aws_name)"><ng-template #notactive ><mat-icon class="deactive" matTooltip="Inactive" matTooltipPosition="above">close</mat-icon></ng-template></a>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- <div *ngIf="dataSource.length === 0">No records found</div> -->
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50, 100]"></mat-paginator>
|
||||
</div>
|
||||
<ng-container matColumnDef="Actions">
|
||||
<mat-header-cell *matHeaderCellDef> Actions </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us">
|
||||
<a mat-icon-button class="hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editUserDetails(us.userid,us.aws_name)"><mat-icon>edit</mat-icon></a>
|
||||
<!-- <a mat-icon-button class="hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="deleteuser(us)"><mat-icon>delete_forever</mat-icon></a>
|
||||
<a mat-icon-button class="hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="adminedituser(us)"><mat-icon>account_circle</mat-icon></a> -->
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns;">
|
||||
</mat-row>
|
||||
</mat-table>
|
||||
|
||||
<!-- <div *ngIf="dataSource.length === 0">No records found</div> -->
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50, 100]"></mat-paginator>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
||||
@ -26,6 +26,7 @@ export class UserListComponent implements OnInit {
|
||||
constructor(public aws: AwsService, public route: Router,public users:UserService) {
|
||||
|
||||
this.getusers();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -116,9 +117,15 @@ export class UserListComponent implements OnInit {
|
||||
add(){
|
||||
this.route.navigate(['setting/users/register']);
|
||||
}
|
||||
// deleteuser(user){
|
||||
// this.aws.deleteAws(user).subscribe(res=>{
|
||||
// this.getusers();
|
||||
// });
|
||||
// }
|
||||
deleteuser(user){
|
||||
this.aws.admindelete(user).subscribe(res=>{
|
||||
this.getusers();
|
||||
});
|
||||
}
|
||||
adminedituser(user){
|
||||
this.aws.adminresetpassword(user).subscribe(res=>{
|
||||
this.getusers();
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
126
ng6-seed/src/app/settings/users/user-profile/user-profile-component.html
Executable file
126
ng6-seed/src/app/settings/users/user-profile/user-profile-component.html
Executable file
@ -0,0 +1,126 @@
|
||||
<div class="user-profile relative">
|
||||
<div class="profile-cover">
|
||||
</div>
|
||||
<div class="">
|
||||
<!-- <div fxLayout="row" fxLayoutWrap="wrap" class="profile-w">
|
||||
<div fxFlex.gt-sm="25" fxFlex.gt-xs="25" fxFlex="20">
|
||||
</div>
|
||||
<div fxFlex.gt-sm="50" fxFlex.gt-xs="50" fxFlex="80" class="user-links">
|
||||
<ul class="profile-menu">
|
||||
<li><a href="">Tweets<span class="block text-lg-center">217</span></a></li>
|
||||
<li><a href="">Followings<span class="block text-lg-center">89</span></a></li>
|
||||
<li><a href="">Followers<span class="block text-lg-center">78,6790</span></a></li>
|
||||
<li><a href="">Likes<span class="block text-lg-center">7</span></a></li>
|
||||
<li><a href="">Moments<span class="block text-lg-center">0</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div fxFlex.gt-sm="25" fxFlex.gt-xs="25" fxFlex="100" class="align-self-center">
|
||||
<button type="button" class="UserActions-editButton edit-button EdgeButton EdgeButton--tertiary" data-scribe-element="profile_edit_button">
|
||||
<span class="button-text">Edit profile</span>
|
||||
</button>
|
||||
</div>
|
||||
</div> -->
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div fxFlex.gt-sm="25" fxFlex.gt-xs="50" fxFlex="100" class="relative">
|
||||
<div class="profile-avatar">
|
||||
<img src="../../../assets/images/test3.jpg" width="200" height="200" alt="user">
|
||||
</div>
|
||||
<div class="profile-info">
|
||||
<h3 class="profile-name"><strong>{{userDetails.user_full_name}}</strong></h3>
|
||||
<span class="user-name">{{userDetails.email}}</span>
|
||||
<span class="user-name">{{userDetails.mobile_no}}</span>
|
||||
|
||||
<span class="pro-des">
|
||||
|
||||
</span>
|
||||
<span><i class="fa fa-map-marker"></i> {{userDetails.addressline1}} {{userDetails.addressline2}}</span>
|
||||
<span><i class="fa fa-calendar"></i>{{userDetails.addressline3}} {{userDetails.state_name}} - {{userDetails.pincode}}</span>
|
||||
<span>{{userDetails.createdon | date:'dd MMM yyyy'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex.gt-sm="50" fxFlex.gt-xs="50" fxFlex="100" class="mt-1">
|
||||
<div class="profile-content">
|
||||
<div class="profile-head">
|
||||
<h4>Tweets</h4>
|
||||
<div fxFlex.gt-sm="25" fxFlex.gt-xs="25" fxFlexOffset="50" fxFlex="100" class="align-self-center">
|
||||
<button type="button" class="UserActions-editButton edit-button EdgeButton EdgeButton--tertiary" data-scribe-element="profile_edit_button" (click)="changePassword()">
|
||||
<span class="button-text">Edit profile</span>
|
||||
</button>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="profile-cont">
|
||||
<ul class="pl-0">
|
||||
<li>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex.xs="15" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="15" fxFlex.xl="15"> <img class="profile-thumb" src="../../../assets/images/test3.jpg" width="80" height="80" alt="user">
|
||||
</div>
|
||||
<div class="pl-1 pr-1 profile-i" fxFlex.xs="85" fxFlex.sm="85" fxFlex.md="85" fxFlex.lg="85" fxFlex.xl="85">
|
||||
<div>
|
||||
<span class="post-profile-head">{{userDetails.user_full_name}}</span>
|
||||
<span class="twitter-uname"><i class="fa fa-email"></i> {{userDetails.email}}</span>
|
||||
<span class="time">{{userDetails.createdon | date:'dd MMM yyyy'}}</span>
|
||||
<p><i class="fa fa-mobile"></i> {{userDetails.mobile_no}}</p>
|
||||
<p>{{userDetails.addressline1}} {{userDetails.addressline2}} <br/>
|
||||
{{userDetails.addressline3}} - {{userDetails.pincode}} {{userDetails.state_name}}
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="profile-action"><a href=""><i class="fa fa-retweet"></i></a><a href=""><i class="fa fa-comment-o"></i></a><a href=""><i class="fa fa-heart-o"></i></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex.xs="15" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="15" fxFlex.xl="15"> <img class="profile-thumb" src="../../../assets/images/test3.jpg" width="80" height="80" alt="user">
|
||||
</div>
|
||||
<div class="pl-1 pr-1 profile-i" fxFlex.xs="85" fxFlex.sm="85" fxFlex.md="85" fxFlex.lg="85" fxFlex.xl="85">
|
||||
<div>
|
||||
<span class="post-profile-head">Jane Doe</span>
|
||||
<span class="twitter-uname">@JaneDoe</span>
|
||||
<span class="time">Sep 11, 2017</span>
|
||||
<p>
|
||||
“Tomorrow belongs to those who can hear it coming.” - David Bowie
|
||||
</p>
|
||||
</div>
|
||||
<div class="profile-action"><a href=""><i class="fa fa-retweet"></i></a><a href=""><i class="fa fa-comment-o"></i></a><a href=""><i class="fa fa-heart-o"></i></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex.xs="15" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="15" fxFlex.xl="15"> <img class="profile-thumb" src="../../../assets/images/test3.jpg" width="80" height="80" alt="user">
|
||||
</div>
|
||||
<div class="pl-1 pr-1 profile-i" fxFlex.xs="85" fxFlex.sm="85" fxFlex.md="85" fxFlex.lg="85" fxFlex.xl="85">
|
||||
<div>
|
||||
<span class="post-profile-head">Jane Doe</span>
|
||||
<span class="twitter-uname">@JaneDoe</span>
|
||||
<span class="time">Sep 13, 2017</span>
|
||||
<p>our recent work</p>
|
||||
</div>
|
||||
<div class="img-wrp" fxLayout="row" fxLayoutWrap="space-around">
|
||||
<div fxFlex.gt-sm="50" fxFlex.gt-xs="50" fxFlex="100">
|
||||
<div class="thumb-border">
|
||||
<img src="../../../assets/images/blog-1.jpg" alt="user">
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex.gt-sm="50" fxFlex.gt-xs="50" fxFlex="100">
|
||||
<div class="thumb-border">
|
||||
<img src="../../../assets/images/blog-2.jpg" alt="user">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile-action"><a href=""><i class="fa fa-retweet"></i></a><a href=""><i class="fa fa-comment-o"></i></a><a href=""><i class="fa fa-heart-o"></i></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex.gt-sm="25" fxFlex.gt-xs="50" fxFlex="100" class="align-self-center">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
0
ng6-seed/src/app/settings/users/user-profile/user-profile-component.scss
Executable file
0
ng6-seed/src/app/settings/users/user-profile/user-profile-component.scss
Executable file
109
ng6-seed/src/app/settings/users/user-profile/user-profile.component.ts
Executable file
109
ng6-seed/src/app/settings/users/user-profile/user-profile.component.ts
Executable file
@ -0,0 +1,109 @@
|
||||
import { Component, OnInit,ViewEncapsulation } from '@angular/core';
|
||||
import { AwsService } from '../../../AwsService/aws.service';
|
||||
import { MatDialog, MatDialogRef, MatDialogConfig } from '@angular/material';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||
import { CustomValidators } from 'ng2-validation';
|
||||
import { UserService } from '../../service/user.service';
|
||||
@Component({
|
||||
selector: 'ms-user-profile',
|
||||
templateUrl:'./user-profile-component.html',
|
||||
styleUrls: ['./user-profile-component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class UserProfileComponent implements OnInit {
|
||||
config: MatDialogConfig = {
|
||||
disableClose: false,
|
||||
width: '',
|
||||
height: '',
|
||||
position: {
|
||||
top: '',
|
||||
bottom: '',
|
||||
left: '',
|
||||
right: ''
|
||||
}
|
||||
};
|
||||
userDetails:any=[];
|
||||
constructor(public AWS:AwsService,public dialog: MatDialog,public users:UserService ) {
|
||||
this.getuser();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
getuser(){
|
||||
//console.log(this.AWS.getUser());
|
||||
this.users.getroles().subscribe(res=>{
|
||||
this.userDetails = res;
|
||||
this.userDetails = this.userDetails.records[0];
|
||||
});
|
||||
}
|
||||
changePassword(){
|
||||
let dialogRef = this.dialog.open(ChangePasswordDialog,this.config);
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
|
||||
if(result !==undefined){
|
||||
if(result.confirmPassword !== undefined && result.confirmPassword !="" && result.newPassword !="" && result.oldPassword !=""){
|
||||
this.AWS.changepassword(result)
|
||||
.subscribe(res=>{
|
||||
alert('Change Password');
|
||||
})
|
||||
}
|
||||
}
|
||||
//console.log(ChangePasswordDialog.prototype.pass);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-jazz-dialog',
|
||||
template: `
|
||||
<h5 class="mt-0">New Password Change.</h5>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Old Password" [(ngModel)]="pass.oldPassword" type="password" style="width: 100%;">
|
||||
|
||||
</mat-form-field>
|
||||
<br/>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="New Password" [(ngModel)]="pass.newPassword" type="password" style="width: 100%;">
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<br/>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="ConfirmPassword" [(ngModel)]="pass.confirmPassword" type="password" style="width: 100%;">
|
||||
</mat-form-field>
|
||||
|
||||
<small *ngIf="pass.confirmPassword !='' && pass.newPassword != pass.confirmPassword" class="mat-text-warn">Passwords do not math.</small>
|
||||
|
||||
<br>
|
||||
|
||||
<button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(pass)">Submit</button>
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
export class ChangePasswordDialog{
|
||||
|
||||
pass = {
|
||||
oldPassword:'',
|
||||
newPassword:'',
|
||||
confirmPassword:'',
|
||||
|
||||
}
|
||||
|
||||
jazzMessage = 'Jazzy jazz jazz';
|
||||
|
||||
constructor(public dialogRef: MatDialogRef <ChangePasswordDialog>,public aws:AwsService) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ import { RouterModule } from '@angular/router';
|
||||
import { UserRoutes} from './users.routing';
|
||||
import { RegisterComponent } from './register/register.component';
|
||||
import { UserListComponent} from './user-list/user-list.component';
|
||||
import { UserProfileComponent, ChangePasswordDialog } from './user-profile/user-profile.component';
|
||||
|
||||
import { NewPasswordDialog, ForgotPass } from '../../session/login/login.component';
|
||||
// import { HttpClientModule } from '@angular/common/http';
|
||||
@ -36,7 +37,7 @@ import { NewPasswordDialog, ForgotPass } from '../../session/login/login.compone
|
||||
FormsModule, ReactiveFormsModule,
|
||||
// HttpClientModule,
|
||||
],
|
||||
declarations: [UserListComponent, RegisterComponent],
|
||||
declarations: [UserListComponent, RegisterComponent,UserProfileComponent],
|
||||
|
||||
|
||||
})
|
||||
|
||||
@ -2,6 +2,7 @@ import { Routes } from '@angular/router';
|
||||
|
||||
import { UserListComponent } from './user-list/user-list.component';
|
||||
import { RegisterComponent } from './register/register.component';
|
||||
import { UserProfileComponent } from './user-profile/user-profile.component';
|
||||
export const UserRoutes: Routes = [{
|
||||
path: '',
|
||||
redirectTo: 'userlist',
|
||||
@ -14,5 +15,8 @@ export const UserRoutes: Routes = [{
|
||||
},{
|
||||
path: 'register',
|
||||
component: RegisterComponent
|
||||
},{
|
||||
path:'userprofile',
|
||||
component:UserProfileComponent
|
||||
}]
|
||||
}];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user