Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
commit
9451c4e5ff
@ -24,10 +24,10 @@ import { CognitoService } from './cognito.service';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const sineedge_poolData = {
|
// const sineedge_poolData = {
|
||||||
UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
// UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
||||||
ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
// ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
||||||
};
|
// };
|
||||||
const sineedgedev_poolData = {
|
const sineedgedev_poolData = {
|
||||||
UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV
|
UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV
|
||||||
ClientId: "2o5c3cs9k3als16nqhp3irh8rs" // ClientName: SINEEDGE_DEV_WEB
|
ClientId: "2o5c3cs9k3als16nqhp3irh8rs" // ClientName: SINEEDGE_DEV_WEB
|
||||||
@ -37,10 +37,10 @@ const lender_poolData = {
|
|||||||
ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB
|
ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB
|
||||||
};
|
};
|
||||||
const vendor_poolData = {
|
const vendor_poolData = {
|
||||||
UserPoolId: "",
|
UserPoolId: "ap-south-1_K57yPaWxV",
|
||||||
ClientId: ""
|
ClientId: ""
|
||||||
}
|
}
|
||||||
const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
|
// const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
|
||||||
const lenderUserPool = new CognitoUserPool(lender_poolData);
|
const lenderUserPool = new CognitoUserPool(lender_poolData);
|
||||||
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
|
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
|
|||||||
*/
|
*/
|
||||||
const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
|
const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
|
||||||
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
|
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
|
||||||
const vendorIdenttiy = "";
|
const vendorIdenttiy = "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874";
|
||||||
// serviceProvider
|
// serviceProvider
|
||||||
const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
|
const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
|
||||||
//const apiurl = "http://localhost/sparqapi/api/";
|
//const apiurl = "http://localhost/sparqapi/api/";
|
||||||
@ -355,6 +355,29 @@ export class AwsService {
|
|||||||
/* more items */
|
/* more items */
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
}else if(userData.type.entity_type_id == 3){
|
||||||
|
params = {
|
||||||
|
UserPoolId: vendor_poolData.UserPoolId /* required */,
|
||||||
|
Username: userData.email /* required */,
|
||||||
|
DesiredDeliveryMediums: [
|
||||||
|
"EMAIL"
|
||||||
|
/* more items */
|
||||||
|
],
|
||||||
|
// ForceAliasCreation: true || false,
|
||||||
|
MessageAction: "SUPPRESS",
|
||||||
|
TemporaryPassword: "temp1234",
|
||||||
|
UserAttributes: [
|
||||||
|
{
|
||||||
|
Name: "email" /* required */,
|
||||||
|
Value: userData.email
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "phone_number" /* required */,
|
||||||
|
Value: "+91" + userData.phone
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
]
|
||||||
|
};
|
||||||
}
|
}
|
||||||
console.log(params);
|
console.log(params);
|
||||||
return Observable.create(observe => {
|
return Observable.create(observe => {
|
||||||
@ -390,27 +413,19 @@ export class AwsService {
|
|||||||
this.getconfig();
|
this.getconfig();
|
||||||
|
|
||||||
//let cognitodata = "539bfefa-ae42-4bee-bf79-4b15d1a2af7f";
|
//let cognitodata = "539bfefa-ae42-4bee-bf79-4b15d1a2af7f";
|
||||||
if(userData.userid === null ){
|
|
||||||
for(let role of userData.role){
|
|
||||||
|
|
||||||
let params: any;
|
let params: any;
|
||||||
if (userData.type.entity_type_id == 1) {
|
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
GroupName: role.GroupName /* required */,
|
GroupName: "ADMIN" /* required */,
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||||
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||||
};
|
};
|
||||||
|
|
||||||
} else if (userData.type.entity_type_id == 2) {
|
|
||||||
params = {
|
|
||||||
GroupName: role.GroupName /* required */,
|
|
||||||
UserPoolId: lender_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
|
||||||
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
//(params);
|
//(params);
|
||||||
return Observable.create(observe=>{
|
return Observable.create(observe=>{
|
||||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
@ -431,50 +446,9 @@ export class AwsService {
|
|||||||
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}else{
|
|
||||||
let params :any;
|
|
||||||
console.log(userData);
|
|
||||||
console.log(cognitodata);
|
|
||||||
if (userData.fk_entity_id == 1) {
|
|
||||||
|
|
||||||
params = {
|
}
|
||||||
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.GroupName /* required */,
|
|
||||||
UserPoolId: lender_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
|
||||||
Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
//(params);
|
|
||||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
|
||||||
|
|
||||||
cognitoidentityserviceprovider.adminAddUserToGroup(params, function (
|
|
||||||
err,
|
|
||||||
data
|
|
||||||
) {
|
|
||||||
if (err) {
|
|
||||||
alert(err.message);
|
|
||||||
}//(err, err.stack);
|
|
||||||
// an error occurred
|
|
||||||
else {//(data);
|
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -560,7 +534,7 @@ export class AwsService {
|
|||||||
)[0];
|
)[0];
|
||||||
// (userGroup);
|
// (userGroup);
|
||||||
if (userGroup == "ADMIN") {
|
if (userGroup == "ADMIN") {
|
||||||
if (userData.fk_entity_id == 1) {
|
if (userData.fk_entity_type_id == 1) {
|
||||||
params = {
|
params = {
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId /* required */,
|
UserPoolId: sineedgedev_poolData.UserPoolId /* required */,
|
||||||
Username: userData.aws_name,//userData.email /* required */,
|
Username: userData.aws_name,//userData.email /* required */,
|
||||||
@ -579,7 +553,7 @@ export class AwsService {
|
|||||||
/* more items */
|
/* more items */
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
} else if (userData.fk_entity_id == 2) {
|
} else if (userData.fk_entity_type_id == 2) {
|
||||||
params = {
|
params = {
|
||||||
UserPoolId: lender_poolData.UserPoolId /* required */,
|
UserPoolId: lender_poolData.UserPoolId /* required */,
|
||||||
Username: userData.aws_name /* required */,
|
Username: userData.aws_name /* required */,
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { Observable } from 'rxjs/internal/Observable';
|
|||||||
import { AwsService } from '../../AwsService/aws.service';
|
import { AwsService } from '../../AwsService/aws.service';
|
||||||
import { environment } from 'environments/environment';
|
import { environment } from 'environments/environment';
|
||||||
const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
|
const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
|
||||||
|
// const apiurl = "http://localhost/sparqapi/api/";
|
||||||
const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
|
const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@ -85,7 +86,15 @@ export class UserService {
|
|||||||
return this.http.post(apiurl+'getListOfMaster',master_name);
|
return this.http.post(apiurl+'getListOfMaster',master_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
roles(){
|
||||||
|
let master_name = {'master_name':'ROLES'};
|
||||||
|
return this.http.post(apiurl+'getListOfMaster',master_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
entitiesDetails(){
|
||||||
|
let master_name = {'master_name':'ENTITY'};
|
||||||
|
return this.http.post(apiurl+'getListOfMaster',master_name);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -124,59 +133,53 @@ export class UserService {
|
|||||||
console.log(users);
|
console.log(users);
|
||||||
|
|
||||||
|
|
||||||
let roles:any=[];
|
// let roles:any=[];
|
||||||
for(var role of users.role){
|
// for(var role of users.role){
|
||||||
|
|
||||||
roles.push({ "user_role": role.GroupName });
|
|
||||||
}
|
|
||||||
|
|
||||||
let designation:any;
|
|
||||||
if(users.type.entity_type_id ==2){
|
|
||||||
let lenderhie:any =[];
|
let enities:any;
|
||||||
lenderhie.push(users.lenderHierarchy);
|
if(users.type.entity_type_id ==2 || users.type.entity_type_id == 3){
|
||||||
formData.append('lender_hierarchy',JSON.stringify(lenderhie));
|
enities = users.lenVenName.entity_id;
|
||||||
designation = '';
|
|
||||||
}else if(users.type.entity_type_id ==1){
|
}else if(users.type.entity_type_id ==1){
|
||||||
designation =users.designation.designation_id;
|
enities =null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let pdtypeid:any;
|
let pdtypeid:any;
|
||||||
let productid:any;
|
|
||||||
let pdteam:any;
|
let pdteam:any;
|
||||||
let cust:any;
|
|
||||||
if(users.product != null && users.customer != null && users.pdteam !=null && users.pdtype !=null){
|
if(users.pdteam !=null && users.pdtype !=null){
|
||||||
pdtypeid = users.pdtype.pd_type_id;
|
pdtypeid = users.pdtype.pd_type_id;
|
||||||
productid = users.product.product_id;
|
|
||||||
pdteam = users.pdteam.pdteam_id;
|
pdteam = users.pdteam.pdteam_id;
|
||||||
cust = users.customer.customer_segment_id;
|
|
||||||
|
}
|
||||||
|
let userid:any;
|
||||||
|
if(users.userid != null){
|
||||||
|
userid = users.userid
|
||||||
}
|
}
|
||||||
let pdofficer = {
|
let pdofficer = {
|
||||||
'fk_pd_type_id':pdtypeid,
|
'fk_pd_type_id':pdtypeid,
|
||||||
'fk_product_id':productid,
|
|
||||||
'fk_customer_segment':cust,
|
|
||||||
'fk_team_id':pdteam,
|
'fk_team_id':pdteam,
|
||||||
'fk_user_id':users.userid
|
'fk_user_id':userid
|
||||||
|
|
||||||
};
|
};
|
||||||
let records:any = {
|
let records:any = {
|
||||||
"userid":users.userid,
|
"userid":userid,
|
||||||
"aws_name": aws_name,
|
"aws_name": aws_name,
|
||||||
"first_name": users.firstName,
|
"first_name": users.firstName,
|
||||||
"last_name": users.lastName,
|
"last_name": users.lastName,
|
||||||
"mobile_no": users.phone,
|
"mobile_no": users.phone,
|
||||||
"email": users.email,
|
"email": users.email,
|
||||||
"alt_email":users.altemail,
|
|
||||||
"alt_mobile_no":users.altphone,
|
|
||||||
"addressline1":users.address1,
|
|
||||||
"addressline2":users.address2,
|
|
||||||
"addressline3":users.address3,
|
|
||||||
"isactive":users.isactive,
|
"isactive":users.isactive,
|
||||||
"fk_entity_id":users.type.entity_type_id,
|
|
||||||
"fk_designation":designation,
|
"fk_entity_type_id":users.type.entity_type_id,
|
||||||
|
"fk_entity_id":enities,
|
||||||
"fk_city":users.city.city_id,
|
"fk_city":users.city.city_id,
|
||||||
"fk_state":users.state.state_id,
|
"fk_state":users.state.state_id,
|
||||||
"pincode":users.pincode,
|
|
||||||
"profilepic":profilepic,
|
"profilepic":profilepic,
|
||||||
"fk_createdby":createdby,
|
"fk_createdby":createdby,
|
||||||
"fk_updatedby":updateby,
|
"fk_updatedby":updateby,
|
||||||
@ -185,7 +188,7 @@ export class UserService {
|
|||||||
};
|
};
|
||||||
//console.log(roles);
|
//console.log(roles);
|
||||||
formData.append('records',JSON.stringify(records));
|
formData.append('records',JSON.stringify(records));
|
||||||
formData.append('roles',JSON.stringify(roles));
|
formData.append('roles',JSON.stringify(({ "user_role": users.role.role_id})));
|
||||||
formData.append('profilepic',users.userpic);
|
formData.append('profilepic',users.userpic);
|
||||||
formData.append('pdofficer',JSON.stringify(pdofficer));
|
formData.append('pdofficer',JSON.stringify(pdofficer));
|
||||||
|
|
||||||
|
|||||||
@ -11,11 +11,11 @@
|
|||||||
<!-- <mat-card-subtitle>Angular2 custom validation</mat-card-subtitle> -->
|
<!-- <mat-card-subtitle>Angular2 custom validation</mat-card-subtitle> -->
|
||||||
<form [formGroup]="regForm" (ngSubmit)="register(regForm.value)">
|
<form [formGroup]="regForm" (ngSubmit)="register(regForm.value)">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<mat-card-title>Personal</mat-card-title><hr/><br/>
|
<mat-card-title>Personal</mat-card-title><hr/>
|
||||||
|
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||||
<input matInput placeholder="First name" [formControl]="regForm.controls['firstName']">
|
<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">You must include a first name.</mat-error>
|
<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('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-error *ngIf="regForm.controls['firstName'].hasError('maxlength') && regForm.controls['firstName'].touched" class="mat-text-warn">Your first name cannot exceed 10 characters.</mat-error>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||||
<input matInput placeholder="Last name" [formControl]="regForm.controls['lastName']">
|
<input matInput placeholder="Last name" [formControl]="regForm.controls['lastName']" required>
|
||||||
<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-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-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('minlength') && regForm.controls['lastName'].touched" class="mat-text-warn">Your first name must be at least 5 characters long.</mat-error>
|
||||||
@ -36,25 +36,30 @@
|
|||||||
<img [src]="profileurl" style="width: 17%;height: 50%;border-radius: 50%;"></span>
|
<img [src]="profileurl" style="width: 17%;height: 50%;border-radius: 50%;"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mat-card-title>Account Details</mat-card-title><hr/><br/>
|
<mat-card-title>Account Details</mat-card-title><hr/>
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||||
<input matInput placeholder="Email address" [formControl]="regForm.controls['email']" type="email">
|
<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">You must include an email address.</mat-error>
|
<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>
|
||||||
|
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
<!-- <mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||||
<input matInput placeholder="Alt Email address" [formControl]="regForm.controls['altemail']" type="email">
|
<input matInput placeholder="Alt Email address" [formControl]="regForm.controls['altemail']" type="email">
|
||||||
</mat-form-field>
|
</mat-form-field> -->
|
||||||
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||||
|
<input matInput placeholder="Phone number" [formControl]="regForm.controls['phone']" type="number" required>
|
||||||
|
<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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<mat-card-title>Contact Information</mat-card-title><hr/><br/>
|
<!-- <mat-card-title>Contact Information</mat-card-title><hr/>
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||||
<input matInput placeholder="Phone number" [formControl]="regForm.controls['phone']" type="text">
|
<input matInput placeholder="Phone number" [formControl]="regForm.controls['phone']" type="text">
|
||||||
@ -68,13 +73,13 @@
|
|||||||
<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-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-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-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">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||||
|
|
||||||
<input matInput placeholder="Address 1" [formControl]="regForm.controls['address1']">
|
<input matInput placeholder="Address 1" [formControl]="regForm.controls['address1']">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div> -->
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
<!-- <div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs">
|
||||||
|
|
||||||
<input matInput placeholder="Address 2" [formControl]="regForm.controls['address2']">
|
<input matInput placeholder="Address 2" [formControl]="regForm.controls['address2']">
|
||||||
@ -89,10 +94,10 @@
|
|||||||
|
|
||||||
<input matInput placeholder="Pincode" [formControl]="regForm.controls['pincode']">
|
<input matInput placeholder="Pincode" [formControl]="regForm.controls['pincode']">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div> -->
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||||
<mat-select matInput placeholder="Select State" [formControl]="regForm.controls['state']" required (selectionChange)="getcity($event)">
|
<mat-select matInput placeholder="State" [formControl]="regForm.controls['state']" required (selectionChange)="getcity($event)" >
|
||||||
<mat-option>--</mat-option>
|
<mat-option>--</mat-option>
|
||||||
<mat-option *ngFor="let s of State" [value]="s" >
|
<mat-option *ngFor="let s of State" [value]="s" >
|
||||||
{{s.name}}
|
{{s.name}}
|
||||||
@ -101,7 +106,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||||
<mat-select matInput placeholder="Select City" [formControl]="regForm.controls['city']" required>
|
<mat-select matInput placeholder="City" [formControl]="regForm.controls['city']" required>
|
||||||
<mat-option>--</mat-option>
|
<mat-option>--</mat-option>
|
||||||
<mat-option *ngFor="let c of City" [value]="c">
|
<mat-option *ngFor="let c of City" [value]="c">
|
||||||
{{c.name}}
|
{{c.name}}
|
||||||
@ -113,7 +118,7 @@
|
|||||||
<mat-card-title>Role Information</mat-card-title><hr/><br/>
|
<mat-card-title>Role Information</mat-card-title><hr/><br/>
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||||
<mat-select matInput placeholder="Select Enitity type" (selectionChange)="checktype($event.value)" [formControl]="regForm.controls['type']"
|
<mat-select matInput placeholder="Enitity type" (selectionChange)="checktype($event.value)" [formControl]="regForm.controls['type']"
|
||||||
required>
|
required>
|
||||||
<mat-option>--</mat-option>
|
<mat-option>--</mat-option>
|
||||||
<mat-option *ngFor="let types of types" [value]="types">
|
<mat-option *ngFor="let types of types" [value]="types">
|
||||||
@ -125,13 +130,29 @@
|
|||||||
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<!-- <span *ngIf="roleload"> -->
|
<!-- <span *ngIf="roleload"> -->
|
||||||
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="typeValue == '2'">
|
||||||
|
<mat-select matInput placeholder="Lender Name" [formControl]="regForm.controls['lenVenName']" required>
|
||||||
|
<mat-option>--</mat-option>
|
||||||
|
<mat-option *ngFor="let ent of entities" [value]="ent">
|
||||||
|
{{ent.full_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="typeValue == '3'">
|
||||||
|
<mat-select matInput placeholder="Vendor Name" [formControl]="regForm.controls['lenVenName']" required>
|
||||||
|
<mat-option>--</mat-option>
|
||||||
|
<mat-option *ngFor="let ent of entities" [value]="ent">
|
||||||
|
{{ent.full_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
<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-select matInput placeholder="Role" (selectionChange)="toggleAllSelection($event,regForm.controls['type'].value)" [formControl]="regForm.controls['role']" required>
|
||||||
<!-- <mat-option #allSelected (click)="toggleAllSelection()" [value]="0">ALL</mat-option> -->
|
<!-- <mat-option #allSelected (click)="toggleAllSelection()" [value]="0">ALL</mat-option> -->
|
||||||
<mat-option *ngFor="let role of roles" [value]="role" (onSelectionChange)="toggleAllSelection($event)">
|
<mat-option *ngFor="let role of roles" [value]="role" >
|
||||||
{{role.GroupName}}
|
{{role.role_name}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<div *ngIf="roleload"><mat-progress-bar mode="indeterminate" color="defalut"></mat-progress-bar></div>
|
<div *ngIf="roleload"><mat-progress-bar mode="indeterminate" color="defalut"></mat-progress-bar></div>
|
||||||
@ -139,26 +160,12 @@
|
|||||||
<mat-error *ngIf="regForm.controls['role'].errors?.phone && 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>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="typeValue == '1'">
|
|
||||||
<mat-select matInput placeholder="Select designation" [formControl]="regForm.controls['designation']" required>
|
|
||||||
<mat-option>--</mat-option>
|
|
||||||
<mat-option *ngFor="let d of designation" [value]="d">
|
|
||||||
{{d.name}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="typeValue == '2'">
|
|
||||||
<mat-select matInput placeholder="Select lenderHierarchy" [formControl]="regForm.controls['lenderHierarchy']" required>
|
|
||||||
<mat-option>--</mat-option>
|
|
||||||
<mat-option *ngFor="let l of lenderHierarchy" [value]="l">
|
|
||||||
{{l.lender_hierarchy}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2" *ngIf="roleAccess">
|
<!-- <div fxLayout="row" fxLayoutAlign="start center" class="mb-2" *ngIf="roleAccess">
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" >
|
|
||||||
|
<!-- <mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" >
|
||||||
<mat-select matInput placeholder="Select Customer" [formControl]="regForm.controls['customer']" required (selectionChange)="getcity($event)">
|
<mat-select matInput placeholder="Select Customer" [formControl]="regForm.controls['customer']" required (selectionChange)="getcity($event)">
|
||||||
<mat-option>--</mat-option>
|
<mat-option>--</mat-option>
|
||||||
<mat-option *ngFor="let C of customerSeg" [value]="C" >
|
<mat-option *ngFor="let C of customerSeg" [value]="C" >
|
||||||
@ -176,10 +183,10 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div> -->
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="roleAccess">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="roleAccess">
|
||||||
<mat-select matInput placeholder="Select PDTEAM" [formControl]="regForm.controls['pdteam']" required (selectionChange)="getcity($event)">
|
<mat-select matInput placeholder="PD Team" [formControl]="regForm.controls['pdteam']" required >
|
||||||
<mat-option>--</mat-option>
|
<mat-option>--</mat-option>
|
||||||
<mat-option *ngFor="let pd of pdTeam" [value]="pd" >
|
<mat-option *ngFor="let pd of pdTeam" [value]="pd" >
|
||||||
{{pd.team_name}}
|
{{pd.team_name}}
|
||||||
@ -188,7 +195,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="roleAccess">
|
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;" *ngIf="roleAccess">
|
||||||
<mat-select matInput placeholder="Select PDTYPE" [formControl]="regForm.controls['pdtype']" required>
|
<mat-select matInput placeholder="PD Type" [formControl]="regForm.controls['pdtype']" required>
|
||||||
<mat-option>--</mat-option>
|
<mat-option>--</mat-option>
|
||||||
<mat-option *ngFor="let PDT of pdType" [value]="PDT">
|
<mat-option *ngFor="let PDT of pdType" [value]="PDT">
|
||||||
{{PDT.type_name}}
|
{{PDT.type_name}}
|
||||||
@ -199,10 +206,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
|
||||||
UserProfile
|
UserProfile
|
||||||
<input type="file" (change)="onFileChange($event)" [formControl]="regForm.controls['userpic']" />
|
<input type="file" (change)="onFileChange($event)" [formControl]="regForm.controls['userpic']" accept="image/*" />
|
||||||
|
<br/>
|
||||||
<span *ngIf="usersData!=''">{{img}}</span>
|
<div *ngIf="imageaccess">
|
||||||
<!-- <img [src]="file" style="width: 40px;height: 50px;"> -->
|
<img [src]="filename" style="width: 27%;
|
||||||
|
height: 62%;
|
||||||
|
border-radius: 50%;
|
||||||
|
">
|
||||||
|
</div>
|
||||||
|
<span *ngIf="usersData !=''">
|
||||||
|
{{img}}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
|
|||||||
import { MatOption } from '@angular/material';
|
import { MatOption } from '@angular/material';
|
||||||
import { UserService } from '../../service/user.service';
|
import { UserService } from '../../service/user.service';
|
||||||
import { ifStmt } from '@angular/compiler/src/output/output_ast';
|
import { ifStmt } from '@angular/compiler/src/output/output_ast';
|
||||||
const pdoff = "PDOFFICER";
|
const pdoff = "PD Officer";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-register',
|
selector: 'app-register',
|
||||||
@ -19,6 +19,10 @@ const pdoff = "PDOFFICER";
|
|||||||
|
|
||||||
|
|
||||||
export class RegisterComponent implements OnInit {
|
export class RegisterComponent implements OnInit {
|
||||||
|
Cities: any;
|
||||||
|
role: any;
|
||||||
|
imageaccess: boolean = false;
|
||||||
|
filename:any;
|
||||||
roleload:boolean = false;
|
roleload:boolean = false;
|
||||||
pdTeam: any = [];
|
pdTeam: any = [];
|
||||||
customerSeg: any = [];
|
customerSeg: any = [];
|
||||||
@ -48,6 +52,8 @@ export class RegisterComponent implements OnInit {
|
|||||||
@ViewChild('allSelected') private allSelected: MatOption;
|
@ViewChild('allSelected') private allSelected: MatOption;
|
||||||
profileurl: any;
|
profileurl: any;
|
||||||
profileaccess: boolean;
|
profileaccess: boolean;
|
||||||
|
entitiesDetails:any;
|
||||||
|
entities:any;
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router, public fb: FormBuilder, public AWS: AwsService, private cd: ChangeDetectorRef
|
private router: Router, public fb: FormBuilder, public AWS: AwsService, private cd: ChangeDetectorRef
|
||||||
,private elementRef: ElementRef,public users:UserService) { }
|
,private elementRef: ElementRef,public users:UserService) { }
|
||||||
@ -65,23 +71,14 @@ export class RegisterComponent implements OnInit {
|
|||||||
firstName: [null, Validators.compose([Validators.required, Validators.minLength(2)])],
|
firstName: [null, Validators.compose([Validators.required, Validators.minLength(2)])],
|
||||||
lastName: [null, Validators.compose([Validators.required])],
|
lastName: [null, Validators.compose([Validators.required])],
|
||||||
phone: [null, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(12)])],
|
phone: [null, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(12)])],
|
||||||
altphone: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(12)])],
|
|
||||||
email: [null, Validators.compose([Validators.required, CustomValidators.email])],
|
email: [null, Validators.compose([Validators.required, CustomValidators.email])],
|
||||||
altemail: [null, Validators.compose([CustomValidators.email])],
|
|
||||||
role: [null, Validators.compose([Validators.required])],
|
role: [null, Validators.compose([Validators.required])],
|
||||||
type: [null, Validators.compose([Validators.required])],
|
type: [null, Validators.compose([Validators.required])],
|
||||||
address1: [null, ''],
|
|
||||||
address2: [null, ''],
|
|
||||||
address3: [null, ''],
|
|
||||||
state: [null, Validators.compose([Validators.required])],
|
state: [null, Validators.compose([Validators.required])],
|
||||||
city: [null, Validators.compose([Validators.required])],
|
city: [null, Validators.compose([Validators.required])],
|
||||||
designation: [null, Validators.compose([Validators.required])],
|
lenVenName: [null, Validators.compose([Validators.required])],
|
||||||
userpic: [null],
|
userpic: [null],
|
||||||
isactive: [true],
|
isactive: [true],
|
||||||
pincode: [null],
|
|
||||||
lenderHierarchy:[null,Validators.compose([Validators.required])],
|
|
||||||
customer:[null,Validators.compose([Validators.required])],
|
|
||||||
product:[null,Validators.compose([Validators.required])],
|
|
||||||
pdteam:[null,Validators.compose([Validators.required])],
|
pdteam:[null,Validators.compose([Validators.required])],
|
||||||
pdtype:[null,Validators.compose([Validators.required])],
|
pdtype:[null,Validators.compose([Validators.required])],
|
||||||
|
|
||||||
@ -91,12 +88,6 @@ export class RegisterComponent implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelect(e){
|
|
||||||
// alert();
|
|
||||||
// console.log(e)
|
|
||||||
// console.log(e.isUserInput);
|
|
||||||
// console.log(this.regForm.controls['role'].value);
|
|
||||||
}
|
|
||||||
|
|
||||||
regdata() {
|
regdata() {
|
||||||
this.users.entityType().subscribe(res => {
|
this.users.entityType().subscribe(res => {
|
||||||
@ -104,12 +95,23 @@ export class RegisterComponent implements OnInit {
|
|||||||
if (this.types.status == 200) {
|
if (this.types.status == 200) {
|
||||||
this.types = this.types.records;
|
this.types = this.types.records;
|
||||||
//console.log(this.types);
|
//console.log(this.types);
|
||||||
|
this.regForm.controls['type'].setValue(this.types[0]);
|
||||||
|
this.users.roles().subscribe(res=>{
|
||||||
|
console.log(res);
|
||||||
|
this.roleload = false;
|
||||||
|
//console.log(roleload);
|
||||||
|
this.role = res;
|
||||||
|
if(this.role.dataStatus == true){
|
||||||
|
this.role = this.role.records;
|
||||||
|
this.checktype(this.types[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.users.City().subscribe(res => {
|
this.users.City().subscribe(res => {
|
||||||
this.City = res;
|
this.Cities = res;
|
||||||
if (this.City.status == 200) {
|
if (this.Cities.status == 200) {
|
||||||
this.City = this.City.records.filter(City=>City.isactive ==1);
|
this.Cities = this.Cities.records.filter(City=>City.isactive ==1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.users.State().subscribe(res => {
|
this.users.State().subscribe(res => {
|
||||||
@ -118,25 +120,7 @@ export class RegisterComponent implements OnInit {
|
|||||||
this.State = this.State.records.filter(state=>state.isactive ==1);
|
this.State = this.State.records.filter(state=>state.isactive ==1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.users.designation().subscribe(res => {
|
|
||||||
this.designation = res;
|
|
||||||
if (this.designation.status == 200) {
|
|
||||||
this.designation = this.designation.records.filter(des=>des.isactive ==1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.users.lenderHierarchy().subscribe(res=>{
|
|
||||||
this.lenderHierarchy = res;
|
|
||||||
if(this.lenderHierarchy.status ==200){
|
|
||||||
this.lenderHierarchy = this.lenderHierarchy.records.filter(len=>len.isactive ==1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.users.products().subscribe(res=>{
|
|
||||||
this.product = res;
|
|
||||||
if(this.product.status == 200){
|
|
||||||
this.product = this.product.records.filter(product=>product.isactive ==1);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.users.pdTeam().subscribe(res=>{
|
this.users.pdTeam().subscribe(res=>{
|
||||||
|
|
||||||
this.pdTeam = res;
|
this.pdTeam = res;
|
||||||
@ -150,28 +134,39 @@ export class RegisterComponent implements OnInit {
|
|||||||
this.pdType = this.pdType.records.filter(pdty=>pdty.isactive ==1);
|
this.pdType = this.pdType.records.filter(pdty=>pdty.isactive ==1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.users.customerSegment().subscribe(res=>{
|
|
||||||
this.customerSeg = res;
|
|
||||||
if(this.customerSeg.status == 200){
|
|
||||||
this.customerSeg = this.customerSeg.records.filter(cus=>cus.isactive ==1);
|
this.users.entitiesDetails().subscribe(res=>{
|
||||||
console.log(this.customerSeg);
|
this.entitiesDetails = res;
|
||||||
|
if(this.entitiesDetails.dataStatus == true){
|
||||||
|
this.entitiesDetails = this.entitiesDetails.records;
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
//console.log(this.State+''+this.types+''+this.City+''+this.designation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onFileChange($event) {
|
onFileChange($event) {
|
||||||
//console.log($event.target.files[0]);
|
//console.log($event.target.files[0]);
|
||||||
|
this.imageaccess = true;
|
||||||
|
var reader = new FileReader();
|
||||||
//if($event.target.files[0] < 0 ){
|
//if($event.target.files[0] < 0 ){
|
||||||
this.files = $event.target.files[0];
|
this.files = $event.target.files[0];
|
||||||
// console.log(this.files);
|
console.log(this.files);
|
||||||
// let file = ;
|
|
||||||
console.log($event.target.result);
|
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);
|
//console.log(this.files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
register(userData) {
|
register(userData) {
|
||||||
// console.log(userData);
|
console.log(userData);
|
||||||
let data:any;
|
let data:any;
|
||||||
|
|
||||||
// console.log(this.files);
|
// console.log(this.files);
|
||||||
@ -192,7 +187,9 @@ this.loader = true;
|
|||||||
|
|
||||||
this.AWS.register(userData).subscribe(res => {
|
this.AWS.register(userData).subscribe(res => {
|
||||||
if (res.User.UserStatus != '' && res.User.UserStatus !== undefined && res.User.UserStatus != null) {
|
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.AWS.UserGroup(res,userData).subscribe(res=>{
|
||||||
|
});}
|
||||||
this.users.saveRecords(res, userData).subscribe(res => {
|
this.users.saveRecords(res, userData).subscribe(res => {
|
||||||
data = res;
|
data = res;
|
||||||
if (data.status == 200) {
|
if (data.status == 200) {
|
||||||
@ -204,11 +201,14 @@ this.loader = true;
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
//})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.AWS.adminchangeData(this.usersData,userData).subscribe(res=>{
|
this.AWS.adminchangeData(this.usersData,userData).subscribe(res=>{
|
||||||
|
if(userData.role.role_id == 10){
|
||||||
|
this.AWS.UserGroup(res,userData).subscribe(res=>{
|
||||||
|
});}
|
||||||
this.users.saveRecords(res,userData).subscribe(res=>{
|
this.users.saveRecords(res,userData).subscribe(res=>{
|
||||||
this.loader = false;
|
this.loader = false;
|
||||||
alert('Update User');
|
alert('Update User');
|
||||||
@ -221,42 +221,42 @@ this.loader = true;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleAllSelection(e) {
|
toggleAllSelection(e,enitiyid) {
|
||||||
|
console.log(enitiyid);
|
||||||
|
// if(e.value){
|
||||||
|
|
||||||
if(e.source.selected){
|
// if(e.value.role_name == pdoff && enitiyid.entity_type_id == 1){
|
||||||
|
// console.log(e.value);
|
||||||
if(e.source.value.GroupName == pdoff){
|
// this.roleAccess = true;
|
||||||
|
// }else{
|
||||||
|
// this.roleAccess = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (this.usersData != '' && this.usersData !==undefined || e.value.role_name == pdoff && enitiyid.entity_type_id == 1) {
|
||||||
|
console.log(e);
|
||||||
|
if(e.role_name == pdoff && enitiyid.entity_type_id == 1 || e.value.role_name == pdoff && enitiyid.entity_type_id == 1){
|
||||||
|
|
||||||
this.roleAccess = true;
|
this.roleAccess = true;
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
if(e.source.value.GroupName == pdoff){
|
|
||||||
this.roleAccess = false;
|
this.roleAccess = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (this.usersData != '' && this.usersData !==undefined) {
|
|
||||||
let users: any;
|
|
||||||
|
|
||||||
console.log(this.usersData);
|
|
||||||
//for (let role of this.usersData[0]) {
|
|
||||||
//this.AWS.adminremoveGroup(roles,this.usersData);
|
|
||||||
if(e.source.selected){
|
|
||||||
this.AWS.UserGroup(e.source.value,this.usersData);
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
this.AWS.adminremoveGroup(e.source.value,this.usersData);
|
this.roleAccess = false;
|
||||||
console.log("else");
|
|
||||||
}
|
|
||||||
//this.AWS.adminremoveGroup()
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
getcity(e){
|
getcity(e){
|
||||||
// console.log(e)
|
console.log(e);
|
||||||
// this.City =[]= this.City.filter(city=>city.fk_state == e.state_id)[0];
|
console.log(this.Cities);
|
||||||
|
|
||||||
|
|
||||||
|
this.City = this.Cities.filter(city=>city.fk_state_id == e.value.state_id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
userupdate() {
|
userupdate() {
|
||||||
|
|
||||||
@ -266,70 +266,73 @@ this.loader = true;
|
|||||||
this.users.entityType().subscribe(res => {
|
this.users.entityType().subscribe(res => {
|
||||||
this.types = res;
|
this.types = res;
|
||||||
if (this.types.status == 200) {
|
if (this.types.status == 200) {
|
||||||
let type = this.types.records;
|
let type = this.types.records.filter(type=>type.isactive ==1);
|
||||||
this.types= type.filter(type => type.entity_type_id == this.usersData.fk_entity_id);
|
this.types= type.filter(type => type.entity_type_id == this.usersData.fk_entity_type_id);
|
||||||
this.checktype(this.types[0]);
|
|
||||||
|
|
||||||
this.regForm.controls['type'].setValue(this.types[0]);
|
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.users.roles().subscribe(res=>{
|
||||||
|
|
||||||
|
this.roleload = false;
|
||||||
|
//console.log(roleload);
|
||||||
|
this.role = res;
|
||||||
|
if(this.role.dataStatus == true){
|
||||||
|
this.role = this.role.records;
|
||||||
|
this.checktype(this.types[0]);
|
||||||
|
|
||||||
|
let role = this.role.filter(role=>role.role_type == this.usersData.fk_entity_type_id && role.role_id == this.usersData.user_role)[0];
|
||||||
|
this.regForm.controls['role'].setValue(role);
|
||||||
|
console.log(role);
|
||||||
|
this.toggleAllSelection(role,this.types[0]);
|
||||||
|
// this.regForm.controls['role'].setValue(role);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.users.City().subscribe(res => {
|
|
||||||
this.City = res;
|
|
||||||
if (this.City.status == 200) {
|
|
||||||
this.City = this.City.records;
|
|
||||||
let citys = this.City.filter(city => city.city_id == this.usersData.fk_city)[0];
|
|
||||||
this.regForm.controls['city'].setValue(citys);
|
|
||||||
// console.log(this.City);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.users.State().subscribe(res => {
|
this.users.State().subscribe(res => {
|
||||||
this.State = res;
|
this.State = res;
|
||||||
if (this.State.status == 200) {
|
if (this.State.status == 200) {
|
||||||
this.State = this.State.records;
|
this.State = this.State.records.filter(ent=>ent.isactive ==1);
|
||||||
let states = this.State.filter(state => state.state_id == this.usersData.fk_state)[0];
|
let states = this.State.filter(state => state.state_id == this.usersData.fk_state)[0];
|
||||||
// console.log(this.State);
|
console.log(states);
|
||||||
this.regForm.controls['state'].setValue(states);
|
this.regForm.controls['state'].setValue(states);
|
||||||
}
|
this.users.City().subscribe(res => {
|
||||||
});
|
this.Cities = res;
|
||||||
this.users.designation().subscribe(res => {
|
if (this.Cities.status == 200) {
|
||||||
this.designation = res;
|
//this.City = this.Cities.records;
|
||||||
if (this.designation.status == 200) {
|
this.Cities = this.Cities.records.filter(ent=>ent.isactive ==1);
|
||||||
this.designation = this.designation.records;
|
let City = this.Cities.filter(city=>city.fk_state_id == states.state_id && city.city_id == this.usersData.fk_city)[0];
|
||||||
let des = this.designation.filter(des => des.designation_id == this.usersData.fk_designation)[0];
|
let value = {'value':{'state_id':states.state_id}};
|
||||||
this.regForm.controls['designation'].setValue(des);
|
this.getcity(value);
|
||||||
}
|
this.regForm.controls['city'].setValue(City);
|
||||||
});
|
// let citys = this.Cities.filter(city => city.city_id == this.usersData.fk_city)[0];
|
||||||
this.users.lenderHierarchy().subscribe(res=>{
|
// this.regForm.controls['city'].setValue(citys);
|
||||||
this.lenderHierarchy = res;
|
// console.log(this.City);
|
||||||
if(this.lenderHierarchy.status ==200){
|
|
||||||
this.lenderHierarchy = this.lenderHierarchy.records;
|
|
||||||
let hie = this.lenderHierarchy.filter(hie => hie.lender_hierarchy_id == this.usersData.fk_hierarchy_id)[0];
|
|
||||||
console.log(hie);
|
|
||||||
this.regForm.controls['lenderHierarchy'].setValue(hie);
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.users.products().subscribe(res=>{
|
|
||||||
this.product = res;
|
|
||||||
if(this.product.status == 200){
|
|
||||||
this.product = this.product.records;
|
|
||||||
//console.log(this.usersData.fk_product_id);
|
|
||||||
let pro = this.product.filter(pro=>pro.product_id == this.usersData.fk_product_id)[0];
|
|
||||||
//console.log(pro);
|
|
||||||
this.regForm.controls['product'].setValue(pro);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.users.pdTeam().subscribe(res=>{
|
this.users.pdTeam().subscribe(res=>{
|
||||||
|
|
||||||
this.pdTeam = res;
|
this.pdTeam = res;
|
||||||
if(this.pdTeam.status == 200){
|
if(this.pdTeam.status == 200){
|
||||||
this.pdTeam = this.pdTeam.records;
|
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];
|
let pdteam = this.pdTeam.filter(pd=>pd.pdteam_id == this.usersData.fk_team_id)[0];
|
||||||
this.regForm.controls['pdteam'].setValue(pdteam);
|
this.regForm.controls['pdteam'].setValue(pdteam);
|
||||||
}
|
}
|
||||||
@ -337,20 +340,12 @@ this.loader = true;
|
|||||||
this.users.pdType().subscribe(res=>{
|
this.users.pdType().subscribe(res=>{
|
||||||
this.pdType = res;
|
this.pdType = res;
|
||||||
if(this.pdType.status == 200){
|
if(this.pdType.status == 200){
|
||||||
this.pdType = this.pdType.records;
|
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];
|
let pdtype = this.pdType.filter(pdt=>pdt.pd_type_id == this.usersData.fk_pd_type_id)[0];
|
||||||
this.regForm.controls['pdtype'].setValue(pdtype);
|
this.regForm.controls['pdtype'].setValue(pdtype);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.users.customerSegment().subscribe(res=>{
|
|
||||||
this.customerSeg = res;
|
|
||||||
if(this.customerSeg.status == 200){
|
|
||||||
this.customerSeg = this.customerSeg.records;
|
|
||||||
let cust = this.customerSeg.filter(cus=>cus.customer_segment_id == this.usersData.fk_customer_segment)[0];
|
|
||||||
this.regForm.controls['customer'].setValue(cust);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let users= {
|
let users= {
|
||||||
'userid':this.usersData.userid,
|
'userid':this.usersData.userid,
|
||||||
'entityid':this.usersData.fk_entity_id,
|
'entityid':this.usersData.fk_entity_id,
|
||||||
@ -372,12 +367,8 @@ this.loader = true;
|
|||||||
this.regForm.controls['firstName'].setValue(this.usersData.user_first_name);
|
this.regForm.controls['firstName'].setValue(this.usersData.user_first_name);
|
||||||
this.regForm.controls['lastName'].setValue(this.usersData.user_last_name);
|
this.regForm.controls['lastName'].setValue(this.usersData.user_last_name);
|
||||||
this.regForm.controls['phone'].setValue(this.usersData.mobile_no);
|
this.regForm.controls['phone'].setValue(this.usersData.mobile_no);
|
||||||
this.regForm.controls['altphone'].setValue(this.usersData.alt_mobile_no);
|
|
||||||
this.regForm.controls['email'].setValue(this.usersData.email);
|
this.regForm.controls['email'].setValue(this.usersData.email);
|
||||||
this.regForm.controls['altemail'].setValue(this.usersData.alt_email);
|
|
||||||
this.regForm.controls['address1'].setValue(this.usersData.addressline1);
|
|
||||||
this.regForm.controls['address2'].setValue(this.usersData.addressline2);
|
|
||||||
this.regForm.controls['address3'].setValue(this.usersData.addressline3);
|
|
||||||
if (this.usersData.isactive == 1) {
|
if (this.usersData.isactive == 1) {
|
||||||
this.regForm.controls['isactive'].setValue(true);
|
this.regForm.controls['isactive'].setValue(true);
|
||||||
} else {
|
} else {
|
||||||
@ -385,31 +376,29 @@ this.loader = true;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this.regForm.controls['userpic'].setValue(this.usersData.profilepic);
|
// this.regForm.controls['userpic'].setValue(this.usersData.profilepic);
|
||||||
this.regForm.controls['pincode'].setValue(this.usersData.pincode);
|
|
||||||
this.img = this.usersData.profilepic;
|
this.img = this.usersData.profilepic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
checktype(e){
|
checktype(e){
|
||||||
//console.log(e);
|
console.log(e);
|
||||||
|
this.roleAccess= false;
|
||||||
let userRole:any = [];
|
let userRole:any;
|
||||||
if(e !== undefined){
|
if(e !== undefined){
|
||||||
this.roleload = true;
|
|
||||||
//console.log(roleload);
|
//console.log(roleload);
|
||||||
this.AWS.adminlistgroup(e.entity_type_id).subscribe(res=>{
|
|
||||||
this.roleload = false;
|
this.roles = this.role.filter(role=>role.role_type == e.entity_type_id);
|
||||||
//console.log(roleload);
|
console.log(this.roles);
|
||||||
this.roles = res;
|
// let role = this.roles.filter(role=>role.role_id == this.usersData.user_role_id);
|
||||||
if(this.usersData !==undefined){
|
// console.log(role);
|
||||||
for (let role of this.usersData[0]) {
|
// this.regForm.controls['role'].setValue(role);
|
||||||
//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) {
|
switch (e.entity_type_id) {
|
||||||
case "1":
|
case "1":
|
||||||
this.typeValue =1;
|
this.typeValue =1;
|
||||||
@ -417,16 +406,18 @@ this.loader = true;
|
|||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
this.typeValue =2;
|
this.typeValue =2;
|
||||||
|
this.entities = this.entitiesDetails.filter(entity=>entity.fk_entity_type_id == e.entity_type_id);
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
this.typeValue =3;
|
this.typeValue =3;
|
||||||
|
this.entities = this.entitiesDetails.filter(entity=>entity.fk_entity_type_id == e.entity_type_id);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
this.typeValue = -1;
|
this.typeValue = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user