prod iss fixes on user
This commit is contained in:
parent
561287e1e9
commit
d54d5dcd6c
@ -272,6 +272,7 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
|
|||||||
//alert();
|
//alert();
|
||||||
this.aws.logout().subscribe(res=>{
|
this.aws.logout().subscribe(res=>{
|
||||||
//alert("res");
|
//alert("res");
|
||||||
|
localStorage.removeItem('user_role');
|
||||||
this.router.navigate(['/authentication/login']);
|
this.router.navigate(['/authentication/login']);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,6 +65,7 @@ export class RegisterComponent implements OnInit {
|
|||||||
if (this.users.localUserId != '' && this.users.localUserId != null && this.users.localUserId !== undefined) {
|
if (this.users.localUserId != '' && this.users.localUserId != null && this.users.localUserId !== undefined) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.regdata();
|
this.regdata();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,20 +96,22 @@ export class RegisterComponent implements OnInit {
|
|||||||
regdata() {
|
regdata() {
|
||||||
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) {
|
||||||
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.regForm.controls['type'].setValue(this.types[0]);
|
||||||
this.users.roles().subscribe(res=>{
|
// this.users.roles().subscribe(res=>{
|
||||||
// console.log(res);
|
// console.log('res',res);
|
||||||
this.roleload = false;
|
// this.roleload = false;
|
||||||
//console.log(roleload);
|
// console.log('this.roleload',this.roleload);
|
||||||
this.role = res;
|
// this.role = res;
|
||||||
if(this.role.dataStatus == true){
|
// if(this.role.dataStatus == true){
|
||||||
this.role = this.role.records;
|
// this.role = this.role.records;
|
||||||
this.checktype(this.types[0]);
|
// this.checktype(this.types[0]);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
this.callrole(1,this.types[0],'');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.users.City().subscribe(res => {
|
this.users.City().subscribe(res => {
|
||||||
@ -267,42 +270,27 @@ this.loader = true;
|
|||||||
this.usersData = this.users.localUserId;
|
this.usersData = this.users.localUserId;
|
||||||
|
|
||||||
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.filter(type=>type.isactive ==1);
|
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.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.regForm.controls['type'].setValue(this.types[0]);
|
this.entitiesDetails = res;
|
||||||
|
if(this.entitiesDetails.dataStatus == true){
|
||||||
|
this.entitiesDetails = this.entitiesDetails.records.filter(ent=>ent.isactive ==1);
|
||||||
this.users.entitiesDetails().subscribe(res=>{
|
let entitiy = this.entitiesDetails.filter(ent=>this.usersData.fk_entity_id == ent.entity_id)[0];
|
||||||
this.entitiesDetails = res;
|
this.regForm.controls['lenVenName'].setValue(entitiy);
|
||||||
if(this.entitiesDetails.dataStatus == true){
|
this.callrole(2,this.types[0],this.usersData);
|
||||||
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];
|
else{
|
||||||
this.regForm.controls['lenVenName'].setValue(entitiy);
|
this.callrole(2,this.types[0],this.usersData);
|
||||||
|
}
|
||||||
this.users.roles().subscribe(res=>{
|
},error => {
|
||||||
|
alert('Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -388,8 +376,39 @@ this.loader = true;
|
|||||||
this.userupdate();
|
this.userupdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** to call role api
|
||||||
|
* params are flag are if 1 - add and 2 - edit
|
||||||
|
**/
|
||||||
|
callrole(flag,type,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);
|
||||||
|
// 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){
|
checktype(e){
|
||||||
// console.log(e);
|
|
||||||
this.roleAccess= false;
|
this.roleAccess= false;
|
||||||
let userRole:any;
|
let userRole:any;
|
||||||
if(e !== undefined){
|
if(e !== undefined){
|
||||||
@ -397,7 +416,7 @@ this.loader = true;
|
|||||||
//console.log(roleload);
|
//console.log(roleload);
|
||||||
|
|
||||||
this.roles = this.role.filter(role=>role.role_type == e.entity_type_id);
|
this.roles = this.role.filter(role=>role.role_type == e.entity_type_id);
|
||||||
// console.log(this.roles);
|
|
||||||
// let role = this.roles.filter(role=>role.role_id == this.usersData.user_role_id);
|
// let role = this.roles.filter(role=>role.role_id == this.usersData.user_role_id);
|
||||||
// console.log(role);
|
// console.log(role);
|
||||||
// this.regForm.controls['role'].setValue(role);
|
// this.regForm.controls['role'].setValue(role);
|
||||||
@ -419,7 +438,7 @@ this.loader = true;
|
|||||||
this.entities = this.entitiesDetails.filter(entity=>entity.fk_entity_type_id == e.entity_type_id);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ export const environment = {
|
|||||||
|
|
||||||
environmentName: 'Production Environment',//Live Environment.
|
environmentName: 'Production Environment',//Live Environment.
|
||||||
|
|
||||||
apiEndpoint: 'https://pdgenie.com/sparqprod/api',
|
apiEndpoint: 'https://pdgenie.com/sparqprod/api/',
|
||||||
|
|
||||||
authorization: 'TnAwuc64pVpcB9xf',
|
authorization: 'TnAwuc64pVpcB9xf',
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user