From f1f43227f9b4e4f28a64e91f4796dfdbe9332dfe Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 28 Jun 2019 12:41:26 +0530 Subject: [PATCH] Environment Setup for Test --- ng6-seed/angular.json | 16 + ng6-seed/package.json | 7 +- ng6-seed/src/app/AwsService/aws.service.ts | 63 +- .../src/app/AwsService/cognito.service.ts | 48 +- .../src/app/AwsService_bkup/aws.service.ts | 778 ++++++++++++++++++ .../app/AwsService_bkup/cognito.service.ts | 204 +++++ ng6-seed/src/app/_guard/token.interceptor.ts | 4 +- ng6-seed/src/app/_guard_bkup/auth.guard.ts | 48 ++ .../src/app/_guard_bkup/token.interceptor.ts | 91 ++ .../list-pd/add-pd/add-pd.component.ts | 6 +- .../list-pd/all-pd/all-pd.component.ts | 4 +- .../completed-pd/completed-pd.component.ts | 4 +- .../edit-pd-applicant.component.ts | 2 +- .../edit-pd-master.component.ts | 10 +- .../initiate-additional-pd.component.ts | 2 +- .../inprogress-pd/inprogress-pd.component.ts | 2 +- .../pd-allocation/pd-allocation.component.ts | 6 +- .../model-edit-pd-report.component.ts | 2 +- .../list-pd/pd-report/pd-report.component.ts | 8 +- .../qc-review/qc-review.component.ts | 2 +- .../pd-requirement.component.ts | 4 +- .../pd-status-change-dialogue.component.ts | 4 +- .../qc-completed-pd.component.ts | 4 +- .../schedule-pd/schedule-pd.component.ts | 8 +- .../scheduled-pd/scheduled-pd.component.ts | 2 +- .../smart-pd-allocation.component.ts | 6 +- .../client-info/client-info.component.html | 4 +- .../qc-pd-report/qc-pd-report.component.ts | 4 +- ng6-seed/src/app/shared/messaging.service.ts | 22 +- ng6-seed/src/environments/environment.prod.ts | 21 +- .../src/environments/environment.stage.ts | 31 + ng6-seed/src/environments/environment.ts | 28 +- 32 files changed, 1334 insertions(+), 111 deletions(-) create mode 100755 ng6-seed/src/app/AwsService_bkup/aws.service.ts create mode 100755 ng6-seed/src/app/AwsService_bkup/cognito.service.ts create mode 100755 ng6-seed/src/app/_guard_bkup/auth.guard.ts create mode 100755 ng6-seed/src/app/_guard_bkup/token.interceptor.ts create mode 100644 ng6-seed/src/environments/environment.stage.ts diff --git a/ng6-seed/angular.json b/ng6-seed/angular.json index 1e7a7c049..e484fdc2f 100755 --- a/ng6-seed/angular.json +++ b/ng6-seed/angular.json @@ -64,6 +64,22 @@ "with": "src/environments/environment.prod.ts" } ] + }, + "staging": { + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.stage.ts" + }] } } }, diff --git a/ng6-seed/package.json b/ng6-seed/package.json index 23d6d10a5..1d544e5dd 100755 --- a/ng6-seed/package.json +++ b/ng6-seed/package.json @@ -1,9 +1,10 @@ { - "name": "optima", - "version": "0.0.0", + "name": "pd_genie_web_application", + "version": "1.0.0", "license": "MIT", "scripts": { - "prod": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod --build-optimizer=true", + "production": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod ", + "staging": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod --configuration=staging", "ng": "ng", "start": "ng serve", "build": "ng build", diff --git a/ng6-seed/src/app/AwsService/aws.service.ts b/ng6-seed/src/app/AwsService/aws.service.ts index 62e54839c..7e93144af 100755 --- a/ng6-seed/src/app/AwsService/aws.service.ts +++ b/ng6-seed/src/app/AwsService/aws.service.ts @@ -23,40 +23,33 @@ import 'rxjs/add/operator/map'; import { CognitoService } from './cognito.service'; - -// const sineedge_poolData = { -// UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV -// ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB -// }; -const sineedgedev_poolData = { - UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV - ClientId: "67b4fnbuols5upms5to8bvqddh"// ClientName: SINEEDGE_DEV_WEB +const se_poolData = { + UserPoolId: environment.seUserPoolId, // UserName :SPARQ_SINEEDGE_DEV + ClientId: environment.seClientId// ClientName: SINEEDGE_DEV_WEB } // client id changed on 12-04-2019 by kms //ClientId: "2o5c3cs9k3als16nqhp3irh8rs" const lender_poolData = { - UserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV - ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB + UserPoolId: environment.lenUserPoolId, // Username :SPARQ_LENDER_DEV + ClientId: environment.lenClientId // ClientName:LENDER_DEV_WEB }; + const vendor_poolData = { - UserPoolId: "ap-south-1_K57yPaWxV", - ClientId: "" + UserPoolId: environment.venUserPoolId, + ClientId: environment.venClientId } -// const sineedgeUserPool = new CognitoUserPool(sineedge_poolData); + +const sineedgeUserpool = new CognitoUserPool(se_poolData); const lenderUserPool = new CognitoUserPool(lender_poolData); -const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData); + /** -* Identity PoolID -*/ -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 vendorIdenttiy = "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874"; -// serviceProvider -const apiurl = environment.apiEndpoint; -//const apiurl = "http://ssa.sineedge.com/sparqapi/api/"; -//const apiurl = "http://localhost/sparqapi/api/"; + * Identity PoolID + */ +const sineedgeIdentity = environment.seIdentityPoolId; +const lenderIdentity = environment.lenIdentityPoolId; +const vendorIdenttiy = environment.venIdentityPoolId; @Injectable({ providedIn: "root" @@ -85,7 +78,7 @@ export class AwsService { let attributesData = []; const userData = { Username: authenticationData.Username, // User email id - Pool: sineedgedevUserpool // user Pool ID + Pool: sineedgeUserpool // user Pool ID }; let cognitoUser = new CognitoUser(userData); return Observable.create(observer => { @@ -132,7 +125,7 @@ export class AwsService { ////(auth); const userData = { Username: auth.Username, - Pool: sineedgedevUserpool + Pool: sineedgeUserpool }; let cognitoUser = new CognitoUser(userData); return Observable.create(observe => { @@ -228,7 +221,7 @@ export class AwsService { if (userGroup == 'ADMIN') { if (userdata.fk_entity_type_id == 1) { params = { - UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + UserPoolId: se_poolData.UserPoolId, /* required */ Username: awsName /* required */ }; } else if (userdata.fk_entity_type_id == 2) { @@ -275,7 +268,7 @@ export class AwsService { if (userdata.fk_entity_type_id == 1) { params = { - UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + UserPoolId: se_poolData.UserPoolId, /* required */ Username: awsName /* required */ }; } else if (userdata.fk_entity_type_id == 2) { @@ -310,7 +303,7 @@ export class AwsService { if (userGroup == "ADMIN") { if (userData.type.entity_type_id == 1) { params = { - UserPoolId: sineedgedev_poolData.UserPoolId /* required */, + UserPoolId: se_poolData.UserPoolId /* required */, Username: userData.email /* required */, DesiredDeliveryMediums: [ "EMAIL" @@ -425,14 +418,14 @@ export class AwsService { if(userData.userid === undefined){ params = { GroupName: "ADMIN" /* required */, - UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */, + UserPoolId: se_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */, Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */ }; }else { params = { GroupName: "ADMIN" /* required */, - UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */, + UserPoolId: se_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */, Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */ }; } @@ -492,7 +485,7 @@ export class AwsService { } /* more items */ ], - UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + UserPoolId: se_poolData.UserPoolId, /* required */ Username: user.email /* required */ }; }else if(user.type.entity_type_id ==2){ @@ -563,7 +556,7 @@ export class AwsService { if (userGroup == "ADMIN") { if (userData.fk_entity_type_id == 1) { params = { - UserPoolId: sineedgedev_poolData.UserPoolId /* required */, + UserPoolId: se_poolData.UserPoolId /* required */, Username: userData.aws_name,//userData.email /* required */, // ForceAliasCreation: true || false, @@ -687,7 +680,7 @@ adminresetpassword(awsuser){ let params:any; if(awsuser.fk_entity_id ==1){ params= { - UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + UserPoolId: se_poolData.UserPoolId, /* required */ Username: awsuser.email /* required */ }; }else if(awsuser.fk_entity_id ==2){ @@ -730,7 +723,7 @@ admindelete(aws){ let params:any; if(aws.fk_entity_id ==1){ params= { - UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + UserPoolId: se_poolData.UserPoolId, /* required */ Username: aws.email /* required */ }; }else if(aws.fk_entity_id ==2){ @@ -756,7 +749,7 @@ adminlistgroup(enitiy){ let params:any; if(enitiy ==1){ params = { - UserPoolId:sineedgedev_poolData.UserPoolId, + UserPoolId:se_poolData.UserPoolId, } }else if(enitiy ==2){ params = { diff --git a/ng6-seed/src/app/AwsService/cognito.service.ts b/ng6-seed/src/app/AwsService/cognito.service.ts index 257ca25a6..7fcc7b5e3 100755 --- a/ng6-seed/src/app/AwsService/cognito.service.ts +++ b/ng6-seed/src/app/AwsService/cognito.service.ts @@ -13,36 +13,36 @@ import { import { environment } from '../../environments/environment'; import { BehaviorSubject,Observable,of } from 'rxjs'; -const sineedge_poolData = { - UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV - ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB -}; -const sineedgedev_poolData = { - UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV - ClientId: "67b4fnbuols5upms5to8bvqddh" // ClientName: SINEEDGE_DEV_WEB +// const sineedge_poolData = { +// UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV +// ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB +// }; + +const sineedge_poolData = { + UserPoolId: environment.seUserPoolId, // UserName + ClientId: environment.seClientId // ClientName } + const lender_poolData = { - UserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV - ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB + UserPoolId: environment.lenUserPoolId, // UserName + ClientId: environment.lenClientId // ClientName }; + const vendor_poolData = { - UserPoolId: "", - ClientId: "" + UserPoolId: environment.venUserPoolId, // UserName + ClientId: environment.venClientId // ClientName } -const sineedgeUserPool = new CognitoUserPool(sineedge_poolData); + +const sineedgeUserpool = new CognitoUserPool(sineedge_poolData); const lenderUserPool = new CognitoUserPool(lender_poolData); -const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData); + /** * Identity PoolID */ -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 vendorIdenttiy = ""; -// serviceProvider -//const apiurl = "http://ssa.sineedge.com/sparqapi/api/"; -const apiurl = environment.apiEndpoint; -// const apiurl = "http://localhost/sparqapi/api/"; +const sineedgeIdentity = environment.seIdentityPoolId;//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961"; +const lenderIdentity = environment.lenIdentityPoolId; +const vendorIdenttiy = environment.venIdentityPoolId; export interface Callback { callback(): void; @@ -55,6 +55,7 @@ export interface Callback { }) export class CognitoService implements CanActivateChild { public loggedIn :boolean = false; + // public static _REGION = environment.region; // public static _IDENTITY_POOL_ID = environment.identityPoolId; @@ -65,14 +66,16 @@ export class CognitoService implements CanActivateChild { // UserPoolId: CognitoService._USER_POOL_ID, // ClientId: CognitoService._CLIENT_ID // }; + get isLoggedIn() { - if(sineedgedevUserpool.getCurrentUser() !=null){ + if(sineedgeUserpool.getCurrentUser() !=null){ this.loggedIn = true; }else{ this.loggedIn = false; } return this.loggedIn; // {2} } + canActivateChild(){ if(this.getToken()){ //alert('session valid') @@ -96,8 +99,7 @@ isloggin:boolean = false; // } getCurrentUser() { - - return sineedgedevUserpool.getCurrentUser(); + return sineedgeUserpool.getCurrentUser(); } constructor(public route:Router) { } diff --git a/ng6-seed/src/app/AwsService_bkup/aws.service.ts b/ng6-seed/src/app/AwsService_bkup/aws.service.ts new file mode 100755 index 000000000..62e54839c --- /dev/null +++ b/ng6-seed/src/app/AwsService_bkup/aws.service.ts @@ -0,0 +1,778 @@ +import { Injectable } from "@angular/core"; +import { + AuthenticationDetails, + CognitoUserPool, + CognitoUser, + CognitoUserAttribute, + ICognitoUserAttributeData, + ISignUpResult, + CognitoUserSession +} from "amazon-cognito-identity-js"; +import * as AWS from "aws-sdk"; + +import { Observable } from "rxjs/Observable"; +import "rxjs/add/operator/map"; +// import AWS from "aws-sdk/dist/aws-sdk"; + +//environment +import { environment } from '../../environments/environment'; + +import { Http, Headers, RequestOptions } from '@angular/http'; +import { HttpClient } from '@angular/common/http'; +import 'rxjs/add/operator/map'; +import { CognitoService } from './cognito.service'; + + + +// const sineedge_poolData = { +// UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV +// ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB +// }; +const sineedgedev_poolData = { + UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV + ClientId: "67b4fnbuols5upms5to8bvqddh"// ClientName: SINEEDGE_DEV_WEB +} +// client id changed on 12-04-2019 by kms +//ClientId: "2o5c3cs9k3als16nqhp3irh8rs" + +const lender_poolData = { + UserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV + ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB +}; +const vendor_poolData = { + UserPoolId: "ap-south-1_K57yPaWxV", + ClientId: "" +} +// const sineedgeUserPool = new CognitoUserPool(sineedge_poolData); +const lenderUserPool = new CognitoUserPool(lender_poolData); +const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData); + +/** +* Identity PoolID +*/ +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 vendorIdenttiy = "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874"; +// serviceProvider +const apiurl = environment.apiEndpoint; +//const apiurl = "http://ssa.sineedge.com/sparqapi/api/"; +//const apiurl = "http://localhost/sparqapi/api/"; + +@Injectable({ + providedIn: "root" +}) + + +export class AwsService { + //public static _REGION = environment.region; + mySecData: any; + + cognitoUser: any; + jwttoken: any; + cognitousers: any; + localUserId:any = ''; + constructor(public http: Http, public RequestOptions: RequestOptions,public shared:CognitoService) { } + + /** + * Login Function + * @param authenticationData inside of(email and password for login user) + * By sriram + */ + dologin(authenticationData) { + //(authenticationData); + const authenticationDetails = new AuthenticationDetails(authenticationData); + let Newpassword = authenticationData.newpassword; + let attributesData = []; + const userData = { + Username: authenticationData.Username, // User email id + Pool: sineedgedevUserpool // user Pool ID + }; + let cognitoUser = new CognitoUser(userData); + return Observable.create(observer => { + cognitoUser.authenticateUser(authenticationDetails, { + newPasswordRequired: (userAttributes, requiredAttributes) => { // new password set + cognitoUser.completeNewPasswordChallenge( + Newpassword, + attributesData, + { + onSuccess: function (result) { + observer.next(result); + observer.complete(); + }, + onFailure: function (err) { + //(err); + observer.error(err); + //LoginComponent.prototype.open(); + } + } + ); + }, + onSuccess: function (result) { // success user login + // let accessToken = result.getAccessToken().getJwtToken(); + ////(result); + //window.localStorage.setItem('Currentuser', '1'); + observer.next(result); + observer.complete(); + }, + onFailure: function (err) { // error user login + + alert(err.message); + observer.error(err); + } + }); + }); + } + /** + * End of the login function + */ + /** + * User forget password + */ + userforgotpass(auth) { + ////(auth); + const userData = { + Username: auth.Username, + Pool: sineedgedevUserpool + }; + let cognitoUser = new CognitoUser(userData); + return Observable.create(observe => { + cognitoUser.forgotPassword({ + onSuccess: function (data) { + // successfully initiated reset password request + //('CodeDeliveryData from forgotPassword: ' + data); + observe.next(data); + }, + onFailure: function (err) { + alert(err.message || JSON.stringify(err)); + }, + //Optional automatic callback + inputVerificationCode: function (data) { + //('Code sent to: ' + data); + var verificationCode = prompt('Enter Verification Code Sent to Mobile ', ''); + var newPassword = prompt('Enter New Password ', ''); + cognitoUser.confirmPassword(verificationCode, newPassword, { + onSuccess() { + //('Password confirmed!'); + }, + onFailure(err) { + //('Password not confirmed!'); + } + }); + } + }); + }); + + + } + /** + * End of the function + */ + + /** + * Logout function + */ + logout(){ + + return Observable.create(observe=>{ + this.shared.getCurrentUser().signOut(); + + observe.next(); + + observe.complete(); + }); + } + + + /** + * Config function + */ + getconfig() { + let session:any = this.shared.getAccessToken() || ""; + let config = ""; + config += AWS.config.region = "ap-south-1"; + config += AWS.config.credentials = new AWS.CognitoIdentityCredentials({ + IdentityPoolId: sineedgeIdentity, // for sineedge_DEV + Logins: { + "cognito-idp.ap-south-1.amazonaws.com/ap-south-1_qQ85yQZJO": session + .getIdToken() + .getJwtToken() + } + // NOTE: getSession must be called to authenticate user before calling getUserAttributes + }); + return config; + } + /** + * admin Disable user + * @param userdata + * @param awsName + */ + admindisabelUser(userdata, awsName) { + let session:any = this.shared.getAccessToken() || ""; + this.getconfig(); + // let config = ""; + // AWS.config.region = "ap-south-1";//environment.region; + // AWS.config.credentials = new AWS.CognitoIdentityCredentials({ + // IdentityPoolId: sineedgeIdentity, // for sineedge_DEV + // Logins: { + // "cognito-idp.ap-south-1.amazonaws.com/ap-south-1_qQ85yQZJO": session + // .getIdToken() + // .getJwtToken() + // } + // // NOTE: getSession must be called to authenticate user before calling getUserAttributes + // }); + let userGroup = session.idToken.payload["cognito:groups"].filter( + usergroup => usergroup == "ADMIN" + )[0]; + //cognitosdata = 7; + let params: any; + if (userGroup == 'ADMIN') { + if (userdata.fk_entity_type_id == 1) { + params = { + UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + Username: awsName /* required */ + }; + } else if (userdata.fk_entity_type_id == 2) { + params = { + UserPoolId: lender_poolData.UserPoolId, /* required */ + Username: awsName /* required */ + }; + } + return Observable.create(observe => { + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + cognitoidentityserviceprovider.adminDisableUser(params, function (err, data) { + if (err) console.log(err, err.stack); // an error occurred + observe.next("0"); // successful response + }); + }); + } + } + + /** + * Admin enable user + * @param userdata + * @param awsName + */ + adminenableUser(userdata, awsName) { + let session:any = this.shared.getAccessToken() || ""; + // this.getconfig(); + let config = ""; + AWS.config.region = "ap-south-1"; + AWS.config.credentials = new AWS.CognitoIdentityCredentials({ + IdentityPoolId: sineedgeIdentity, // for sineedge_DEV + Logins: { + "cognito-idp.ap-south-1.amazonaws.com/ap-south-1_qQ85yQZJO": session + .getIdToken() + .getJwtToken() + } + // NOTE: getSession must be called to authenticate user before calling getUserAttributes + }); + let userGroup = session.idToken.payload["cognito:groups"].filter( + usergroup => usergroup == "ADMIN" + )[0]; + //cognitosdata = 7; + let params: any; + if (userGroup == 'ADMIN') { + + if (userdata.fk_entity_type_id == 1) { + params = { + UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + Username: awsName /* required */ + }; + } else if (userdata.fk_entity_type_id == 2) { + params = { + UserPoolId: lender_poolData.UserPoolId, /* required */ + Username: awsName /* required */ + }; + } + return Observable.create(observe => { + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + cognitoidentityserviceprovider.adminEnableUser(params, function (err, data) { + if (err) console.log(err, err.stack); // an error occurred + observe.next("1"); // successful response + }); + }); + } + } + + /** + * + */ + register(userData) { + let session:any = this.shared.getAccessToken() || ""; + + this.getconfig(); + let registeredData: any = ""; + let params: any; + let userGroup = session.idToken.payload["cognito:groups"].filter( + usergroup => usergroup == "ADMIN" + )[0]; + // (userGroup); + if (userGroup == "ADMIN") { + if (userData.type.entity_type_id == 1) { + params = { + UserPoolId: sineedgedev_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 + },{ + Name: "custom:role_id" /* required */, + Value: userData.role.role_id + } + /* more items */ + ] + }; + } else if (userData.type.entity_type_id == 2) { + params = { + UserPoolId: lender_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 + },{ + Name: "custom:role_id" /* required */, + Value: userData.role.role_id + } + /* 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 + },{ + Name: "custom:role_id" /* required */, + Value: userData.role.role_id + } + /* more items */ + ] + }; + } + return Observable.create(observe => { + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + + cognitoidentityserviceprovider.adminCreateUser(params, ( + err, + data + ) => { + if (err) { alert(err.message); } + // an error occurred + + + + + observe.next(data); + + + // successful response + }); + }); + }else{ + return alert('Admin Only create user'); + } + } + + + UserGroup(cognitodata, userData) { + //console.log(cognitodata); + this.getconfig(); + //console.log(userData); + //let cognitodata = "539bfefa-ae42-4bee-bf79-4b15d1a2af7f"; + + + + let params: any; + + if(userData.userid === undefined){ + params = { + GroupName: "ADMIN" /* required */, + UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */, + Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */ + }; + }else + { + params = { + GroupName: "ADMIN" /* required */, + UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */, + Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */ + }; + } + + //console.log(params); + return Observable.create(observe=>{ + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + + cognitoidentityserviceprovider.adminAddUserToGroup(params, function ( + err, + data + ) { + if (err) { + alert(err.message); + }//(err, err.stack); + // an error occurred + else {//(data); + + observe.next(cognitodata); + + } + + }) + }); + +} + + + + /** + * admin User update + * @param username,clientid params + **/ + adminUpdateuser(user, cognitosdata) { + let session:any = this.shared.getAccessToken() || ""; + this.getconfig(); + + //let cognitodata = "539bfefa-ae42-4bee-bf79-4b15d1a2af7f"; + let userGroup = session.idToken.payload["cognito:groups"].filter( + usergroup => usergroup == "ADMIN" + )[0]; + //cognitosdata = 7; + let params:any; + if (userGroup == 'ADMIN') { + if(user.type.entity_type_id ==1){ + params = { + UserAttributes: [ /* required */ + { + Name: 'locale', /* required */ + Value: cognitosdata.toString() + },{ + Name:"email_verified", + Value:"true" + },{ + Name:"phone_number_verified", + Value:"true" + } + /* more items */ + ], + UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + Username: user.email /* required */ + }; + }else if(user.type.entity_type_id ==2){ + params = { + UserAttributes: [ /* required */ + { + Name: 'locale', /* required */ + Value: cognitosdata.toString() + },{ + Name:"email_verified", + Value:"true" + },{ + Name:"phone_number_verified", + Value:"true" + } + /* more items */ + ], + UserPoolId: lender_poolData.UserPoolId, /* required */ + Username: user.email /* required */ + }; + }else if(user.type.entity_type_id ==3){ + params = { + UserAttributes: [ /* required */ + { + Name: 'locale', /* required */ + Value: cognitosdata.toString() + },{ + Name:"email_verified", + Value:"true" + },{ + Name:"phone_number_verified", + Value:"true" + } + /* more items */ + ], + UserPoolId: vendor_poolData.UserPoolId, /* required */ + Username: user.email /* required */ + }; + } + //console.log(params); + return Observable.create(observe => { + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + + cognitoidentityserviceprovider.adminUpdateUserAttributes(params, function (err, data) { + if (err) //(err, err.stack); + //console.log(data); // an error occurred + observe.next(data); // successful response + }); + }); + } + + } + + getlocale(){ + let session:any = this.shared.getAccessToken() || ""; + return session.idToken.payload.locale; + } + + adminchangeData(userData,changeusers){ + let session:any = this.shared.getAccessToken() || ""; + this.getconfig(); + let registeredData: any = ""; + let params:any=''; + let userGroup = session.idToken.payload["cognito:groups"].filter( + usergroup => usergroup == "ADMIN" + )[0]; + // (userGroup); + if (userGroup == "ADMIN") { + if (userData.fk_entity_type_id == 1) { + params = { + UserPoolId: sineedgedev_poolData.UserPoolId /* required */, + Username: userData.aws_name,//userData.email /* required */, + + // ForceAliasCreation: true || false, + + UserAttributes: [ + { + Name: "email" /* required */, + Value: changeusers.email,//userData.email + }, + { + Name: "phone_number" /* required */, + Value: "+91"+ changeusers.phone + }, + { + Name: "custom:role_id" /* required */, + Value: userData.user_role + },{ + Name:"email_verified", + Value:"true" + },{ + Name:"phone_number_verified", + Value:"true" + } + /* more items */ + ] + }; + } else if (userData.fk_entity_type_id == 2) { + params = { + UserPoolId: lender_poolData.UserPoolId /* required */, + Username: userData.aws_name /* required */, + + UserAttributes: [ + { + Name: "email" /* required */, + Value: changeusers.email + }, + { + Name: "phone_number" /* required */, + Value: "+91" + changeusers.phone + },{ + Name: "custom:role_id" /* required */, + Value: userData.user_role + },{ + Name:"email_verified", + Value:"true" + },{ + Name:"phone_number_verified", + Value:"true" + } + /* more items */ + ] + }; + }else if(userData.fk_entity_type_id == 3) + { + params = { + UserPoolId: vendor_poolData.UserPoolId /* required */, + Username: userData.aws_name /* required */, + + UserAttributes: [ + { + Name: "email" /* required */, + Value: changeusers.email + }, + { + Name: "phone_number" /* required */, + Value: "+91" + changeusers.phone + },{ + Name: "custom:role_id" /* required */, + Value: userData.user_role + },{ + Name:"email_verified", + Value:"true" + },{ + Name:"phone_number_verified", + Value:"true" + } + /* more items */ + ] + }; + } + return Observable.create(observe=>{ + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + cognitoidentityserviceprovider.adminUpdateUserAttributes(params, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + observe.next(data); // successful response + }); + }) + } + } +// adminremoveGroup(roles,users){ +// console.log(roles); +// console.log(users); +// if(users !==undefined){ + +// let session:any = this.shared.getAccessToken() ||""; +// this.getconfig(); +// let params:any; +// if(users.fk_entity_type_id ==1){ +// params = { +// GroupName: roles.GroupName, /* required */ +// UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ +// Username: users.aws_name//'2c64866e-e96f-453b-903f-2b6f831688af' /* required */ +// }; +// }else if(users.fk_entity_id ==2){ +// params = { +// GroupName: roles.GroupName, /* required */ +// UserPoolId: lender_poolData.UserPoolId, /* required */ +// Username: users.aws_name//'2c64866e-e96f-453b-903f-2b6f831688af' /* required */ +// }; +// } +// let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); +// cognitoidentityserviceprovider.adminRemoveUserFromGroup(params, function(err, data) { +// if (err) console.log(err, err.stack); // an error occurred +// else console.log(data); // successful response +// }); +// } +// } + +adminresetpassword(awsuser){ + this.getconfig(); + let params:any; + if(awsuser.fk_entity_id ==1){ + params= { + UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + Username: awsuser.email /* required */ + }; +}else if(awsuser.fk_entity_id ==2){ + params= { + UserPoolId: lender_poolData.UserPoolId, /* required */ + Username: awsuser.email /* required */ + }; +} + return Observable.create(observe=>{ + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + cognitoidentityserviceprovider.changePassword(params, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + else { + observe.next(data); + } // successful response + }); +}); +} + +changepassword(passData) { + let session:any = this.shared.getAccessToken() || ""; + this.getconfig(); + var params = { + AccessToken: session.accessToken.jwtToken, /* required */ + PreviousPassword: passData.oldPassword, /* required */ + ProposedPassword: passData.newPassword /* required */ + }; + return Observable.create(observe => { + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + cognitoidentityserviceprovider.changePassword(params, function (err, data) { + if (err) console.log(err, err.stack); // an error occurred + observe.next(data); + // successful response + }); + }) +} + +admindelete(aws){ + this.getconfig(); + let params:any; + if(aws.fk_entity_id ==1){ + params= { + UserPoolId: sineedgedev_poolData.UserPoolId, /* required */ + Username: aws.email /* required */ + }; +}else if(aws.fk_entity_id ==2){ + params= { + UserPoolId: lender_poolData.UserPoolId, /* required */ + Username: aws.email /* required */ + }; +} + return Observable.create(observe=>{ + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + cognitoidentityserviceprovider.adminDeleteUser(params, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + else { + observe.next(data); + } // successful response + }); +}); +} + +adminlistgroup(enitiy){ + // console.log(enitiy); + this.getconfig(); + let params:any; + if(enitiy ==1){ + params = { + UserPoolId:sineedgedev_poolData.UserPoolId, + } + }else if(enitiy ==2){ + params = { + UserPoolId:lender_poolData.UserPoolId + } + } + //console.log(enitiy); + return Observable.create(observe=>{ + + let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); + cognitoidentityserviceprovider.listGroups(params,function(err,data){ + if(err) alert(err.stack); + else {observe.next(data.Groups);} + }) +}); + +} + +} diff --git a/ng6-seed/src/app/AwsService_bkup/cognito.service.ts b/ng6-seed/src/app/AwsService_bkup/cognito.service.ts new file mode 100755 index 000000000..257ca25a6 --- /dev/null +++ b/ng6-seed/src/app/AwsService_bkup/cognito.service.ts @@ -0,0 +1,204 @@ +import { Injectable } from '@angular/core'; +import * as AWS from "aws-sdk"; +import { CanActivateChild, Router } from '@angular/router'; +import { + AuthenticationDetails, + CognitoUserPool, + CognitoUser, + CognitoUserAttribute, + ICognitoUserAttributeData, + ISignUpResult, + CognitoUserSession +} from "amazon-cognito-identity-js"; +import { environment } from '../../environments/environment'; + +import { BehaviorSubject,Observable,of } from 'rxjs'; +const sineedge_poolData = { + UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV + ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB +}; +const sineedgedev_poolData = { + UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV + ClientId: "67b4fnbuols5upms5to8bvqddh" // ClientName: SINEEDGE_DEV_WEB +} +const lender_poolData = { + UserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV + ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB +}; +const vendor_poolData = { + UserPoolId: "", + ClientId: "" +} +const sineedgeUserPool = new CognitoUserPool(sineedge_poolData); +const lenderUserPool = new CognitoUserPool(lender_poolData); +const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData); + +/** +* Identity PoolID +*/ +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 vendorIdenttiy = ""; +// serviceProvider +//const apiurl = "http://ssa.sineedge.com/sparqapi/api/"; +const apiurl = environment.apiEndpoint; +// const apiurl = "http://localhost/sparqapi/api/"; + +export interface Callback { + callback(): void; + + callbackWithParam(result: any): void; +} + +@Injectable({ + providedIn: 'root' +}) +export class CognitoService implements CanActivateChild { + public loggedIn :boolean = false; + // public static _REGION = environment.region; + + // public static _IDENTITY_POOL_ID = environment.identityPoolId; + // public static _USER_POOL_ID = environment.UserPoolId; + // public static _CLIENT_ID = environment.ClientId; + + // public static _POOL_DATA: any = { + // UserPoolId: CognitoService._USER_POOL_ID, + // ClientId: CognitoService._CLIENT_ID + // }; + get isLoggedIn() { + if(sineedgedevUserpool.getCurrentUser() !=null){ + this.loggedIn = true; + }else{ + this.loggedIn = false; + } + return this.loggedIn; // {2} + } + canActivateChild(){ + if(this.getToken()){ + //alert('session valid') + return true; + }else{ + this.route.navigate(['/authentication/login']); + //alert('session valid timeout'); + return false; + } + } + + public cognitoCreds: AWS.CognitoIdentityCredentials; +isloggin:boolean = false; + + + // getUserPool() { + // if (environment.cognito_idp_endpoint) { + // CognitoService.sineedgedev_poolData.endpoint = environment.cognito_idp_endpoint; + // } + // return new CognitoUserPool(CognitoService.sineedgedev_poolData); + // } + + getCurrentUser() { + + return sineedgedevUserpool.getCurrentUser(); + } + constructor(public route:Router) { } + +// getAccessToken(callback: Callback): void { +// if (callback == null) { +// throw("CognitoUtil: callback in getAccessToken is null...returning"); +// } +// if (this.getCurrentUser() != null) { +// this.getCurrentUser().getSession(function (err, session) { +// if (err) { +// console.log("CognitoUtil: Can't set the credentials:" + err); +// callback.callbackWithParam(null); +// } +// else { +// if (session.isValid()) { +// console.log("62"); +// callback.callbackWithParam(session.getAccessToken().getJwtToken()); + +// } +// } +// }); +// } +// else { +// callback.callbackWithParam(null); +// } +// } +refresh() { + let tokenexp:boolean; + this.getCurrentUser().getSession(function (err, session) { + if (err) { + } + + else { + if (session.isValid()) { + tokenexp = session.isValid(); + of(tokenexp) + + } else { + tokenexp = session.isValid(); + } + } + + return tokenexp; + + }); +} +getAccessToken(){ + this.refresh(); + let jwttoken = ''; + if (this.getCurrentUser() != null) { + //console.log(JSON.stringify(this.getCurrentUser())); + // console.log('76 if'); + this.getCurrentUser().getSession(function (err, session) { + if (err) { + jwttoken =''; + // console.log('81 if') + } + else { + if (session.isValid()) { + // console.log('85 else if'); + jwttoken = session; + } else { + + } + } + }); + } + else { + //console.log("else"); + + } + return jwttoken; +} + +getToken():boolean { + let isloggin = false; + if (this.getCurrentUser() != null) { + //console.log(JSON.stringify(this.getCurrentUser())); + //console.log('76 if'); + this.getCurrentUser().getSession(function (err, session) { + if (err) { + // console.log("CognitoUtil: Can't set the credentials:" + err); + isloggin = false; + //console.log('81 if') + } + else { + if (session.isValid()) { + // console.log('85 else if'); + isloggin = true; + } else { + isloggin = false; + } + } + }); + } + else { + // console.log("else"); + isloggin = false; + } + return isloggin; +} + + +} diff --git a/ng6-seed/src/app/_guard/token.interceptor.ts b/ng6-seed/src/app/_guard/token.interceptor.ts index aa0e7ae44..0d097cb91 100755 --- a/ng6-seed/src/app/_guard/token.interceptor.ts +++ b/ng6-seed/src/app/_guard/token.interceptor.ts @@ -12,6 +12,8 @@ import { Router } from '@angular/router'; import { retry,catchError, map, tap } from 'rxjs/operators'; import { HttpErrorResponse } from "@angular/common/http"; import { CognitoService } from '../AwsService/cognito.service'; +//environment +import { environment } from '../../environments/environment'; @Injectable() export class TokenInterceptor implements HttpInterceptor{ @@ -26,7 +28,7 @@ export class TokenInterceptor implements HttpInterceptor{ //console.log(token); let requests = request.clone({ headers:new HttpHeaders({ - 'Authorization': 'sparqvenba2018', + 'Authorization': environment.authorization, 'Token': token.getIdToken().getJwtToken() }) }); diff --git a/ng6-seed/src/app/_guard_bkup/auth.guard.ts b/ng6-seed/src/app/_guard_bkup/auth.guard.ts new file mode 100755 index 000000000..8b7e970b3 --- /dev/null +++ b/ng6-seed/src/app/_guard_bkup/auth.guard.ts @@ -0,0 +1,48 @@ +import { Injectable } from '@angular/core'; +import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router'; +import { Observable , of } from 'rxjs'; +import { CognitoService } from '../AwsService/cognito.service'; +@Injectable() +export class AuthGuard implements CanActivate, CanActivateChild { + + constructor(private router: Router,public shared:CognitoService) { } + + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + if (this.shared.getToken()) { + alert("if"); + // this.router.navigate(['']); + return true + } else { + alert("else"); + this.router.navigate(['/login']); + return false; + } + } + + canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { + + if (this.shared.getToken()) { + // alert("if"); + + return true; + } else { + // alert("else"); + setTimeout(() => { + this.router.navigate(['authentication/login']); + return false; + },1000); + + } + } + + // public getToken(): string { + // return localStorage.getItem('token'); + // } + + // public logOut() { + // localStorage.clear(); + // if(localStorage.getItem('token') === null){ + // this.router.navigate(['/login']); + // } + // } +} \ No newline at end of file diff --git a/ng6-seed/src/app/_guard_bkup/token.interceptor.ts b/ng6-seed/src/app/_guard_bkup/token.interceptor.ts new file mode 100755 index 000000000..aa0e7ae44 --- /dev/null +++ b/ng6-seed/src/app/_guard_bkup/token.interceptor.ts @@ -0,0 +1,91 @@ +import { Injectable } from '@angular/core'; +import { + HttpRequest, + HttpHandler, + HttpEvent, + HttpInterceptor, + HttpHeaders +} from '@angular/common/http'; +// import { AuthGuard } from './auth.guard'; +import { Observable, of, throwError } from 'rxjs'; +import { Router } from '@angular/router'; +import { retry,catchError, map, tap } from 'rxjs/operators'; +import { HttpErrorResponse } from "@angular/common/http"; +import { CognitoService } from '../AwsService/cognito.service'; + +@Injectable() +export class TokenInterceptor implements HttpInterceptor{ + constructor( private router: Router,public shared:CognitoService) {} + intercept(request: HttpRequest, next: HttpHandler): Observable> { + // request = request.clone({ + // setHeaders: { + // Authorization: `${this.auth.getToken()}` + // } + // }); + let token:any = this.shared.getAccessToken() ||""; + //console.log(token); + let requests = request.clone({ + headers:new HttpHeaders({ + 'Authorization': 'sparqvenba2018', + 'Token': token.getIdToken().getJwtToken() + }) + }); + return next.handle(requests).pipe( + catchError(this.handleError('role', [])) + ) + } + + // private handleError (operation = 'operation', result?: T) { + // console.log(result); + // return (error: any): Observable => { + // if(error instanceof HttpErrorResponse){ + // console.error("Error: " + error.status); + // if(error.status == 401){ + // localStorage.clear(); + // this.router.navigate(['/authentication/login']); + // } + // return of(result as T); + // } + // }; + // } + + private handleError (operation = 'operation', result?: T) { + return (error: any): Observable => { + if(error instanceof HttpErrorResponse){ + console.error("Error: " + error.status); + if(error.status == 401){ + localStorage.clear(); + this.router.navigate(['/authentication/login']); + } + else if(error.status == 404){ + this.router.navigate(['/error/404']); + } + else if(error.status == 503){ + this.router.navigate(['/error/503']); + } + else if(error.status == 0){ + this.router.navigate(['/error/404']); + } + else{ + let errorMessage = ''; + let type : number; + if (error.error instanceof ErrorEvent) { + // client-side error + errorMessage = `Error: ${error.error.message}`; + type = 1; + } else { + // server-side error + errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`; + type = 2; + } + return throwError({error_status :type == 2 ? error.status : '', + error_message:error.message, + error_text :type == 2 ? error.statusText : '', + html_format :errorMessage, + error_type :type, + }); + } + } + }; + } +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index 5443987d7..c70930301 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -694,11 +694,11 @@ export class AddPdComponent implements OnInit, OnDestroy { } else { this.disableAfterSubmit = false; - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Went Wrong Try Again.! \t\"' + result.status +'\" Error Occur.!'); } - }, error => { + }, err => { this.disableAfterSubmit = false; - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!'); }); } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts index e41df4ac6..b96f94fc5 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts @@ -98,7 +98,7 @@ export class AllPdComponent implements OnInit, OnChanges { // , error => {this.errorMessage = error}); ,error => { this.errorMessage.push(error); - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); alert(error.html_format); }); } @@ -205,7 +205,7 @@ export class AllPdComponent implements OnInit, OnChanges { } },error => { this.errorMessage.push(error); - this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); alert(error.html_format); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts index 93d5948c3..2f74f16a7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts @@ -101,7 +101,7 @@ export class CompletedPdComponent implements OnInit, OnChanges { // , error => this.errorMessage = error); ,error => { this.errorMessage.push(error); - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); alert(error.html_format); }); } @@ -216,7 +216,7 @@ export class CompletedPdComponent implements OnInit, OnChanges { } },error => { this.errorMessage.push(error); - this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); alert(error.html_format); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts index c5b9c654b..6b7dd8b43 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts @@ -265,7 +265,7 @@ export class EditPdApplicantComponent implements OnInit { } }, error => { this.disableAfterSubmit = false; - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); }); } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts index 6012ea1c1..2034be09d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts @@ -96,7 +96,7 @@ export class EditPdMasterComponent implements OnInit { //, error => this.errorMessage = error); , error => { // this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); }); } selectedLender(lender){ @@ -583,21 +583,21 @@ export class EditPdMasterComponent implements OnInit { } else { this.notifier.notify('success', 'PD Details Updated.'); - this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!'); + this.notifier.notify('warning', 'Something Went Wrong in Address Try Again.!'); }//else }, error => { // this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!'); - this.notifier.notify('warning', 'Something Wents Wrong in Address Section Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); }); } else { this.disableAfterSubmit = false; - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Went Wrong Try Again.!'); }//else }, error => { // this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.disableAfterSubmit = false; - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); });//error closed }//else closed diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/initiate-additional-pd/initiate-additional-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/initiate-additional-pd/initiate-additional-pd.component.ts index ad92ed3c7..c714da27d 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/initiate-additional-pd/initiate-additional-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/initiate-additional-pd/initiate-additional-pd.component.ts @@ -95,7 +95,7 @@ submitDetails(values: any) { },3000); }, error => { // this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); // alert(error); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts index dfd27ad49..5e86047d6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts @@ -94,7 +94,7 @@ export class InprogressPdComponent implements OnInit, OnChanges { } },error => { this.errorMessage.push(error); - this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); alert(error.html_format); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts index 6cfc777fa..49fd5cfe8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts @@ -70,11 +70,11 @@ export class PdAllocationComponent implements OnInit { this.dialogRef.close(); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.errorMessage = "Something Wents Wrong Try Again.!"; + this.notifier.notify('warning', 'Something Went Wrong Try Again.!'); + this.errorMessage = "Something Went Wrong Try Again.!"; } }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); this.errorMessage = "Some Thing Wents Wrong Try Again.!"; // this.dialogRef.close(); }); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.ts index 652fe5f46..b71c63871 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component.ts @@ -90,7 +90,7 @@ export class ModelEditPdReportComponent implements OnInit { } ); }, err => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!'); }) } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts index 7c5dbb216..f0794bd18 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts @@ -101,10 +101,10 @@ export class PdReportComponent implements OnInit { this.notifier.notify('success', 'Your Changes Updated.!'); this.getPdReportVersionList(); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Went Wrong Try Again.!'); } }, err => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!'); }) } generateNewPDReport() { @@ -116,10 +116,10 @@ export class PdReportComponent implements OnInit { this.notifier.notify('success', 'Your Changes Updated.!'); this.getPdReportVersionList(); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Went Wrong Try Again.!'); } }, err => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!'); }) } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/qc-review/qc-review.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/qc-review/qc-review.component.ts index 7fa06f1f4..3f4c5af2f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/qc-review/qc-review.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/qc-review/qc-review.component.ts @@ -90,7 +90,7 @@ export class QcReviewComponent implements OnInit { status: true }); }, err => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!'); }) } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.ts index cd18dae6d..28fb29e05 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.ts @@ -85,10 +85,10 @@ export class PdRequirementComponent implements OnInit { this.dialogRef.close(); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Went Wrong Try Again.!'); } }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); }); } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts index d62a5536c..33cf43e7e 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts @@ -68,11 +68,11 @@ export class PdStatusChangeDialogueComponent implements OnInit { } else { this.dialogRef.close({update_status:false}); - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Went Wrong Try Again.!'); } }, error => { this.dialogRef.close({update_status:false}); - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.ts index 9e83f3040..447f1cea9 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.ts @@ -103,7 +103,7 @@ export class QcCompletedPdComponent implements OnInit, OnChanges { // , error => this.errorMessage = error); ,error => { this.errorMessage.push(error); - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); alert(error.html_format); }); } @@ -194,7 +194,7 @@ export class QcCompletedPdComponent implements OnInit, OnChanges { } },error => { this.errorMessage.push(error); - this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); alert(error.html_format); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts index d102fd7e1..40e5b61a4 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts @@ -96,12 +96,12 @@ export class SchedulePdComponent implements OnInit, OnDestroy { this.dialogRef.close(); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.errorMessage = "Something Wents Wrong Try Again.!"; + this.notifier.notify('warning', 'Something Went Wrong Try Again.!'); + this.errorMessage = "Something Went Wrong Try Again.!"; } }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.errorMessage = "Some Thing Wents Wrong Try Again.!"; + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); + this.errorMessage = "Some Thing Went Wrong Try Again.!"; this.dialogRef.close(); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.ts index 9fa6b5e76..7486b14bc 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.ts @@ -210,7 +210,7 @@ export class ScheduledPdComponent implements OnInit, OnChanges { } },error => { this.errorMessage.push(error); - this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); alert(error.html_format); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.ts index 73f01d755..cf70503ee 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.ts @@ -74,11 +74,11 @@ export class SmartPdAllocationComponent implements OnInit { } else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.errorMessage = "Something Wents Wrong Try Again.!"; + this.errorMessage = "Something Went Wrong Try Again.!"; } }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.errorMessage = "Some Thing Wents Wrong Try Again.!"; + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); + this.errorMessage = "Some Thing Went Wrong Try Again.!"; // this.dialogRef.close(); }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html index 501e32090..39dabe925 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html @@ -298,10 +298,10 @@
-
Service Provided {{l+1}}
+
Service Provider {{l+1}}
- + Select {{ pm.name }} diff --git a/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.ts b/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.ts index 1779dadc0..c448125b1 100644 --- a/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.ts +++ b/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.ts @@ -97,10 +97,10 @@ export class QcPdReportComponent implements OnInit { this.notifier.notify('success', 'Your Changes Updated.!'); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.! \t\"' + data.status +'\" Error Occur.!'); + this.notifier.notify('warning', 'Something Went Wrong Try Again.! \t\"' + data.status +'\" Error Occur.!'); } }, err => { - this.notifier.notify('error', 'Something Wents Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!'); + this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!'); // alert(err.html_format); }); diff --git a/ng6-seed/src/app/shared/messaging.service.ts b/ng6-seed/src/app/shared/messaging.service.ts index 9571a027b..13fd14bc0 100644 --- a/ng6-seed/src/app/shared/messaging.service.ts +++ b/ng6-seed/src/app/shared/messaging.service.ts @@ -2,9 +2,13 @@ import { Injectable } from '@angular/core'; import { AngularFireDatabase } from '@angular/fire/database'; import { AngularFireAuth } from '@angular/fire/auth'; import { AngularFireMessaging } from '@angular/fire/messaging'; -import { mergeMapTo } from 'rxjs/operators'; +import { mergeMapTo,catchError } from 'rxjs/operators'; import { take } from 'rxjs/operators'; -import { BehaviorSubject } from 'rxjs' +import { BehaviorSubject, Observable, of } from 'rxjs' +import { HttpClient } from '@angular/common/http'; + +/** Environment */ +import { environment } from 'environments/environment' @Injectable() export class MessagingService { @@ -14,7 +18,8 @@ export class MessagingService { constructor( private angularFireDB: AngularFireDatabase, private angularFireAuth: AngularFireAuth, - private angularFireMessaging: AngularFireMessaging) { + private angularFireMessaging: AngularFireMessaging, + private http: HttpClient) { this.angularFireMessaging.messaging.subscribe( (_messaging) => { _messaging.onMessage = _messaging.onMessage.bind(_messaging); @@ -36,9 +41,20 @@ export class MessagingService { const data = {}; data[userId] = token this.angularFireDB.object('fcmTokens/').update(data) + }) + let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}}; + this.updateNotificationToken(params).subscribe( + (data) => { console.log('success',data);}, + (err) => { console.error('something wents wrong on update notify.', err); + }); } + updateNotificationToken(params): Observable { + return this.http.post(environment.apiEndpoint + 'updateNotificationToken', params) + .pipe(catchError(() => of(null))); + } + /** * request permission for notification from firebase cloud messaging * diff --git a/ng6-seed/src/environments/environment.prod.ts b/ng6-seed/src/environments/environment.prod.ts index 1f1a874d9..b5b67e9d7 100755 --- a/ng6-seed/src/environments/environment.prod.ts +++ b/ng6-seed/src/environments/environment.prod.ts @@ -1,6 +1,24 @@ export const environment = { production: true, - apiEndpoint: 'https://ssa.sineedge.com/sparqtest/api/', + + environmentName: 'Production Environment',//Live Environment. + + apiEndpoint: 'https://pdgenie.com/sparqprod/api', + + authorization: 'TnAwuc64pVpcB9xf', + + seIdentityPoolId: 'ap-south-1:31774418-8384-4fbb-b3e2-b87ce0f26ef1', + seUserPoolId: 'ap-south-1_MlTee1O5V', // UserName + seClientId: '7sd1jutija6hkrq5m7tegf3mvq',// ClientName + + lenIdentityPoolId:"ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907", + lenUserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV + lenClientId: "vkotfqgqorgjh3fvp1r26hslv", // ClientName:LENDER_DEV_WEB + + venIdentityPoolId: "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874", + venUserPoolId: '', + venClientId: '', + firebase: { apiKey: "AIzaSyCzmyM0WJ0wdLf8UsYoZ4GreICimyt7SEk", authDomain: "ssa-push.firebaseapp.com", @@ -10,4 +28,5 @@ export const environment = { messagingSenderId: "627754063571", appId: "1:627754063571:web:8cfa56d80607267b" } + }; \ No newline at end of file diff --git a/ng6-seed/src/environments/environment.stage.ts b/ng6-seed/src/environments/environment.stage.ts new file mode 100644 index 000000000..ae4372086 --- /dev/null +++ b/ng6-seed/src/environments/environment.stage.ts @@ -0,0 +1,31 @@ +export const environment = { + production: true, + + environmentName: 'Testing Environment',//Test Environment. + + apiEndpoint: 'https://ssa.sineedge.com/sparqtest/api/', + + authorization: 'sparqvenba2018', + + seIdentityPoolId: 'ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961', + seUserPoolId: 'ap-south-1_qQ85yQZJO', + seClientId: '67b4fnbuols5upms5to8bvqddh', + + lenIdentityPoolId:"ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907", + lenUserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV + lenClientId: "vkotfqgqorgjh3fvp1r26hslv", // ClientName:LENDER_DEV_WEB + + venIdentityPoolId: "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874", + venUserPoolId: '', + venClientId: '', + + firebase: { + apiKey: "AIzaSyCzmyM0WJ0wdLf8UsYoZ4GreICimyt7SEk", + authDomain: "ssa-push.firebaseapp.com", + databaseURL: "https://ssa-push.firebaseio.com", + projectId: "ssa-push", + storageBucket: "ssa-push.appspot.com", + messagingSenderId: "627754063571", + appId: "1:627754063571:web:8cfa56d80607267b" + } +}; \ No newline at end of file diff --git a/ng6-seed/src/environments/environment.ts b/ng6-seed/src/environments/environment.ts index ca3b7c402..89d411147 100755 --- a/ng6-seed/src/environments/environment.ts +++ b/ng6-seed/src/environments/environment.ts @@ -5,7 +5,13 @@ export const environment = { production: false, + + environmentName: 'Development Environment',//Localhost Environment. + apiEndpoint: 'https://ssa.sineedge.com/sparqapi/api/', + + authorization: 'sparqvenba2018', + firebase: { apiKey: "AIzaSyCzmyM0WJ0wdLf8UsYoZ4GreICimyt7SEk", authDomain: "ssa-push.firebaseapp.com", @@ -18,9 +24,25 @@ export const environment = { region: 'ap-south-1', - identityPoolId: 'ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961', - UserPoolId: 'ap-south-1_qQ85yQZJO', - ClientId: '2o5c3cs9k3als16nqhp3irh8rs', + // identityPoolId: 'ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961', + // UserPoolId: 'ap-south-1_qQ85yQZJO', + // ClientId: '2o5c3cs9k3als16nqhp3irh8rs', + + // lenClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName + + seIdentityPoolId: 'ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961', + seUserPoolId: 'ap-south-1_qQ85yQZJO', + seClientId: '67b4fnbuols5upms5to8bvqddh', + + lenIdentityPoolId:"ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907", + lenUserPoolId: "ap-south-1_hFiGyr1Gw", // Username + lenClientId: "vkotfqgqorgjh3fvp1r26hslv", // ClientName + + + venIdentityPoolId: "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874", + venUserPoolId: '', + venClientId: '', + rekognitionBucket: '', albumName: "",