QC completed tab hidden
This commit is contained in:
parent
7db0cc5d98
commit
214d1f472e
@ -786,5 +786,37 @@ adminlistgroup(enitiy){
|
||||
});
|
||||
|
||||
}
|
||||
// adminSetpassword(awsuser,lenname){
|
||||
// // console.log(awsuser,lenname);
|
||||
// this.getconfig();
|
||||
// if(lenname == 'SINEEDGE'){
|
||||
// var params = {
|
||||
// Password: 'temp1234', /* required */
|
||||
// UserPoolId: se_poolData.UserPoolId, /* required */
|
||||
// Username: awsuser, /* required */
|
||||
// Permanent: false
|
||||
// };
|
||||
// }
|
||||
// else{
|
||||
// if(lenname == 'LENDER'){
|
||||
// var params = {
|
||||
// Password: 'temp1234', /* required */
|
||||
// UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||
// Username: awsuser, /* required */
|
||||
// Permanent: false
|
||||
// };
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// return Observable.create(observe=>{
|
||||
// let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||
// cognitoidentityserviceprovider.adminSetUserPassword(params, function(err, data) {
|
||||
// if (err) console.log(err, err.stack); // an error occurred
|
||||
// else {observe.next('success'); console.log(data);} // successful response
|
||||
// });
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -32,12 +32,12 @@
|
||||
|
||||
|
||||
</mat-tab>
|
||||
<mat-tab>
|
||||
<!-- <mat-tab>
|
||||
<ng-template mat-tab-label><mat-icon>done_all</mat-icon> QC Completed </ng-template>
|
||||
<app-qc-completed-pd [bindFilterValue]="filterValue" (loadPdView)="viewPDDetails($event)"></app-qc-completed-pd>
|
||||
|
||||
|
||||
</mat-tab>
|
||||
</mat-tab> -->
|
||||
|
||||
</mat-tab-group>
|
||||
</mat-card>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { AwsService } from '../../AwsService/aws.service';
|
||||
import { environment } from 'environments/environment';
|
||||
@ -18,12 +18,13 @@ export class UserService {
|
||||
constructor(public http:HttpClient,public aws:AwsService) { }
|
||||
|
||||
|
||||
getuserdata() {
|
||||
|
||||
return this.http.get(apiurl + 'getListOfUsers');
|
||||
|
||||
|
||||
}
|
||||
getuserdata(): Observable<any> {
|
||||
let LocalSetEntity : string = localStorage.getItem('LocalSetEntity');
|
||||
let entityID =
|
||||
{ params: new HttpParams().set('eid', LocalSetEntity) };
|
||||
return this.http.get<any>(apiurl + 'getListOfUsers/',entityID);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Local Update
|
||||
@ -241,5 +242,11 @@ export class UserService {
|
||||
return 'credit'
|
||||
}
|
||||
}
|
||||
|
||||
// get lenders list
|
||||
getLenderDetails(): Observable<any> {
|
||||
return this.http.get<any>(apiurl + 'getListOfLenders');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
184
ng6-seed/src/app/settings/users/register/register.component.html
Executable file
184
ng6-seed/src/app/settings/users/register/register.component.html
Executable file
@ -0,0 +1,184 @@
|
||||
<mat-card>
|
||||
<form [formGroup]="regForm" (ngSubmit)="register(regForm.value)">
|
||||
<mat-card-content>
|
||||
<div fxflex="100" fxLayout="row" fxLayoutAlign="start center">
|
||||
<div dividerColor="primary" class="ml-xs mr-xs">
|
||||
<div style="font-size:24px;"> User Registration</div>
|
||||
</div>
|
||||
<div dividerColor="primary" class="ml-xs mr-xs" style="text-align: right;margin-top: -4%;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above"(click)="back()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex.gt-sm="33.33%" fxFlex="50" class="m-gap p-gap">
|
||||
<mat-card>
|
||||
<mat-card-title>Personal</mat-card-title><hr/>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||
<label class="hoverdp" for="fileUpload" >
|
||||
<span dividerColor="primary" class="ml-xs mr-xs" *ngIf="!imageaccess">
|
||||
<img [src]="profileurl || 'https://image.ibb.co/mGjZB9/usernew.png'" style="width: 100px;height:100px;border-radius: 50%;border:2px solid red">
|
||||
</span>
|
||||
<span dividerColor="primary" *ngIf="imageaccess">
|
||||
<img [src]="filename" style="width: 100px;height:100px; border-radius: 50%;border:2px solid #e00201">
|
||||
</span>
|
||||
<mat-icon style="color:#716462;position: absolute; top: 39%;left: 5.5%;">camera_alt</mat-icon>
|
||||
</label>
|
||||
|
||||
|
||||
<input type="file" id="fileUpload" (change)="onFileChange($event)" [formControl]="regForm.controls['userpic']" accept="image/*" style="display:none"/>
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
<input matInput placeholder="First Name" [formControl]="regForm.controls['firstName']" required>
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('required') && regForm.controls['firstName'].touched" class="mat-text-warn">First Name Required.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('minlength') && regForm.controls['firstName'].touched" class="mat-text-warn">Atleast 5 Characters.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['firstName'].hasError('maxlength') && regForm.controls['firstName'].touched" class="mat-text-warn">Not More Than 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">Last Name Required.</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="display: none;">
|
||||
<input matInput placeholder="User Id" [formControl]="regForm.controls['userid']">
|
||||
</mat-form-field>
|
||||
<mat-slide-toggle color="primary" [formControl]="regForm.controls['isactive']">
|
||||
Isactive
|
||||
</mat-slide-toggle>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon ml-1" matTooltip="Password Reset" matTooltipPosition="above" type="button" (click)="resetAdminPassword()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div fxFlex.gt-sm="33.33%" fxFlex="50" class="m-gap p-gap">
|
||||
<mat-card>
|
||||
<mat-card-title>Contact</mat-card-title><hr/>
|
||||
<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="Email Address" [formControl]="regForm.controls['email']" type="email" required>
|
||||
<mat-error *ngIf="regForm.controls['email'].hasError('required') && regForm.controls['email'].touched" class="mat-text-warn">Email Address Required.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['email'].errors?.email && regForm.controls['email'].touched" class="mat-text-warn">Invalid Email Address.</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||
<input matInput placeholder="Phone Number" [formControl]="regForm.controls['phone']" required (keypress)="keyPress($event)">
|
||||
<mat-error *ngIf="regForm.controls['phone'].hasError('required') && regForm.controls['phone'].touched" class="mat-text-warn">Phone Number Required.</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['phone'].errors?.phone && regForm.controls['phone'].touched" class="mat-text-warn">Invalid Phone Number.</mat-error>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" >
|
||||
<mat-select matInput placeholder="State" [formControl]="regForm.controls['state']" required (selectionChange)="getcity($event)" >
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let s of State" [value]="s" >
|
||||
{{s.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="regForm.controls['state'].hasError('required') && regForm.controls['state'].touched" class="mat-text-warn">State Required.</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" >
|
||||
<mat-select matInput placeholder="City" [formControl]="regForm.controls['city']" required>
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let c of City" [value]="c">
|
||||
{{c.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="regForm.controls['city'].hasError('required') && regForm.controls['city'].touched" class="mat-text-warn">city Required.</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div fxFlex.gt-sm="33.33%" fxFlex="50" class="m-gap p-gap">
|
||||
<mat-card>
|
||||
|
||||
<mat-card-title>Role</mat-card-title><hr/>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" >
|
||||
<mat-select matInput placeholder="Entity 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>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="regForm.controls['type'].hasError('required') && regForm.controls['type'].touched" class="mat-text-warn">Enitity Type Required</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['type'].errors?.phone && regForm.controls['type'].touched" class="mat-text-warn">Enitity Type Required</mat-error>
|
||||
|
||||
</mat-form-field>
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" *ngIf="typeValue == '2'">
|
||||
<mat-select matInput placeholder="Lender Name" [formControl]="regForm.controls['lenVenName']" (selectionChange)="getBranch()">
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let ent of entities" [value]="ent">
|
||||
{{ent.full_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="regForm.controls['lenVenName'].hasError('required') && regForm.controls['lenVenName'].touched" class="mat-text-warn">Lender Name Required.</mat-error>
|
||||
|
||||
</mat-form-field>
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" *ngIf="typeValue == '3'">
|
||||
<mat-select matInput placeholder="Vendor Name" [formControl]="regForm.controls['lenVenName']" >
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let ent of entities" [value]="ent">
|
||||
{{ent.full_name}}
|
||||
</mat-option>
|
||||
</mat-select><mat-error *ngIf="regForm.controls['lenVenName'].hasError('required') && regForm.controls['lenVenName'].touched" class="mat-text-warn">Vendor Name Required.</mat-error>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" >
|
||||
<mat-select matInput placeholder="Role" (selectionChange)="toggleAllSelection($event.value,regForm.controls['type'].value)" [formControl]="regForm.controls['role']" >
|
||||
<mat-option *ngFor="let role of roles" [value]="role" >
|
||||
{{role.role_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
||||
<div *ngIf="roleload"><mat-progress-bar mode="indeterminate" color="defalut"></mat-progress-bar></div>
|
||||
<mat-error *ngIf="regForm.controls['role'].hasError('required') && regForm.controls['role'].touched" class="mat-text-warn">User Role Required</mat-error>
|
||||
<mat-error *ngIf="regForm.controls['role'].errors?.phone && regForm.controls['role'].touched" class="mat-text-warn">User Role Required</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" *ngIf="enableBranch">
|
||||
<mat-select matInput placeholder="Branch" [formControl]="regForm.controls['fk_lender_branch_id']" >
|
||||
<mat-option *ngFor="let branch of branchList" [value]="branch.entity_lender_branch_id" >
|
||||
{{branch.branch_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="regForm.controls['fk_lender_branch_id'].hasError('required')" class="mat-text-warn">Branch is Required</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" *ngIf="roleAccess">
|
||||
<mat-select matInput placeholder="PD Team" [formControl]="regForm.controls['pdteam']" >
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let pd of pdTeam" [value]="pd" >
|
||||
{{pd.team_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
<hr>
|
||||
<mat-card-actions style="text-align:right;">
|
||||
|
||||
<button *ngIf = "this.regForm.controls['userid'].value == null ; else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
</ng-template>
|
||||
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Submit" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
|
||||
|
||||
</mat-card-actions>
|
||||
</form>
|
||||
</mat-card>
|
||||
<div *ngIf="loader">
|
||||
<mat-progress-bar mode="indeterminate" color="primary" class="mb-1"></mat-progress-bar>
|
||||
|
||||
</div>
|
||||
14
ng6-seed/src/app/settings/users/register/register.component.scss
Executable file
14
ng6-seed/src/app/settings/users/register/register.component.scss
Executable file
@ -0,0 +1,14 @@
|
||||
.hoverdp:hover img {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.hoverdp mat-icon{
|
||||
display:none;
|
||||
}
|
||||
.hoverdp:hover mat-icon{
|
||||
display:block;
|
||||
}
|
||||
mat-form-field {
|
||||
width:23%;
|
||||
}
|
||||
|
||||
25
ng6-seed/src/app/settings/users/register/register.component.spec.ts
Executable file
25
ng6-seed/src/app/settings/users/register/register.component.spec.ts
Executable file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RegisterComponent } from './register.component';
|
||||
|
||||
describe('RegisterComponent', () => {
|
||||
let component: RegisterComponent;
|
||||
let fixture: ComponentFixture<RegisterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RegisterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RegisterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
540
ng6-seed/src/app/settings/users/register/register.component.ts
Executable file
540
ng6-seed/src/app/settings/users/register/register.component.ts
Executable file
@ -0,0 +1,540 @@
|
||||
import { Component, OnInit, ChangeDetectorRef, ViewChild, ElementRef,Pipe } from '@angular/core';
|
||||
|
||||
import { Router } from "@angular/router";
|
||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||
import { CustomValidators } from 'ng2-validation';
|
||||
import { AwsService } from '../../../AwsService/aws.service';
|
||||
import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
|
||||
// import { SharedService } from '../../shared.service';
|
||||
import { MatOption } from '@angular/material';
|
||||
import { UserService } from '../../service/user.service';
|
||||
import { ifStmt } from '@angular/compiler/src/output/output_ast';
|
||||
/**sweet alert */
|
||||
import Swal from 'sweetalert2';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
const pdoff = "PD Officer";
|
||||
const pdexu = "PD Executive";
|
||||
|
||||
@Component({
|
||||
selector: 'app-register',
|
||||
templateUrl: './register.component.html',
|
||||
styleUrls: ['./register.component.scss']
|
||||
})
|
||||
|
||||
|
||||
export class RegisterComponent implements OnInit {
|
||||
Cities: any;
|
||||
role: any;
|
||||
imageaccess: boolean = false;
|
||||
filename:any;
|
||||
roleload:boolean = false;
|
||||
pdTeam: any = [];
|
||||
customerSeg: any = [];
|
||||
pdType: any = [];
|
||||
product: any = [];
|
||||
img: any;
|
||||
roles: any;
|
||||
types: any = [];
|
||||
loader:boolean = false;
|
||||
roleAccess:boolean = false;
|
||||
public regForm: FormGroup;
|
||||
|
||||
// name: string;
|
||||
// email: string;
|
||||
// password: string;
|
||||
// passwordConfirm: string;
|
||||
entityType: any;
|
||||
City: any = [];
|
||||
State: any;
|
||||
designation: any;
|
||||
hierarchy:any=[];
|
||||
files: File = null
|
||||
usersData: any;
|
||||
sampledrop:any;
|
||||
typeValue:any;
|
||||
lenderHierarchy:any;
|
||||
@ViewChild('allSelected') private allSelected: MatOption;
|
||||
profileurl: any;
|
||||
profileaccess: boolean;
|
||||
entitiesDetails:any;
|
||||
entities:any;
|
||||
notifier:NotifierService;
|
||||
entity_for_branch: any;
|
||||
branchList: any;
|
||||
enableBranch: boolean=false;
|
||||
constructor(
|
||||
private router: Router, public fb: FormBuilder, public AWS: AwsService, private cd: ChangeDetectorRef
|
||||
,private elementRef: ElementRef,public users:UserService,notifier:NotifierService) {
|
||||
this.notifier=notifier
|
||||
// console.log(this.notifier)
|
||||
}
|
||||
ngOnInit() {
|
||||
if (this.users.localUserId != '' && this.users.localUserId != null && this.users.localUserId !== undefined) {
|
||||
|
||||
} else {
|
||||
|
||||
this.regdata();
|
||||
}
|
||||
|
||||
|
||||
this.regForm = this.fb.group({
|
||||
userid: [null],
|
||||
firstName: [null, Validators.compose([Validators.required, Validators.minLength(2)])],
|
||||
lastName: [''],
|
||||
phone: [null, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(12)])],
|
||||
email: [null, Validators.compose([Validators.required, CustomValidators.email])],
|
||||
role: [null, Validators.compose([Validators.required])],
|
||||
type: [null, Validators.compose([Validators.required])],
|
||||
state: [null, Validators.compose([Validators.required])],
|
||||
city: [null, Validators.compose([Validators.required])],
|
||||
lenVenName: [null],
|
||||
userpic: [null],
|
||||
isactive: [true],
|
||||
pdteam:[null],
|
||||
pdtype:[null],
|
||||
fk_lender_branch_id:[null]
|
||||
|
||||
});
|
||||
this.userupdate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
regdata() {
|
||||
this.users.entityType().subscribe(res => {
|
||||
this.types = res;
|
||||
|
||||
if (this.types.status == 200) {
|
||||
this.types = this.types.records;
|
||||
//console.log(this.types);
|
||||
this.regForm.controls['type'].setValue(this.types[0]);
|
||||
// this.users.roles().subscribe(res=>{
|
||||
// console.log('res',res);
|
||||
// this.roleload = false;
|
||||
// console.log('this.roleload',this.roleload);
|
||||
// this.role = res;
|
||||
// if(this.role.dataStatus == true){
|
||||
// this.role = this.role.records;
|
||||
// this.checktype(this.types[0]);
|
||||
// }
|
||||
// });
|
||||
this.callrole(1,this.types[0],'');
|
||||
}
|
||||
});
|
||||
this.users.City().subscribe(res => {
|
||||
this.Cities = res;
|
||||
if (this.Cities.status == 200) {
|
||||
this.Cities = this.Cities.records.filter(City=>City.isactive ==1);
|
||||
}
|
||||
});
|
||||
this.users.State().subscribe(res => {
|
||||
this.State = res;
|
||||
if (this.State.status == 200) {
|
||||
this.State = this.State.records.filter(state=>state.isactive ==1);
|
||||
}
|
||||
});
|
||||
|
||||
this.users.pdTeam().subscribe(res=>{
|
||||
|
||||
this.pdTeam = res;
|
||||
if(this.pdTeam.status == 200){
|
||||
this.pdTeam = this.pdTeam.records.filter(pdt=>pdt.isactive ==1);
|
||||
}
|
||||
});
|
||||
this.users.pdType().subscribe(res=>{
|
||||
this.pdType = res;
|
||||
if(this.pdType.status == 200){
|
||||
this.pdType = this.pdType.records.filter(pdty=>pdty.isactive ==1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.users.entitiesDetails().subscribe(res=>{
|
||||
this.entitiesDetails = res;
|
||||
if(this.entitiesDetails.dataStatus == true){
|
||||
this.entitiesDetails = this.entitiesDetails.records;
|
||||
}
|
||||
})
|
||||
this.users.getLenderDetails().subscribe(res=>{
|
||||
this.entity_for_branch=res
|
||||
if(this.entity_for_branch.dataStatus == true){
|
||||
this.entity_for_branch = this.entity_for_branch.records;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
onFileChange($event) {
|
||||
//console.log($event.target.files[0]);
|
||||
this.imageaccess = true;
|
||||
var reader = new FileReader();
|
||||
//if($event.target.files[0] < 0 ){
|
||||
this.files = $event.target.files[0];
|
||||
// console.log(this.files);
|
||||
|
||||
reader.onload = ($event: ProgressEvent) => {
|
||||
// console.log((<FileReader>$event.target).result);
|
||||
this.filename = (<FileReader>$event.target).result;
|
||||
}
|
||||
|
||||
reader.readAsDataURL($event.target.files[0]);
|
||||
//}
|
||||
//console.log(this.files);
|
||||
}
|
||||
|
||||
|
||||
register(userData) {
|
||||
if(this.regForm.invalid){
|
||||
// this.notifier.notify('success','Please Fill all the Fields')
|
||||
Swal('Please Fill all the Fields');
|
||||
const invalid = [];
|
||||
const controls = this.regForm.controls;
|
||||
for (const name in controls) {
|
||||
if (controls[name].invalid) {
|
||||
invalid.push(name);
|
||||
}
|
||||
}
|
||||
console.log(invalid);
|
||||
return;
|
||||
}
|
||||
// console.log(userData);
|
||||
let data:any;
|
||||
|
||||
// console.log(this.files);
|
||||
if (this.usersData != '' && this.usersData !== undefined) {
|
||||
if (this.files) {
|
||||
userData.userpic = this.files;
|
||||
} else {
|
||||
userData.userpic = this.usersData.profilepic;
|
||||
}
|
||||
} else {
|
||||
if (this.files) {
|
||||
userData.userpic = this.files;
|
||||
}
|
||||
}
|
||||
//console.log(this.usersData);
|
||||
this.loader = true;
|
||||
console.log("cog",userData,this.usersData)
|
||||
if (this.usersData === undefined) {
|
||||
this.AWS.register(userData).subscribe(res => {
|
||||
if (res.User.UserStatus != '' && res.User.UserStatus !== undefined && res.User.UserStatus != null) {
|
||||
if(userData.role.role_id == 10){
|
||||
this.AWS.UserGroup(res,userData).subscribe(res=>{});}
|
||||
this.users.saveRecords(res, userData).subscribe(res => {
|
||||
data = res;
|
||||
if (data.status == 200) {
|
||||
this.AWS.adminUpdateuser(userData, data.record).subscribe(res => {});
|
||||
|
||||
this.loader =false;
|
||||
// console.log(res);
|
||||
Swal('User Created');
|
||||
this.router.navigate(['setting/users/userlist']);
|
||||
|
||||
}
|
||||
})
|
||||
//})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.AWS.adminchangeData(this.usersData,userData).subscribe(res=>{
|
||||
if(userData.role.role_id == 10){
|
||||
userData.aws_name = this.usersData.aws_name;
|
||||
this.AWS.UserGroup(res,userData).subscribe(res=>{
|
||||
});}
|
||||
this.users.saveRecords(res,userData).subscribe(res=>{
|
||||
this.loader = false;
|
||||
Swal('User Updated');
|
||||
this.router.navigate(['setting/users/userlist']);
|
||||
//this.shared.redirectTo('settings/userListing');
|
||||
delete this.AWS.localUserId;
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
toggleAllSelection(e,enitiyid,flag?) {
|
||||
console.log(enitiyid,e);
|
||||
// if(e.value){
|
||||
|
||||
// if(e.value.role_name == pdoff && enitiyid.entity_type_id == 1){
|
||||
// console.log(e.value);
|
||||
// this.roleAccess = true;
|
||||
// }else{
|
||||
// this.roleAccess = false;
|
||||
// }
|
||||
// }
|
||||
if (this.usersData != '' && this.usersData !==undefined || e.role_name == pdoff && enitiyid.entity_type_id == 1 || e.role_name == pdexu && enitiyid.entity_type_id == 1) {
|
||||
|
||||
if(e.role_name == pdoff && enitiyid.entity_type_id == 1 ||e.role_name == pdexu && enitiyid.entity_type_id == 1 || e.role_name == pdoff && enitiyid.entity_type_id == 1 || e.role_name == pdexu && enitiyid.entity_type_id == 1){
|
||||
|
||||
this.roleAccess = true;
|
||||
}else{
|
||||
this.roleAccess = false;
|
||||
}
|
||||
}else{
|
||||
this.roleAccess = false;
|
||||
}
|
||||
this.getBranch(flag);
|
||||
}
|
||||
getBranch(flag?){
|
||||
if(this.regForm.value.role != null && (this.regForm.value.role.role_name == "Branch Credit" || this.regForm.value.role.role_name == "Branch Sales") && this.regForm.value.lenVenName != null){
|
||||
console.log(this.regForm.value.role,this.entity_for_branch,this.regForm.value.lenVenName);
|
||||
if(this.entity_for_branch.length > 0){
|
||||
this.enableBranch=true
|
||||
// this.branchList=this.entity_for_branch
|
||||
this.branchList=this.entity_for_branch.filter(val=>val.short_name == this.regForm.value.lenVenName.short_name).map(b=>b.branches)
|
||||
console.log("dgg",this.branchList)
|
||||
if(this.branchList.length > 0){
|
||||
this.branchList=this.branchList[0]
|
||||
if(flag == 1){ // for edit purpose
|
||||
console.log(this.usersData.fk_lender_branch_id)
|
||||
this.regForm.controls['fk_lender_branch_id'].setValue(this.usersData.fk_lender_branch_id)
|
||||
}
|
||||
else{
|
||||
this.regForm.controls['fk_lender_branch_id'].setValue(null);
|
||||
}
|
||||
this.regForm.controls['fk_lender_branch_id'].setValidators(Validators.required)
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.regForm.controls['fk_lender_branch_id'].clearValidators()
|
||||
this.enableBranch=false
|
||||
this.branchList=[]
|
||||
this.regForm.controls['fk_lender_branch_id'].setValue(null);
|
||||
}
|
||||
|
||||
}
|
||||
getcity(e){
|
||||
// console.log(e);
|
||||
// console.log(this.Cities);
|
||||
|
||||
|
||||
this.City = this.Cities.filter(city=>city.fk_state_id == e.value.state_id);
|
||||
|
||||
|
||||
}
|
||||
userupdate() {
|
||||
|
||||
if (this.users.localUserId != '' && this.users.localUserId != null && this.users.localUserId !== undefined) {
|
||||
this.usersData = this.users.localUserId;
|
||||
|
||||
this.users.entityType().subscribe(res => {
|
||||
|
||||
this.types = res;
|
||||
if (this.types.status == 200) {
|
||||
let type = this.types.records.filter(type=>type.isactive ==1);
|
||||
this.types= type.filter(type => type.entity_type_id == this.usersData.fk_entity_type_id);
|
||||
this.regForm.controls['type'].setValue(this.types[0]);
|
||||
|
||||
this.users.entitiesDetails().subscribe(res=>{
|
||||
this.entitiesDetails = res;
|
||||
if(this.entitiesDetails.dataStatus == true){
|
||||
this.entitiesDetails = this.entitiesDetails.records.filter(ent=>ent.isactive ==1);
|
||||
let entitiy = this.entitiesDetails.filter(ent=>this.usersData.fk_entity_id == ent.entity_id)[0];
|
||||
this.regForm.controls['lenVenName'].setValue(entitiy);
|
||||
this.callrole(2,this.types[0],this.usersData);
|
||||
}
|
||||
else{
|
||||
this.callrole(2,this.types[0],this.usersData);
|
||||
}
|
||||
},error => {
|
||||
alert('Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.users.State().subscribe(res => {
|
||||
this.State = res;
|
||||
if (this.State.status == 200) {
|
||||
this.State = this.State.records.filter(ent=>ent.isactive ==1);
|
||||
let states = this.State.filter(state => state.state_id == this.usersData.fk_state)[0];
|
||||
// console.log(states);
|
||||
this.regForm.controls['state'].setValue(states);
|
||||
this.users.City().subscribe(res => {
|
||||
this.Cities = res;
|
||||
if (this.Cities.status == 200) {
|
||||
//this.City = this.Cities.records;
|
||||
this.Cities = this.Cities.records.filter(ent=>ent.isactive ==1);
|
||||
let City = this.Cities.filter(city=>city.fk_state_id == states.state_id && city.city_id == this.usersData.fk_city)[0];
|
||||
let value = {'value':{'state_id':states.state_id}};
|
||||
this.getcity(value);
|
||||
this.regForm.controls['city'].setValue(City);
|
||||
// let citys = this.Cities.filter(city => city.city_id == this.usersData.fk_city)[0];
|
||||
// this.regForm.controls['city'].setValue(citys);
|
||||
// console.log(this.City);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.users.pdTeam().subscribe(res=>{
|
||||
|
||||
this.pdTeam = res;
|
||||
if(this.pdTeam.status == 200){
|
||||
this.pdTeam = this.pdTeam.records.filter(ent=>ent.isactive ==1);
|
||||
let pdteam = this.pdTeam.filter(pd=>pd.pdteam_id == this.usersData.fk_team_id)[0];
|
||||
this.regForm.controls['pdteam'].setValue(pdteam);
|
||||
}
|
||||
});
|
||||
this.users.pdType().subscribe(res=>{
|
||||
this.pdType = res;
|
||||
if(this.pdType.status == 200){
|
||||
this.pdType = this.pdType.records.filter(ent=>ent.isactive ==1);
|
||||
let pdtype = this.pdType.filter(pdt=>pdt.pd_type_id == this.usersData.fk_pd_type_id)[0];
|
||||
this.regForm.controls['pdtype'].setValue(pdtype);
|
||||
}
|
||||
});
|
||||
this.users.getLenderDetails().subscribe(res=>{
|
||||
this.entity_for_branch=res
|
||||
if(this.entity_for_branch.dataStatus == true){
|
||||
this.entity_for_branch = this.entity_for_branch.records;
|
||||
// this.getBranch(1); //for edit functionality
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
let users= {
|
||||
'userid':this.usersData.userid,
|
||||
'entityid':this.usersData.fk_entity_type_id,
|
||||
'profilepic':this.usersData.profilepic
|
||||
}
|
||||
this.profileaccess = false;
|
||||
this.users.getprofilepic(users).subscribe(res=>{
|
||||
this.profileurl = res;
|
||||
if(this.profileurl.dataStatus == true){
|
||||
this.profileaccess = true;
|
||||
this.profileurl = this.profileurl.records;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
//console.log(userRole);
|
||||
// this.regForm.controls['firstName'].setValue({'firstName':'sriram'});
|
||||
this.regForm.controls['userid'].setValue(this.usersData.userid);
|
||||
this.regForm.controls['firstName'].setValue(this.usersData.user_first_name);
|
||||
this.regForm.controls['lastName'].setValue(this.usersData.user_last_name);
|
||||
this.regForm.controls['phone'].setValue(this.usersData.mobile_no);
|
||||
|
||||
this.regForm.controls['email'].setValue(this.usersData.email);
|
||||
if (this.usersData.isactive == 1) {
|
||||
this.regForm.controls['isactive'].setValue(true);
|
||||
} else {
|
||||
this.regForm.controls['isactive'].setValue(false);
|
||||
}
|
||||
|
||||
// this.regForm.controls['userpic'].setValue(this.usersData.profilepic);
|
||||
|
||||
this.img = this.usersData.profilepic;
|
||||
}
|
||||
}
|
||||
|
||||
onResetForEdit(){
|
||||
this.userupdate();
|
||||
}
|
||||
|
||||
/** to call role api
|
||||
* params are flag are if 1 - add and 2 - edit
|
||||
**/
|
||||
callrole(flag,type,usersData){
|
||||
console.log(this.usersData)
|
||||
this.users.roles().subscribe(res=>{
|
||||
|
||||
this.roleload = false;
|
||||
this.role = res;
|
||||
|
||||
if(this.role.dataStatus == true){
|
||||
|
||||
this.role = this.role.records;
|
||||
this.checktype(type);
|
||||
|
||||
if(flag == 2){
|
||||
let role = this.role.filter(role=>role.role_type == usersData.fk_entity_type_id && role.role_id == usersData.user_role)[0];
|
||||
this.regForm.controls['role'].setValue(role);
|
||||
|
||||
this.toggleAllSelection(role,type,1);
|
||||
// this.regForm.controls['role'].setValue(role);
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
console.log('something went wrong - role master can`t able to call');
|
||||
}
|
||||
},error => {
|
||||
alert('Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
});
|
||||
}
|
||||
|
||||
checktype(e){
|
||||
|
||||
this.roleAccess= false;
|
||||
let userRole:any;
|
||||
if(e !== undefined){
|
||||
|
||||
//console.log(roleload);
|
||||
|
||||
this.roles = this.role.filter(role=>role.role_type == e.entity_type_id);
|
||||
|
||||
// let role = this.roles.filter(role=>role.role_id == this.usersData.user_role_id);
|
||||
// console.log(role);
|
||||
// this.regForm.controls['role'].setValue(role);
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch (e.entity_type_id) {
|
||||
case "1":
|
||||
this.typeValue =1;
|
||||
|
||||
break;
|
||||
case "2":
|
||||
this.typeValue =2;
|
||||
this.entities = this.entitiesDetails.filter(entity=>entity.fk_entity_type_id == e.entity_type_id);
|
||||
break;
|
||||
case "3":
|
||||
this.typeValue =3;
|
||||
this.entities = this.entitiesDetails.filter(entity=>entity.fk_entity_type_id == e.entity_type_id);
|
||||
break;
|
||||
default :
|
||||
this.typeValue = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
back(){
|
||||
delete this.users.localUserId;
|
||||
this.router.navigate(['setting/users/userlist']);
|
||||
}
|
||||
/** On Key Press Event For Numbers */
|
||||
keyPress(event: any) {
|
||||
const pattern = /[0-9]/;
|
||||
|
||||
let inputChar = String.fromCharCode(event.charCode);
|
||||
if (event.keyCode != 8 && !pattern.test(inputChar)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// resetAdminPassword(){
|
||||
// // console.log(this.types);
|
||||
// this.AWS.adminSetpassword(this.users.localUserId.aws_name,this.types[0].name).subscribe(res=>{
|
||||
|
||||
// if(res == 'success'){
|
||||
// // this.notifier.notify('success','Please Fill all the Fields')
|
||||
// Swal('Successfully Reset');
|
||||
// }
|
||||
// console.log('999',res);
|
||||
|
||||
// })
|
||||
// }
|
||||
}
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import {Router} from "@angular/router";
|
||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||
import { CustomValidators } from 'ng2-validation';
|
||||
import { AwsService } from '../../aws.service';
|
||||
@Component({
|
||||
selector: 'app-register',
|
||||
templateUrl: './register.component.html',
|
||||
styleUrls: ['./register.component.scss']
|
||||
})
|
||||
export class RegisterComponent implements OnInit {
|
||||
roles:any;
|
||||
types:any;
|
||||
public regForm :FormGroup;
|
||||
|
||||
// name: string;
|
||||
// email: string;
|
||||
// password: string;
|
||||
// passwordConfirm: string;
|
||||
|
||||
constructor(
|
||||
private router: Router,public fb:FormBuilder,public AWS:AwsService
|
||||
) { }
|
||||
ngOnInit(){
|
||||
this.roles = [
|
||||
{name:'Admin',value:'ADMIN'},
|
||||
{name:'Audit',value:'AUDIT'}
|
||||
]
|
||||
this.types = [
|
||||
{name:'Sineedge',value:'1'},
|
||||
{name:'Lender',value:'2'}
|
||||
]
|
||||
this.regForm = this.fb.group({
|
||||
firstName:[null, Validators.compose([Validators.required, Validators.minLength(5), Validators.maxLength(10)])],
|
||||
lastName:[null,Validators.compose([Validators.required])],
|
||||
phone:[null,Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12)])],
|
||||
email:[null,Validators.compose([Validators.required,CustomValidators.email])],
|
||||
role:[null,Validators.compose([Validators.required])],
|
||||
type:[null,Validators.compose([Validators.required])]
|
||||
|
||||
})
|
||||
this.AWS.adminGetuser();
|
||||
}
|
||||
|
||||
register(userData) {
|
||||
console.log(userData);
|
||||
this.AWS.register(userData);
|
||||
// this.router.navigate(['/']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import {Router} from "@angular/router";
|
||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||
import { CustomValidators } from 'ng2-validation';
|
||||
import { AwsService } from '../../aws.service';
|
||||
@Component({
|
||||
selector: 'app-register',
|
||||
templateUrl: './register.component.html',
|
||||
styleUrls: ['./register.component.scss']
|
||||
})
|
||||
export class RegisterComponent implements OnInit {
|
||||
roles:any;
|
||||
types:any;
|
||||
public regForm :FormGroup;
|
||||
|
||||
// name: string;
|
||||
// email: string;
|
||||
// password: string;
|
||||
// passwordConfirm: string;
|
||||
|
||||
constructor(
|
||||
private router: Router,public fb:FormBuilder,public AWS:AwsService
|
||||
) { }
|
||||
ngOnInit(){
|
||||
this.roles = [
|
||||
{name:'Admin',value:'ADMIN'},
|
||||
{name:'Audit',value:'AUDIT'}
|
||||
];
|
||||
this.types = [
|
||||
{name:'Sineedge',value:'1'},
|
||||
{name:'Lender',value:'2'}
|
||||
];
|
||||
this.regForm = this.fb.group({
|
||||
firstName:[null, Validators.compose([Validators.required, Validators.minLength(5), Validators.maxLength(10)])],
|
||||
lastName:[null,Validators.compose([Validators.required])],
|
||||
phone:[null,Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12)])],
|
||||
email:[null,Validators.compose([Validators.required,CustomValidators.email])],
|
||||
role:[null,Validators.compose([Validators.required])],
|
||||
type:[null,Validators.compose([Validators.required])]
|
||||
|
||||
})
|
||||
this.AWS.adminGetuser();
|
||||
}
|
||||
|
||||
register(userData) {
|
||||
console.log(userData);
|
||||
this.AWS.register(userData);
|
||||
// this.router.navigate(['/']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
99
ng6-seed/src/app/settings/users/user-list/user-list.component.html
Executable file
99
ng6-seed/src/app/settings/users/user-list/user-list.component.html
Executable file
@ -0,0 +1,99 @@
|
||||
<div>
|
||||
<mat-card>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-1">
|
||||
<div class="ml-xs mr-xs">
|
||||
<mat-card-title><span style="font-size:24px;"> Users</span></mat-card-title>
|
||||
</div>
|
||||
</div>
|
||||
<mat-card-content>
|
||||
<div class="example-container mat-elevation-z8" style="margin-top:26px;">
|
||||
<div class="example-header">
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2" >
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
|
||||
</mat-form-field>
|
||||
<label style="text-align: right;margin-left:57%;" fxLayoutAlign="start center" fxFlexOffset="50px">
|
||||
<button mat-fab class="mr-1 mb-1" style="margin-top: 7px;"color="primary" (click)="add()"><mat-icon>add</mat-icon></button>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<mat-table [dataSource]="dataSource" matSort >
|
||||
|
||||
<ng-container matColumnDef="SerialNo">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header>Sl </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us; let i = index;"> {{us.SerialNo}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="FullName">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header>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 </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 </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.mobile_no}} </mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Roles">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Role</mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.role_name}} </mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Entity">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header>Entity </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"> {{us.entitytypename}} </mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="IsActive">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Active </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us"><!--{{row.isactive}}-->
|
||||
<mat-slide-toggle
|
||||
class="example-margin"
|
||||
[checked]="us.isactive == 1 ? true : false " [color]="color"
|
||||
[matTooltip]="us.isactive == 1 ? 'Active': 'Deactive'" matTooltipPosition="above"
|
||||
(click)="isactive(us.userid,us.aws_name)">
|
||||
</mat-slide-toggle>
|
||||
|
||||
|
||||
|
||||
<!-- <mat-slide-toggle *ngIf="us.isactive == 1;else notactive;"
|
||||
class="example-margin"
|
||||
matTooltip="Active" matTooltipPosition="above"
|
||||
checked="true" [color]="color"
|
||||
(change)="isactive(us.userid,us.aws_name)"
|
||||
(click)=deactive()>
|
||||
</mat-slide-toggle>
|
||||
<ng-template #notactive >
|
||||
<mat-slide-toggle
|
||||
class="example-margin"
|
||||
matTooltip="Inactive" matTooltipPosition="above"
|
||||
checked="false" [color]="color"
|
||||
(change)="isactive(us.userid,us.aws_name)"
|
||||
(click)=active()>
|
||||
</mat-slide-toggle></ng-template> -->
|
||||
<!-- <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> Action </mat-header-cell>
|
||||
<mat-cell *matCellDef="let us">
|
||||
<a mat-icon-button [color]="color" 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>
|
||||
|
||||
<mat-paginator [pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
91
ng6-seed/src/app/settings/users/user-list/user-list.component.scss
Executable file
91
ng6-seed/src/app/settings/users/user-list/user-list.component.scss
Executable file
@ -0,0 +1,91 @@
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
}
|
||||
.active{
|
||||
|
||||
color: green;
|
||||
font-size: 20px;
|
||||
}
|
||||
.active:hover{
|
||||
color:red;
|
||||
font-size:25px;
|
||||
}
|
||||
.deactive{
|
||||
|
||||
color: red;
|
||||
font-size: 20px;
|
||||
}
|
||||
.deactive:hover{
|
||||
color: green;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.example-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.example-header {
|
||||
min-height: 64px;
|
||||
padding: 8px 24px 0;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.mat-form-field {
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mat-table {
|
||||
overflow: auto;
|
||||
max-height: 500px;
|
||||
}
|
||||
.mat-table {
|
||||
display: table;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
max-height: 500px;
|
||||
|
||||
> .mat-header-row, > .mat-row {
|
||||
display: table-row;
|
||||
padding: 0;
|
||||
border: none;
|
||||
|
||||
> .mat-header-cell, > .mat-cell {
|
||||
display: table-cell;
|
||||
height: 48px;
|
||||
vertical-align: middle;
|
||||
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Table CSS -nocontent */
|
||||
.nocontent {
|
||||
color: red;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/** Table CSS - Search(or)Filter Field */
|
||||
.mat-form-field {
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.filter-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.filter-header {
|
||||
min-height: 64px;
|
||||
padding: 8px 24px 0;
|
||||
}
|
||||
25
ng6-seed/src/app/settings/users/user-list/user-list.component.spec.ts
Executable file
25
ng6-seed/src/app/settings/users/user-list/user-list.component.spec.ts
Executable file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UserListComponent } from './user-list.component';
|
||||
|
||||
describe('UserListComponent', () => {
|
||||
let component: UserListComponent;
|
||||
let fixture: ComponentFixture<UserListComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UserListComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UserListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
201
ng6-seed/src/app/settings/users/user-list/user-list.component.ts
Executable file
201
ng6-seed/src/app/settings/users/user-list/user-list.component.ts
Executable file
@ -0,0 +1,201 @@
|
||||
import { Component, OnInit, ViewChild, } from '@angular/core';
|
||||
import { Router, RouterOutlet } from '@angular/router';
|
||||
import { AwsService } from '../../../AwsService/aws.service';
|
||||
import { MatPaginator, MatTableDataSource,MatSort } from '@angular/material';
|
||||
import { UserService } from '../../service/user.service';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { CognitoService } from '../../../AwsService/cognito.service';
|
||||
/**sweet alert */
|
||||
import Swal from 'sweetalert2'
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-list',
|
||||
templateUrl: './user-list.component.html',
|
||||
styleUrls: ['./user-list.component.scss']
|
||||
})
|
||||
export class UserListComponent implements OnInit {
|
||||
public dataLength: number;
|
||||
public dataSource = new MatTableDataSource();
|
||||
displayedColumns = ['SerialNo','FullName','Email','Mobile','Roles','Entity','Actions', 'IsActive'];
|
||||
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
color="primary";
|
||||
// pagination variable details
|
||||
pageSize = 10;
|
||||
userdata: any = [];
|
||||
loader: boolean = false;
|
||||
|
||||
|
||||
|
||||
constructor(public aws: AwsService, public route: Router,public users:UserService,public shared:CognitoService) {
|
||||
let session:any = this.shared.getAccessToken();
|
||||
//console.log(session.idToken.payload["cognito:groups"]);
|
||||
// let userGroup = session.idToken.payload["cognito:groups"].filter(
|
||||
// usergroup => usergroup == "ADMIN"
|
||||
// )[0];
|
||||
|
||||
// if(userGroup == "ADMIN" ){
|
||||
|
||||
// }else{
|
||||
// alert('Admin Only Access Page');
|
||||
// this.route.navigate(['home']);
|
||||
|
||||
// }
|
||||
this.getusers();
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
delete this.aws.localUserId;
|
||||
}
|
||||
ngAfterViewInit() {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
applyFilter(filterValue: string) {
|
||||
filterValue = filterValue.trim(); // Remove whitespace
|
||||
filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
|
||||
this.dataSource.filter = filterValue;
|
||||
}
|
||||
getusers() {
|
||||
this.loader = true;
|
||||
let data:any;
|
||||
this.users.getuserdata().subscribe(res => {
|
||||
this.loader = false;
|
||||
// console.log(res);
|
||||
data = res;
|
||||
if (data.status == 200) {
|
||||
this.userdata = data.records;
|
||||
// console.log(data.records.length);
|
||||
this.dataLength = data.records.length;
|
||||
this.dataSource.data = this.userdata;
|
||||
if(data.records.length >= 1){
|
||||
this.userdata = this.userdata.map((val, i)=>{
|
||||
val['SerialNo'] = i + 1;
|
||||
return val;
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
isactive(id, awsname) {
|
||||
let data:any;
|
||||
let userstatus = this.userdata.filter((users) => users.userid == id)[0];
|
||||
if (userstatus.isactive == 1) {
|
||||
Swal({
|
||||
title: 'Are you sure?',
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, deactivate it!'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
this.aws.admindisabelUser(userstatus, awsname).subscribe(res => {
|
||||
if (res == 0) {
|
||||
let users = { 'userid': userstatus.userid,'isactive': '0'}
|
||||
this.users.adminupendis(users).subscribe(res => {
|
||||
data = res;
|
||||
if (data.status == 200) {
|
||||
Swal(
|
||||
'Deactivated!',
|
||||
'success'
|
||||
)
|
||||
this.getusers();
|
||||
//this.shared.redirectTo(this.route.url);
|
||||
}
|
||||
else{
|
||||
Swal("Sorry Try Again !");
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
this.getusers();
|
||||
}
|
||||
})//swal End Here
|
||||
} else {
|
||||
|
||||
Swal({
|
||||
title: 'Are you sure?',
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, activate it!'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
this.aws.adminenableUser(userstatus, awsname).subscribe(res => {
|
||||
//console.log(res);
|
||||
if (res == 1) {
|
||||
let users = { 'userid': userstatus.userid,
|
||||
'isactive': '1'}
|
||||
this.users.adminupendis(users).subscribe(res => {
|
||||
data = res;
|
||||
if (data.status == 200) {
|
||||
Swal(
|
||||
'Activated!',
|
||||
'success'
|
||||
)
|
||||
this.getusers();
|
||||
//this.shared.redirectTo(this.route.url);
|
||||
}
|
||||
else{
|
||||
Swal("Sorry Try Again !");
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
this.getusers();
|
||||
}
|
||||
})//swal End Here
|
||||
}
|
||||
}
|
||||
editUserDetails(userId){
|
||||
|
||||
let userDetails = this.userdata.filter(users=>users.userid == userId)[0];
|
||||
this.users.adminGetUsers(userDetails).subscribe(res=>{
|
||||
|
||||
this.route.navigate(['setting/users/register']);
|
||||
});
|
||||
}
|
||||
add(){
|
||||
this.route.navigate(['setting/users/register']);
|
||||
}
|
||||
deleteuser(user){
|
||||
this.aws.admindelete(user).subscribe(res=>{
|
||||
this.getusers();
|
||||
});
|
||||
}
|
||||
adminedituser(user){
|
||||
this.aws.adminresetpassword(user).subscribe(res=>{
|
||||
this.getusers();
|
||||
})
|
||||
}
|
||||
//Sweetalert2 for active and deactive
|
||||
deactive()
|
||||
{
|
||||
Swal({
|
||||
title: 'Are you sure?',
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, deactivate it!'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
Swal(
|
||||
'Deactivated!',
|
||||
'success'
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@ -22,13 +22,59 @@ import { UserRoutes} from './users.routing';
|
||||
import { UserProfileComponent, ChangePasswordDialog } from './user-profile/user-profile.component';
|
||||
import { UserService } from './../service/user.service';
|
||||
import { NewPasswordDialog, ForgotPass } from '../../session/login/login.component';
|
||||
import { UserListComponent } from './user-list/user-list.component';
|
||||
import { RegisterComponent } from './register/register.component';
|
||||
import { NotifierModule, NotifierOptions } from 'angular-notifier';
|
||||
// import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
const pdCustomNotifierOptions: NotifierOptions = {
|
||||
position: {
|
||||
horizontal: {
|
||||
position: 'right',
|
||||
distance: 12
|
||||
},
|
||||
vertical: {
|
||||
position: 'top',
|
||||
distance: 32,
|
||||
gap: 10
|
||||
}
|
||||
},
|
||||
theme: 'material',
|
||||
behaviour: {
|
||||
autoHide: 2000,
|
||||
onClick: 'hide',
|
||||
onMouseover: 'pauseAutoHide',
|
||||
showDismissButton: true,
|
||||
stacking: 4
|
||||
},
|
||||
animations: {
|
||||
enabled: true,
|
||||
show: {
|
||||
preset: 'slide',
|
||||
speed: 300,
|
||||
easing: 'ease'
|
||||
},
|
||||
hide: {
|
||||
preset: 'fade',
|
||||
speed: 300,
|
||||
easing: 'ease',
|
||||
offset: 50
|
||||
},
|
||||
shift: {
|
||||
speed: 300,
|
||||
easing: 'ease'
|
||||
},
|
||||
overlap: 150
|
||||
}
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild(UserRoutes),
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
NotifierModule.withConfig(pdCustomNotifierOptions),
|
||||
MatInputModule,
|
||||
MatRadioModule,
|
||||
MatButtonModule,MatTableModule,MatPaginatorModule,
|
||||
@ -38,7 +84,7 @@ import { NewPasswordDialog, ForgotPass } from '../../session/login/login.compone
|
||||
FormsModule, ReactiveFormsModule,
|
||||
// HttpClientModule,
|
||||
],
|
||||
declarations: [UserProfileComponent],
|
||||
declarations: [UserProfileComponent,UserListComponent,RegisterComponent],
|
||||
providers: [ UserService ]
|
||||
|
||||
})
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
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: '',
|
||||
@ -7,6 +9,12 @@ export const UserRoutes: Routes = [{
|
||||
},{
|
||||
path: '',
|
||||
children: [{
|
||||
path: 'userlist',
|
||||
component: UserListComponent
|
||||
},{
|
||||
path: 'register',
|
||||
component: RegisterComponent
|
||||
},{
|
||||
path:'userprofile',
|
||||
component:UserProfileComponent
|
||||
}]
|
||||
|
||||
@ -38,6 +38,17 @@ const HORIZONTALMENUITEMS = [
|
||||
// {state:'pdtriggerlist',name:'Pd Trigger Listing'}
|
||||
// ]
|
||||
},
|
||||
// {
|
||||
// state:'setting/users',
|
||||
// name:'Users',
|
||||
// type:'link',
|
||||
// icon:'settings',
|
||||
|
||||
// // children:[
|
||||
// // {state:'pdtriggerlist',name:'Pd Trigger Listing'}
|
||||
// // ]
|
||||
// },
|
||||
|
||||
// {
|
||||
// state:'quality_check_discussion',
|
||||
// name:'Quality Check',
|
||||
@ -68,12 +79,22 @@ const salesmenu = [
|
||||
// {state:'pdtriggerlist',name:'Pd Trigger Listing'}
|
||||
// ]
|
||||
},
|
||||
{
|
||||
state:'sales-pd-list',
|
||||
name:'Sales PD',
|
||||
type:'link',
|
||||
icon:'work',
|
||||
},
|
||||
// {
|
||||
// state:'setting/users',
|
||||
// name:'Users',
|
||||
// type:'link',
|
||||
// icon:'settings',
|
||||
|
||||
// // children:[
|
||||
// // {state:'pdtriggerlist',name:'Pd Trigger Listing'}
|
||||
// // ]
|
||||
// },
|
||||
// {
|
||||
// state:'sales-pd-list',
|
||||
// name:'Sales PD',
|
||||
// type:'link',
|
||||
// icon:'work',
|
||||
// },
|
||||
// {
|
||||
// state:'quality_check_discussion',
|
||||
// name:'Quality Check',
|
||||
|
||||
@ -80,6 +80,16 @@ const MENUITEMS : Menu[] = [
|
||||
// ]
|
||||
},
|
||||
// {
|
||||
// state:'setting/users',
|
||||
// name:'Users',
|
||||
// type:'link',
|
||||
// icon:'settings',
|
||||
|
||||
// // children:[
|
||||
// // {state:'pdtriggerlist',name:'Pd Trigger Listing'}
|
||||
// // ]
|
||||
// },
|
||||
// {
|
||||
// state:'quality_check_discussion',
|
||||
// name:'Quality Check',
|
||||
// type:'link',
|
||||
@ -150,12 +160,23 @@ const salesMenus: Menu[]= [
|
||||
// {state:'pdtriggerlist',name:'Pd Trigger Listing'}
|
||||
// ]
|
||||
},
|
||||
{
|
||||
state:'sales-pd-list',
|
||||
name:'Sales PD',
|
||||
type:'link',
|
||||
icon:'work',
|
||||
},
|
||||
// {
|
||||
// state:'setting/users',
|
||||
// name:'Users',
|
||||
// type:'link',
|
||||
// icon:'settings',
|
||||
|
||||
// // children:[
|
||||
// // {state:'pdtriggerlist',name:'Pd Trigger Listing'}
|
||||
// // ]
|
||||
// },
|
||||
|
||||
// {
|
||||
// state:'sales-pd-list',
|
||||
// name:'Sales PD',
|
||||
// type:'link',
|
||||
// icon:'work',
|
||||
// },
|
||||
// {
|
||||
// state:'quality_check_discussion',
|
||||
// name:'Quality Check',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user