This commit is contained in:
venbatechnologies@gmail.com 2019-06-27 17:57:31 +05:30
parent 8b4e41d703
commit 94ea0e0885
684 changed files with 20621 additions and 13495 deletions

0
ng6-seed/angular.json Normal file → Executable file
View File

2271
ng6-seed/package-lock.json generated Normal file → Executable file

File diff suppressed because it is too large Load Diff

72
ng6-seed/package.json Normal file → Executable file
View File

@ -3,6 +3,7 @@
"version": "0.0.0",
"license": "MIT",
"scripts": {
"prod": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod --build-optimizer=true",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
@ -12,72 +13,87 @@
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.2",
"@angular/animations": "^6.0.0-rc.5",
"@agm/core": "^1.0.0-beta.5",
"@angular/animations": "^6.1.10",
"@angular/cdk": "^6.0.0-rc.5",
"@angular/common": "^6.0.0-rc.5",
"@angular/compiler": "^6.0.0-rc.5",
"@angular/core": "^6.0.0-rc.5",
"@angular/common": "^6.1.10",
"@angular/compiler": "^6.1.10",
"@angular/core": "^6.1.10",
"@angular/flex-layout": "^6.0.0-beta.18",
"@angular/forms": "^6.0.0-rc.5",
"@angular/http": "^6.0.0-rc.5",
"@angular/forms": "^6.1.10",
"@angular/http": "^6.0.0-rc.6",
"@angular/material": "^6.0.0-rc.5",
"@angular/platform-browser": "^6.0.0-rc.5",
"@angular/platform-browser-dynamic": "^6.0.0-rc.5",
"@angular/router": "^6.0.0-rc.5",
"@angular/material-moment-adapter": "^6.0.0-rc.5",
"@angular/platform-browser": "^6.1.10",
"@angular/platform-browser-dynamic": "^6.1.10",
"@angular/router": "^6.1.10",
"@ngx-translate/core": "^10.0.2",
"@ngx-translate/http-loader": "^3.0.1",
"@swimlane/ngx-charts": "^7.0.1",
"@swimlane/ngx-datatable": "11.1.5",
"amazon-cognito-identity-js": "^2.0.27",
"@types/file-saver": "^2.0.0",
"amazon-cognito-identity-js": "^2.0.30",
"angular-calendar": "0.23.3",
"angular-sortablejs": "^2.0.6",
"angular-notifier": "^4.1.1",
"angular-sortablejs": "^2.7.0",
"angular-tree-component": "6.1.0",
"aws-sdk": "^2.318.0",
"chart.js": "2.6.0",
"core-js": "^2.5.5",
"core-js": "^2.6.5",
"d3": "^4.9.1",
"dragula": "3.7.2",
"file-saver": "^2.0.1",
"font-awesome": "4.7.0",
"hammerjs": "2.0.8",
"intl": "^1.2.4",
"jquery": "3.2.1",
"karma-jasmine": "^1.1.1",
"leaflet": "^1.0.2",
"moment": "^2.15.0",
"leaflet": "^1.4.0",
"moment": "^2.24.0",
"ng-pick-datetime": "^6.0.16",
"ng2-charts": "1.6.0",
"ng2-ckeditor": "^1.2.2",
"ng2-dragula": "1.3.1",
"ng2-file-upload": "1.2.1",
"ng2-pdf-viewer": "^5.2.4",
"ng2-toastr": "^4.1.2",
"ng2-validation": "4.2.0",
"ngx-color-picker": "^4.0.3",
"ngx-mat-select-search": "^1.3.1",
"ngx-mat-daterange-picker": "^1.1.4",
"ngx-mat-select-search": "^1.7.2",
"ngx-perfect-scrollbar": "5.0.0-7",
"ngx-viewer": "^1.0.1",
"node-sass": "^4.11.0",
"perfect-scrollbar": "^1.3.0",
"quill": "^1.2.0",
"rxjs": "^6.3.1",
"rxjs-compat": "^6.3.1",
"rxjs": "^6.5.1",
"rxjs-compat": "^6.5.1",
"screenfull": "^3.2.2",
"simple-line-icons": "^2.4.1",
"sortablejs": "^1.6.0",
"tether": "^1.4.0",
"zone.js": "^0.8.26"
"sortablejs": "^1.9.0",
"sweetalert2": "^7.33.1",
"tether": "^1.4.6",
"viewerjs": "^1.3.3",
"xlsx": "^0.14.2",
"zone.js": "^0.8.29"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.1",
"@angular/cli": "^6.0.0-rc.5",
"@angular/compiler-cli": "^6.0.0-rc.5",
"@types/node": "~8.9.4",
"codelyzer": "~4.1.0",
"@angular-devkit/build-angular": "^0.6.8",
"@angular/cli": "^6.2.9",
"@angular/compiler-cli": "^6.1.10",
"@types/aws-sdk": "^2.7.0",
"@types/jasmine": "2.5.52",
"@types/jquery": "3.2.0",
"@types/node": "^8.10.46",
"aws-sdk": "^2.443.0",
"codelyzer": "~4.1.0",
"jasmine-core": "2.6.3",
"jasmine-spec-reporter": "4.1.0",
"karma": "1.7.0",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.3.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "1.3.0",
"protractor": "5.1.2",
"ts-node": "~5.0.0",
"tslint": "~5.9.1",

View File

@ -1,16 +1,18 @@
import { Injectable } from "@angular/core";
import {
AuthenticationDetails,
CognitoUserPool ,
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 * as AWS from "aws-sdk";
// import AWS from "aws-sdk/dist/aws-sdk";
//environment
import { environment } from '../../environments/environment';
@ -18,28 +20,30 @@ 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 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: environment.UserPoolId, // UserName :SPARQ_SINEEDGE_DEV
ClientId: environment.ClientId// ClientName: SINEEDGE_DEV_WEB
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
ClientId: "vkotfqgqorgjh3fvp1r26hslv" // ClientName:LENDER_DEV_WEB
};
const vendor_poolData = {
UserPoolId: "",
UserPoolId: "ap-south-1_K57yPaWxV",
ClientId: ""
}
const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
// const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
const lenderUserPool = new CognitoUserPool(lender_poolData);
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
@ -47,11 +51,12 @@ 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 = "";
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
const vendorIdenttiy = "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874";
// serviceProvider
const apiurl = "http://localhost/sineedge/sparqapi/api/";
const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
const apiurl = environment.apiEndpoint;
//const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
//const apiurl = "http://localhost/sparqapi/api/";
@Injectable({
providedIn: "root"
@ -59,14 +64,14 @@ const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
export class AwsService {
public static _REGION = environment.region;
//public static _REGION = environment.region;
mySecData: any;
cognitoUser: any;
jwttoken: any;
cognitousers: any;
localUserId:any = '';
constructor(public http: Http, public RequestOptions: RequestOptions) { }
constructor(public http: Http, public RequestOptions: RequestOptions,public shared:CognitoService) { }
/**
* Login Function
@ -80,7 +85,7 @@ export class AwsService {
let attributesData = [];
const userData = {
Username: authenticationData.Username, // User email id
Pool: sineedgedevUserpool // user Pool ID
Pool: lenderUserPool // user Pool ID
};
let cognitoUser = new CognitoUser(userData);
return Observable.create(observer => {
@ -127,7 +132,7 @@ export class AwsService {
////(auth);
const userData = {
Username: auth.Username,
Pool: sineedgedevUserpool
Pool: lenderUserPool
};
let cognitoUser = new CognitoUser(userData);
return Observable.create(observe => {
@ -143,8 +148,8 @@ export class AwsService {
//Optional automatic callback
inputVerificationCode: function (data) {
//('Code sent to: ' + data);
var verificationCode = prompt('Please input verification code ', '');
var newPassword = prompt('Enter new password ', '');
var verificationCode = prompt('Enter Verification Code Sent to Mobile ', '');
var newPassword = prompt('Enter New Password ', '');
cognitoUser.confirmPassword(verificationCode, newPassword, {
onSuccess() {
//('Password confirmed!');
@ -162,4 +167,597 @@ export class AwsService {
/**
* 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: lenderIdentity, // 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: lenderIdentity, // for lender_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) {
console.log('inside - updateuser');
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){
console.log('inside - changeData');
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
}
/* 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
}
/* 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
}
/* 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);}
})
});
}
}

128
ng6-seed/src/app/AwsService/cognito.service.ts Normal file → Executable file
View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import * as AWS from "aws-sdk";
import { CanActivateChild, Router } from '@angular/router';
import {
AuthenticationDetails,
CognitoUserPool,
@ -10,6 +11,39 @@ import {
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: "vkotfqgqorgjh3fvp1r26hslv" // 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;
@ -19,33 +53,53 @@ export interface Callback {
@Injectable({
providedIn: 'root'
})
export class CognitoService {
public static _REGION = environment.region;
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 _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
};
// public static _POOL_DATA: any = {
// UserPoolId: CognitoService._USER_POOL_ID,
// ClientId: CognitoService._CLIENT_ID
// };
get isLoggedIn() {
if(lenderUserPool.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._POOL_DATA.endpoint = environment.cognito_idp_endpoint;
}
return new CognitoUserPool(CognitoService._POOL_DATA);
}
// getUserPool() {
// if (environment.cognito_idp_endpoint) {
// CognitoService.sineedgedev_poolData.endpoint = environment.cognito_idp_endpoint;
// }
// return new CognitoUserPool(CognitoService.sineedgedev_poolData);
// }
getCurrentUser() {
return this.getUserPool().getCurrentUser();
return lenderUserPool.getCurrentUser();
}
constructor() { }
constructor(public route:Router) { }
// getAccessToken(callback: Callback): void {
// if (callback == null) {
@ -70,20 +124,40 @@ isloggin:boolean = false;
// 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');
// console.log('76 if');
this.getCurrentUser().getSession(function (err, session) {
if (err) {
console.log("CognitoUtil: Can't set the credentials:" + err);
jwttoken ='';
console.log('81 if')
// console.log('81 if')
}
else {
if (session.isValid()) {
console.log('85 else if');
// console.log('85 else if');
jwttoken = session;
} else {
@ -92,7 +166,7 @@ getAccessToken(){
});
}
else {
console.log("else");
//console.log("else");
}
return jwttoken;
@ -102,16 +176,16 @@ getToken():boolean {
let isloggin = false;
if (this.getCurrentUser() != null) {
//console.log(JSON.stringify(this.getCurrentUser()));
console.log('76 if');
//console.log('76 if');
this.getCurrentUser().getSession(function (err, session) {
if (err) {
console.log("CognitoUtil: Can't set the credentials:" + err);
// console.log("CognitoUtil: Can't set the credentials:" + err);
isloggin = false;
console.log('81 if')
//console.log('81 if')
}
else {
if (session.isValid()) {
console.log('85 else if');
// console.log('85 else if');
isloggin = true;
} else {
isloggin = false;
@ -120,7 +194,7 @@ getToken():boolean {
});
}
else {
console.log("else");
// console.log("else");
isloggin = false;
}
return isloggin;

92
ng6-seed/src/app/_guard/auth.guard.ts Normal file → Executable file
View File

@ -1,54 +1,48 @@
// import { Injectable } from '@angular/core';
// import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router';
// import { Observable , of } from 'rxjs';
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 {
// @Injectable()
// export class AuthGuard implements CanActivate, CanActivateChild {
constructor(private router: Router,public shared:CognitoService) { }
// constructor(private router: Router) { }
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;
}
}
// canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
// if (localStorage.getItem('token') != null) {
// // this.router.navigate(['']);
// return true
// } 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);
}
}
// canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
// if (this.loginService.loggedIn()) {
// let roles = route.data["role"] as Array<string>;
// console.log("dataRole: " +roles);
// if(roles.length > -1){
// var match = this.loginService.roleMatch(roles);
// if(match){
// // this.router.navigate(['./dashboard']);
// return this.loginService.loggedIn()
// }
// else {
// this.router.navigate(['./404']);
// return this.loginService.loggedIn();
// }
// } else {
// this.router.navigate(['/login']);
// return this.loginService.loggedIn();
// }
// } else {
// this.router.navigate(['/login']);
// return this.loginService.loggedIn();
// }
// }
// public getToken(): string {
// return localStorage.getItem('token');
// }
// public getToken(): string {
// return localStorage.getItem('token');
// }
// public logOut() {
// localStorage.clear();
// if(localStorage.getItem('token') === null){
// this.router.navigate(['/login']);
// }
// }
// }
// public logOut() {
// localStorage.clear();
// if(localStorage.getItem('token') === null){
// this.router.navigate(['/login']);
// }
// }
}

7
ng6-seed/src/app/_guard/token.interceptor.ts Normal file → Executable file
View File

@ -14,6 +14,7 @@ import { 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) {}
@ -24,7 +25,7 @@ export class TokenInterceptor implements HttpInterceptor{
// }
// });
let token:any = this.shared.getAccessToken() ||"";
console.log(token);
//console.log(token);
let requests = request.clone({
headers:new HttpHeaders({
@ -41,9 +42,9 @@ export class TokenInterceptor implements HttpInterceptor{
return (error: any): Observable<T> => {
if(error instanceof HttpErrorResponse){
console.error("Error: " + error.status);
if(error.status == 401 || error.status == 500){
if(error.status == 401){
localStorage.clear();
this.router.navigate(['/login']);
this.router.navigate(['/authentication/login']);
}
return of(result as T);
}

0
ng6-seed/src/app/app.component.html Normal file → Executable file
View File

0
ng6-seed/src/app/app.component.spec.ts Normal file → Executable file
View File

2
ng6-seed/src/app/app.component.ts Normal file → Executable file
View File

@ -12,5 +12,5 @@ export class AppComponent {
const browserLang: string = translate.getBrowserLang();
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
}
}
}

25
ng6-seed/src/app/app.module.ts Normal file → Executable file
View File

@ -6,6 +6,8 @@ import { FormsModule } from '@angular/forms';
import { HttpModule, Http } from '@angular/http';
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS} from '@angular/common/http';
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
import { PERFECT_SCROLLBAR_CONFIG } from 'ngx-perfect-scrollbar';
import { PerfectScrollbarConfigInterface } from 'ngx-perfect-scrollbar';
@ -28,7 +30,9 @@ import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatSelectModule} from '@angular/material/select';
import {MatCardModule} from '@angular/material/card';
import {MatBadgeModule} from '@angular/material/badge';
import {ChangePasswordDialog} from './settings/users/user-profile/user-profile.component';
import { MatFormFieldModule,MatProgressSpinnerModule } from '@angular/material';
import { AppRoutes } from './app.routing';
import { AppComponent } from './app.component';
import { AdminLayoutComponent } from './layouts/admin/admin-layout.component';
@ -36,6 +40,10 @@ import { AuthLayoutComponent } from './layouts/auth/auth-layout.component';
import { SharedModule } from './shared/shared.module';
import { AwsService } from './AwsService/aws.service';
import { TokenInterceptor } from './_guard/token.interceptor';
import { NewPasswordDialog, ForgotPass } from './session/login/login.component';
import { AuthGuard } from './_guard/auth.guard';
import { RoleMenuItemsPipe } from './layouts/role-menu-items.pipe';
import { ResizableModule } from 'angular-resizable-element';
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}
@ -52,7 +60,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
declarations: [
AppComponent,
AdminLayoutComponent,
AuthLayoutComponent
AuthLayoutComponent,
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe,
],
imports: [
BrowserModule,
@ -70,10 +79,14 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
MatTabsModule,
MatCheckboxModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatSelectModule,
MatCardModule,
MatBadgeModule,
DemoMaterialModule,
MatFormFieldModule,
HttpClientModule,
ResizableModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
@ -84,7 +97,11 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
FlexLayoutModule,
],
providers: [
AwsService,
{
provide: LocationStrategy,
useClass: HashLocationStrategy,
},
AwsService,AuthGuard,
TranslateService,
// {
// provide: PERFECT_SCROLLBAR_CONFIG,
@ -96,7 +113,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
multi: true
}
],
entryComponents: [],
entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog],
bootstrap: [AppComponent]
})
export class AppModule { }

16
ng6-seed/src/app/app.routing.ts Normal file → Executable file
View File

@ -2,7 +2,8 @@ import { Routes } from '@angular/router';
import { AdminLayoutComponent } from './layouts/admin/admin-layout.component';
import { AuthLayoutComponent } from './layouts/auth/auth-layout.component';
import { CognitoService} from './AwsService/cognito.service';
import { AuthGuard } from './_guard/auth.guard';
export const AppRoutes: Routes = [{
path: '',
redirectTo: 'home',
@ -10,6 +11,7 @@ export const AppRoutes: Routes = [{
}, {
path: '',
component: AdminLayoutComponent,
canActivateChild:[AuthGuard],
children: [{
path: 'home',
loadChildren: './dashboard/dashboard.module#DashboardModule'
@ -17,6 +19,18 @@ export const AppRoutes: Routes = [{
path:'setting',
loadChildren:'./settings/settings.module#SettingsModule'
}
,{
path:'personal_discussion',
loadChildren:'./personal-discussion/personal-discussion.module#PersonalDiscussionModule'
},
{
path:'quality_check_discussion',
loadChildren:'./quality-check/quality-check.module#QualityCheckModule'
},
{
path:'reports',
loadChildren:'./reports/reports.module#ReportsModule'
},
]
}, {
path: '',

View File

@ -1,232 +1,270 @@
export const single = [
{
name: 'Germany',
value: 40632
},
{
name: 'USA',
value: 49737
},
{
name: 'France',
value: 36745
},
{
name: 'UK',
value: 36240
},
{
name: 'Spain',
value: 33000
},
{
name: 'Italy',
value: 35800
}
];
export const multi = [
{
name: 'Germany',
series: [
{
name: '2017',
value: 71632
},
{
name: '2010',
value: 40632
},
{
name: '2000',
value: 76953
},
{
name: '1990',
value: 31476
}
]
},
{
name: 'USA',
series: [
{
name: '2017',
value: 82632
},
{
name: '2010',
value: 49737
},
{
name: '2000',
value: 55986
},
{
name: '1990',
value: 37060
}
]
},
{
name: 'France',
series: [
{
name: '2017',
value: 51732
},
{
name: '2010',
value: 36745
},
{
name: '2000',
value: 34774
},
{
name: '1990',
value: 29476
}
]
},
{
name: 'UK',
series: [
{
name: '2017',
value: 95652
},
{
name: '2010',
value: 36240
},
{
name: '2000',
value: 32543
},
{
name: '1990',
value: 26424
}
]
}
];
export const bubble = [
{
name: 'Germany',
series: [
{
name: '2009',
x: new Date(2009, 0, 1),
y: 80.3,
r: 80.4
},
{
name: '2006',
x: new Date(2006, 0, 1),
y: 80.3,
r: 78
},
{
name: '1995',
x: new Date(1995, 0, 1),
y: 77.7,
r: 58.1
},
{
name: '1990',
x: new Date(1990, 0, 1),
y: 75.4,
r: 79
}
]
},
{
name: 'USA',
series: [
{
name: '2010',
x: new Date(2010, 0, 1),
y: 78.8,
r: 310
},
{
name: '2005',
x: new Date(2005, 0, 1),
y: 76.9,
r: 283
},
{
name: '1996',
x: new Date(1996, 0, 1),
y: 78.7,
r: 59.1
},
{
name: '1990',
x: new Date(1990, 0, 1),
y: 75.4,
r: 253
}
]
},
{
name: 'France',
series: [
{
name: '2008',
x: new Date(2008, 0, 1),
y: 81.4,
r: 63
},
{
name: '2000',
x: new Date(2000, 0, 1),
y: 79.1,
r: 59.4
},
{
name: '1994',
x: new Date(1994, 0, 1),
y: 76.7,
r: 58.1
},
{
name: '1990',
x: new Date(1990, 0, 1),
y: 77.2,
r: 56.9
}
]
},
{
name: 'UK',
series: [
{
name: '2007',
x: new Date(2007, 0, 1),
y: 80.2,
r: 62.7
},
{
name: '2003',
x: new Date(2003, 0, 1),
y: 77.8,
r: 58.9
},
{
name: '1995',
x: new Date(1995, 0, 1),
y: 78.7,
r: 59.1
},
{
name: '1990',
x: new Date(1990, 0, 1),
y: 75.7,
r: 57.1
}
]
}
export const single = [
{
name: 'Germany',
value: 40632
},
{
name: 'USA',
value: 49737
},
{
name: 'France',
value: 36745
},
{
name: 'UK',
value: 36240
},
{
name: 'Spain',
value: 33000
},
{
name: 'Italy',
value: 35800
}
];
export const multi = [
{
name: 'Draft',
series: [
{
name: 'Full PD',
value: 16
},
{
name: 'Smart PD',
value: 13
},
{
name: 'Tele PD',
value: 12
},
]
},
{
name: 'Triggered',
series: [
{
name: 'Full PD',
value: 16
},
{
name: 'Smart PD',
value: 17
},
{
name: 'Tele PD',
value: 12
},
]
},
{
name: 'Allocated',
series: [
{
name: 'Full PD',
value: 12
},
{
name: 'Smart PD',
value: 32
},
{
name: 'Tele PD',
value: 20
},
]
},{
name: 'Scheduled',
series: [
{
name: 'Full PD',
value: 15
},
{
name: 'Smart PD',
value: 24
},
{
name: 'Tele PD',
value: 14
}
]
},
{
name: 'Inprogress',
series: [
{
name: 'Full PD',
value: 24
},
{
name: 'Smart PD',
value: 20
},
{
name: 'Tele PD',
value: 23
},
]
},
{
name: 'Completed',
series: [
{
name: 'Full PD',
value: 14
},
{
name: 'Smart PD',
value: 22
},
{
name: 'Tele PD',
value: 14
},
]
},
{
name: 'QC Completed',
series: [
{
name: 'Full PD',
value: 22
},
{
name: 'Smart PD',
value: 17
},
{
name: 'Tele PD',
value: 21
},
]
}
];
export const bubble = [
{
name: 'Germany',
series: [
{
name: '2009',
x: new Date(2009, 0, 1),
y: 80.3,
r: 80.4
},
{
name: '2006',
x: new Date(2006, 0, 1),
y: 80.3,
r: 78
},
{
name: '1995',
x: new Date(1995, 0, 1),
y: 77.7,
r: 58.1
},
{
name: '1990',
x: new Date(1990, 0, 1),
y: 75.4,
r: 79
}
]
},
{
name: 'USA',
series: [
{
name: '2010',
x: new Date(2010, 0, 1),
y: 78.8,
r: 310
},
{
name: '2005',
x: new Date(2005, 0, 1),
y: 76.9,
r: 283
},
{
name: '1996',
x: new Date(1996, 0, 1),
y: 78.7,
r: 59.1
},
{
name: '1990',
x: new Date(1990, 0, 1),
y: 75.4,
r: 253
}
]
},
{
name: 'France',
series: [
{
name: '2008',
x: new Date(2008, 0, 1),
y: 81.4,
r: 63
},
{
name: '2000',
x: new Date(2000, 0, 1),
y: 79.1,
r: 59.4
},
{
name: '1994',
x: new Date(1994, 0, 1),
y: 76.7,
r: 58.1
},
{
name: '1990',
x: new Date(1990, 0, 1),
y: 77.2,
r: 56.9
}
]
},
{
name: 'UK',
series: [
{
name: '2007',
x: new Date(2007, 0, 1),
y: 80.2,
r: 62.7
},
{
name: '2003',
x: new Date(2003, 0, 1),
y: 77.8,
r: 58.9
},
{
name: '1995',
x: new Date(1995, 0, 1),
y: 78.7,
r: 59.1
},
{
name: '1990',
x: new Date(1990, 0, 1),
y: 75.7,
r: 57.1
}
]
}
];

146
ng6-seed/src/app/dashboard/dashboard.component.html Normal file → Executable file
View File

@ -1,5 +1,141 @@
<div class="pad-wrap">
<p>
Dashboard!
</p>
</div>
<div class="pad-wrap" [style.minHeight]="'100%'">
<div fxFlex.gt-sm="100" fxFlex.gt-xs="100" fxFlex="100">
<mat-card>
<mat-card-title style="background-color:#e00201;padding: 23px;">TAT Charts</mat-card-title>
<mat-card-subtitle></mat-card-subtitle>
<mat-card-content>
<div class="w-100 h-300px">
<ngx-charts-bar-horizontal-stacked [scheme]="colorScheme" [results]="multi" [gradient]="gradient" [xAxis]="showXAxis" [yAxis]="showYAxis" [legend]="showLegend" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel" [xAxisLabel]="yAxisLabel" [yAxisLabel]="xAxisLabel" (select)="onSelect($event)">
</ngx-charts-bar-horizontal-stacked>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
<div class="pad-wrap" [style.minHeight]="'100%'">
<div fxFlex.gt-sm="100" fxFlex.gt-xs="100" fxFlex="100">
<mat-card>
<mat-card-title style="background-color:#e00201;padding: 23px;">
PD Report
</mat-card-title>
<mat-card-content>
<div fxFlex="row">
<div fxFlex="100">
<div fxFlex="50" algin="center">
<div fxLayout="row wrap">
<mat-card style="background-color:#c1c1c1;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h2>892</h2>
<h6 style="margin-top: 0px;">Draft</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#f44336;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>265</h4>
<h6 style="margin-top: 0px;">Triggered</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#ffa500;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>452</h4>
<h6 style="margin-top: 0px;">Allocated</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#ffeb3b;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>56</h4>
<h6 style="margin-top: 0px;">Scheduled</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#3f51b5;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>56</h4>
<h6 style="margin-top: 0px;">InProgress</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#3f51b5;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>56</h4>
<h6 style="margin-top: 0px;">Completed</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#4caf50;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>56</h4>
<h6 style="margin-top: 0px;">QC Completed</h6>
</mat-card-content>
</mat-card>
<!-- </div> -->
</div>
</div>
<div fxFlex="50" algin="center">
<div fxLayout="row wrap">
<!-- <div fxFlex="100"> -->
<mat-card style="background-color:#c1c1c1;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h2>892</h2>
<h6 style="margin-top: 0px;">Draft</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#f44336;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>265</h4>
<h6 style="margin-top: 0px;">Triggered</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#ffa500;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>452</h4>
<h6 style="margin-top: 0px;">Allocated</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#ffeb3b;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>56</h4>
<h6 style="margin-top: 0px;">Scheduled</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#3f51b5;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>56</h4>
<h6 style="margin-top: 0px;">InProgress</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#3f51b5;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>56</h4>
<h6 style="margin-top: 0px;">Completed</h6>
</mat-card-content>
</mat-card>
<mat-card style="background-color:#4caf50;color: #fff;height: 100px;text-align: center;width: 125px;margin: 1px;">
<mat-card-content>
<h4>56</h4>
<h6 style="margin-top: 0px;">QC Completed</h6>
</mat-card-content>
</mat-card>
<!-- </div> -->
<div fxFlex.gt-sm="100" fxFlex.gt-xs="100" fxFlex="100">
<!-- <mat-card>
<mat-card-title>Bar Chart 4</mat-card-title>
<mat-card-subtitle></mat-card-subtitle>
<hr>
<mat-card-content>
<div class="w-100 h-300px">
<ngx-charts-bar-horizontal-stacked [scheme]="colorScheme" [results]="multi" [gradient]="gradient" [xAxis]="showXAxis" [yAxis]="showYAxis" [legend]="showLegend" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel" [xAxisLabel]="yAxisLabel" [yAxisLabel]="xAxisLabel" (select)="onSelect($event)">
</ngx-charts-bar-horizontal-stacked>
</div>
</mat-card-content>
</mat-card> -->
</div>
</div>
</div>
</div>
</div>
</mat-card-content>
</mat-card>
</div>
</div>

575
ng6-seed/src/app/dashboard/dashboard.component.scss Normal file → Executable file
View File

@ -2,538 +2,73 @@ $red: #f5515f;
$blue: #05abe0;
$grey: #343434;
$p: 12px;
.profile {
position: relative;
width: 100%;
height: 100%;
background: rgba(white, .25);
border-radius: 2px;
overflow: hidden;
box-shadow: 0 0 20px rgba(darken($red, 40%), .2);
&.pre-enter {
transform-origin: center center;
transform: scaleY(0);
.avatar {
transform-origin: center top;
transform: scaleY(0);
}
h1,
h2,
a.follow,
a.link {
opacity: 0;
transform: translateY(300px);
}
}
&.on-enter {
animation: scaleYIn 1000ms ease-out forwards;
.avatar {
animation: scaleYIn-small 750ms ease-out forwards 1000ms;
}
h1,
h2,
a.follow,
a.link {
opacity: 1;
animation: slideInUp 1000ms ease-out forwards;
}
h1 {
animation-delay: 1050ms;
}
h2 {
animation-delay: 1100ms;
}
a.follow {
animation-delay: 1250ms;
}
li {
&:nth-child(1) {
a.link {
animation-delay: 1300ms;
}
}
&:nth-child(2) {
a.link {
animation-delay: 1350ms;
}
}
&:nth-child(3) {
a.link {
animation-delay: 1400ms;
}
}
}
}
::ng-deep .ngx-mat-drp-date-input{text-overflow:ellipsis !important;color:#fff !important;}
mat-card-title{
background-color:#E00201 !important;
color:#fff;
}
.background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: white;
border-radius: 2px;
.mat-input-wrapper {
background: #fff;
}
.avatar,
.info {
width: 100%;
height: 50%;
li
{
display:inline-block;
//float:left;
}
.avatar {
background: url('../../assets/images/1.jpg') no-repeat center center / cover;
clip-path: polygon(0 0, 100% 0, 100% 75%, 0% 100%);
.example-full-width {
width: 95%;
}
.oval {
height: 13px;
width: 25px;
border-radius: 50%;
}
.prof-list {
li {
display: inline-block;
list-style: none;
}
// .ngx-mat-drp-date-input[_ngcontent-c17] {
// text-overflow: ellipsis;
// color: #fff;
// }
//.lengend-list {
// list-style-type: none;
//margin: 0;
// padding: 0;
// overflow: hidden;
// text-align:justify;
//}
.lengend-element {
font-size: 1rem !important;
padding-right: 3%;
}
.info {
display: flex;
flex-flow: row wrap;
align-items: center;
align-content: center;
justify-content: center;
position: relative;
text-align: center;
h1 {
padding: $p $p 0;
width: 100%;
font-size: 24px;
font-weight: 800;
letter-spacing: 2px;
text-transform: uppercase;
}
h2,
a.follow {
display: block;
border-radius: 2px;
padding: $p/2;
color: white;
font-size: 12px;
font-weight: 500;
letter-spacing: 1px;
text-transform: uppercase;
}
h2 {
background: $red;
background: linear-gradient(135deg, rgba(#f5825f, 1) 0%, rgba(#f5005f, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5825f', endColorstr='#f5005f', GradientType=1);
}
a.follow {
margin-left: $p;
background: $blue;
background: linear-gradient(135deg, rgba(#05c8e0, 1) 0%, rgba(#057fe0, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#05c8e0', endColorstr='#057fe0', GradientType=1);
&:hover,
&:focus {
background: #05c8e0;
background: linear-gradient(135deg, rgba(lighten(#05c8e0, 10%), 1) 0%, rgba(lighten(#057fe0, 10%), 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='lighten(#05c8e0, 10%)', endColorstr='lighten(#057fe0, 10%)', GradientType=1);
}
&:active {
background: #057fe0;
background: linear-gradient(135deg, rgba(darken(#05c8e0, 5%), 1) 0%, rgba(darken(#057fe0, 5%), 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='darken(#05c8e0, 5%)', endColorstr='darken(#057fe0, 5%)', GradientType=1);
}
}
ul {
display: flex;
justify-content: center;
padding: $p/2;
width: 100%;
li {
padding: $p/2;
}
}
a.link {
display: block;
border-radius: 100%;
background: $blue;
width: 30px;
height: 30px;
line-height: 30px;
display: block;
}
.donut-inner{
margin-top: -165px;
// margin-left: 120px;
}
a.link {
&.portfolio {
background: #f5c8bf;
background: linear-gradient(135deg, rgba(#f5c8bf, 1) 0%, rgba(#f58dbf, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5c8bf', endColorstr='#f58dbf', GradientType=1);
box-shadow: inset 0 0 10px rgba(#f58dbf, .5);
&:hover,
&:focus {
background: lighten(#f5c8bf, 5%);
background: linear-gradient(135deg, rgba(lighten(#f5c8bf, 5%), 1) 0%, rgba(lighten(#f58dbf, 5%), 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='lighten(#f5c8bf, 5%)', endColorstr='lighten(#f58dbf, 5%)', GradientType=1);
box-shadow: inset 0 0 10px rgba(lighten(#f58dbf, 5%), .5);
}
&:active {
background: darken(#f5c8bf, 5%);
background: linear-gradient(135deg, rgba(darken(#f5c8bf, 5%), 1) 0%, rgba(darken(#f58dbf, 5%), 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='darken(#f5c8bf, 5%)', endColorstr='darken(#f58dbf, 5%)', GradientType=1);
box-shadow: inset 0 0 10px rgba(darken(#f58dbf, 5%), .5);
}
}
&.codepen {
background: #fcd000;
background: linear-gradient(135deg, rgba(#fcd000, 1) 0%, rgba(#fc9a00, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcd000', endColorstr='#fc9a00', GradientType=1);
box-shadow: inset 0 0 10px rgba(#fc9a00, .5);
&:hover,
&:focus {
background: lighten(#fcd000, 5%);
background: linear-gradient(135deg, rgba(lighten(#fcd000, 5%), 1) 0%, rgba(lighten(#fc9a00, 5%), 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='lighten(#fcd000, 5%)', endColorstr='lighten(#fc9a00, 5%)', GradientType=1);
box-shadow: inset 0 0 10px rgba(lighten(#fc9a00, 5%), .5);
}
&:active {
background: darken(#fcd000, 5%);
background: linear-gradient(135deg, rgba(darken(#fcd000, 5%), 1) 0%, rgba(darken(#fc9a00, 5%), 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='darken(#fcd000, 5%)', endColorstr='darken(#fc9a00, 5%)', GradientType=1);
box-shadow: inset 0 0 10px rgba(darken(#fc9a00, 5%), .5);
}
}
&.github {
background: #41adc4;
background: linear-gradient(135deg, rgba(#41adc4, 1) 0%, rgba(#4183c4, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#41adc4', endColorstr='#4183c4', GradientType=1);
box-shadow: inset 0 0 10px rgba(#4183c4, .5);
&:hover,
&:focus {
background: lighten(#41adc4, 5%);
background: linear-gradient(135deg, rgba(lighten(#41adc4, 5%), 1) 0%, rgba(lighten(#4183c4, 5%), 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='lighten(#41adc4, 5%)', endColorstr='lighten(#4183c4, 5%)', GradientType=1);
box-shadow: inset 0 0 10px rgba(lighten(#4183c4, 5%), .5);
}
&:active {
background: darken(#41adc4, 5%);
background: linear-gradient(135deg, rgba(darken(#41adc4, 5%), 1) 0%, rgba(darken(#4183c4, 5%), 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='darken(#41adc4, 5%)', endColorstr='darken(#4183c4, 5%)', GradientType=1);
box-shadow: inset 0 0 10px rgba(darken(#4183c4, 5%), .5);
}
}
.donut-inner h5 {
margin-bottom: 5px;
margin-top: 0;
}
.donut-inner span{
font-size:1rems;
}
@media only screen and (min-width: 470px) {
.profile {
display: flex;
&.pre-enter {
transform: scaleX(0);
.avatar {
transform-origin: left center;
transform: scaleX(0);
}
h1,
h2,
a.follow,
a.link {
transform: translateX(300px);
}
}
&.on-enter {
animation-name: scaleXIn;
.avatar {
animation-name: scaleXIn-small;
}
h1,
h2,
a.follow,
a.link {
animation-name: slideInLeft;
}
}
}
.background {
mix-blend-mode: overlay;
}
.avatar,
.info {
width: 50%;
height: 100%;
}
.avatar {
clip-path: polygon(0 0, 100% 0, 75% 100%, 0% 100%);
}
mat-card-content{
min-height: 400px;
}
@media only screen and (min-width: 470px) and (min-height: 600px) {
.profile {
max-height: 400px;
}
}
/* https://goo.gl/jIUq3E */
@keyframes scaleXIn {
0% {
transform: matrix3d(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
4.7% {
transform: matrix3d(0.45, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
9.41% {
transform: matrix3d(0.883, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
14.11% {
transform: matrix3d(1.141, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
18.72% {
transform: matrix3d(1.212, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
24.32% {
transform: matrix3d(1.151, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
29.93% {
transform: matrix3d(1.048, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
35.54% {
transform: matrix3d(0.979, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
41.04% {
transform: matrix3d(0.961, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
52.15% {
transform: matrix3d(0.991, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
63.26% {
transform: matrix3d(1.007, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
85.49% {
transform: matrix3d(0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
100% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
/* https://goo.gl/auuhcg */
@keyframes scaleYIn {
0% {
transform: matrix3d(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
4.7% {
transform: matrix3d(1, 0, 0, 0, 0, 0.45, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
9.41% {
transform: matrix3d(1, 0, 0, 0, 0, 0.883, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
14.11% {
transform: matrix3d(1, 0, 0, 0, 0, 1.141, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
18.72% {
transform: matrix3d(1, 0, 0, 0, 0, 1.212, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
24.32% {
transform: matrix3d(1, 0, 0, 0, 0, 1.151, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
29.93% {
transform: matrix3d(1, 0, 0, 0, 0, 1.048, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
35.54% {
transform: matrix3d(1, 0, 0, 0, 0, 0.979, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
41.04% {
transform: matrix3d(1, 0, 0, 0, 0, 0.961, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
52.15% {
transform: matrix3d(1, 0, 0, 0, 0, 0.991, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
63.26% {
transform: matrix3d(1, 0, 0, 0, 0, 1.007, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
85.49% {
transform: matrix3d(1, 0, 0, 0, 0, 0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
100% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
/* https://goo.gl/dNBqrt */
@keyframes scaleXIn-small {
0% {
transform: matrix3d(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
6.31% {
transform: matrix3d(0.384, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
12.51% {
transform: matrix3d(0.621, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
18.82% {
transform: matrix3d(0.771, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
25.03% {
transform: matrix3d(0.862, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
37.54% {
transform: matrix3d(0.952, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
50.05% {
transform: matrix3d(0.984, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
75.08% {
transform: matrix3d(0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
100% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
/* https://goo.gl/jZL0uj */
@keyframes scaleYIn-small {
0% {
transform: matrix3d(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
6.31% {
transform: matrix3d(1, 0, 0, 0, 0, 0.384, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
12.51% {
transform: matrix3d(1, 0, 0, 0, 0, 0.621, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
18.82% {
transform: matrix3d(1, 0, 0, 0, 0, 0.771, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
25.03% {
transform: matrix3d(1, 0, 0, 0, 0, 0.862, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
37.54% {
transform: matrix3d(1, 0, 0, 0, 0, 0.952, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
50.05% {
transform: matrix3d(1, 0, 0, 0, 0, 0.984, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
75.08% {
transform: matrix3d(1, 0, 0, 0, 0, 0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
100% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
/* https://goo.gl/Ne0Mkr */
@keyframes slideInLeft {
0% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 300, 0, 0, 1);
}
6.31% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 184.858, 0, 0, 1);
}
12.51% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 113.68, 0, 0, 1);
}
18.82% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 68.663, 0, 0, 1);
}
25.03% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 41.37, 0, 0, 1);
}
37.54% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 14.382, 0, 0, 1);
}
50.05% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4.724, 0, 0, 1);
}
75.08% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0.381, 0, 0, 1);
}
100% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
/* https://goo.gl/MSqtd5 */
@keyframes slideInUp {
0% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 300, 0, 1);
}
6.31% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 184.858, 0, 1);
}
12.51% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 113.68, 0, 1);
}
18.82% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 68.663, 0, 1);
}
25.03% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 41.37, 0, 1);
}
37.54% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 14.382, 0, 1);
}
50.05% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 4.724, 0, 1);
}
75.08% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0.381, 0, 1);
}
100% {
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
//wheather
.card-wheather {
height: 220px;
color: #fff;
}
.city {
font-size: 26px;
}
.date {
font-size: 20px;
line-height: 40px;
}
.sun {
height: 70px;
}
.grad-blue {
background: linear-gradient(58deg, #f44336, #673ab7);
color: #fff;
}
.grad-green {
background: linear-gradient(58deg, #009688, #673ab7);
color: #fff;
}
.grad-red {
background: linear-gradient(58deg, #f44336, #673ab7);
color: #fff;
}
.card-wheather{
padding: 2rem;
}
.temp {
font-size: 50px;
display: inline-block;
.chart{
padding: 0.8rem;
}
::ng-deep .body-container{
padding: 0rem !important;
}

35
ng6-seed/src/app/dashboard/dashboard.component.ts Normal file → Executable file
View File

@ -1,12 +1,41 @@
import { Component } from '@angular/core';
import { Component } from '@angular/core';
import { DashboardService } from './dashboard.service';
import { single, multi } from './charts.data';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent {
constructor() {
export class DashboardComponent {
dashboardTitle = 'PD Report';
public single: any[];
public multi: any[];
public showXAxis = true;
public showYAxis = true;
public gradient = false;
public showLegend = false;
public showXAxisLabel = true;
public xAxisLabel = 'PD Process';
public showYAxisLabel = true;
public yAxisLabel = 'PD`s';
public colorScheme = {
domain: ['#ffeb3b', '#ffa500', '#f44336']
};
constructor(private _dashboardService: DashboardService) {
Object.assign(this, {single, multi});
}
ngOnInit(){}
public onSelect(event) {
console.log(event);
}
}

20
ng6-seed/src/app/dashboard/dashboard.module.ts Normal file → Executable file
View File

@ -1,15 +1,20 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommonModule } from '@angular/common';
import { MatIconModule, MatCardModule, MatButtonModule, MatListModule, MatProgressBarModule, MatMenuModule } from '@angular/material';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ChartsModule } from 'ng2-charts/ng2-charts';
import { NgxChartsModule} from '@swimlane/ngx-charts';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { MatIconModule,
MatCardModule,
MatTabsModule,
MatButtonModule} from '@angular/material';
import { DashboardComponent } from './dashboard.component';
import { DashboardRoutes } from './dashboard.routing';
import { DashboardRoutes } from './dashboard.routing';
/** Dashboard Service */
import { DashboardService } from './dashboard.service';
@NgModule({
imports: [
@ -17,15 +22,14 @@ import { DashboardRoutes } from './dashboard.routing';
RouterModule.forChild(DashboardRoutes),
MatIconModule,
MatCardModule,
MatTabsModule,
MatButtonModule,
MatListModule,
MatProgressBarModule,
MatMenuModule,
ChartsModule,
NgxChartsModule,
NgxDatatableModule,
MatCardModule,
FlexLayoutModule
],
providers: [ DashboardService ],
declarations: [ DashboardComponent ]
})

0
ng6-seed/src/app/dashboard/dashboard.routing.ts Normal file → Executable file
View File

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { DashboardService } from './dashboard.service';
describe('DashboardService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: DashboardService = TestBed.get(DashboardService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,24 @@
/** Common Import Section */
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';//for Datatables
import { HttpClient } from '@angular/common/http';
import { catchError } from 'rxjs/operators';
import { of } from 'rxjs';
/** Imported Service Files Are., */
import { AwsService } from '../AwsService/aws.service';
/** Environment */
import { environment } from 'environments/environment';
@Injectable({
providedIn: 'root'
})
export class DashboardService {
private apiUrl = environment.apiEndpoint;
constructor(private _http: HttpClient,
private _aws:AwsService) { }
}

0
ng6-seed/src/app/error/404/error-404-component.html Normal file → Executable file
View File

0
ng6-seed/src/app/error/404/error-404-component.scss Normal file → Executable file
View File

0
ng6-seed/src/app/error/404/error-404.component.ts Normal file → Executable file
View File

0
ng6-seed/src/app/error/503/error-503-component.html Normal file → Executable file
View File

0
ng6-seed/src/app/error/503/error-503-component.scss Normal file → Executable file
View File

0
ng6-seed/src/app/error/503/error-503.component.ts Normal file → Executable file
View File

0
ng6-seed/src/app/error/error.module.ts Normal file → Executable file
View File

0
ng6-seed/src/app/error/error.routing.ts Normal file → Executable file
View File

1118
ng6-seed/src/app/layouts/admin/admin-layout.component.html Normal file → Executable file

File diff suppressed because it is too large Load Diff

107
ng6-seed/src/app/layouts/admin/admin-layout.component.ts Normal file → Executable file
View File

@ -9,13 +9,24 @@ import {TranslateService} from '@ngx-translate/core';
import PerfectScrollbar from 'perfect-scrollbar';
import { PerfectScrollbarConfigInterface,
PerfectScrollbarComponent, PerfectScrollbarDirective } from 'ngx-perfect-scrollbar';
import { UserService } from '../../settings/service/user.service';
import { DashboardService } from '../../dashboard/dashboard.service';
import { AwsService } from '../../AwsService/aws.service';
import { RoleMenuItemsPipe } from './../role-menu-items.pipe';
@Component({
selector: 'app-layout',
templateUrl: './admin-layout.component.html'
templateUrl: './admin-layout.component.html',
providers: [RoleMenuItemsPipe],
})
export class AdminLayoutComponent implements OnInit, OnDestroy {
profileurl: any;;
userDep: string;
fullName: any;
roleName:any;
currentUser: any;
private _router: Subscription;
today: number = Date.now();
@ -28,22 +39,80 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
sidebarBg: boolean = true;
currentLang = 'en';
layoutDir = 'ltr';
menuLayout : any = 'vertical-menu';
menuLayout : any = 'top-menu';
selectedSidebarImage : any = 'bg-1';
selectedSidebarColor : any = 'sidebar-default';
selectedSidebarColor : any = 'sidebar-red';
selectedHeaderColor : any = 'header-default';
collapsedClass : any = 'side-panel-opened';
@ViewChild('sidemenu') sidemenu;
public config: PerfectScrollbarConfigInterface = {};
constructor(private router: Router, public menuItems: MenuItems, public horizontalMenuItems : HorizontalMenuItems, public translate: TranslateService ) {
alertMsgTriggerType : any[];
alertMsgAllocateType : any[];
alertCount: any;
userRoleType: String;
constructor(private router: Router, public menuItems: MenuItems, public horizontalMenuItems : HorizontalMenuItems, public translate: TranslateService,public aws:AwsService,public users:UserService,private _dashboardService: DashboardService) {
const browserLang: string = translate.getBrowserLang();
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
this.users.getroles().subscribe(res=>{
this.currentUser = res;
if(this.currentUser.dataStatus == true){
this.currentUser = this.currentUser.records[0];
this.fullName = this.currentUser.user_first_name +' '+this.currentUser.user_last_name;
this.roleName = this.currentUser.role_name;
console.log('this.currentUser',this.currentUser);
window.localStorage.setItem('LenderRoleID', this.currentUser.user_role);
if(this.currentUser.fk_entity_type_id == 1 ){
this.userDep = "SineEdge";
}else if(this.currentUser.fk_entity_type_id == 2 ){
// this.userDep = "Lender";
this.userDep = this.currentUser.full_name;
}else{
this.userDep = "Vendor";
}
let users= {
'userid':this.currentUser.userid,
'entityid':this.currentUser.fk_entity_type_id,
'profilepic':this.currentUser.profilepic
}
this.users.getprofilepic(users).subscribe(res=>{
this.profileurl = res;
if(this.profileurl.dataStatus == true){
this.profileurl = this.profileurl.records;
}
})
}
});
/** 3) Getting PD Details For Alert Message */
// this._dashboardService.getAlertDetail().subscribe(data => {
// console.log(' *****Layout Alert Message *****');
// console.log('Layout Alert Message Whole Data',data);
// this.alertCount = data.records.length;
// this.alertMsgTriggerType = data.records.filter(trigger=>trigger.pd_status == "TRIGGERED" );
// this.alertMsgAllocateType = data.records.filter(allocate=>allocate.pd_status == "ALLOCATED" );
// console.log('Layout Alert Message',this.alertMsgTriggerType);
// console.log('Layout Alert Message',this.alertMsgAllocateType);
// console.log('Layout Alert Count',this.alertCount);
// });
}
ngOnInit(): void {
this.userRoleType=localStorage.getItem('user_role');
// console.clear();
const elemSidebar = <HTMLElement>document.querySelector('.sidebar-container ');
if (window.matchMedia(`(min-width: 960px)`).matches && !this.isMac() && !this.compactSidebar && this.layoutDir != 'rtl') {
@ -52,6 +121,7 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
suppressScrollX: true
});
}
this._router = this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => {
this.url = event.url;
@ -64,7 +134,7 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
}
});
}
@HostListener('click', ['$event'])
onClick(e: any) {
const elemSidebar = <HTMLElement>document.querySelector('.sidebar-container ');
@ -80,6 +150,7 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this._router.unsubscribe();
}
isOver(): boolean {
@ -126,7 +197,7 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
changeMenuLayout(value)
{
console.log(value)
// console.log(value)
if(value)
{
this.menuLayout = 'top-menu';
@ -200,4 +271,26 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
]
});
}
userprofile(){
this.router.navigate(['setting/users/userprofile']);
}
logout(){
//alert();
this.aws.logout().subscribe(res=>{
//alert("res");
this.router.navigate(['/authentication/login']);
})
}
menunav(active){
switch(active){
case 'HOME':
this.router.navigate(['/home']);
break;
case 'USERS':
this.router.navigate(['/setting/users/userprofile']);
break;
case 'SETTING':
break;
}
}
}

View File

0
ng6-seed/src/app/layouts/auth/auth-layout.component.ts Normal file → Executable file
View File

View File

@ -0,0 +1,8 @@
import { RoleMenuItemsPipe } from './role-menu-items.pipe';
describe('RoleMenuItemsPipe', () => {
it('create an instance', () => {
const pipe = new RoleMenuItemsPipe();
expect(pipe).toBeTruthy();
});
});

View File

@ -0,0 +1,51 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'roleMenuItems'
})
export class RoleMenuItemsPipe implements PipeTransform {
transform(value: any, type: any): any {
// this is for horizontal menu filter
// if(type=="1"){
// switch(localStorage.getItem('user_role')){
// case '1': return value.filter(val=>val.state!="quality_check_discussion");
// case '2': return value.filter(val=>val.state!="quality_check_discussion");
// case '4': return value.filter(val=>val.state!="quality_check_discussion" && val.state!="reports");
// case '5': return value.filter(val=>val.state!="quality_check_discussion" && val.state!="reports");
// case '6': return value.filter(val=>val.state!="personal_discussion" && val.state!="reports");
// case '7': return value.filter(val=>val.state!="personal_discussion" && val.state!="reports");
// case '10': return value;
// default: return value.filter(val=>val.state!="quality_check_discussion");
// }
// }
// // this is for vertical menu filter
// else if(type=="2"){
// switch(localStorage.getItem('user_role')){
// case '1': return value.filter(val=>val.state!="quality_check_discussion");
// case '2': return value.filter(val=>val.state!="quality_check_discussion");
// case '4': return value.filter(val=>val.state!="quality_check_discussion" && val.state!="reports");
// case '5': return value.filter(val=>val.state!="quality_check_discussion" && val.state!="reports");
// case '6': return value.filter(val=>val.state!="personal_discussion" && val.state!="reports");
// case '7': return value.filter(val=>val.state!="personal_discussion" && val.state!="reports");
// case '10': return value;
// default: return value.filter(val=>val.state!="quality_check_discussion");
// }
// }
// else{
// return [];
// }
// if(localStorage.getItem('user_role')=="10"){
// return value
// }
// else if(localStorage.getItem('user_role')=="6" || localStorage.getItem('user_role')=="7"){
// return value.filter(val=>val.state!='' && val.state!="personal_discussion" && val.state!="reports")
// }
// else{
// return value.filter(val=>val.state!='' && val.state!="quality_check_discussion")
// }
return value;
}
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { GetGeometricLocationService } from './get-geometric-location.service';
describe('GetGeometricLocationService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: GetGeometricLocationService = TestBed.get(GetGeometricLocationService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,24 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';//for Datatables
import { Http } from '@angular/http';
@Injectable()
export class GetGeometricLocationService {
MAP_API_KEY: string;
MAP_API_URL: string;
constructor(private _http: Http) {
this.MAP_API_KEY = 'AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg'
this.MAP_API_URL = `https://maps.googleapis.com/maps/api/geocode/json?key=${this.MAP_API_KEY}&address=`;
}
findLocations(address:string, postalCode?: string,state?:string, city?: string): Observable<any> {
let compositeAddress = [address];
if (postalCode) compositeAddress.push(postalCode);
if (state) compositeAddress.push(state);
if (city) compositeAddress.push(city);
let url = `${this.MAP_API_URL}${compositeAddress.join(',')}`;
return this._http.get(url).map(response => <any> response.json());
}
}

View File

@ -0,0 +1,358 @@
<mat-card>
<mat-card-content>
<form [formGroup]="_PDtriggerForm">
<mat-card-content>
<div style="width: 100%;text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"
(click)="loadPdListCompoent(cancelStatus)"><mat-icon>close</mat-icon></button>
</div>
<mat-card>
<mat-card-header>
<mat-card-title> PD Details </mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field style="width: 28%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option> Select </mat-option>
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%">
<mat-select placeholder="Branch" formControlName="pd_branch_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let LB of lenderBranchList" [value]="LB.entity_lender_branch_id" >
{{LB.branch_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput autocomplete="off" placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" required>
<!-- <mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput autocomplete="off" placeholder="Lender Contact Person" formControlName="lender_contact_person" type="text" required>
<!-- <mat-error *ngIf="pdMain.lender_contact_person.hasError('required')">Lender Contact Person Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput autocomplete="off" placeholder="Lender's Mobile Number" formControlName="lender_contact_mobile" type="text" ForMobileNumbers maxlength="10" minlength="10">
<mat-error *ngIf="pdMain.lender_contact_mobile.hasError('maxlength') || pdMain.lender_contact_mobile.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<!--<mat-form-field style="width: 32%">
<input matInput autocomplete="off" placeholder="Lender Contact Number" formControlName="lender_contact_mobile" type="text" OnlyNumber maxlength="10" required>
<mat-error *ngIf="pdMain.lender_contact_mobile.hasError('pattern') || pdMain.lender_contact_mobile.hasError('maxlength') || pdMain.lender_contact_mobile.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>-->
<mat-form-field style="width: 8%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="lender_stdcode" type="text" maxlength="5" ForMobileNumbers>
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter Valid STD Code Number.</mat-error>
</mat-form-field> -
<mat-form-field style="width: 17%">
<input matInput autocomplete="off" placeholder="Landline Number" formControlName="lender_landline" type="text" maxlength="8" ForMobileNumbers>
<mat-error *ngIf="pdMain.lender_landline.hasError('maxlength') || pdMain.lender_landline.hasError('minlength')">Enter Valid LandLine Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 28%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value)">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id" >
{{PL.product_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product Required.</mat-error> -->
</mat-form-field>
<mat-form-field *ngIf="isSubproductShown" style="width: 28%">
<mat-select placeholder="Sub Product Name" formControlName="fk_subproduct_id">
<mat-option>Select</mat-option>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id" >
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub Product Required.</mat-error> -->
</mat-form-field>
<!-- {{customerSegmentList | json}} -->
<mat-form-field style="width: 28%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id" >
{{CSL.abbr}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<!-- {{pdMain.fk_customer_segment.value}} -->
<mat-form-field style="width: 28%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" >
{{PDL.type_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 60%">
<input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" OnlyNumber required autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value">{{"&#8377;"}} {{pdMain.loan_amount.value | numberToWords}} Only</mat-hint>
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>
</mat-form-field>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title>Address Details</mat-card-title>
</mat-card-header>
<div formArrayName="addresses" *ngFor="let addresses of pdAddresses.controls; let i = index;">
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 96%">
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done" formControlName="addressline1"
[value]="addresses.get('addressline1').value | titlecase"></textarea>
<!-- oninput="this.value = this.value.toUpperCase()" -->
<!-- <mat-error *ngIf="pdAddresses.addressline1.hasError('required')">Address1 required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList($event.value,i)">
<mat-option> Select </mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdAddresses.fk_state.hasError('required')">State Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option> Select </mat-option>
<mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdAddresses.fk_city.hasError('required')">City Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode" (selectionChange)="getPincode($event.value,i)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 24%" *ngIf="pincodeflag[i]">
<!-- *ngIf="pdAddresses.pincode.value == 1" -->
<input matInput autocomplete="off" placeholder="Specify Pincode" formControlName="other_pincode" OnlyNumber>
<!-- <mat-error *ngIf="pdAddresses.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
</mat-form-field>
<div align="end" *ngIf="pdAddresses.controls.length > 1">
<button mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="removeAddresses(i)" type="button"><mat-icon>delete</mat-icon></button>
</div>
</mat-card-content>
</div>
<mat-card-actions align="end">
<button type="button" mat-raised-button mat-icon-button (click)="addAddresses()"
matTooltip="Add More Additional Addresses" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>add</mat-icon>
</button>
</mat-card-actions>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title>Applicant Details</mat-card-title>
</mat-card-header>
<mat-card-content>
<h5>Applicant 1</h5>
<mat-form-field style="width: 12%">
<mat-select placeholder="Title" formControlName="applicant_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 38%">
<input matInput autocomplete="off" placeholder="Name of Individual Applicant" formControlName="applicant_name"
[value]="pdMain.applicant_name.value | titlecase">
<!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 38%" *ngIf="pdMain.fk_customer_segment.value != '8'">
<input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field>
<mat-form-field style="width: 38%">
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" ForMobileNumbers maxlength="10" minlength="10">
<mat-error *ngIf="pdMain.mobile_no.hasError('required')">Mobile No is Required . </mat-error>
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 12%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="applicant_stdcode" type="text" ForMobileNumbers maxlength="5">
<mat-error *ngIf="pdMain.applicant_stdcode.hasError('maxlength') || pdMain.applicant_stdcode.hasError('minlength')">Enter Valid STD Code Number. </mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 22%">
<input matInput autocomplete="off" placeholder="Landline Number" formControlName="applicant_landline" type="text" ForMobileNumbers maxlength="8">
<mat-error *ngIf="pdMain.applicant_landline.hasError('maxlength') || pdMain.applicant_landline.hasError('minlength')">Enter Valid LandLine Number. </mat-error>
</mat-form-field>
<div formArrayName="coapplicants" *ngFor="let coDetails of pdCoApplicant.controls; let i = index;">
<div class="row" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<h5>{{coDetails.controls.label.value}} {{i+2}}</h5>
<div [formGroupName]="i">
<mat-form-field style="width: 12%">
<mat-select placeholder="Title" formControlName="applicant_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 38%">
<input matInput autocomplete="off" placeholder="Name of Individual Applicant" formControlName="coapplicant_name" type="text"
[value]="coDetails['controls'].coapplicant_name.value | titlecase" required>
<!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 38%" *ngIf="pdMain.fk_customer_segment.value != '8'">
<input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field>
<!-- <mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="coapplicant_name" type="text" required>
</mat-form-field> -->
<mat-form-field style="width: 38%">
<input matInput placeholder="Mobile Number" formControlName="coapplicant_mobile_no" type="text" maxlength="10" ForMobileNumbers>
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 12%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="coapplicant_stdcode" type="text" maxlength="5" ForMobileNumbers>
<mat-error *ngIf="coDetails['controls'].coapplicant_stdcode.hasError('maxlength') || coDetails['controls'].coapplicant_stdcode.hasError('minlength')">Enter Valid STD Code. </mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 22%">
<input matInput autocomplete="off" placeholder="Landline Number" formControlName="coapplicant_landline" type="text" maxlength="8" ForMobileNumbers>
<mat-error *ngIf="coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
</mat-form-field>
<button mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="removeCoApplicant(i)" type="button"><mat-icon>delete</mat-icon></button>
</div>
</div>
</div>
<!-- Phone field to be split into 2 parts. Mobile Number mandatory and optional land line number with std code. ---->
</mat-card-content>
<mat-card-actions align="end">
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Applicant" matTooltipPosition="above" style="opacity: 0.8;border:2px;border-radius: 50%;" (click)="addCoApplicant()"><mat-icon>group_add</mat-icon><div class="mat-button-ripple mat-ripple" matripple=""></div><div class="mat-button-focus-overlay"></div></button>
</mat-card-actions>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title>Additional Requirements</mat-card-title>
</mat-card-header>
<mat-card-content formArrayName="addtional_requirements" *ngFor="let requirements of pdRequirements.controls; let i = index;">
<mat-card>
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 90%;">
<input matInput autocomplete="off" placeholder="Requirement" formControlName="add_requirement">
</mat-form-field>
<button mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="removeRequirements(i)" type="button"><mat-icon>delete</mat-icon></button>
</mat-card-content>
</mat-card>
</mat-card-content>
<mat-card-actions align="end">
<button type="button" mat-raised-button mat-icon-button (click)="addRequiremnts()"
matTooltip="Add More Additional Requirements" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>add</mat-icon>
</button>
</mat-card-actions>
</mat-card>
<mat-card formArrayName="documents">
<mat-card-header>
<mat-card-title>
Document
</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-list *ngFor="let docList of documents.controls; let d = index;" [formGroupName]="d">
<!-- <h3 mat-subheader>Upload Documents</h3> -->
<mat-list-item>
<mat-form-field style="width: 70%">
<input matInput autocomplete="off" placeholder="Document Name" formControlName="doc_name" type="text">
</mat-form-field>
<div style="width:50%">
<input type="file" title="Browse Document" (change)="fileSelectionEvent($event,d)" formControlName="documentFile">
<span (click)="removeItem(d)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" type="button"><mat-icon>delete</mat-icon></button>
</span>
</div>
</mat-list-item>
</mat-list>
</mat-card-content>
<mat-card-actions align="end">
<button mat-raised-button mat-icon-button matTooltip="Add Document" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" (click)="addMoreDocs()" type="button"><mat-icon>attach_file</mat-icon></button>
</mat-card-actions>
</mat-card>
</mat-card-content>
<mat-card-actions>
<div fxFlex="70" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%">
<!-- <mat-label>Remarks</mat-label> -->
<textarea matInput autocomplete="off" placeholder="Remarks" formControlName="remarks"></textarea>
</mat-form-field>
</div>
<div fxFlex="30" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button"
(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="saveDraftPD(_PDtriggerForm.value,draftStatus)" matTooltip="Save as Draft" matTooltipPosition="above" type="button" [disabled]="disableAfterSubmit===true"><mat-icon>description</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Trigger PD" matTooltipPosition="above" (click)="triggerPD(_PDtriggerForm.value,PDTriggerStatus)" [disabled]="disableAfterSubmit===true"><mat-icon>save</mat-icon></button>
</div>
</mat-card-actions>
</form>
</mat-card-content>
</mat-card>
<notifier-container></notifier-container>

View File

@ -0,0 +1,7 @@
mat-form-field {
margin: 0 2%;
}
.mat-form-field-appearance-legacy .mat-hint{
color:rgba(0, 0, 0, 0.8) !important;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MastersComponent } from './masters.component';
import { AddPdComponent } from './add-pd.component';
describe('MastersComponent', () => {
let component: MastersComponent;
let fixture: ComponentFixture<MastersComponent>;
describe('AddPdComponent', () => {
let component: AddPdComponent;
let fixture: ComponentFixture<AddPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MastersComponent ]
declarations: [ AddPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MastersComponent);
fixture = TestBed.createComponent(AddPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,743 @@
import { Component, OnInit, ViewEncapsulation, Output, EventEmitter, OnDestroy } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { ListPdComponent } from '../list-pd.component';
import { AwsService } from '../../../../AwsService/aws.service';
import { TitleCasePipe } from '@angular/common';
/**sweet alert */
import Swal from 'sweetalert2';
@Component({
selector: 'app-add-pd',
templateUrl: './add-pd.component.html',
styleUrls: ['./add-pd.component.scss'],
providers:[TitleCasePipe],
encapsulation: ViewEncapsulation.None
})
export class AddPdComponent implements OnInit, OnDestroy {
//@Output() loadParent = new EventEmitter<string>();
cancelStatus: boolean;
enablePDButton: boolean;
coapplicantFlag: boolean = false;
draftStatus: string;
PDTriggerStatus: string;
private notifier: NotifierService;
public _PDtriggerForm: FormGroup;
addresses: FormArray;
coapplicants: FormArray;
addtional_requirements: FormArray;
productList: any = [];
subProductList: any;
lenderList: any;
lenderBranchList: any;
customerSegmentAllList: any;
customerSegmentList: any;
productAllList : any = [];
stateList: any = [];
cityList: any = [];
pdTypeList: any;
billingList: any;
relationShipList: any;
pincodeList: any = [];
errorMessage: any;
titleList: any;
// Dynamic co applicant
createWithLongContent = false;
dynamicCoApplicant = [];
disableAfterSubmit: boolean;
pincodeflag : any = [];
isSubproductShown: boolean = true;
constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent,
private titleCase : TitleCasePipe) {
this.notifier = notifier;
this.disableAfterSubmit = false;
}
public totalfiles: Array<File> = [];
public totalFileName = [];
public lengthCheckToaddMore = 0;
ngOnInit() {
this.draftStatus = "DRAFT";
this.PDTriggerStatus = "TRIGGERED";
this.enablePDButton = false;
this.cancelStatus = false;
this.ListPdComponent.showListView(false);
this.getLenderList();
this.getProductsList();
this.getCustomerSegmentList();
this.getStateCityList();
this.getPDTypeList();
this.getRelationMaster();
this.getTitleMaster();
this.loadFormData();
}
// load form data
loadFormData() {
this._PDtriggerForm = this._fb.group({
fk_lender_id: [null],
pd_branch_id: [null],
lender_applicant_id: [null, Validators.compose([Validators.required])],
lender_contact_person: [null, Validators.compose([Validators.required])],
lender_contact_mobile: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(12), Validators.pattern('^[0-9]*$')])],
lender_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
lender_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
//lender_billing: [null],
fk_product_id: [null],
fk_subproduct_id: [null],
fk_pd_type: [null],
fk_customer_segment: [null],
loan_amount: [null, Validators.compose([Validators.pattern('^[0-9]*$')])],
applicant_title_name: [''],
applicant_name: [null,Validators.compose([Validators.required])],
mobile_no: [null, Validators.compose([Validators.maxLength(10), Validators.minLength(10)])],
// landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
// email: [null],
applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
applicant_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
company_name: [null],
remarks: [null],
// allocation_type: [null],
// sub_allocation_type: [null],
coapplicants: this._fb.array([]),
addresses: this._fb.array([this.createAddresses()]),
documents: this._fb.array([]),
addtional_requirements: this._fb.array([this.createRequiremnt()])
});
}
lenderShortName:string;
/** FOR Dropdowns */
selectedLender(lender) {
// console.log('lender',lender);
this.lenderBranchList = lender['branches'];
this.lenderShortName = lender['short_name'];
// console.log(this.lenderShortName);
this._PDtriggerForm.controls.pd_branch_id.setValue(null);
if(this.lenderShortName == 'CLIX'){
let getProductAbbr = this.productAllList.map(dval => dval.product_abbr);
let ClixProductAbbr = ['BL','LAEP'];
let FilteredAbbr: any = [];
FilteredAbbr = ClixProductAbbr.map(x => {
let findIndex = getProductAbbr.indexOf(x);
return this.productAllList[findIndex];
});
this.productList = FilteredAbbr.length > 0 ? FilteredAbbr : this.productAllList;
}
else{
this.productList = this.productAllList;
}
// console.log(this.productList);
// console.log('this.productList',this.productList);
this._PDtriggerForm.controls['fk_product_id'].setValue('');
this._PDtriggerForm.controls['fk_subproduct_id'].setValue('');
this._PDtriggerForm.controls['fk_pd_type'].setValue('');
this._PDtriggerForm.controls['fk_customer_segment'].setValue('');
this._PDtriggerForm.controls['loan_amount'].setValue('');
}
getLenderList() {
this._pd.getLenderDetails().subscribe(
data => {
if (data.status == 200) {
this.lenderList = data.records
}
}, error => this.errorMessage = <any>error);
}
getProductsList() {
this._pd.getProductsDetails().subscribe(
data => {
if (data.status == 200) {
this.productAllList = data.records
}
}, error => this.errorMessage = <any>error);
}
getCustomerSegmentList() {
this._pd.getCustomersDetails().subscribe(
data => {
if (data.status == 200) {
this.customerSegmentAllList = data.records
}
}, error => this.errorMessage = <any>error);
}
//get State
getStateCityList() {
this._pd.getAllMasterDatas('STATE').subscribe(
data => {
if (data.status == 200) {
this.stateList = data.records.filter(item => item.isactive == 1);
}
});
}
//get PDType List
getPDTypeList() {
this._pd.getPDTypeDetails().subscribe(
data => {
if (data.status == 200) {
this.pdTypeList = data.records.pd_type;
}
}, error => this.errorMessage = <any>error);
}
//get sub product list based on prokduct id
getSubproductList(productID: string) {
let productabbr : any;
// console.log('productID',productID);
if(productID !== undefined && productID !== null && productID !== '') {
this.subProductList = this.productList.filter(item => item.product_id == productID);
this.subProductList = this.subProductList[0].subproducts;
this.subProductList = this.subProductList.filter(item => item.is_others == 0);
productabbr = this.productAllList.filter(item => item.product_id == productID)[0].product_abbr;
}
else{
productabbr = ''
this.subProductList = [];
this._PDtriggerForm.controls['fk_subproduct_id'].setValue('');
this._PDtriggerForm.controls['fk_pd_type'].setValue('');
this._PDtriggerForm.controls['fk_customer_segment'].setValue('');
this._PDtriggerForm.controls['loan_amount'].setValue('');
}
// console.log('productID',productID,productabbr);
/**customer segment */
switch(productabbr){
case 'BL' :
// console.log(1);
this.customerSegmentList = this.customerSegmentAllList.filter(s => (s.customer_segment).includes('Self'));
this._PDtriggerForm.controls['fk_subproduct_id'].setValue(null);
this.isSubproductShown = false;
break;
case 'LAEP':
// console.log(2);
this.customerSegmentList = this.customerSegmentAllList.filter(s => (s.customer_segment).includes('Self'));
this._PDtriggerForm.controls['fk_subproduct_id'].setValue(null);
this.isSubproductShown = false;
break;
default:
// console.log(3);
this.customerSegmentList = this.customerSegmentAllList;
this.isSubproductShown = true;
break;
}
if(this.lenderShortName == 'CLIX' && productabbr != ''){
this._PDtriggerForm.controls['fk_pd_type'].setValue('1');
this._PDtriggerForm.controls['fk_customer_segment'].setValue('5');
this._PDtriggerForm.controls['loan_amount'].setValue(0);
}
}
//get city list details based on state id
getCityList(stateID: string,index) {
this._pd.getStateWiseCities(stateID).subscribe(data => {
if (data.status == 200) {
this.cityList[index] = data.records.cities;
this.pincodeList[index] = data.records.pincode;
}
});
}
// get relation master details
getRelationMaster() {
let relation = "RELATIONSHIPS";
this._pd.getAllMasterDatas(relation).subscribe(
data => {
if (data.status == 200) {
this.relationShipList = data.records;
}
}, error => this.errorMessage = <any>error);
}
// get title master
getTitleMaster() {
let relation = "TITLES";
this._pd.getAllMasterDatas(relation).subscribe(
data => {
if (data.status == 200) {
this.titleList = data.records.filter(val => val.isactive == 1);
}
}, error => this.errorMessage = <any>error);
}
/** FOR Documents */
addMoreDocs() {
if (this.totalfiles.length != 0) {
if (this.documents.value[0].doc_name != "" && ((this.lengthCheckToaddMore) === (this.totalfiles.length))) {
this.documents.insert(0, this.generateDocuments())
this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1;
}
}
else if (this.totalfiles.length === 0 && this.lengthCheckToaddMore === 0) {
this.documents.insert(0, this.generateDocuments())
this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1;
}
}
generateDocuments(): FormGroup {
return this._fb.group({
doc_name: [null],//Validators.compose([Validators.required])
documentFile: [null],//, Validators.compose([Validators.required])
});
}
get documents(): FormArray {
return this._PDtriggerForm.get('documents') as FormArray;
};
get pdMain() {
return this._PDtriggerForm.controls;
}
removeItem(index: number) {
this.totalfiles.splice(index, 1);
this.totalFileName.splice(index, 1);
this.documents.removeAt(index);
this.lengthCheckToaddMore = this.lengthCheckToaddMore - 1;
}
/** FOR Coapplicant */
get pdCoApplicant() { return this._PDtriggerForm.get('coapplicants') as FormArray; }
addCoApplicant() {
this.coapplicants = this._PDtriggerForm.get('coapplicants') as FormArray;
this.coapplicants.push(this.createCoApplicant());
}
createCoApplicant(): FormGroup {
return this._fb.group({
label: ['Applicant'],
applicant_title_name:[null],
coapplicant_name: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
coapplicant_stdcode:[null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
coapplicant_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
company_name:[null],
relationship: [null],
});
};
removeCoApplicant(i: number) {
const control = <FormArray>this._PDtriggerForm.controls['coapplicants'];
control.removeAt(i);
}
/** FOr Adress */
get pdAddresses() { return this._PDtriggerForm.get('addresses') as FormArray; }
createAddresses(): FormGroup {
return this._fb.group({
addressline1: [null],
fk_city: [null],
fk_state: [null],
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
});
};
addAddresses() {
this.addresses = this._PDtriggerForm.get('addresses') as FormArray;
this.addresses.push(this.createAddresses());
}
removeAddresses(index: number) {
const address_control = <FormArray>this._PDtriggerForm.controls['addresses'];
address_control.removeAt(index);
}
get pdRequirements() { return this._PDtriggerForm.get('addtional_requirements') as FormArray; }
createRequiremnt(): FormGroup {
return this._fb.group({
add_req_id: [null],
add_requirement: [null],
isactive: [1],
});
};
addRequiremnts() {
this.addtional_requirements = this._PDtriggerForm.get('addtional_requirements') as FormArray;
this.addtional_requirements.push(this.createRequiremnt());
}
removeRequirements(index: number) {
const requirement_control = <FormArray>this._PDtriggerForm.controls['addtional_requirements'];
requirement_control.removeAt(index);
}
public fileSelectionEvent(fileInput: any, oldIndex: number) {
if (fileInput.target.files && fileInput.target.files[0]) {
var reader = new FileReader();
reader.onload = (event: any) => {
}
if (oldIndex == 0) {
this.totalfiles.unshift((fileInput.target.files[0]))
this.totalFileName.unshift(fileInput.target.files[0].name)
}
else {
this.totalfiles[oldIndex] = (fileInput.target.files[0]);
this.totalFileName[oldIndex] = fileInput.target.files[0].name
}
reader.readAsDataURL(fileInput.target.files[0]);
}
if (this.totalfiles.length == 1) {
this.lengthCheckToaddMore = 1;
}
}
getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;}
// save pd in draft
saveDraftPD(formValue: any, status: string) {
//alert('Inside The Draft PD');
this.submitPdDetails(formValue, status);
}
//trigger pd
triggerPD(formValue: any, status: string) {
this._PDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
// if(formValue.fk_product_id != '4'){
// this._PDtriggerForm.controls['fk_subproduct_id'].setValidators([Validators.required]);
// this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
// }
if(formValue.fk_product_id == '4'){
this._PDtriggerForm.controls['fk_subproduct_id'].setValue(null);
}
if(this.lenderShortName != 'CLIX'){
this._PDtriggerForm.controls['fk_pd_type'].setValidators([Validators.required]);
this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
this._PDtriggerForm.controls['fk_customer_segment'].setValidators([Validators.required]);
this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
this._PDtriggerForm.controls['loan_amount'].setValidators([Validators.required]);
this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
}
this._PDtriggerForm.controls['applicant_name'].setValidators([Validators.required]);
this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
this._PDtriggerForm.controls['applicant_title_name'].setValidators([Validators.required]);
this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
this._PDtriggerForm.controls['mobile_no'].setValidators([Validators.required]);
this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
// this._PDtriggerForm.controls['addressline1'].setValidators([Validators.required]);
// this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
// this._PDtriggerForm.controls['fk_city'].setValidators([Validators.required]);
// this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
// this._PDtriggerForm.controls['fk_state'].setValidators([Validators.required]);
// this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
// this._PDtriggerForm.controls['pincode'].setValidators([Validators.required]);
// this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
setTimeout(() => {
this.clearCustomValidatorFields();
}, 10000);
this.submitPdDetails(formValue, status);
}
// this is for clear custom validator required fields
clearCustomValidatorFields() {
this._PDtriggerForm.controls['fk_lender_id'].clearValidators();
this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
this._PDtriggerForm.controls['fk_product_id'].clearValidators();
this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
// if(this._PDtriggerForm.controls.fk_product_id.value != '4'){
// this._PDtriggerForm.controls['fk_subproduct_id'].clearValidators();
// this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
// }
if(this._PDtriggerForm.controls.fk_product_id.value == '4'){
this._PDtriggerForm.controls['fk_subproduct_id'].setValue(null);
}
this._PDtriggerForm.controls['fk_pd_type'].clearValidators();
this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
this._PDtriggerForm.controls['fk_customer_segment'].clearValidators();
this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
this._PDtriggerForm.controls['loan_amount'].clearValidators();
this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
this._PDtriggerForm.controls['applicant_name'].clearValidators();
this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
this._PDtriggerForm.controls['applicant_title_name'].clearValidators();
this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
this._PDtriggerForm.controls['mobile_no'].clearValidators();
this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
// this._PDtriggerForm.controls['addressline1'].clearValidators();
// this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
// this._PDtriggerForm.controls['fk_city'].clearValidators();
// this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
// this._PDtriggerForm.controls['fk_state'].clearValidators();
// this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
// this._PDtriggerForm.controls['pincode'].clearValidators();
// this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
this.validateAllFormFields(this._PDtriggerForm);
}
// common function for both draft and process pd
submitPdDetails(formValue: any, status: string) {
// console.log('inside the submitPdDetails data');
if (this._PDtriggerForm.invalid) {
this.validateAllFormFields(this._PDtriggerForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
else {
if ((formValue.lender_contact_mobile == '' || formValue.lender_contact_mobile == null) && (formValue.lender_stdcode == '' || formValue.lender_stdcode == null && formValue.lender_landline == '' || formValue.lender_landline == null)) {
this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
return;
}
else if (formValue.mobile_no != null && formValue.mobile_no.length != 10){
this.notifier.notify('warning', 'Please Check Applicant Mobile Number.!');
return;
}
else {
this.disableAfterSubmit = true;
let lender_landline_no;
let applicant_landline_no;
if(!formValue.lender_stdcode || !formValue.lender_landline){
lender_landline_no = null;
}
else if(!formValue.lender_stdcode && !formValue.lender_landline){
lender_landline_no = null;
}
else if(formValue.lender_stdcode && formValue.lender_landline){
lender_landline_no = formValue.lender_stdcode + '-' + formValue.lender_landline;
}
else{
lender_landline_no = null;
}
if(!formValue.applicant_stdcode || !formValue.applicant_landline){
applicant_landline_no = null;
}
else if(!formValue.applicant_stdcode && !formValue.applicant_landline){
applicant_landline_no = null;
}
else if(formValue.applicant_stdcode && formValue.applicant_landline){
applicant_landline_no = formValue.applicant_stdcode + '-' + formValue.applicant_landline;
}
else{
applicant_landline_no = null;
}
let pd_details: any = {
"fk_lender_id": formValue.fk_lender_id,
"lender_applicant_id": formValue.lender_applicant_id,
"pd_branch_id": formValue.pd_branch_id,
"pd_contact_person": formValue.lender_contact_person,
"pd_contact_mobileno": formValue.lender_contact_mobile,
"pd_contact_landline": lender_landline_no,
"fk_product_id": formValue.fk_product_id,
"fk_subproduct_id": formValue.fk_product_id != 4 ? formValue.fk_subproduct_id != '' || formValue.fk_subproduct_id != 0 ? formValue.fk_subproduct_id : null : null,
"fk_pd_type": formValue.fk_pd_type,
"fk_customer_segment": formValue.fk_customer_segment,
"loan_amount": formValue.loan_amount,
"addressline1": !formValue.addresses[0].addressline1 ? null : this.titleCase.transform(formValue.addresses[0].addressline1),
"fk_city": formValue.addresses[0].fk_city,
"fk_state": formValue.addresses[0].fk_state,
"pincode": formValue.addresses[0].pincode,
"other_pincode": formValue.addresses[0].other_pincode,
"remarks": formValue.remarks,
"pd_status": status,
"fk_createdby": this._aws.getlocale(),
};
var pd_applicant_details: any = [];
var addresses_details: any = [];
if (formValue.applicant_name) {
pd_applicant_details.push({
"applicant_name": this.titleCase.transform(formValue.applicant_name),
"applicant_title_name": formValue.applicant_title_name,
"company_name": formValue.company_name,
"mobile_no": formValue.mobile_no,
"landline": applicant_landline_no,
"applicant_type": 1,
"relation": "",
});
}
formValue.coapplicants.forEach((itemElement, itemIndex) => {
let coapplicant_landline_no;
if(!itemElement.coapplicant_stdcode || !itemElement.coapplicant_landline){
coapplicant_landline_no = null;
}
else if(!itemElement.coapplicant_stdcode && !itemElement.coapplicant_landline){
coapplicant_landline_no = null;
}
else if(itemElement.coapplicant_stdcode && itemElement.coapplicant_landline){
coapplicant_landline_no = formValue.coapplicant_stdcode + '-' + itemElement.applicant_landline;
}
else{
coapplicant_landline_no = null;
}
// if (itemElement.coapplicant_stdcode != null || itemElement.coapplicant_landline != null) {
// if (itemElement.coapplicant_stdcode != '' && itemElement.coapplicant_landline != '') {
// coapplicant_landline_no = formValue.coapplicant_stdcode + '-' + itemElement.applicant_landline;
// }
// else {
// coapplicant_landline_no = null;
// }
// }
// else {
// coapplicant_landline_no = null;
// }
let obj1 = {
"applicant_name":this.titleCase.transform(itemElement.coapplicant_name),
"applicant_title_name": itemElement.applicant_title_name,
"company_name": itemElement.company_name,
"mobile_no":itemElement.coapplicant_mobile_no,
"landline": coapplicant_landline_no,
"applicant_type":0,
"relation": "",
}
pd_applicant_details.push(obj1)
});
if (formValue.addresses.length > 0) {
formValue.addresses.forEach((addressElement, itemIndex) => {
let addressobj = {
"addressline1": !addressElement.addressline1 ? null : this.titleCase.transform(addressElement.addressline1),
"fk_city": addressElement.fk_city,
"fk_state": addressElement.fk_state,
"pincode": addressElement.pincode,
"other_pincode": addressElement.other_pincode,
}
addresses_details.push(addressobj);
});
}
// docs details
let pd_form: FormData = new FormData();
for (let j = 0; j < this.totalfiles.length; j++) {
pd_form.append('pddocuments[]', <File>this.totalfiles[j])
}
//reverseFileNames=this.totalFileName.reverse();
let AllFilesObj = []
formValue.documents.forEach((element, index) => {
AllFilesObj.push(element.doc_name);
});
pd_form.append("pd_details", JSON.stringify(pd_details))
if (pd_applicant_details.length > 0) {
pd_form.append("pd_applicant_details", JSON.stringify(pd_applicant_details))
}
if(addresses_details.length>0){
pd_form.append("addresses", JSON.stringify(addresses_details));
}
pd_form.append("pd_document_titles", JSON.stringify(AllFilesObj))
if (formValue.addtional_requirements.length > 0) {
pd_form.append("addtional_requirements", JSON.stringify(formValue.addtional_requirements))
}
this._pd.addPdDetails(pd_form).subscribe(result => {
if (result.status == 200) {
this.disableAfterSubmit = false;
this.notifier.notify('success', 'PD Saved.');
this.loadPdListCompoent(true);
}
else {
this.disableAfterSubmit = false;
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.disableAfterSubmit = false;
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
});
}
}
}
loadPdListCompoent(from: boolean) {
//alert(from);
if (from) {
// alert('if'+from);
this.router.navigate(['../../'], { relativeTo: this.route });
this.ListPdComponent.pdListLoad(true);
}
else {
// alert(from);
this.router.navigate(['../../'], { relativeTo: this.route });
this.ListPdComponent.showListView(true);
}
}
ngOnDestroy(): void {
this.ListPdComponent.showListView(true);
}
/** To Reset Popup Data */
onReset() {
this.loadFormData();
this.disableAfterSubmit = false;
}
// validate all form group and form array fields
validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
control.markAsTouched({ onlySelf: true });
} else if (control instanceof FormGroup) {
this.validateAllFormFields(control);
} else if (control instanceof FormArray) {
this.validateAllFormFields(control);
}
});
}
}

View File

@ -0,0 +1,153 @@
<mat-card-content>
<mat-expansion-panel [(expanded)]="xpandStatus">
<mat-expansion-panel-header>
<mat-panel-title class="text-xs-left">
<mat-toolbar-row>
<mat-icon>filter_list</mat-icon>
<span class="toolbar-space"></span>
<span>Advance Filter</span>
</mat-toolbar-row>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-list class="m-gap p-gap">
<div [formGroup]="searchForm">
<mat-form-field style="width:20%">
<mat-select multiple formControlName="pd_type" placeholder="PD Type">
<mat-option *ngFor="let type of PDType" [value]="type.pd_type_id">{{type.type_name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:25%">
<mat-select multiple formControlName="pd_status" placeholder="PD Status">
<mat-option *ngFor="let status of pdStatus" [value]="status.pd_status_name">{{status.pd_status_name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:20%">
<input matInput [matDatepicker]="picker" (blur)="checkDate($event)" [max]="todaydate" formControlName="pd_from_date" placeholder="Choose a From date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:20%">
<input matInput [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" [max]="todaydate" formControlName="pd_to_date" placeholder="Choose a todate">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_products" placeholder="Products">
<mat-option *ngFor="let pro of PRODUCTS" [value]="pro.product_id">{{pro.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_city" placeholder="City">
<mat-option *ngFor="let city of CITY" [value]="city.city_id">{{city.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_lender" placeholder="Lender Name">
<mat-option *ngFor="let ent of ENTITY" [value]="ent.entity_id">{{ent.full_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_name" placeholder="Applicant Name">
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
</mat-form-field>
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
matTooltip="Reset" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary">
<mat-icon>settings_backup_restore</mat-icon>
</button>
<button type="button" mat-raised-button mat-icon-button (click)="searchItem()"
matTooltip="Search" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>search</mat-icon>
</button>
</div>
</div>
</mat-list>
</mat-expansion-panel>
<br/>
<mat-table [dataSource]="dataSourceTab1" matSort *ngIf="PdListData.length > 0">
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="10" fxFlex.lg="10" fxFlex.xl="10" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold'}" mat-line>{{details.pd_id}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<span *ngIf="details.is_child" mat-line>
<b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b>
</span>
<br>
<span class="fontsize"> {{details.lender_applicant_id}}</span>
<span class="fontsize" *ngIf="details.customer_segment_abbr">-({{details.customer_segment_abbr}} )</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Lenderid">
<mat-cell class="cell" *matCellDef="let details">
<span *ngIf="details.lender_short_name" mat-line> {{details.lender_short_name}} </span>
<br>
<span *ngIf="details.product_abbr" mat-line class="fontsize"> {{details.product_abbr}}<span *ngIf="details.subproduct_abbr">/{{details.subproduct_abbr}}</span></span>
<br>
<span *ngIf="details.loan_amount" class="fontsize">
<i class="fa-1x fa fa-rupee"></i> {{details.loan_amount}}</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Address">
<mat-cell class="cell" *matCellDef="let details;">
<span matTooltip="Initiated Date" matTooltipPosition="above">{{details.pd_date_of_initiation}}</span>
<br>
<span class="fontsize" *ngIf="details.city_name">
<i class="fa-1x fa fa-map-marker"> </i> {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }} </span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Status">
<mat-cell class="cell center" *matCellDef="let details;">
<span *ngIf="details.pd_status!='QC_COMPLETED'"> {{details.pd_status}}</span>
<span *ngIf="details.pd_status=='QC_COMPLETED'"> QC COMPLETED</span>
<br>
<span class="fontsize" *ngIf="details.pd_status!='SCHEDULED' && details.pd_status!='QC_COMPLETED'" [matTooltip]="details.pd_status | titlecase"
matTooltipPosition="above">{{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }}
</span>
<span class="fontsize" *ngIf="details.pd_status=='QC_COMPLETED'" matTooltip="QC Completed" matTooltipPosition="above">{{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }}
</span>
<span class="fontsize" *ngIf="details.pd_status=='SCHEDULED'" [matTooltip]="details.pd_status | titlecase" matTooltipPosition="above">{{details.scheduled_on}}
</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Action">
<mat-cell class="cell center" *matCellDef="let details;">
<a [style.visibility]="details.pd_status=='INITIATED' && details.encrypted_url!=null && details.encrypted_url!='' ? 'visible' : 'hidden'" [attr.href]="details.encrypted_url" target="_blank">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" color="primary"
matTooltip="Officer Tracking" matTooltipPosition="above">
<mat-icon>my_location</mat-icon>
</button>
</a>
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" color="primary" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id)"
matTooltip="View" matTooltipPosition="above">
<mat-icon>visibility</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
<!-- <ng-template #noRecord>
<div> No Record found </div>
</ng-template> -->
</mat-card-content>
<mat-paginator *ngIf="!recordStatus" #paginator class="mat-elevation-z1" [length]="PdListData.length" [pageIndex]="pageIndex"
[pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>
<notifier-container></notifier-container>

View File

@ -0,0 +1,21 @@
.ic-change:hover {
transform: scale(1.1);
color: green;
}
.cell{
display:inline !important;
}
.cellhide{
display: none !important;
}
.center{
text-align:center;
}
.fontsize{
font-size:14px;
}
.toolbar-space {
flex: 0.01 0 auto;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UomListComponent } from './uom-list.component';
import { AllPdComponent } from './all-pd.component';
describe('UomListComponent', () => {
let component: UomListComponent;
let fixture: ComponentFixture<UomListComponent>;
describe('AllPdComponent', () => {
let component: AllPdComponent;
let fixture: ComponentFixture<AllPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UomListComponent ]
declarations: [ AllPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UomListComponent);
fixture = TestBed.createComponent(AllPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,223 @@
import { Component,ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter, OnDestroy, AfterViewInit, OnChanges, SimpleChanges } from '@angular/core';
import { PdTrigerService } from './../../../pd-service/pd-triger.service';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { FormGroup, FormBuilder } from '@angular/forms';
import { DatePipe } from '@angular/common';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-all-pd',
templateUrl: './all-pd.component.html',
styleUrls: ['./all-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class AllPdComponent implements OnInit, OnChanges {
xpandStatus: boolean = false;
PRODUCTS:any[]=[];
ENTITY: any[]=[]
CITY: any[]=[]
PDType: any[]=[]
pdStatus: any[]=[]
searchForm:FormGroup;
pipe = new DatePipe('en-US');
private notifier: NotifierService;
recordStatus: boolean;
errorMessage:any[]=[];
tabStatus:string="ALL";
public dataLengthTab1: number;
public dataSourceTab1 = new MatTableDataSource();
displayedColumns = ['PDType','Name','Lenderid','Address','Status','Action'];
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@Input() bindFilterValue: string;
@Output() loadPdView = new EventEmitter<string>();
// data source variable details
PdListData:any[] = [];
// pagination variable details
length = 5;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
todaydate:Date = new Date();
constructor(private _pd: PdTrigerService,private _fb:FormBuilder,notifier: NotifierService,) {
this.notifier = notifier;
this.searchForm = this._fb.group(
{
pd_type:[null],
pd_status:[null],
pd_from_date:[null],
pd_to_date:[null],
pd_city:[null],
pd_products:[null],
pd_lender:[null],
pd_name:[null],
pd_applicant_id:[null],
});
this.getcommonDropDown();
}
ngOnInit() {
this.recordStatus=false;
// this.loadPDDetails();
//this.getcommonDropDown();
}
// get changes for filter from parent componnet filter
ngOnChanges(changes: SimpleChanges) {
let filteredText = changes.bindFilterValue.currentValue ? changes.bindFilterValue.currentValue.trim() : changes.bindFilterValue.currentValue;
filteredText = filteredText ? filteredText.toLowerCase() : filteredText;
this.dataSourceTab1.filter = filteredText;
}
// load inprogress pd list
loadPDDetails() {
//this._pd.getTabStatusPdDetails(this.tabStatus)
this._pd.getPdDetails()
.subscribe(
data => {
if (data.status == 200) {
this.PdListData = data.records;
this.dataLengthTab1 = data.records.length;
this.dataSourceTab1.data = this.PdListData;
}
else{
this.PdListData=[];
this.dataSourceTab1 = null;
this.recordStatus=true;
}
}
// , error => {this.errorMessage = <any> error});
,error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
pageChange(e) {
console.log(e);
}
viewPD(pdid:string){
this.loadPdView.next(pdid);
}
titleCaseWord(word:string) {
if (!word) return word;
return word[0].toUpperCase() + word.substr(1).toLowerCase();
}
/**
* Common Search
* sriram
*/
getcommonDropDown(): void
{
this._pd.getAllMasterDatas('PDSTATUS').subscribe(res=>
{
if(res.dataStatus==true)
{
this.pdStatus = res.records.filter(status=>status.isactive==1);
}
});
this._pd.getAllMasterDatas('PDTYPE').subscribe(res=>
{
if(res.dataStatus==true)
{
this.PDType = res.records.filter(type=>type.isactive==1);
}
});
this._pd.getListOfCities().subscribe(res=>
{
if(res.dataStatus==true)
{
this.CITY = res.records;
}
});
this._pd.getAllMasterDatas('ENTITY').subscribe(res=>
{
if(res.dataStatus==true)
{
this.ENTITY = res.records.filter(ent=>ent.isactive==1);
}
});
this._pd.getAllMasterDatas('PRODUCTS').subscribe(res=>
{
if(res.dataStatus==true)
{
this.PRODUCTS = res.records.filter(pro=>pro.isactive==1);
}
});
}
checkDate(e)
{
console.log(e);
}
searchItem()
{
if(this.searchForm.value.pd_type !=null)
{
}else
{
this.searchForm.value.pd_type = [];
}
if(this.searchForm.value.pd_status !=null)
{
}else
{
this.searchForm.value.pd_status = [];
}
this.searchForm.value.pd_from_date = this.pipe.transform(this.searchForm.value.pd_from_date,'yyyy-MM-dd');
this.searchForm.value.pd_to_date = this.pipe.transform(this.searchForm.value.pd_to_date,'yyyy-MM-dd');
// console.log(JSON.stringify(this.searchForm.value));
this._pd.overAllSearchFormDetails(this.searchForm.value).subscribe(res=>
{
this.xpandStatus = false;
if(res['dataStatus']==true)
{
this.dataSourceTab1.data = res['records'];
// console.log('records',res['records']);
this.dataSourceTab1.paginator = this.paginator;
}else{
this.notifier.notify('warning', 'No Records Found !');
this.dataSourceTab1.paginator['length'] = 0;
this.dataSourceTab1.paginator['pageIndex'] = 0;
this.dataSourceTab1.data = [];
// console.log('records-records',res['records']);
}
},error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
onReset(){
this.searchForm.reset();
this.loadPDDetails();
this.xpandStatus = false;
}
ngAfterViewInit() {
this.dataSourceTab1.paginator = this.paginator;
this.dataSourceTab1.sort = this.sort;
}
}

View File

@ -0,0 +1,126 @@
<mat-card-content>
<mat-expansion-panel [(expanded)]="xpandStatus">
<mat-expansion-panel-header>
<mat-panel-title class="text-xs-left">
<!-- <h6 class="mt-0"><mat-icon>filter_list</mat-icon> Filter</h6> -->
<mat-toolbar-row>
<mat-icon>filter_list</mat-icon>
<span class="toolbar-space"></span>
<span>Advance Filter</span>
</mat-toolbar-row>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-list class="m-gap p-gap">
<div [formGroup]="searchForm">
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_type" placeholder="PD Type">
<mat-option *ngFor="let type of PDType" [value]="type.pd_type_id">{{type.type_name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<!-- <mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_status" placeholder="PD Status">
<mat-option *ngFor="let status of pdStatus" [value]="status.pd_status_name">{{status.pd_status_name}}</mat-option>
</mat-select>
</mat-form-field> -->
<mat-form-field style="width:30%">
<input matInput [max]="todaydate" [matDatepicker]="picker" (blur)="checkDate($event)" formControlName="pd_from_date" placeholder="Choose a From date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput [max]="todaydate" [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" formControlName="pd_to_date" placeholder="Choose a todate">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_products" placeholder="Products">
<mat-option *ngFor="let pro of PRODUCTS" [value]="pro.product_id">{{pro.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_city" placeholder="City">
<mat-option *ngFor="let city of CITY" [value]="city.city_id">{{city.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_lender" placeholder="Lender Name">
<mat-option *ngFor="let ent of ENTITY" [value]="ent.entity_id">{{ent.full_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_name" placeholder="Applicant Name">
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
</mat-form-field>
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
matTooltip="Reset" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary">
<mat-icon>settings_backup_restore</mat-icon>
</button>
<button type="button" mat-raised-button mat-icon-button (click)="searchItem()"
matTooltip="Search" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>search</mat-icon>
</button>
</div>
</div>
</mat-list>
</mat-expansion-panel>
<br/>
<mat-table [dataSource]="dataSourceTab4" matSort *ngIf="completedPdListData.length > 0" >
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="10" fxFlex.lg="10" fxFlex.xl="10" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold'}" mat-line>{{details.pd_id}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<!-- <span *ngIf="details.applicant_name" mat-line><b>{{details.applicant_name}}</b></span><br> -->
<span *ngIf="details.is_child" mat-line>
<b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b>
</span><br>
<span class="fontsize"> {{details.lender_applicant_id}}</span> <span class="fontsize" *ngIf="details.customer_segment_abbr">-({{details.customer_segment_abbr}} )</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Lenderid">
<mat-cell class="cell" *matCellDef="let details">
<span *ngIf="details.lender_short_name" mat-line> {{details.lender_short_name}} </span><br>
<span *ngIf="details.product_abbr" mat-line class="fontsize"> {{details.product_abbr}}<span *ngIf="details.subproduct_abbr">/{{details.subproduct_abbr}}</span></span> <br>
<span *ngIf="details.loan_amount" class="fontsize"><i class="fa-1x fa fa-rupee"></i> {{details.loan_amount}}</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Address">
<mat-cell class="cell" *matCellDef="let details;">
<span matTooltip="Initiated Date" matTooltipPosition="above">{{details.pd_date_of_initiation}}</span><br>
<span class="fontsize" *ngIf="details.city_name"> <i class="fa-1x fa fa-map-marker"> </i> {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }} </span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Status">
<mat-cell class="cell center" *matCellDef="let details;">
<span> {{details.pd_status}}</span><br>
<span class="fontsize" [matTooltip]="details.pd_status | titlecase" >{{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }}
</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Action">
<mat-cell class="cell center" *matCellDef="let details;">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id)" matTooltip="View"
matTooltipPosition="above" color="primary"><mat-icon>visibility</mat-icon></button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
</mat-card-content>
<mat-paginator *ngIf="!recordStatus" #paginator class="mat-elevation-z1" [length]="completedPdListData.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>

View File

@ -0,0 +1,19 @@
.ic-change:hover {
transform: scale(1.1);
color: green;
}
.cell{
display:inline !important;
}
.cellhide{
display: none !important;
}
.center{
text-align:center;
}
.fontsize{
font-size:14px;
}
.toolbar-space {
flex: 0.01 0 auto;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ProductListComponent } from './product-list.component';
import { CompletedPdComponent } from './completed-pd.component';
describe('ProductListComponent', () => {
let component: ProductListComponent;
let fixture: ComponentFixture<ProductListComponent>;
describe('CompletedPdComponent', () => {
let component: CompletedPdComponent;
let fixture: ComponentFixture<CompletedPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProductListComponent ]
declarations: [ CompletedPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ProductListComponent);
fixture = TestBed.createComponent(CompletedPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,236 @@
import { Component,ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter, OnDestroy, AfterViewInit, OnChanges, SimpleChanges } from '@angular/core';
import { PdTrigerService } from './../../../pd-service/pd-triger.service';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { FormGroup, FormBuilder } from '@angular/forms';
import { DatePipe } from '@angular/common';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-completed-pd',
templateUrl: './completed-pd.component.html',
styleUrls: ['./completed-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class CompletedPdComponent implements OnInit, OnChanges {
xpandStatus: boolean = false;
PRODUCTS: any[]=[];
CITY: any[]=[];
ENTITY: any[]=[];
PDType: any[]=[];
pdStatus: any[]=[];
searchForm:FormGroup;
pipe = new DatePipe('en-US');
private notifier: NotifierService;
recordStatus: boolean;
errorMessage:any[]=[];
tabStatus:string="COMPLETED";
public dataLengthTab4: number;
public dataSourceTab4 = new MatTableDataSource();
displayedColumns = ['PDType','Name','Lenderid','Address','Status','Action'];
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@Input() bindFilterValue: string;
@Output() loadPdView = new EventEmitter<string>();
// data source variable details
completedPdListData:any[] = [];
// pagination variable details
length = 5;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
todaydate:Date = new Date();
constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,) {
this.notifier = notifier;
this.searchForm = this._fb.group(
{
pd_type:[null],
pd_status:['COMPLETED'],
pd_from_date:[null],
pd_to_date:[null],
pd_city:[null],
pd_products:[null],
pd_lender:[null],
pd_name:[null],
pd_applicant_id:[null],
});
this.getcommonDropDown();
}
ngOnInit() {
this.recordStatus=false;
// this.loadPDDetails();
// this.getcommonDropDown();
}
// get changes for filter from parent componnet filter
ngOnChanges(changes: SimpleChanges) {
// let filteredText = changes.bindFilterValue.currentValue;
let filteredText = changes.bindFilterValue.currentValue ? changes.bindFilterValue.currentValue.trim() : changes.bindFilterValue.currentValue;
// filteredText = filteredText ? filteredText.trim() : filteredText;
filteredText = filteredText ? filteredText.toLowerCase() : filteredText;
this.dataSourceTab4.filter = filteredText;
}
// load inprogress pd list
loadPDDetails() {
this._pd.getTabStatusPdDetails(this.tabStatus)
.subscribe(
data => {
if (data.status == 200) {
this.completedPdListData = data.records;
this.dataLengthTab4 = data.records.length;
this.dataSourceTab4.data = this.completedPdListData;
}
else{
this.completedPdListData=[];
this.dataLengthTab4= null;
this.recordStatus=true;
}
}
// , error => this.errorMessage = <any> error);
,error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
pageChange(e) {
console.log(e);
}
viewPD(pdid:string){
this.loadPdView.next(pdid);
}
titleCaseWord(word:string) {
if (!word) return word;
return word[0].toUpperCase() + word.substr(1).toLowerCase();
}
/**
* Common Search
* sriram
*/
getcommonDropDown(): void
{
this._pd.getAllMasterDatas('PDSTATUS').subscribe(res=>
{
if(res.dataStatus==true)
{
this.pdStatus = res.records.filter(status=>status.isactive==1 && status.pd_status_name==this.tabStatus);
// this.searchForm.controls['pd_status'].setValue(this.pdStatus[0]);
}
});
this._pd.getAllMasterDatas('PDTYPE').subscribe(res=>
{
if(res.dataStatus==true)
{
this.PDType = res.records.filter(type=>type.isactive==1);
}
});
// this._pd.getAllMasterDatas('CITY').subscribe(res=>
// {
// if(res.dataStatus==true)
// {
// this.CITY = res.records.filter(city=>city.isactive==1);
// }
// });
this._pd.getListOfCities().subscribe(res=>
{
if(res.dataStatus==true)
{
this.CITY = res.records;
}
});
this._pd.getAllMasterDatas('ENTITY').subscribe(res=>
{
if(res.dataStatus==true)
{
this.ENTITY = res.records.filter(ent=>ent.isactive==1);
}
});
this._pd.getAllMasterDatas('PRODUCTS').subscribe(res=>
{
if(res.dataStatus==true)
{
this.PRODUCTS = res.records.filter(pro=>pro.isactive==1);
}
});
}
checkDate(e)
{
console.log(e);
}
searchItem()
{
if(this.searchForm.value.pd_type !=null)
{
}else
{
this.searchForm.value.pd_type = [];
}
if(this.searchForm.value.pd_status !=null)
{
}else
{
this.searchForm.value.pd_status = [];
}
this.searchForm.value.pd_from_date = this.pipe.transform(this.searchForm.value.pd_from_date,'yyyy-MM-dd');
this.searchForm.value.pd_to_date = this.pipe.transform(this.searchForm.value.pd_to_date,'yyyy-MM-dd');
this._pd.overAllSearchFormDetails(this.searchForm.value).subscribe(res=>
{
this.xpandStatus = false;
if(res['dataStatus']==true)
{
this.dataSourceTab4 = res['records'];
this.dataSourceTab4.paginator = this.paginator;
}else{
this.notifier.notify('warning', 'No Records Found !');
this.dataSourceTab4.paginator['length'] = 0;
this.dataSourceTab4.paginator['pageIndex'] = 0;
this.dataSourceTab4.data = [];
}
},error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
onReset(){
this.searchForm.reset();
this.loadPDDetails();
this.xpandStatus = false;
}
ngAfterViewInit() {
this.dataSourceTab4.paginator = this.paginator;
this.dataSourceTab4.sort = this.sort;
}
}

View File

@ -0,0 +1,120 @@
<form [formGroup]="_EditApplicantForm">
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
{{pageTitle}}
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content>
<mat-card>
<mat-card-header>
<mat-card-title>Applicant 1</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="applicant_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 65%">
<!-- <input matInput placeholder="Name of Individual Applicant" formControlName="applicant_name"
[value]="pdMainApplicant.applicant_name.value | titlecase" required> -->
<input matInput placeholder="Name of Individual Applicant" formControlName="applicant_name" required>
</mat-form-field>
<mat-form-field style="width: 40%" *ngIf="CSAbbr != 'SE-RI'">
<input matInput placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field>
<mat-form-field style="width: 40%">
<input matInput placeholder="Mobile Number" formControlName="mobile_no" type="text" maxlength="10" ForMobileNumbers required>
<mat-error *ngIf="pdMainApplicant.mobile_no.hasError('maxlength') || pdMainApplicant.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput placeholder="STD Code" formControlName="stdcode" type="text" maxlength="5" ForMobileNumbers>
<!-- <span matPrefix>+91</span> -->
<mat-error *ngIf="pdMainApplicant.stdcode.hasError('maxlength') || pdMainApplicant.stdcode.hasError('minlength')">Enter Valid STD Code. </mat-error>
</mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 60%">
<input matInput placeholder="LandLine Number" formControlName="landline" maxlength="8" type="text" ForMobileNumbers>
<mat-error *ngIf="pdMainApplicant.landline.hasError('maxlength') || pdMainApplicant.landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
</mat-form-field>
</mat-card-content>
</mat-card>
<mat-card formArrayName="coApplicantItems" *ngFor="let coDetails of pdCoApplicant.controls; let i = index;">
<mat-card-header>
<mat-card-title>Applicant {{i+2}}</mat-card-title>
</mat-card-header>
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="applicant_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 65%">
<input matInput placeholder="Name of Individual Applicant" formControlName="coapplicantName" type="text" required>
</mat-form-field>
<mat-form-field style="width: 40%" *ngIf="CSAbbr != 'SE-RI'">
<input matInput placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field>
<mat-form-field style="width: 40%">
<input matInput placeholder="Mobile Number" formControlName="coapplicant_mobile_no" type="text" maxlength="10" minlength="10" ForMobileNumbers>
<mat-error *ngIf=" coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<!-- <mat-form-field style="width: 40%" >
<input matInput placeholder="LandLine Number" formControlName="coapplicant_landline" type="text" OnlyNumber>
<mat-error *ngIf=" coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
</mat-form-field> -->
<mat-form-field style="width: 15%">
<input matInput placeholder="STD Code" formControlName="coapplicant_stdcode" type="text" maxlength="5" ForMobileNumbers>
<!-- <span matPrefix>+91</span> -->
<mat-error *ngIf="coDetails['controls'].coapplicant_stdcode.hasError('maxlength') || coDetails['controls'].coapplicant_stdcode.hasError('minlength')">Enter Valid STD Number. </mat-error>
</mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 60%">
<input matInput placeholder="LandLine Number" formControlName="coapplicant_landline" type="text" maxlength="8" ForMobileNumbers>
<mat-error *ngIf="coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
</mat-form-field>
<!-- <mat-form-field style="width: 82%">
<mat-select placeholder="Relationship With Main Applicant" formControlName="relationship">
<mat-option>Select</mat-option>
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
{{rel.name}}
</mat-option>
</mat-select>
</mat-form-field> -->
</mat-card-content>
</mat-card>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1" matTooltip="Add More Co-Applicant" matTooltipPosition="above" color="primary" type="button" (click)="addCoApplicant(emptyData)"><mat-icon>add</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="updatePdApplicant(_EditApplicantForm.value)"><mat-icon>save</mat-icon></button>
</mat-dialog-actions>
</form>
<!-- <notifier-container></notifier-container> -->

View File

@ -0,0 +1,8 @@
mat-form-field {
margin: 0 2%;
}
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
// padding: 10px !important;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CompanyListComponent } from './company-list.component';
import { EditPdApplicantComponent } from './edit-pd-applicant.component';
describe('CompanyListComponent', () => {
let component: CompanyListComponent;
let fixture: ComponentFixture<CompanyListComponent>;
describe('EditPdApplicantComponent', () => {
let component: EditPdApplicantComponent;
let fixture: ComponentFixture<EditPdApplicantComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CompanyListComponent ]
declarations: [ EditPdApplicantComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CompanyListComponent);
fixture = TestBed.createComponent(EditPdApplicantComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,326 @@
import { Component, OnInit,ViewEncapsulation, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { TitleCasePipe } from '@angular/common';
@Component({
selector: 'app-edit-pd-applicant',
templateUrl: './edit-pd-applicant.component.html',
styleUrls: ['./edit-pd-applicant.component.scss'],
providers:[TitleCasePipe],
encapsulation: ViewEncapsulation.None,
})
export class EditPdApplicantComponent implements OnInit {
public pageTitle: string = "Applicant Details";
errorMessage: any;
public _EditApplicantForm:FormGroup;
public notifier: NotifierService;
mainApplicantData: any[];
coApplicantData: any[];
coApplicantItems:FormArray;
emptyData:any;
relationShipList:any;
titleList: any;
CSAbbr:any;
disableAfterSubmit: boolean;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService, private dialogRef: MatDialogRef<EditPdApplicantComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,private titleCase : TitleCasePipe) {
this.notifier=notifier;
this.disableAfterSubmit = false;
}
ngOnInit() {
this.CSAbbr = this.data.SegmentAbbr != '' ? this.data.SegmentAbbr != null ? this.data.SegmentAbbr : '' :'' ;
if(this.data.records.length>0){
this.mainApplicantData= this.data.records.filter(item => item.applicant_type == 1);
this.coApplicantData= this.data.records.filter(item => item.applicant_type == 0);
this.loadApplicantFormData();
}
else{
this.loadEmptyFormData()
}
this.getRelationMaster();
this.getTitleMaster();
}
loadEmptyFormData() {
this._EditApplicantForm = this._fb.group({
fk_applicant_primary_id: [null],
applicant_name: [null, Validators.compose([Validators.required])],
mobile_no: [null, Validators.compose([Validators.minLength(10),Validators.maxLength(12)])],
stdcode: [null, Validators.compose([Validators.minLength(3),Validators.maxLength(5)])],
landline: [null, Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
company_name: [null],
applicant_type: [1],
coApplicantItems: this._fb.array([]),
});
}
loadApplicantFormData() {
let stdcode;
let landline;
if(this.mainApplicantData[0].landline != null){
let stdcodesearch = this.mainApplicantData[0].landline.search("-");
stdcode = this.mainApplicantData[0].landline.substr(0,stdcodesearch) ;
landline = this.mainApplicantData[0].landline.substr(+stdcodesearch + 1,8) ;
}else{
stdcode = '';
landline = '';
}
this._EditApplicantForm = this._fb.group({
fk_applicant_primary_id: [this.mainApplicantData[0].pd_co_applicant_id],
applicant_name: [this.titleCase.transform(this.mainApplicantData[0].applicant_name), Validators.compose([Validators.required])],
mobile_no: [this.mainApplicantData[0].mobile_no, Validators.compose([Validators.minLength(10),Validators.maxLength(12)])],
stdcode: [stdcode, Validators.compose([Validators.minLength(3),Validators.maxLength(5)])],
landline: [landline, Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
company_name: [this.mainApplicantData[0].company_name],
applicant_type: [this.mainApplicantData[0].applicant_type, Validators.compose([Validators.required])],
applicant_title_name: [this.mainApplicantData[0].applicant_title_name, Validators.compose([Validators.required])],
coApplicantItems: this._fb.array([]),
});
// bind dynamic co applicant data
if(this.coApplicantData.length > 0){
for(let value of this.coApplicantData){
this.addCoApplicant(value);
}
}
}
createItem(listData): FormGroup {
if(listData){
let stdcode;
let landline;
if(listData.landline != null){
let stdcodesearch = listData.landline.search("-");
stdcode = listData.landline.substr(0,stdcodesearch);
landline = listData.landline.substr(+stdcodesearch + 1,8);}
else{
stdcode = '';
landline = '';
}
return this._fb.group({
label: ['Co Applicant'],
fk_applicant_primary_id: [listData.pd_co_applicant_id],
applicant_title_name: [listData.applicant_title_name, Validators.compose([Validators.required])],
coapplicantName: [this.titleCase.transform(listData.applicant_name), Validators.compose([Validators.required])],
coapplicant_mobile_no: [listData.mobile_no,Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
coapplicant_stdcode: [stdcode, Validators.compose([Validators.minLength(3),Validators.maxLength(5)])],
// landline: [landline, Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
coapplicant_landline: [landline,Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
// relationship: [listData.relation],
applicant_type: [listData.applicant_type, Validators.compose([Validators.required])],
company_name: [listData.company_name],
});
}
else{
return this._fb.group({
label: ['Co Applicant'],
fk_applicant_primary_id: [null],
applicant_title_name: [null, Validators.compose([Validators.required])],
coapplicantName: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [null, Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
coapplicant_stdcode: [null, Validators.compose([Validators.minLength(3),Validators.maxLength(5)])],
coapplicant_landline: [null,Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
//coapplicant_landline: [null, Validators.compose([Validators.minLength(8),Validators.maxLength(12)])],
// relationship: [null],
applicant_type: [0],
company_name: [null],
});
}
};
addCoApplicant(listData) {
if(this._EditApplicantForm.valid){
this.coApplicantItems = this._EditApplicantForm.get('coApplicantItems') as FormArray;
this.coApplicantItems.push(this.createItem(listData));
}
}
get pdMainApplicant() { return this._EditApplicantForm.controls; }
get pdCoApplicant() { return this._EditApplicantForm.get('coApplicantItems') as FormArray; }
updatePdApplicant(formValue: any) {
if(this._EditApplicantForm.invalid) {
this.validateAllFormFields(this._EditApplicantForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
else {
if((formValue.mobile_no == '') && (formValue.stdcode == '' || formValue.landline == '')){
this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
return;
}
else if(formValue.mobile_no.length != 10){
this.notifier.notify('warning', 'Please Check Applicant Mobile Number.!');
return;
}
else{
let concat_landline1
// if(formValue.stdcode != null && formValue.landline != null){
// if(formValue.stdcode == '' && formValue.landline == ''){
// concat_landline1 = null;
// }else {
// let std = formValue.stdcode == '' ? '' : formValue.stdcode;
// let landline = formValue.landline == '' ? '' : formValue.landline;
// concat_landline1 = std+'-'+landline;
// }
// }
// else if(formValue.stdcode == '' && formValue.landline == ''){
// concat_landline1 = null;
// }else{
// concat_landline1 = null;
// }
if(!formValue.stdcode || !formValue.landline){
concat_landline1 = null;
}
else if(!formValue.stdcode && !formValue.landline){
concat_landline1 = null;
}
else if(formValue.stdcode && formValue.landline){
let std = formValue.stdcode == '' ? '' : formValue.stdcode;
let landline = formValue.landline == '' ? '' : formValue.landline;
concat_landline1 = std+'-'+landline;
}
else{
concat_landline1 = null;
}
let pd_applicant_details : any=[{
"fk_pd_id": this.data.pdID,
"pd_co_applicant_id": formValue.fk_applicant_primary_id,
"applicant_name":this.titleCase.transform(formValue.applicant_name),
"company_name":formValue.company_name,
"mobile_no":formValue.mobile_no,
"landline":concat_landline1,
"applicant_type":formValue.applicant_type,
// "relation":formValue.relationship,
"applicant_title_name": formValue.applicant_title_name,
"isactive":1
}];
formValue.coApplicantItems.forEach((itemElement, itemIndex) => {
let concat_landline
// if(itemElement.coapplicant_stdcode != null && itemElement.coapplicant_landline != null){
// if(itemElement.coapplicant_stdcode == '' && itemElement.coapplicant_landline == ''){
// concat_landline = null;
// }else{
// let std = itemElement.coapplicant_stdcode == '' ? '' : itemElement.coapplicant_stdcode;
// let landline = itemElement.coapplicant_landline == '' ? '' : itemElement.coapplicant_landline;
// concat_landline = std+'-'+landline;
// }
// }else if(itemElement.coapplicant_stdcode == '' && itemElement.coapplicant_landline == ''){
// concat_landline = null;
// }else{
// concat_landline = null;
// }
if(!itemElement.coapplicant_stdcode || !itemElement.coapplicant_landline){
concat_landline = null;
}
else if(!itemElement.coapplicant_stdcode && !itemElement.coapplicant_landline){
concat_landline = null;
}
else if(itemElement.coapplicant_stdcode && itemElement.coapplicant_landline){
let std = itemElement.coapplicant_stdcode == '' ? '' : itemElement.coapplicant_stdcode;
let landline = itemElement.coapplicant_landline == '' ? '' : itemElement.coapplicant_landline;
concat_landline = std+'-'+landline;
}
else{
concat_landline = null;
}
let obj1 = {
"fk_pd_id": this.data.pdID,
"pd_co_applicant_id": itemElement.fk_applicant_primary_id,
"applicant_title_name":itemElement.applicant_title_name,
"applicant_name":this.titleCase.transform(itemElement.coapplicantName),
// "relation":itemElement.relationship,
"mobile_no":itemElement.coapplicant_mobile_no,
"landline":concat_landline,
"applicant_type":itemElement.applicant_type,
"company_name":itemElement.company_name,
"isactive":1
}
pd_applicant_details.push(obj1)
});
this.disableAfterSubmit = true;
this._pd.updatePdApplicant(pd_applicant_details).subscribe(result => {
if (result.status == 200) {
this.disableAfterSubmit = false;
this.notifier.notify('success', 'PD Details Updated.');
this.dialogRef.close();
}
else {
this.disableAfterSubmit = false;
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.disableAfterSubmit = false;
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
});
}
}
}
// get relation master details
getRelationMaster(){
let relation ="RELATIONSHIPS";
this._pd.getAllMasterDatas(relation).subscribe(
data => {
if (data.status == 200) {
this.relationShipList=data.records;
}
}, error => this.errorMessage = <any> error);
}
// get title master
getTitleMaster() {
let relation ="TITLES";
this._pd.getAllMasterDatas(relation).subscribe(
data => {
if (data.status == 200) {
this.titleList=data.records.filter(val=>val.isactive==1);
}
}, error => this.errorMessage = <any> error);
}
/** To Reset Popup Data */
onReset() {
this.disableAfterSubmit = false;
if(this.data.records.length>0){
this.loadApplicantFormData();
}
else{
this.loadEmptyFormData();
}
}
/** For Popup Close Button */
closeEditComponent(): void {
this.dialogRef.close();
}
// validate all form group and form array fields
validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
control.markAsTouched({ onlySelf: true });
} else if (control instanceof FormGroup) {
this.validateAllFormFields(control);
} else if (control instanceof FormArray) {
this.validateAllFormFields(control);
}
});
}
}

View File

@ -0,0 +1,233 @@
<form [formGroup]="_EditPDtriggerForm" novalidate>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
{{pageTitle}}
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
matTooltipPosition="right" mat-dialog-close>
<mat-icon>close</mat-icon>
</button>
</div>
</h2>
<mat-dialog-content>
<mat-card>
<!-- <mat-card-header>
<mat-card-title>PD Details</mat-card-title>
</mat-card-header> -->
<mat-card-content>
<mat-form-field style="width: 29%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id">
<mat-option>
Select
</mat-option>
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > -->
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList"
[value]="LL.entity_id">
{{LL.full_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender Name Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id"
type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person"
type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno"
type="text" maxlength="10" ForMobileNumbers>
<mat-error *ngIf="pdMain.pd_contact_mobileno.hasError('pattern') || pdMain.pd_contact_mobileno.hasError('maxlength') || pdMain.pd_contact_mobileno.hasError('minlength')">Enter
Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 10%">
<input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text" maxlength="5"
ForMobileNumbers>
<!-- <span matPrefix>+91</span> -->
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter
Valid STD Code. </mat-error>
</mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 20%">
<input matInput placeholder="LandLine Number" formControlName="lender_landline"
type="text" maxlength="8" ForMobileNumbers>
<mat-error *ngIf="pdMain.lender_landline.hasError('maxlength') || pdMain.lender_landline.hasError('minlength')">Enter
Valid Landline Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 21.5%">
<mat-select placeholder="Branch" formControlName="pd_branch_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let LB of lenderBranchList" [value]="LB.entity_lender_branch_id">
{{LB.branch_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Product Name" formControlName="fk_product_id"
(selectionChange)="getSubproductList(pdMain.fk_product_id.value,2)">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id">
{{PL.product_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product Required.</mat-error> -->
</mat-form-field>
<!-- <mat-form-field style="width: 29%"> -->
<mat-form-field *ngIf="isSubproductShown" style="width: 29%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id">
<mat-option>Select</mat-option>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id">
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub Product Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
<mat-option>Select</mat-option>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id">
<!-- {{CSL.customer_segment}} -->{{CSL.abbr}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id">
{{PDL.type_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 62%">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
<input matInput placeholder="Loan Amount" formControlName="loan_amount"
OnlyNumber required
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value != ''">{{"&#8377;"}} {{pdMain.loan_amount.value | numberToWords}} Only</mat-hint>
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount.
</mat-error>
</mat-form-field>
</mat-card-content>
</mat-card>
<div formArrayName="addresses" *ngFor="let addresses of pdAddresses.controls; let i = index; let last = last">
<mat-card [formGroupName]="i">
<mat-card-header>
<mat-card-title>Address Details #{{i+1}} <span *ngIf="!addressesDeactivited[i]" style="color: red;" align="end"><i> Deactivited </i></span> </mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field style="width: 96%">
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done"
formControlName="addressline1" [value]="addresses.get('addressline1').value | titlecase"></textarea>
</mat-form-field>
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state"
(selectionChange)="getCityList($event.value,i)">
<mat-option> Select </mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option> Select </mat-option>
<mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode"
(selectionChange)="getPincode($event.value,i)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 24%" *ngIf="pincodeflag[i]">
<!-- *ngIf="pdAddresses.pincode.value == 1" -->
<input matInput autocomplete="off" placeholder="Specify Pincode"
formControlName="other_pincode" OnlyNumber>
<!-- <mat-error *ngIf="pdAddresses.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
</mat-form-field>
</mat-card-content>
<mat-card-actions align="end">
<button mat-raised-button mat-icon-button matTooltip="Delete"
matTooltipPosition="above" (click)="removeAddresses(i,'Deactivited')"
type="button" *ngIf="pdAddresses.controls.length > 1 && addressesDeactivited[i]">
<mat-icon>delete</mat-icon>
</button>
<button type="button" mat-flat-button (click)="removeAddresses(i,'Activited')"
matTooltipPosition="above" color="primary" *ngIf="!addressesDeactivited[i]">
<strong>Deleted</strong>
</button>
&nbsp;&nbsp;
<button type="button" mat-raised-button mat-icon-button (click)="addAddresses(i)" *ngIf="last"
matTooltip="Add More Additional Addresses" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>add</mat-icon>
</button>
</mat-card-actions>
</mat-card>
</div>
</mat-dialog-content>
<mat-dialog-actions>
<div fxFlex="70" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="remarks"></textarea>
</mat-form-field>
</div>
<div fxFlex="30" align="end">
<!-- <button *ngIf="currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="saveDraftPD(this._EditPDtriggerForm.value,pdStatusCheck.DRAFT)" type="button" matTooltip="Save As Draft" matTooltipPosition="above"><mat-icon>insert_drive_file</mat-icon></button> -->
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Trigger PD" matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value, pdStatusCheck.TRIGGERED)"><mat-icon>save</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save PD"
matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value,'')" [disabled]="disableAfterSubmit===true">
<mat-icon>save</mat-icon>
</button>
</div>
</mat-dialog-actions>
</form>
<notifier-container></notifier-container>

View File

@ -0,0 +1,18 @@
mat-form-field {
margin: 0 2%;
}
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
// padding: 10px !important;
}
.cdk-global-overlay-wrapper{
justify-content: center !important;
}
mat-dialog-actions{
border-top: 2px solid #e00201;
}
.mat-form-field-appearance-legacy .mat-hint{
color:rgba(0, 0, 0, 0.8) !important;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PdTypeDialogComponent } from './pd-type-dialog.component';
import { EditPdMasterComponent } from './edit-pd-master.component';
describe('PdTypeDialogComponent', () => {
let component: PdTypeDialogComponent;
let fixture: ComponentFixture<PdTypeDialogComponent>;
describe('EditPdMasterComponent', () => {
let component: EditPdMasterComponent;
let fixture: ComponentFixture<EditPdMasterComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PdTypeDialogComponent ]
declarations: [ EditPdMasterComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PdTypeDialogComponent);
fixture = TestBed.createComponent(EditPdMasterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,628 @@
import { Component, OnInit,ViewEncapsulation, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { TitleCasePipe } from '@angular/common';
@Component({
selector: 'app-edit-pd-master',
templateUrl: './edit-pd-master.component.html',
styleUrls: ['./edit-pd-master.component.scss'],
providers:[TitleCasePipe],
encapsulation: ViewEncapsulation.None
})
export class EditPdMasterComponent implements OnInit {
public pageTitle: string = "PD Details";
pdid: any;
errorMessage: any;
productList:any;
productAllList:any;
subProductList:any;
lenderList:any;
customerSegmentAllList:any;
customerSegmentList:any;
stateList:any;
cityList:any = [];
pdTypeList:any;
billingList:any;
lenderBranchList: any;
pincodeList: any = [];
addressesList : any = [];
addressesDeactivited : any = [];
applicantLength:number;
// draftStatus: string;
// PDTriggerStatus: string;
enablePDButton: boolean;
currentPDStatus: string;
disableAfterSubmit: boolean;
pincodeflag : any = [];
public _EditPDtriggerForm:FormGroup;
public notifier: NotifierService;
addresses: FormArray;
// create values for status check
pdStatusCheck :any={
"DRAFT" :'DRAFT',
"TRIGGERED" :'TRIGGERED',
"ALLOCATED" :'ALLOCATED',
"SCHEDULED" :'SCHEDULED',
"INPROGRESS" :'INPROGRESS',
"COMPLETED" :'COMPLETED',
"QC_COMPLETED" :'QC_COMPLETED',
};
lenderShortName: any;
isSubproductShown: boolean = true;
productShortName : any;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<EditPdMasterComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,private titleCase : TitleCasePipe) {
this.notifier=notifier
this.currentPDStatus = data.records.pd_status;
this.pdid = data.records.pd_id;
this.disableAfterSubmit = false;
}
ngOnInit() {
// this.draftStatus="DRAFT";
// this.PDTriggerStatus="TRIGGERED";
this.getCustomerSegmentList();
this.getLenderList();
this.getProductsList();
this.getStateCityList();
this.getPDTypeList();
// this.getAddresses();
this.loadFormData();
this.applicantLength=this.data.applicantLength;
}
getLenderList(){
this._pd.getLenderDetails().subscribe(
data => {
if (data.status == 200) {
this.lenderList=data.records;
if(this.data.records.fk_lender_id != null){
let x = this.lenderList.filter(item => item.entity_id == this.data.records.fk_lender_id)
this.lenderBranchList = x[0]['branches'];
this.lenderShortName = x[0]['short_name'] ;
this.filterProductAbbr(x[0]['short_name'],1);
}
}
}
//, error => this.errorMessage = <any> error);
, error => {
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
});
}
selectedLender(lender){
// alert(JSON.stringify(lender['branches ']));
this.lenderBranchList = lender['branches'];
this.lenderShortName = lender['short_name'];
this.filterProductAbbr(lender['short_name'],2);
this._EditPDtriggerForm.controls.pd_branch_id.setValue(null);
}
filterProductAbbr(param,flag){
if(param == 'CLIX'){
// console.log(this.productAllList);
let getProductAbbr = this.productAllList.map(dval => dval.product_abbr);
// console.log('getProductAbbr',getProductAbbr);
let ClixProductAbbr = ['BL','LAEP'];
// console.log(ClixProductAbbr);
let FilteredAbbr: any = [];
FilteredAbbr = ClixProductAbbr.map(x => {
let findIndex = getProductAbbr.indexOf(x);
return this.productAllList[findIndex];
});
// console.log('FilteredAbbr',FilteredAbbr);
this.productList = FilteredAbbr.length > 0 ? FilteredAbbr : this.productAllList;
// this.productList = this.productAllList;
}
else{
this.productList = this.productAllList;
}
if(flag != 1){
this._EditPDtriggerForm.controls['fk_product_id'].setValue('');
this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue('');
this._EditPDtriggerForm.controls['fk_pd_type'].setValue('');
this._EditPDtriggerForm.controls['fk_customer_segment'].setValue('');
this._EditPDtriggerForm.controls['loan_amount'].setValue('');
}
}
getCustomerSegmentList(){
this._pd.getCustomersDetails().subscribe(
data => {
if (data.status == 200) {
this.customerSegmentAllList=data.records
}
}, error => this.errorMessage = <any> error);
}
getProductsList(){
this._pd.getProductsDetails().subscribe(
data => {
if (data.status == 200) {
// this.productList=data.records
this.productAllList = data.records
if(this.data.records.fk_product_id){
this.getSubproductList(this.data.records.fk_product_id,1);
}
}
}, error => this.errorMessage = <any> error);
}
// getStateCityList(){
// this._pd.getStateCityDetails().subscribe(
// data => {
// if (data.status == 200) {
// this.stateList=data.records
// if(this.data.records.fk_state){
// this.getCityList(this.data.records.fk_state);
// }
// }
// }, error => this.errorMessage = <any> error);
// }
getStateCityList(){
this._pd.getAllMasterDatas('STATE').subscribe(
data => {
if (data.status == 200) {
this.stateList = data.records.filter(item => item.isactive == 1);
}
});
}
getPDTypeList(){
this._pd.getPDTypeDetails().subscribe(
data => {
if (data.status == 200) {
this.pdTypeList=data.records.pd_type;
}
}, error => this.errorMessage = <any> error);
}
loadFormData() {
let stdcode;
let landline;
if(this.data.records.pd_contact_landline){
if(this.data.records.pd_contact_landline != null){
let stdcodesearch = this.data.records.pd_contact_landline.search("-");
stdcode = this.data.records.pd_contact_landline.substr(0,stdcodesearch);
landline = this.data.records.pd_contact_landline.substr(+stdcodesearch + 1,8);
}
else{
stdcode = '';
landline = '';
}
}
// let getpincodeid = this.data.records.pincode != '' ? this.data.records.pincode != null ? (this.pincodeList.filter(data => data.pincode == this.data.records.pincode).pincode_id)
// : this.data.records.pincode
// : this.data.records.pincode;
this._EditPDtriggerForm = this._fb.group({
pd_id: [this.data.records.pd_id],
fk_lender_id: [this.data.records.fk_lender_id, Validators.compose([Validators.required])],
lender_applicant_id: [this.data.records.lender_applicant_id, Validators.compose([Validators.required])],
pd_branch_id:[this.data.records.pd_branch_id, Validators.compose([Validators.required])],
pd_contact_person: [this.data.records.pd_contact_person, Validators.compose([Validators.required])],
pd_contact_mobileno: [this.data.records.pd_contact_mobileno, Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
lender_stdcode: [stdcode, Validators.compose([Validators.minLength(3),Validators.maxLength(5)])],
lender_landline: [landline,Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
fk_product_id: [this.data.records.fk_product_id],
fk_subproduct_id: [this.data.records.fk_subproduct_id],
fk_pd_type: [this.data.records.fk_pd_type],
fk_customer_segment: [this.data.records.fk_customer_segment],
loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])],
addresses: this._fb.array([]),
//   addressline1: [this.data.records.addressline1.toUpperCase()],
// fk_city: [this.data.records.fk_city],
// fk_state: [this.data.records.fk_state],
//   pincode : [this.data.records.pincode_id],
// other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
remarks: [this.data.records.remarks],
});
const addressesArray = this._EditPDtriggerForm.get('addresses') as FormArray;
this._pd.getAddressesDetails(this.pdid).subscribe(
data => {
if (data.status == 200) {
this.addressesList = data.records.filter(item => item.isactive == 1);
if (this.addressesList.length > 0) {
this.addressesList.forEach((val,index)=>{
this.addressesDeactivited[index] = true;
let obj = {
pd_address_id:val.pd_address_id,
addressline1: !val.addressline1 ? null : this.titleCase.transform(val.addressline1),
fk_city: val.fk_city,
fk_state: val.fk_state,
  pincode: val.pincode_id,
other_pincode:val.other_pincode,
isactive:1,
}
this.getCityList(val.fk_state,index);
this.getPincode(val.pincode_id,index);
this.addressesDeactivited[this.addressesList.length] = true;
addressesArray.push(this.createAddresses(obj));
});
}
else{
this.addressesDeactivited[0] = true;
addressesArray.push(this.createAddresses(null));
}
}
else{
this.addressesDeactivited[0] = true;
addressesArray.push(this.createAddresses(null));
}
});
}
get pdMain() { return this._EditPDtriggerForm.controls; }
//get sub product list based on prokduct id
getSubproductList(productID:string,flag:number){
// console.log('productID',productID);
this.customerSegmentList=this.customerSegmentAllList;
if (productID !== undefined && productID !== null && productID !== '') {
this.productShortName = this.productAllList.filter(item => item.product_id == productID)[0].product_abbr;
this.subProductList=this.productAllList.filter(item => item.product_id == productID);
this.subProductList=this.subProductList[0].subproducts;
}
else {
this.productShortName = '';
this.subProductList=[];
}
// console.log('this.productAbbr',this.productShortName);
switch (this.productShortName) {
case 'BL':
// console.log(1);
this.customerSegmentList = this.customerSegmentAllList.filter(s => (s.customer_segment).includes('Self'));
if(this.lenderShortName == 'CLIX' && flag==2 ){ this._EditPDtriggerForm.controls['fk_customer_segment'].setValue('5'); }
this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue(null);
this.subProductList=[];
this.isSubproductShown = false;
break;
case 'LAEP':
// console.log(2);
this.customerSegmentList = this.customerSegmentAllList.filter(s => (s.customer_segment).includes('Self'));
this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue(null);
if(this.lenderShortName == 'CLIX' && flag==2 ){ this._EditPDtriggerForm.controls['fk_customer_segment'].setValue('5'); }
this.subProductList=[];
this.isSubproductShown = false;
break;
default:
// console.log(3);
this.customerSegmentList = this.customerSegmentAllList;
// console.log('productID', productID);
this.isSubproductShown = true;
break;
}
}
// //get city list details based on state id
// getCityList(stateID:string){
// this.cityList= this.stateList.filter(item => item.state_id == stateID);
// this.cityList=this.cityList[0].cities;
// }
//get city list details based on state id
getCityList(stateID:string,i){
this._pd.getStateWiseCities(stateID).subscribe(data=>{
if (data.status == 200) {
this.cityList[i] = data.records.cities;
this.pincodeList[i] = data.records.pincode;
}
});
}
get pdAddresses() { return this._EditPDtriggerForm.get('addresses') as FormArray; }
createAddresses(data): FormGroup {
if(data == null){
return this._fb.group({
fk_pd_id:[this.pdid],
pd_address_id:[null],
addressline1: [null],
fk_city: [null],
fk_state: [null],
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
isactive:[1],
});
}
else{
return this._fb.group({
fk_pd_id:[this.pdid],
pd_address_id:[data.pd_address_id],
  addressline1: [data.addressline1 != null ? this.titleCase.transform(data.addressline1) : null],
fk_city: [data.fk_city],
fk_state: [data.fk_state],
  pincode : [data.pincode],
other_pincode:[data.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
isactive:[data.isactive],
});
}
};
addAddresses(index) {
this.addresses = this._EditPDtriggerForm.get('addresses') as FormArray;
this.addresses.push(this.createAddresses(null));
}
removeAddresses(index: number,strflag : any) {
const address_control = <FormArray>this._EditPDtriggerForm.controls['addresses'];
if(strflag == 'Deactivited'){
address_control.controls[index]['controls'].isactive.setValue(0);
this.addressesDeactivited[index] = false;
}
else if(strflag == 'Activited'){
address_control.controls[index]['controls'].isactive.setValue(1);
this.addressesDeactivited[index] = true;
}
// address_control.controls[index]['controls'].showHide();
// isactive.setValue(0);
// this.showHide = true;
// var div = document.getElementById('newpost');
// if (div.style.display !== 'none') {
// div.style.display = 'none';
// }
// else {
// div.style.display = 'block';
// }
// address_control.controls[index].disable();
// address_control.removeAt(index);
}
getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;}
// save pd in draft
saveDraftPD(formValue: any, status:string){
this.clearCustomValidatorFields();
this.submitPdDetails(formValue, status);
}
triggerPD(formValue: any, status:any){
// console.log('functionclicked',formValue, status);
// this._EditPDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_product_id'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_subproduct_id'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_pd_type'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_customer_segment'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['loan_amount'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['addressline1'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_city'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_state'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['pincode'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity();
// if(this.applicantLength==0){
// this.notifier.notify('error', 'Please add applicants.!');
// }
setTimeout(() => {
this.clearCustomValidatorFields();
}, 10000);
this.submitPdDetails(formValue, status);
}
// this is for clear custom validator required fields
clearCustomValidatorFields(){
this._EditPDtriggerForm.controls['fk_lender_id'].clearValidators();
this._EditPDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_product_id'].clearValidators();
this._EditPDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_subproduct_id'].clearValidators();
this._EditPDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_pd_type'].clearValidators();
this._EditPDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_customer_segment'].clearValidators();
this._EditPDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
this._EditPDtriggerForm.controls['loan_amount'].clearValidators();
this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['addressline1'].clearValidators();
// this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_city'].clearValidators();
// this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_state'].clearValidators();
// this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['pincode'].clearValidators();
// this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity();
this.validateAllFormFields(this._EditPDtriggerForm);
}
submitPdDetails(formValue: any, status:any) {
// let updateStatus = this.currentPDStatus == this.pdStatusCheck.DRAFT ? status : this.currentPDStatus == this.pdStatusCheck.TRIGGERED ? status : this.currentPDStatus;
let updateStatus = this.currentPDStatus;
if(status != 1){
if(this._EditPDtriggerForm.invalid) {
this.validateAllFormFields(this._EditPDtriggerForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
}
if(this.lenderShortName == 'CLIX'){
const control = <FormArray>this._EditPDtriggerForm.controls['addresses'];
let CtrlLength = control.controls.length;
if (CtrlLength > 0) {
let cnt = 0;
while (cnt < CtrlLength) {
let ChildCtrl: any = control.controls[cnt]
ChildCtrl.controls['addressline1'].setValidators([Validators.required]);
ChildCtrl.controls['addressline1'].updateValueAndValidity();
cnt++;
}
this._EditPDtriggerForm.controls['fk_product_id'].setValidators([Validators.required]);
this._EditPDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
this._EditPDtriggerForm.controls['pd_branch_id'].setValidators([Validators.required]);
this._EditPDtriggerForm.controls['pd_branch_id'].updateValueAndValidity();
this._EditPDtriggerForm.controls['pd_contact_person'].setValidators([Validators.required]);
this._EditPDtriggerForm.controls['pd_contact_person'].updateValueAndValidity();
this._EditPDtriggerForm.controls['pd_contact_mobileno'].setValidators([Validators.required]);
this._EditPDtriggerForm.controls['pd_contact_mobileno'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_pd_type'].clearValidators();
this._EditPDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_customer_segment'].clearValidators();
this._EditPDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
this._EditPDtriggerForm.controls['loan_amount'].clearValidators();
this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity();
if(this._EditPDtriggerForm.invalid) {
this.validateAllFormFields(this._EditPDtriggerForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
}
}
let my_array = this._EditPDtriggerForm.value;
let concat_landline
if(my_array.lender_stdcode != null && my_array.lender_landline != null){
if(my_array.lender_stdcode == '' && my_array.lender_landline == ''){
concat_landline = null;
}else{
let std = my_array.lender_stdcode == '' ? '' : my_array.lender_stdcode;
let landline = my_array.lender_landline == '' ? '' : my_array.lender_landline;
concat_landline = std+'-'+landline;
}
}else if(my_array.lender_stdcode == '' && my_array.lender_landerline == ''){
concat_landline = null;
}else{
concat_landline = null;
}
if((my_array.pd_contact_mobileno == '' || my_array.pd_contact_mobileno == null) && (concat_landline == '' || concat_landline == null )){
this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
return;
}
else{
let filteredAddressesdata = my_array.addresses.filter(item => item.isactive == 1);
let lenderMasterArray = {
"pd_id": my_array.pd_id,
"fk_lender_id": my_array.fk_lender_id,
"lender_applicant_id": my_array.lender_applicant_id,
"pd_branch_id":my_array.pd_branch_id,
"pd_contact_person": my_array.pd_contact_person,
"pd_contact_mobileno": my_array.pd_contact_mobileno,
"pd_contact_landline": concat_landline,
"fk_product_id": my_array.fk_product_id,
"fk_subproduct_id": my_array.fk_product_id != '4' ? my_array.fk_subproduct_id : null,
"fk_pd_type": my_array.fk_pd_type,
"fk_customer_segment": my_array.fk_customer_segment,
"loan_amount": my_array.loan_amount,
  "addressline1": filteredAddressesdata[0].addressline1 != null ? this.titleCase.transform(filteredAddressesdata[0].addressline1) : null,
"fk_city": filteredAddressesdata[0].fk_city,
"fk_state": filteredAddressesdata[0].fk_state,
  "pincode": filteredAddressesdata[0].pincode,
"other_pincode":filteredAddressesdata[0].other_pincode,
"remarks": my_array.remarks,
}
this.disableAfterSubmit = true;
this._pd.editPdMasterDetails(lenderMasterArray, updateStatus).subscribe(result => {
if (result.status == 200) {
this.disableAfterSubmit = false;
this._pd.updatePDAddress(my_array.addresses).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Details Updated.');
this.dialogRef.close();
}
else {
this.notifier.notify('success', 'PD Details Updated.');
this.notifier.notify('warning', 'Something Wents 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');
});
}
else {
this.disableAfterSubmit = false;
this.notifier.notify('warning', 'Something Wents 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');
});//error closed
}//else closed
}
/** To Reset Popup Data */
onReset() {
this.disableAfterSubmit = false;
this.loadFormData();
}
/** For Popup Close Button */
closeEditMasterComponent(): void {
this.dialogRef.close();
}
// validate all form group and form array fields
validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
control.markAsTouched({ onlySelf: true });
} else if (control instanceof FormGroup) {
this.validateAllFormFields(control);
} else if (control instanceof FormArray) {
this.validateAllFormFields(control);
}
});
}
}

View File

@ -0,0 +1,41 @@
<form [formGroup]="additionalPDForm" novalidate>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
{{pageTitle}}
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button mat-dialog-close class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content>
<mat-form-field style="width:80%" appearance="outline">
<mat-label>Customer Segment</mat-label>
<mat-select placeholder="" formControlName="fk_customer_segment" required>
<mat-option *ngFor="let segment of customerSegmentList" [value]="segment.customer_segment_id">
{{segment.abbr}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:38%" appearance="outline">
<mat-label>Applicant</mat-label>
<mat-select placeholder="" formControlName="pd_co_applicant_id" required (selectionChange)="toGetMobileNo($event.value)">
<mat-option *ngFor="let appt of applicantList" [value]="appt.pd_co_applicant_id">
{{appt.applicant_name | titlecase}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:38%" appearance="outline">
<mat-label>Applicant Mobile Number</mat-label>
<input matInput placeholder="" formControlName="mobile_no" type="text" maxlength="10" ForMobileNumbers required>
</mat-form-field>
</mat-dialog-content>
<mat-dialog-actions>
<div fxFlex="80" align="left">
<p style="color: #e00201">Note : Changes once made can't be revoked. Are you sure of the Customer Segment?</p>
</div>
<div fxFlex="20" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(additionalPDForm.value)"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>
<notifier-container></notifier-container>

View File

@ -0,0 +1,7 @@
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
}
mat-form-field {
margin: 0 2%;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InitiateAdditionalPdComponent } from './initiate-additional-pd.component';
describe('InitiateAdditionalPdComponent', () => {
let component: InitiateAdditionalPdComponent;
let fixture: ComponentFixture<InitiateAdditionalPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InitiateAdditionalPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InitiateAdditionalPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,116 @@
import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
import { PdTrigerService } from './../../../pd-service/pd-triger.service';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-initiate-additional-pd',
templateUrl: './initiate-additional-pd.component.html',
styleUrls: ['./initiate-additional-pd.component.scss']
})
export class InitiateAdditionalPdComponent implements OnInit {
pageTitle: string;
private notifier: NotifierService;
additionalPDForm:FormGroup;
customerSegmentList: any=[];
applicantList: any =[];
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<InitiateAdditionalPdComponent>) {
this.notifier = notifier;
this.pageTitle="Choose customer segment For this PD address"
this.applicantList = this.data.applicants_details;
this.applicantList = this.applicantList.filter(appt => appt.applicant_type != 2 && appt.applicant_type != 3);
}
ngOnInit() {
this.initForm();
this._pd.getCustomersDetails().subscribe(
data => {
if (data.status == 200) {
this.customerSegmentList = data.records
}
});
this.data.type===false ? this.additionalPDForm.controls['fk_customer_segment'].disable():this.additionalPDForm.controls['fk_customer_segment'].enable();
if(this.data.applicant_id){
this.additionalPDForm.controls['pd_co_applicant_id'].setValue(this.data.applicant_id);
this.toGetMobileNo(this.data.applicant_id);
// this.additionalPDForm.controls['pd_co_applicant_id'].disable();
}
// else { this.additionalPDForm.controls['pd_co_applicant_id'].enable(); }
}
initForm(){
return this.additionalPDForm = this._fb.group({
pd_id:[this.data.type===false ? this.data.pd_id : ''],
parent_pd_id: [this.data.type===true ? this.data.pd_id : ''],
fk_customer_segment: [this.data.type===false ? this.data.fk_customer_segment :'',Validators.required],
pd_co_applicant_id:[this.data.type===false ? '' : '',Validators.required],
mobile_no:[this.data.type===false ? '' : '',Validators.required],
fk_address_id:[this.data.pd_address_id,Validators.required],
pd_status:[this.data.pd_status,Validators.required],
});
}
/** To Get City And Pincode Data For Address Form
* Param 'stateID' -> selected StateId
*/
toGetMobileNo(applicantID) {
let mobile = this.applicantList.filter(val=>val.pd_co_applicant_id == applicantID).map(val=>val.mobile_no)[0]
if(mobile != '' && mobile != null){
this.additionalPDForm.controls['mobile_no'].setValue(mobile);
}
else{
this.additionalPDForm.controls['mobile_no'].setValue('');
}
}
// save details
submitDetails(values: any) {
if (this.additionalPDForm.invalid) {
this.validateAllFormFields(this.additionalPDForm);
this.notifier.notify('warning',"Please Check All Manatory Fields..");
return;
}
let update_details: any;
if(this.data.type){
update_details= {"pd_id":values.pd_id,
"parent_pd_id":values.parent_pd_id,
"fk_customer_segment":values.fk_customer_segment ,
"fk_address_id":values.fk_address_id,
"pd_status":"TRIGGERED",
"pd_co_applicant_id":values.pd_co_applicant_id,
"mobile_no":values.mobile_no};
}
else{
update_details={"pd_id":values.pd_id,
"pd_status":"TRIGGERED",
"parent_pd_id":values.parent_pd_id,
"fk_customer_segment":values.fk_customer_segment ,
"fk_primary_address_id":values.fk_address_id};
}
this._pd.initiateAddressPdProcess(update_details).subscribe(data => {
this.notifier.notify('success', 'Saved Successfully.');
setTimeout(() =>{
this.dialogRef.close({update_status:true});
},3000);
}, error => {
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
// alert(error);
});
}
// validate all form group and form array fields
validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
control.markAsTouched({ onlySelf: true });
} else if (control instanceof FormGroup) {
this.validateAllFormFields(control);
} else if (control instanceof FormArray) {
this.validateAllFormFields(control);
}
});
}
}

View File

@ -0,0 +1,122 @@
<mat-card-content>
<mat-expansion-panel [(expanded)]="xpandStatus">
<mat-expansion-panel-header >
<mat-panel-title class="text-xs-left">
<!-- <h6 class="mt-0"><mat-icon>filter_list</mat-icon> Filter</h6> -->
<mat-toolbar-row>
<mat-icon>filter_list</mat-icon>
<span class="toolbar-space"></span>
<span>Advance Filter</span>
</mat-toolbar-row>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-list class="m-gap p-gap">
<div [formGroup]="searchForm">
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_type" placeholder="PD Type">
<mat-option *ngFor="let type of PDType" [value]="type.pd_type_id">{{type.type_name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<!-- <mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_status" placeholder="PD Status">
<mat-option *ngFor="let status of pdStatus" [value]="status.pd_status_name">{{status.pd_status_name}}</mat-option>
</mat-select>
</mat-form-field> -->
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker" [max]="todaydate" (blur)="checkDate($event)" formControlName="pd_from_date" placeholder="Choose a From date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value" formControlName="pd_to_date" placeholder="Choose a todate">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_products" placeholder="Products">
<mat-option *ngFor="let pro of PRODUCTS" [value]="pro.product_id">{{pro.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_city" placeholder="City">
<mat-option *ngFor="let city of CITY" [value]="city.city_id">{{city.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_lender" placeholder="Lender Name">
<mat-option *ngFor="let ent of ENTITY" [value]="ent.entity_id">{{ent.full_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_name" placeholder="Applicant Name">
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
</mat-form-field>
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
matTooltip="Reset" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary">
<mat-icon>settings_backup_restore</mat-icon>
</button>
<button type="button" mat-raised-button mat-icon-button (click)="searchItem()"
matTooltip="Search" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>search</mat-icon>
</button>
</div>
</div>
</mat-list>
</mat-expansion-panel>
<br/>
<mat-table [dataSource]="dataSourceTab2" matSort *ngIf="progressPdListData.length > 0" >
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="10" fxFlex.lg="10" fxFlex.xl="10" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold'}" mat-line>{{details.pd_id}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<!-- <span *ngIf="details.applicant_name" mat-line><b>{{details.applicant_name}}</b></span><br> -->
<span *ngIf="details.is_child" mat-line>
<b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b>
</span><br>
<span class="fontsize"> {{details.lender_applicant_id}}</span> <span class="fontsize" *ngIf="details.customer_segment_abbr">-({{details.customer_segment_abbr}} )</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Lenderid">
<mat-cell class="cell" *matCellDef="let details">
<span *ngIf="details.lender_short_name" mat-line> {{details.lender_short_name}} </span><br>
<span *ngIf="details.product_abbr" mat-line class="fontsize"> {{details.product_abbr}}<span *ngIf="details.subproduct_abbr">/{{details.subproduct_abbr}}</span></span> <br>
<span *ngIf="details.loan_amount" class="fontsize"><i class="fa-1x fa fa-rupee"></i> {{details.loan_amount}}</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Address">
<mat-cell class="cell" *matCellDef="let details;">
<span matTooltip="Initiated Date" matTooltipPosition="above">{{details.pd_date_of_initiation}}</span><br>
<span class="fontsize" *ngIf="details.city_name"> <i class="fa-1x fa fa-map-marker"> </i> {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }} </span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Status">
<mat-cell class="cell center" *matCellDef="let details;">
<span> {{details.pd_status}}</span><br>
<span class="fontsize" [matTooltip]="details.pd_status | titlecase" matTooltipPosition="above">{{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }}
</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Action">
<mat-cell class="cell center" *matCellDef="let details;">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id)" matTooltip="View" matTooltipPosition="above" color="primary"><mat-icon>visibility</mat-icon></button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
</mat-card-content>
<mat-paginator *ngIf="!recordStatus" #paginator class="mat-elevation-z1" [length]="progressPdListData.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>

View File

@ -0,0 +1,19 @@
.ic-change:hover {
transform: scale(1.1);
color: green;
}
.cell{
display:inline !important;
}
.cellhide{
display: none !important;
}
.center{
text-align:center;
}
.fontsize{
font-size:14px;
}
.toolbar-space {
flex: 0.01 0 auto;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StatesDialogComponent } from './states-dialog.component';
import { InprogressPdComponent } from './inprogress-pd.component';
describe('StatesDialogComponent', () => {
let component: StatesDialogComponent;
let fixture: ComponentFixture<StatesDialogComponent>;
describe('InprogressPdComponent', () => {
let component: InprogressPdComponent;
let fixture: ComponentFixture<InprogressPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ StatesDialogComponent ]
declarations: [ InprogressPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(StatesDialogComponent);
fixture = TestBed.createComponent(InprogressPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,224 @@
import { Component,ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter, OnDestroy, AfterViewInit, OnChanges, SimpleChanges } from '@angular/core';
import { PdTrigerService } from './../../../pd-service/pd-triger.service';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { FormBuilder, FormGroup } from '@angular/forms';
import { DatePipe } from '@angular/common';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-inprogress-pd',
templateUrl: './inprogress-pd.component.html',
styleUrls: ['./inprogress-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class InprogressPdComponent implements OnInit, OnChanges {
xpandStatus: boolean = false;
PRODUCTS: any[]=[];
ENTITY: any[]=[];
CITY: any[]=[];
PDType: any[]=[];
pdStatus: any[]=[];
recordStatus: boolean;
errorMessage:any[]=[];
tabStatus:string="INPROGRESS";
pipe = new DatePipe('en-US');
todaydate:Date = new Date();
private notifier: NotifierService;
public dataLengthTab2: number;
public dataSourceTab2 = new MatTableDataSource();
displayedColumns = ['PDType','Name','Lenderid','Address','Status','Action'];
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@Input() bindFilterValue: string;
@Output() loadPdView = new EventEmitter<string>();
// data source variable details
progressPdListData:any[] = [];
// pagination variable details
length = 5;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
searchForm:FormGroup;
constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService) {
this.notifier = notifier;
this.searchForm = this._fb.group(
{
pd_type:[null],
pd_status:['INPROGRESS'],
pd_from_date:[null],
pd_to_date:[null],
pd_city:[null],
pd_products:[null],
pd_lender:[null],
pd_name:[null],
pd_applicant_id:[null],
});
this.getcommonDropDown();
}
ngOnInit() {
this.recordStatus=false;
// this.loadPDDetails();
// this.getcommonDropDown();
}
// get changes for filter from parent componnet filter
ngOnChanges(changes: SimpleChanges) {
// let filteredText = changes.bindFilterValue.currentValue;
// filteredText = filteredText ? filteredText.trim() : filteredText;
let filteredText = changes.bindFilterValue.currentValue ? changes.bindFilterValue.currentValue.trim() : changes.bindFilterValue.currentValue;
filteredText = filteredText ? filteredText.toLowerCase() : filteredText;
this.dataSourceTab2.filter = filteredText;
}
// load inprogress pd list
loadPDDetails() {
this._pd.getTabStatusPdDetails(this.tabStatus)
.subscribe(
data => {
if (data.status == 200) {
this.progressPdListData = data.records;
this.dataLengthTab2 = data.records.length;
this.dataSourceTab2.data = this.progressPdListData;
}else{
this.progressPdListData =[];
this.dataSourceTab2 = null;
this.recordStatus=true;
}
},error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
pageChange(e) {
console.log(e);
}
viewPD(pdid:string){
this.loadPdView.next(pdid);
}
titleCaseWord(word:string) {
if (!word) return word;
return word[0].toUpperCase() + word.substr(1).toLowerCase();
}
/**
* Common Search
* sriram
*/
getcommonDropDown() : void
{
this._pd.getAllMasterDatas('PDSTATUS').subscribe(res=>
{
if(res.dataStatus==true)
{
this.pdStatus = res.records.filter(status=>status.isactive==1 && status.pd_status_name == this.tabStatus);
}
// this.searchForm.controls['pd_status'].setValue(this.pdStatus[0]);
});
this._pd.getAllMasterDatas('PDTYPE').subscribe(res=>
{
if(res.dataStatus==true)
{
this.PDType = res.records.filter(type=>type.isactive==1);
}
});
// this._pd.getAllMasterDatas('CITY').subscribe(res=>
// {
// if(res.dataStatus==true)
// {
// this.CITY = res.records.filter(city=>city.isactive==1);
// }
// });
this._pd.getListOfCities().subscribe(res=>
{
if(res.dataStatus==true)
{
this.CITY = res.records;
}
});
this._pd.getAllMasterDatas('ENTITY').subscribe(res=>
{
if(res.dataStatus==true)
{
this.ENTITY = res.records.filter(ent=>ent.isactive==1);
}
});
this._pd.getAllMasterDatas('PRODUCTS').subscribe(res=>
{
if(res.dataStatus==true)
{
this.PRODUCTS = res.records.filter(pro=>pro.isactive==1);
}
});
}
checkDate(e)
{
console.log(e);
}
searchItem()
{
if(this.searchForm.value.pd_type !=null)
{
}else
{
this.searchForm.value.pd_type = [];
}
if(this.searchForm.value.pd_status !=null)
{
}else
{
this.searchForm.value.pd_status = [];
}
this.searchForm.value.pd_from_date = this.pipe.transform(this.searchForm.value.pd_from_date,'yyyy-MM-dd');
this.searchForm.value.pd_to_date = this.pipe.transform(this.searchForm.value.pd_to_date,'yyyy-MM-dd');
this._pd.overAllSearchFormDetails(this.searchForm.value).subscribe(res=>
{
this.xpandStatus = false;
if(res['dataStatus']==true)
{
this.dataSourceTab2 = res['records'];
this.dataSourceTab2.paginator = this.paginator;
}else{
this.notifier.notify('warning', 'No Records Found !');
this.dataSourceTab2.paginator['length'] = 0;
this.dataSourceTab2.paginator['pageIndex'] = 0;
this.dataSourceTab2.data = [];
}
},error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
onReset(){
this.searchForm.reset();
this.loadPDDetails();
this.xpandStatus = false;
}
ngAfterViewInit() {
this.dataSourceTab2.paginator = this.paginator;
this.dataSourceTab2.sort = this.sort;
}
}

View File

@ -0,0 +1,50 @@
<mat-card>
<mat-card-content [style.display]="viewPdList ? 'block' : 'none'">
<div fxLayout="row">
<div fxFlex="50" class="pb-0 text-sm-left">
<mat-form-field dividerColor="primary" style="width: 50%;">
<input matInput [(ngModel)]="filterValue" placeholder="Filter">
</mat-form-field>
</div>
<div fxFlex="50" class="pb-0 text-sm-right">
<button mat-fab (click)="viewMapPdDetails()" class="mr-1 mb-1 hover-icon" matTooltip="Map view" matTooltipPosition="above"><mat-icon>map</mat-icon></button>
<span *ngIf="userRoleID == 10 || userRoleID == 3"><button mat-fab (click)="addPdDetails()" class="mr-1 mb-1 hover-icon" matTooltip="Add PD" matTooltipPosition="above" *ngIf="roleAccessDetails.trigger"><mat-icon>add</mat-icon></button></span>
</div>
</div>
<mat-card>
<mat-tab-group (selectedTabChange)="onTabClick($event)">
<mat-tab>
<ng-template mat-tab-label><mat-icon>select_all</mat-icon>&nbsp;All</ng-template>
<app-all-pd [bindFilterValue]="filterValue" (loadPdView)="viewPDDetails($event)"></app-all-pd>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label><mat-icon>schedule</mat-icon>&nbsp;Scheduled </ng-template>
<app-scheduled-pd [bindFilterValue]="filterValue" (loadPdView)="viewPDDetails($event)"></app-scheduled-pd>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label><mat-icon>hdr_strong</mat-icon> &nbsp;In Progress </ng-template>
<app-inprogress-pd [bindFilterValue]="filterValue" (loadPdView)="viewPDDetails($event)"></app-inprogress-pd>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label><mat-icon>done</mat-icon> &nbsp;Completed </ng-template>
<app-completed-pd [bindFilterValue]="filterValue" (loadPdView)="viewPDDetails($event)"></app-completed-pd>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label><mat-icon>done_all</mat-icon>&nbsp;QC Completed </ng-template>
<app-qc-completed-pd [bindFilterValue]="filterValue" (loadPdView)="viewPDDetails($event)"></app-qc-completed-pd>
</mat-tab>
</mat-tab-group>
</mat-card>
</mat-card-content>
</mat-card>
<notifier-container></notifier-container>
<router-outlet></router-outlet>

View File

@ -0,0 +1,27 @@
.ic-change:hover {
transform: scale(1.1);
color: green;
}
.cell{
display:inline !important;
}
.cellhide{
display: none !important;
}
.center{
text-align:center;
}
.fontsize{
font-size:14px;
}
.mat-ink-bar{
background-color:#e00201;
}
.mat-tab-label-active{
color: #e00201 !important;
}
.mat-fab.mat-accent{
color:#e00201 !important;
background-color: #fff !important;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RegisterComponent } from './register.component';
import { ListPdComponent } from './list-pd.component';
describe('RegisterComponent', () => {
let component: RegisterComponent;
let fixture: ComponentFixture<RegisterComponent>;
describe('ListPdComponent', () => {
let component: ListPdComponent;
let fixture: ComponentFixture<ListPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RegisterComponent ]
declarations: [ ListPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RegisterComponent);
fixture = TestBed.createComponent(ListPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,96 @@
import { Component,ViewChild, OnInit, ViewEncapsulation, OnDestroy, OnChanges } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../pd-service/pd-triger.service';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent, MatTabChangeEvent } from '@angular/material';
import { AllPdComponent } from './all-pd/all-pd.component';
import { InprogressPdComponent } from './inprogress-pd/inprogress-pd.component';
import { ScheduledPdComponent } from './scheduled-pd/scheduled-pd.component';
import { CompletedPdComponent } from './completed-pd/completed-pd.component';
import { QcCompletedPdComponent } from './qc-completed-pd/qc-completed-pd.component';
@Component({
selector: 'app-list-pd',
templateUrl: './list-pd.component.html',
styleUrls: ['./list-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ListPdComponent implements OnInit, OnDestroy {
public filterValue: string;
private notifier: NotifierService;
recordStatus: boolean;
noRecordFound:boolean;
viewPdList:boolean;
viewMapPdList:boolean;
errorMessage: any;
public allTab:boolean;
public inprogressTab:boolean = false;
public scheduledTab:boolean = false;
public completedTab:boolean = false;
public getTabIndex:number=0;
@ViewChild(AllPdComponent) allTabC:AllPdComponent;
@ViewChild(InprogressPdComponent) inprogressTabC: InprogressPdComponent;
@ViewChild(ScheduledPdComponent) scheduledTabC:ScheduledPdComponent;
@ViewChild(CompletedPdComponent) completedTabC: CompletedPdComponent;
@ViewChild(QcCompletedPdComponent) qcCompletedTabC: QcCompletedPdComponent;
// roles checks for enables events
roleAccessDetails:any
public userRoleID = +localStorage.getItem('user_role') ;
constructor( notifier: NotifierService, private route: ActivatedRoute,
private router: Router, private _pd: PdTrigerService) {
this.notifier = notifier;
this.roleAccessDetails=this._pd.getRoleAccessDetails();
}
ngOnInit() {
this.viewPdList = true;
this.recordStatus=false;
this.allTab=true;
}
// after view call all tabs component
ngAfterViewInit() {
this.allTabC.loadPDDetails();
}
// view pd list in map view
viewMapPdDetails(){
this.viewPdList = !this.viewPdList;
this.router.navigate([ '../pdlist/pdmaplist'], { relativeTo: this.route });
}
// add pd
addPdDetails() {
this.viewPdList = !this.viewPdList;
this.router.navigate([ '../pdlist/addpd'], { relativeTo: this.route });
}
showListView(status: boolean){
this.viewPdList = status;
}
pdListLoad(status: boolean){
this.viewPdList = status;
this.getTabIndex==0 ? this.allTabC.loadPDDetails() : this.getTabIndex==1 ? this.scheduledTabC.loadPDDetails() : this.getTabIndex==2 ? this.inprogressTabC.loadPDDetails() : this.getTabIndex==3 ? this.completedTabC.loadPDDetails() : this.qcCompletedTabC.loadPDDetails();
}
viewPDDetails(pdid:string){
this.viewPdList = !this.viewPdList;
this.router.navigate([ '../pdlist/viewpd',pdid], { relativeTo: this.route });
}
//get tab changes
onTabClick(event: MatTabChangeEvent) {
this.getTabIndex=event.index;
this.getTabIndex==0 ? this.allTabC.loadPDDetails() : this.getTabIndex==1 ? this.scheduledTabC.loadPDDetails() : this.getTabIndex==2 ? this.inprogressTabC.loadPDDetails() : this.getTabIndex==3 ? this.completedTabC.loadPDDetails() : this.qcCompletedTabC.loadPDDetails();
}
ngOnDestroy(): void {
this.viewPdList=false;
}
}

View File

@ -0,0 +1,100 @@
<div fxLayout="row" [style.minHeight]="'100%'">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<div *ngIf="!noRecordFound" class="ml-xs mr-xs" style="width: 95%;">
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 24%;">
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
</mat-form-field>
</div>
<div>
<div style="text-align:right;position:absolute;z-index:2;right:1px">
<button mat-fab class="hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="goList()"><mat-icon>close</mat-icon></button>
</div>
<div fxFlex="row">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<div [style.overflow]="'auto'" [style.height.px]="'500'" *ngIf="pdList.length > 0">
<mat-card>
<!--<mat-card-header style="background-color:#f44336;color:#fff;padding: 20px;">
PD Details
</mat-card-header>-->
<mat-card-content style="max-height:500px;overflow:auto;">
<div>
<input style="border-bottom: 1px solid #dcd9d9;padding-top: 5%;" matInput (keyup)="applyFilter($event.target.value)" placeholder="Search">
</div>
<div *ngFor="let details of dataSource.connect() | async">
<div *ngIf="(details.pd_status=='TRIGGERED' || details.pd_status=='ALLOCATED') && details.fk_pd_type !='3' ">
<mat-card [ngStyle]="{'border-left':'5px solid','border-left-color': getColor(details.fk_pd_type)}">
<mat-card-title *ngIf="details.applicat_details" style="margin-bottom: 0px;">
<div fxLayout="row" fxFlex="100">
<div fxFlex="55">
<span style="font-weight:700">{{details.applicat_details[0].applicant_name}}</span><span style="font-size: 13px;"> ({{details.customer_segment_abbr}})</span> <br>
<span style="font-size: 13px;" >{{details.lender_full_name}} ({{details.lender_applicant_id}})</span><br>
</div>
<div fxFlex="45" style="text-align:right;" *ngIf="details.pd_status!=pdStatusCheck.DRAFT">
<!-- <button mat-raised-button mat-button-sm mat-icon-button class="mr-1 hover-icon" type="button" matTooltip="PD Allocation" matTooltipPosition="above" (click)="pdAllocationTo(details)" *ngIf="roleAccessDetails.allocate"><mat-icon>verified_user</mat-icon></button> -->
<!-- <button mat-raised-button mat-button-sm mat-icon-button class=" hover-icon" type="button" matTooltip="Schedule" matTooltipPosition="above" (click)="scheduleDetails(details)" *ngIf="roleAccessDetails.schedule"><mat-icon>schedule</mat-icon></button> -->
</div>
</div>
</mat-card-title>
<mat-card-content style="padding: 2% 0% 0% 7%;">
<span style="font-size: 13px;" class="hover-icon"><i *ngIf="details.city_name" class="fa-1x fa fa-map-marker">&nbsp;</i>{{details.city_name}}/{{details.state_name}}-{{details.pincode}}</span> <br>
<span style="font-size: 13px;" *ngIf="details.product_abbr">{{details.product_abbr}}/{{details.subproduct_abbr}}</span><br>
<!----<span style="font-size: 13px;"> {{details.customer_segment_abbr}}<span *ngIf="details.loan_amount" style="padding-left: 48%;"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{details.loan_amount}}</span></span><br>-->
<span style="font-size: 13px;">{{details.pd_date_of_initiation}}</span> -
<span style="font-size: 13px;">{{details.pd_status}} <!--- {{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }}--></span>
</mat-card-content>
</mat-card>
</div>
</div>
</mat-card-content>
<mat-list *ngIf="recordStatus">
<mat-list-item>
<p mat-line>No Record Found ...</p>
</mat-list-item>
</mat-list>
</mat-card>
</div>
<!---- <mat-paginator #paginator [length]="pdList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 100]" (page)="pageEvent = $event; pageChange($event)">
</mat-paginator> -->
</div>
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="70" fxFlex.lg="70" fxFlex.xl="70">
<mat-card class="mb-2" *ngIf="pdList.length > 0">
<agm-map [latitude]="lat" [longitude]="lng" #gm>
<agm-marker *ngFor="let getMap of mapDetails" [latitude]="getMap.geometry.location.lat" [longitude]="getMap.geometry.location.lng" (mouseOver)="onMouseOver(infoWindow,gm)">
<agm-info-window [disableAutoPan]="false" #infoWindow>
<div>
<p><strong>{{getMap.applicant_details | titlecase}}</strong></p>
</div>
<div>
<p>{{getMap.lender_details}}</p>
</div>
</agm-info-window>
</agm-marker>
</agm-map>
</mat-card>
</div>
</div><!--End Row-->
<div style="text-align:right;position:absolute;z-index:2;bottom: 0;right: 0;margin-right: 70px;margin-bottom: 65px;">
<span style="width: 30px; height: 10px; background:#009688;color:#009688">II</span> Full &nbsp; <span style="width: 30px; height: 10px; background:#673ab7;color:#673ab7">II</span> Smart
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,45 @@
@import "../../../../../assets/styles/scss/material.variables";
:host {
margin-left: -5px;
margin-right: -5px;
margin-top: -5px;
display: block;
height: 100%;
}
.sebm-google-map-container {
width: 100%;
height: 500px;
display: flex;
}
$mat-toolbar-height-desktop: 64px !default;
$mat-toolbar-height-mobile-portrait: 56px !default;
$mat-toolbar-height-mobile-landscape: 48px !default;
.mat-card-top {
margin-top: -($mat-toolbar-height-desktop);
}
@media ($mat-xsmall) and (orientation: portrait) {
.mat-card-top {
margin-top: -($mat-toolbar-height-mobile-portrait);
}
}
@media ($mat-small) and (orientation: landscape) {
.mat-card-top {
margin-top: -($mat-toolbar-height-mobile-landscape);
}
}
::-webkit-scrollbar {
width: 0px; /* remove scrollbar space */
background: transparent; /* optional: just make scrollbar invisible */
}
/* optional: show position indicator in red */
::-webkit-scrollbar-thumb {
background: #FF0000;
}
::ng-deep .body-container{
padding:0px !important;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TitleListComponent } from './title-list.component';
import { MapPdViewComponent } from './map-pd-view.component';
describe('TitleListComponent', () => {
let component: TitleListComponent;
let fixture: ComponentFixture<TitleListComponent>;
describe('MapPdViewComponent', () => {
let component: MapPdViewComponent;
let fixture: ComponentFixture<MapPdViewComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TitleListComponent ]
declarations: [ MapPdViewComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TitleListComponent);
fixture = TestBed.createComponent(MapPdViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,162 @@
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { ActivatedRoute, Router } from '@angular/router';
import { NotifierService } from 'angular-notifier';
import { MatDialog } from '@angular/material';
import { PdTrigerService } from './../../../pd-service/pd-triger.service';
import { GetGeometricLocationService } from './../../../location-service/get-geometric-location.service';
import { ListPdComponent } from './../list-pd.component';
// import { PdAllocationComponent } from './../pd-allocation/pd-allocation.component';
import { SmartPdAllocationComponent } from './../smart-pd-allocation/smart-pd-allocation.component';
import { TelePdAllocationComponent } from '././../tele-pd-allocation/tele-pd-allocation.component';
// import { SchedulePdComponent } from './../schedule-pd/schedule-pd.component';
@Component({
selector: 'app-map-pd-view',
templateUrl: './map-pd-view.component.html',
styleUrls: ['./map-pd-view.component.scss']
})
export class MapPdViewComponent implements OnInit, OnDestroy {
private notifier:NotifierService;
lat:string
lng:string
mapDetails:any[] = [];
recordStatus: boolean;
noRecordFound: boolean = true;
errorMessage: any;
// pagination variable details
length = 50;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
// data source variable details
pdListData = null;
public dataLength: number;
public dataSource = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
pdList:any[] = [];
// create values for status check
pdStatusCheck :any={
"DRAFT" :'DRAFT',
"TRIGGERED" :'TRIGGERED',
"ALLOCATED" :'ALLOCATED',
"SCHEDULED" :'SCHEDULED',
"INPROGRESS" :'INPROGRESS',
"COMPLETED" :'COMPLETED',
"QC_COMPLETED" :'QC_COMPLETED',
};
// roles checks for enables events
roleAccessDetails:any
public getColor(type: number): string{
return type == 1 ? "#009688" : "#673ab7" ;
}
constructor(notifier:NotifierService,private route: ActivatedRoute,
private router: Router,private _pd: PdTrigerService,private dialog: MatDialog,private _geolocation: GetGeometricLocationService, private ListPdComponent : ListPdComponent) {
this.notifier=notifier;
this.roleAccessDetails=this._pd.getRoleAccessDetails();
}
ngOnInit() {
this.ListPdComponent.showListView(false);
this.recordStatus=false
this.loadPdDetails(this.pdStatusCheck.TRIGGERED,this.pdStatusCheck.ALLOCATED);
}
ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
loadPdDetails(triStatus,allocStatus){
this._pd.getPdMapList(triStatus,allocStatus).subscribe(responseList => {
if(responseList.length>0){
if(responseList[0].dataStatus===true){
let filterValue=responseList[0].records.filter(val=>val.fk_pd_type !='3')
this.pdList= this.pdList.concat.apply(this.pdList, filterValue);
}
if(responseList[1].dataStatus===true){
let filterValue=responseList[1].records.filter(val=>val.fk_pd_type !='3')
this.pdList= this.pdList.concat.apply(this.pdList, filterValue);
}
if(this.pdList.length>0){
this.pdListData = this.pdList;
this.dataLength = this.pdList.length;
this.dataSource.data = this.pdListData;
this.getMapViewLocations(this.pdList);
}
else {
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
}
}
else {
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
}
},error => this.errorMessage = <any> error);
}
getMapViewLocations(getData:any){
getData.forEach(element => {
if(element.addressline1 && element.pincode && element.state_name && element.city_name){
this._geolocation.findLocations(element.addressline1,element.pincode,element.state_name,element.city_name)
.subscribe(response => {
if (response.status == 'OK') {
this.lat = response.results[0].geometry.location.lat;
this.lng = response.results[0].geometry.location.lng;
response.results[0].applicant_details = element.applicant_name + ' ( Id:'+element.pd_id+')';
response.results[0].lender_details = element.lender_short_name + '( Id:'+element.lender_applicant_id+')';
this.mapDetails.push(response.results[0]);
}
// else if (response.status == 'ZERO_RESULTS') {
// console.log('geocodingAPIService', 'ZERO_RESULTS', response.status);
// } else {
// console.log('geocodingAPIService', 'Other error', response.status);
// }
});
}
});
}
pageChange(e) {
console.log(e);
}
// go list view
goList(){
this.ListPdComponent.showListView(true);
this.router.navigate([ '../../' ], { relativeTo: this.route });
}
ngOnDestroy(): void {
this.ListPdComponent.showListView(true);
}
//Global filter
applyFilter(filterValue: string) {
filterValue = filterValue.trim(); // Remove whitespace
filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
this.dataSource.filter = filterValue;
}
// this is for map tooltip open
onMouseOver(infoWindow, gm) {
if (gm.lastOpen != null) {
gm.lastOpen.close();
}
gm.lastOpen = infoWindow;
infoWindow.open();
}
}

View File

@ -0,0 +1,23 @@
<form role="form" [formGroup]="ngForm" accept-charset="UTF-8" novalidate>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
Edit PD Report Details
</div>
</h2>
<mat-dialog-content *ngIf="showEditor">
<div style="margin: 12px;">
<div class="form-group has-feedback">
<ckeditor formControlName="content" name="myckeditor" required [config]="ckeConfig" debounce="500" (change)="onChange($event)">
</ckeditor>
</div>
<!-- <button [disabled]="ngForm.invalid" mat-raised-button color="primary" type="button" (click)="myClick()">Save</button> -->
</div>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button [disabled]="ngForm.invalid && showEditor===false" mat-raised-button color="primary" type="button" (click)="myClick()">Save</button>
<button mat-button mat-dialog-close mat-raised-button color="primary" type="button">Cancel</button>
</mat-dialog-actions>
</form>
<notifier-container></notifier-container>

View File

@ -0,0 +1,8 @@
::ng-deep .cdk-global-overlay-wrapper{
justify-content: center !important;
overflow: hidden;
}
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ModelEditPdReportComponent } from './model-edit-pd-report.component';
describe('ModelEditPdReportComponent', () => {
let component: ModelEditPdReportComponent;
let fixture: ComponentFixture<ModelEditPdReportComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ModelEditPdReportComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ModelEditPdReportComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,97 @@
import { Component, OnInit, ViewChild , Input, Inject} from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { PdTrigerService } from '../../../../pd-service/pd-triger.service';
import { NotifierService } from "angular-notifier";
import {
MatDialog,
MatDialogRef,
MAT_DIALOG_DATA
} from '@angular/material';
@Component({
selector: 'app-model-edit-pd-report',
templateUrl: './model-edit-pd-report.component.html',
styleUrls: ['./model-edit-pd-report.component.scss']
})
export class ModelEditPdReportComponent implements OnInit {
@Input() questionId: number;
ngForm: FormGroup;
name = 'ng2-ckeditor';
ckeConfig: any;
recordData: any;
log = '';
showEditor: boolean= false;
@ViewChild('myckeditor') ckeditor: any;
/**
* Notifier service
*/
private notifier: NotifierService;
constructor( private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService,
notifier: NotifierService ,
private dialogRef: MatDialogRef<ModelEditPdReportComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier = notifier;
this.ngForm = this._formBuilder.group({
report_template_id: [],
fk_template_id: [],
content: [null, Validators.compose([Validators.required])],
isactive:[1]
})
// this.mycontent = `<p>My html content</p>`;
}
ngOnInit() {
// alert(JSON.stringify(this.data));
// this.ngForm.controls['content'].setValue('<h1>Home<h1>');
this.pdTrigerService.getActualPDReportModelTemplate(this.data).subscribe(data => {
if(data['dataStatus']){
this.recordData = data.records[0];
this.ngForm = this._formBuilder.group({
content: [this.recordData.pd_report_latest_version_blob, Validators.compose([Validators.required])],
isactive:[this.recordData.isactive]
});
this.showEditor = true;
}
},err => {
});
// this.ckeConfig = {
// allowedContent: false,
// extraPlugins: 'divarea',
// forcePasteAsPlainText: true
// };
}
onChange($event: any): void {
// console.log('onChange');
// this.log += new Date() + "<br />";
}
myClick(): void {
let template = this.ngForm.controls['content'].value;
// alert(template);
let data = {
content: template,
pd_id: this.data.startId
}
// alert(JSON.stringify(data));
// var formValues = this.ngForm.value;
// Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
this.pdTrigerService.updatePDReportDetails(data).subscribe(data=>{
this.notifier.notify('success', 'Your Changes Updated.!');
this.dialogRef.close({
status: true
}
);
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
}

View File

@ -0,0 +1,107 @@
<!-- this is for completed pd report -->
<ng-container *ngIf="pdReportRecords && pdReportRecords.pd_status=='COMPLETED'">
<div *ngIf="reGenerateBtn">
<mat-sidenav-container class="app-inner background-none shadow-none mail-db">
<mat-sidenav #mailnav [mode]="isOver() ? 'over' : 'side'" [opened]="!isOver()" class="mail-sidebar pl-xs pr-xs">
<!-- <button _ngcontent-c21="" [disabled]="currentPDStatus !=pdStatusCheck.COMPLETED || actualQuestions!=answeredQuestions" class="compose-btn mat-warn mat-raised-button mb-1" (click)="changePDStatus(pdStatusCheck.QC_COMPLETED);"> <span>{{currentPDStatus==pdStatusCheck.COMPLETED ? 'QC OK':(currentPDStatus==pdStatusCheck.QC_COMPLETED ? 'QC COMPLETED' : currentPDStatus )}}</span></button> -->
<button class="compose-btn mat-warn mat-raised-button mb-1" type="button" [disabled]="reGenerateBtn===false" (click)="reGeneratePFReport()"><b>Re-generate Report</b></button>
<mat-nav-list style="background-color: white !important">
<a mat-list-item *ngFor="let pd of pdReportVersionList; let itemIndex = index;" (click)="changeVersion(pd, itemIndex)">
<h4 mat-line [ngStyle]="{'color':pd.is_latest == 1 && itemIndex == selectedIndex ? '#e00201' : pd.is_latest == 1 && itemIndex != selectedIndex ? 'green' : pd.is_latest !=1 && itemIndex == selectedIndex ? '#e00201' : 'rgba(0, 0, 0, 0.87)' }">{{ pd.doc_name }}</h4>
<!-- <h4 mat-line>{{ pd.doc_name }}</h4> -->
<p mat-line> {{pd.createdby}} ({{pd.createdon}}) </p>
</a>
</mat-nav-list>
</mat-sidenav>
<mat-toolbar color="primary">
<!-- fxHide="false" fxHide.gt-sm -->
<button (click)="mailnav.toggle()" mat-icon-button>
<mat-icon style="color: white;">short_text</mat-icon>
</button>
<span class="mr-1 ml-1">View More</span>
</mat-toolbar>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<!--{{qcStatus}}-->
<figure style="min-height: 240px;">
<div *ngIf="latestPDDetails">
<div style="margin: 12px;">
<!-- background: #ddd;
padding: 8px;" -->
<div style="text-align: right" class="mb-1">
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Edit" matTooltipPosition="above"
*ngIf="latestPDDetails.is_latest == 1 && qcStatus !== 'QC_COMPLETED'" (click)="addNewQuestion()"><mat-icon>edit</mat-icon></button>
<button mat-stroked-button *ngIf="latestPDDetails.is_latest == 0 && qcStatus !== 'QC_COMPLETED'" type="button" (click)="changeDocumentEdit()">Restore</button>
</div>
<div *ngIf="reGenerateBtn">
<pdf-viewer [src]="latestPDDetails.doc_uri" [original-size]="false" [page]="1">
</pdf-viewer>
<!-- latestPDDetails.doc_uri -->
</div>
</div>
</div>
</figure>
</div>
<div class="footer">
<button mat-raised-button color="blue" type="button" (click)="reportReview('REMARKS')" style="margin-right: 2px;">Notes</button>
<button mat-raised-button color="primary" type="button" (click)="reportReview('COMPLETE')" style="margin-right: 2px;">QC Complete</button>
<button mat-raised-button color="primary" type="button" (click)="loadPdViewCompoent()" style="margin-right: 2px;">Close</button>
</div>
</mat-sidenav-container>
</div>
<div *ngIf="generateBtn">
<div fxLayout="row wrap">
<div class="container" fxLayout fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="10px" fxLayoutGap.xs="0" style="padding: 10%;">
<div fxFlex="100">
<h5 style="text-align:center;color: black;"> {{message}}</h5>
<div style="text-align:center;">
<button mat-raised-button color="primary" type="button" *ngIf="generateBtn" (click)="generateNewPDReport()" style="margin-right: 2px;">Generate Report</button>
<button mat-raised-button color="primary" type="button" (click)="loadPdViewCompoent()" style="margin-right: 2px;">Close</button>
</div>
</div>
</div>
</div>
</div>
</ng-container>
<!-- this is for qc completed pd report -->
<ng-container *ngIf="pdReportRecords && pdReportRecords.pd_status=='QC_COMPLETED'">
<div *ngIf="reGenerateBtn" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<!--{{qcStatus}}-->
<figure style="min-height: 240px;">
<ng-container *ngIf="latestPDDetails">
<div style="margin: 12px;">
<div *ngIf="reGenerateBtn">
<pdf-viewer [src]="latestPDDetails.doc_uri" [original-size]="false" [page]="1">
</pdf-viewer>
<!-- latestPDDetails.doc_uri -->
</div>
</div>
</ng-container>
</figure>
</div>
<div class="footer">
<button mat-raised-button color="primary" type="button" (click)="loadPdViewCompoent()" style="margin-right: 2px;">Close</button>
</div>
</ng-container>
<notifier-container></notifier-container>

View File

@ -0,0 +1,128 @@
@import "./../../../../../assets/styles/scss/components/messages";
:host {
margin-left: -5px;
margin-right: -5px;
margin-top: -5px;
display: block;
}
:host /deep/ {
mat-sidenav {
max-width: 400px;
max-height: 500px;
overflow-y: auto;
}
.mat-sidenav-content {
padding: 0;
}
@media (min-width: 959px) {
.mat-sidenav-side {
background-color: transparent;
box-shadow: none!important;
}
}
}
.mat-menu-item-active {
color: red !important;
}
.mat-expansion-panel-header-description {
color: rgba(0, 0, 0, 87);
}
.mat-card-content {
background-color: white;
}
.mat-card-actions {
background-color: white;
}
.text-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.custm-list-item {
cursor: pointer;
}
$base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important;
$product-bg-color-hover: rgba(103, 58, 183, 0.7);
.p-list-main {
background: white;
margin: auto;
position: relative;
overflow: hidden !important;
border-radius: 10px 10px 10px 10px;
box-shadow: $base-card-box-shadow;
transform: scale(0.95);
transition: box-shadow 0.5s, transform 0.5s;
&:hover {
transform: scale(1);
box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.2);
}
.p-list {
position: relative;
.top {
height: 100%;
width: 100%;
// background: url(https://s-media-cache-ak0.pinimg.com/736x/49/80/6f/49806f3f1c7483093855ebca1b8ae2c4.jpg) no-repeat center center;
-webkit-background-size: 100%;
-moz-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
}
.bottom {
width: 200%;
height: 15%;
transition: transform 0.5s;
h1 {
margin: 0;
padding: 0;
}
p {
margin: 0;
padding: 0;
}
.left {
height: 100%;
width: 50%;
background: #f4f4f4;
position: relative;
float: left;
.details {
padding: 5px;
float: left;
// width: calc(70% - 40px);
}
}
.right {
width: 50%;
background: #A6CDDE;
color: white;
float: right;
height: 200%;
overflow: hidden;
.details {
padding: 20px;
float: right;
width: calc(70% - 40px);
}
}
}
}
}
.custm-list-item {
cursor: pointer;
}
.footer {
position: fixed;
bottom: 2%;
right: 2%;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CityListComponent } from './city-list.component';
import { PdReportComponent } from './pd-report.component';
describe('CityListComponent', () => {
let component: CityListComponent;
let fixture: ComponentFixture<CityListComponent>;
describe('PdReportComponent', () => {
let component: PdReportComponent;
let fixture: ComponentFixture<PdReportComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CityListComponent ]
declarations: [ PdReportComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CityListComponent);
fixture = TestBed.createComponent(PdReportComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,329 @@
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
import { Component, ViewChild, OnInit, ViewEncapsulation, OnDestroy, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray, AbstractControl } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { NotifierService } from 'angular-notifier';
import { ListPdComponent } from './../list-pd.component';
import { saveAs as importedSaveAs } from "file-saver";
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import {
MatDialog,
MatDialogRef,
MAT_DIALOG_DATA
} from "@angular/material";
import { ModelEditPdReportComponent } from './model-edit-pd-report/model-edit-pd-report.component';
import { QcReviewComponent } from './qc-review/qc-review.component';
import { HttpResponse } from "@angular/common/http";
/**sweet alert */
// import Swal from 'sweetalert2';
@Component({
selector: 'app-pd-report',
templateUrl: './pd-report.component.html',
styleUrls: ['./pd-report.component.scss']
})
export class PdReportComponent implements OnInit {
Url: SafeUrl;
startPD: any;
//public src = 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf';
public src = 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b';
//public src;
public document;
public generateBtn: Boolean = false;
public reGenerateBtn: Boolean = false;
public pdReportVersionList = [];
// public src;
pdReportRecords: any;
latestPDDetails: any;
message: any;
selectedIndex: Number;
private notifier: NotifierService;
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, public pdTrigerService: PdTrigerService, private listPDComponent: ListPdComponent,
private dialog: MatDialog, private sanitizer: DomSanitizer) {
this.startPD = this.route.snapshot.params['pdid'];
this.notifier = notifier;
// this.src = 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T073026Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=35aa183cbbfc835f96719a5e9aa552c79b3a1b7d8bca043f7d738d730755dcbb';
// this.src = this.sanitizer.bypassSecurityTrustResourceUrl("https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b");
// alert(JSON.stringify(this.src));
// this.document = { name: 'Angular 2',
// description: 'An amazing Angular 2 pdf',
// url: { url: 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b', withCredentials: true } };
// this.Url = this.sanitizer.bypassSecurityTrustResourceUrl("https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181207%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181207T122031Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=fac718f35d195ecb45d1dc7049fbaf0fa3158f237deeedac3bae60f8ec22e822");
}
ngOnInit() {
this.listPDComponent.showListView(false);
this.getPdReportDetails();
this.getPdReportVersionList();
// start
// end
const elemSidebar = <HTMLElement>document.querySelector('.app-inner .mail-sidebar');
const elemContent = <HTMLElement>document.querySelector('.app-inner .main-content');
if (window.matchMedia(`(min-width: 1560px)`).matches && !this.isMac()) {
// Ps.initialize(elemSidebar, { wheelSpeed: 2, suppressScrollX: true });
// Ps.initialize(elemContent, { wheelSpeed: 2, suppressScrollX: true });
}
// this.loadTemplates(this.startPD);
// this.next = 1;
// this.previous = 2;
}
isMac(): boolean {
let bool = false;
if (navigator.platform.toUpperCase().indexOf('MAC') >= 0 || navigator.platform.toUpperCase().indexOf('IPAD') >= 0) {
bool = true;
}
return bool;
}
isOver(): boolean {
return window.matchMedia(`(max-width: 1560px)`).matches;
}
reGeneratePFReport() {
let data = {
"pd_id": this.startPD,
"regenerate": "1"
};
this.pdTrigerService.getPDReportFinalDocument(data).subscribe(data => {
if (data.dataStatus) {
this.notifier.notify('success', 'Your Changes Updated.!');
this.getPdReportVersionList();
} else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
generateNewPDReport() {
let data = {
"pd_id": this.startPD
};
this.pdTrigerService.getPDReportFinalDocument(data).subscribe(data => {
if (data.dataStatus) {
this.notifier.notify('success', 'Your Changes Updated.!');
this.getPdReportVersionList();
} else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
public qcStatus: string = '';
getPdReportVersionList() {
this.pdTrigerService.getPdDocVersionList(this.startPD).subscribe(data => {
if (data.status == 200 && data.dataStatus) {
this.pdReportVersionList = [...data.records.reports_urls].reverse();
let datas = this.pdReportVersionList.filter((a) => { return a.is_latest == 1; })
this.latestPDDetails = datas[0];
this.selectedIndex = 0;
this.qcStatus = data.records.pdstatus;
// alert(JSON.stringify(this.latestPDDetails));
this.reGenerateBtn = true;
} else {
// this.reGenerateBtn = true;
this.generateBtn = true;
this.message = data.msg;
}
}, err => {
})
}
getPdReportDetails() {
this.pdTrigerService.getPdFinalReportDetails(this.startPD).subscribe(data => {
if (data.status == 200) {
// this.pdReportRecords = data.records.question_answers;
this.pdReportRecords = data.records;
// this.pdReportRecords = data.records.qu;
}
}, err => {
})
}
// load pd view component
loadPdViewCompoent() {
this.router.navigate(['../../viewpd', this.startPD], { relativeTo: this.route });
}
// add questions popup model call
addNewQuestion() {
const dialogRef = this.dialog.open(ModelEditPdReportComponent, {
data: { startId: this.startPD, version_id: this.latestPDDetails.doc_name },
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult.status==true){
this.getPdReportVersionList();
}
// this.getPdReportFinalTemplateDetails();
// this.getQuestionsMasters();
// this.getBranch();
// this.isPopupOpened = false;
});
}
changeVersion(pd: any,selIndex:Number): void {
this.latestPDDetails = pd;
this.selectedIndex = selIndex;
}
reportReview(status): void {
const dialogRef = this.dialog.open(QcReviewComponent, {
data: { startId: this.startPD, data_status: status },
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult.status==true){
this.getPdReportVersionList();
}
// this.getPdReportFinalTemplateDetails();
// this.getQuestionsMasters();
// this.getBranch();
// this.isPopupOpened = false;
});
}
changeDocumentEdit(): void {
const dialogRef = this.dialog.open(DialogChangeCurrentVenrsion, {
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if (dataresult) {
let data = {
"pd_id": this.startPD,
"doc_name": this.latestPDDetails.doc_name
};
this.pdTrigerService.swapOlderPDReportToLatest(data).subscribe(data => {
if (data.status == 200) {
this.notifier.notify('success', 'Your Changes Updated.!');
this.getPdReportVersionList();
} else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
} else {
}
});
// Swal('User Created');
// swal({
// title: 'Error!',
// text: 'Do you want to continue',
// type: 'error',
// confirmButtonText: 'Cool'
// });
// Swal({
// title: 'Are you sure?',
// type: 'warning',
// showCancelButton: true,
// confirmButtonColor: '#3085d6',
// cancelButtonColor: '#d33',
// confirmButtonText: SwalButtonText
// }).then((result) => {
// if (result.value) {
// // this._mastersService.editMasterDetails(ActiveDatas,'CITY')
// // .subscribe(dataresult=>{
// // if (dataresult.dataStatus == true){
// // Swal(this.SwalMessage,'success');
// // this.getCity();
// // }
// // else{
// // Swal("Sorry Try Again !");
// // }
// // });
// }
// else{
// // this.getCity();
// }s
// })
}
export() {
this.pdTrigerService.pdReportExportExcel().subscribe((blob: HttpResponse<Blob>) => {
if (blob) {
// console.log(blob);
let datass = blob.headers.get('content-disposition');
let fileName = datass.split(/"/)[1];
// this.notifier.notify('success', 'Your Changes Updated.!');
const blobs = new Blob([blob.body],
{ type: 'application/vnd.ms-excel' });
const file = new File([blobs], fileName,
{ type: 'application/vnd.ms-excel' });
// console.log(file);
importedSaveAs(file);
} else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
}
@Component({
selector: 'dialog-overview-example-dialog',
styles: [`
.listHover: hover {
background: yellow;
}`
],
template: `
<div style="width: 220px;">
<h3 style="text-align: center">Document is marked as final</h3>
<p style="text-align: center"> Because you've marked the document as final, you can edit this document.</p>
<div style="text-align: center; margin: 12px;" class="mb-1">
<button mat-raised-button color="primary" (click)="getConfirmation(false)">Cancel</button>
<button mat-raised-button color="accent" (click)="getConfirmation(true)">ok</button>
</div>
</div>
`
})
export class DialogChangeCurrentVenrsion implements OnInit {
public m_questions: any;
public m_question_forms: any;
constructor(
public dialogRef: MatDialogRef<DialogChangeCurrentVenrsion>,
@Inject(MAT_DIALOG_DATA) public data) {
}
ngOnInit(): void {
}
getConfirmation(confim: Boolean) {
this.dialogRef.close(confim);
}
}

View File

@ -0,0 +1,49 @@
<div *ngIf="showStatus == 'COMPLETE'">
<h2 mat-dialog-title>QC Complete</h2>
<mat-dialog-content class="mat-typography">
<!--<h3>Develop across all platforms</h3>-->
<div *ngIf="conformation === false" style="width: 220px;text-align: center; margin: 12px;">
<p>
Once QC is Completed further edit will not be possible on this document.
</p>
</div>
<div *ngIf="conformation" style="margin: 12px; width: 340px;">
<form role="form" *ngIf="showForm" [formGroup]="ngForm" accept-charset="UTF-8" novalidate>
<div>
<app-rating [rating]="ngForm.get('qc_rating').value" (ratingClick)='ratingComponentClick($event)'></app-rating>
</div>
<div>
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="qc_feedback"></textarea>
</mat-form-field>
</div>
</form>
</div>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button class="btn btn-primary" *ngIf="conformation === false" (click)="conformation = true">Ok</button>
<button mat-button class="btn btn-primary" *ngIf="conformation" (click)="myClick()">Save</button>
<button mat-button mat-dialog-close>Cancel</button>
</mat-dialog-actions>
</div>
<div *ngIf="showStatus == 'REMARKS'">
<h2 mat-dialog-title>QC Notes</h2>
<mat-dialog-content class="mat-typography">
<div style="margin: 12px; width: 340px;">
<form role="form" *ngIf="showForm" [formGroup]="ngForm" accept-charset="UTF-8" novalidate>
<div>
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="qc_remarks"></textarea>
</mat-form-field>
</div>
</form>
</div>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button class="btn btn-primary" (click)="myClick()">Save</button>
<button mat-button mat-dialog-close>Cancel</button>
</mat-dialog-actions>
</div>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { QcReviewComponent } from './qc-review.component';
describe('QcReviewComponent', () => {
let component: QcReviewComponent;
let fixture: ComponentFixture<QcReviewComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ QcReviewComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(QcReviewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,109 @@
import { Component, OnInit, ViewChild , Input, Inject} from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { PdTrigerService } from '../../../../pd-service/pd-triger.service';
import { NotifierService } from "angular-notifier";
import {
MatDialog,
MatDialogRef,
MAT_DIALOG_DATA
} from '@angular/material';
@Component({
selector: 'app-qc-review',
templateUrl: './qc-review.component.html',
styleUrls: ['./qc-review.component.scss']
})
export class QcReviewComponent implements OnInit {
conformation: Boolean = false;
@Input() questionId: number;
ngForm: FormGroup;
recordData: any;
showForm: Boolean;
showStatus : any;
/**
* Notifier service
*/
private notifier: NotifierService;
constructor( private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService,
notifier: NotifierService ,
private dialogRef: MatDialogRef<QcReviewComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier = notifier;
this.showStatus = this.data.data_status;
// this.mycontent = `<p>My html content</p>`;
}
ngOnInit() {
this.getQcCompleteReviewStatus();
}
getQcCompleteReviewStatus() {
let type ; '';
if( this.showStatus === 'REMARKS'){
type = 'QC_REMARKS';
this.pdTrigerService.getQCReportFinalReviewDetails(this.data.startId, type).subscribe(data => {
if(data['dataStatus']){
this.recordData = data.records[0];
this.ngForm = this._formBuilder.group({
qc_remarks: [this.recordData.qc_remarks],
pd_status: [this.recordData.pd_status]
})
this.showForm = true;
}
},err => {
});
} else if(this.showStatus === 'COMPLETE') {
type = 'QC';
this.pdTrigerService.getQCReportFinalReviewDetails(this.data.startId, type).subscribe(data => {
if(data['dataStatus']){
this.recordData = data.records[0];
this.ngForm = this._formBuilder.group({
qc_feedback: [this.recordData.qc_feedback],
qc_rating: [Number(this.recordData.qc_rating)],
pd_status: ["QC_COMPLETED"],
})
this.showForm = true;
}
},err => {
});
} else {
}
}
onChange($event: any): void {
// this.log += new Date() + "<br />";
}
myClick(): void {
let template = this.ngForm.value;
template.pd_id = this.data.startId;
this.pdTrigerService.pdReviewStatusUpdate(template).subscribe(data=>{
this.notifier.notify('success', 'Your Changes Updated.!');
this.dialogRef.close({
status: true
});
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
// =============================
ratingClicked: number;
itemIdRatingClicked: string;
rating : number = 1;
ratingComponentClick(e){
this.ngForm.controls.qc_rating.setValue(e.rating);
}
}

View File

@ -0,0 +1,38 @@
<form [formGroup]="_EditPDRequirementForm" novalidate>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
{{pageTitle}}
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content>
<mat-card formArrayName="addtional_requirements" *ngFor="let requirements of pdRequirements.controls; let i = index;">
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 90%;">
<input matInput placeholder="Requirement" formControlName="add_requirement">
</mat-form-field>
<!-- <button mat-raised-button mat-icon-button color="primary" matTooltip="Delete" matTooltipPosition="above" (click)="removeRequirements(i)" type="button"><mat-icon>delete</mat-icon></button> -->
</mat-card-content>
</mat-card>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button type="button" mat-raised-button mat-icon-button (click)="addRequiremnts(const_requirement)" matTooltip="Add More Additional Requirements" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button"> <mat-icon>add</mat-icon> </button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="updateAdditionalRequirement(_EditPDRequirementForm.value)"><mat-icon>save</mat-icon></button>
</mat-dialog-actions>
</form>
<!-- <notifier-container></notifier-container> -->

View File

@ -0,0 +1,7 @@
mat-form-field {
margin: 0 2%;
}
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CompanyDialogComponent } from './company-dialog.component';
import { PdRequirementComponent } from './pd-requirement.component';
describe('CompanyDialogComponent', () => {
let component: CompanyDialogComponent;
let fixture: ComponentFixture<CompanyDialogComponent>;
describe('PdRequirementComponent', () => {
let component: PdRequirementComponent;
let fixture: ComponentFixture<PdRequirementComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CompanyDialogComponent ]
declarations: [ PdRequirementComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CompanyDialogComponent);
fixture = TestBed.createComponent(PdRequirementComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,111 @@
import { Component, OnInit,ViewEncapsulation, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
@Component({
selector: 'app-pd-requirement',
templateUrl: './pd-requirement.component.html',
styleUrls: ['./pd-requirement.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class PdRequirementComponent implements OnInit {
public pageTitle: string = "Additional Requirements Details";
public _EditPDRequirementForm:FormGroup;
public notifier: NotifierService;
addtional_requirements: FormArray;
public const_requirement : any = {
"add_req_id": '',
"add_requirement":'',
"earning_ans": '',
"isactive": 1,
};
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<PdRequirementComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier=notifier
}
ngOnInit() {
this.loadForm();
}
loadForm() {
this._EditPDRequirementForm = this._fb.group({
pdid: [this.data.pdID],
addtional_requirements: this._fb.array([])
});
// bind dynamic co applicant data
if(this.data.records.length > 0){
this.data.records.forEach((itemElement, itemIndex) => {
this.addRequiremnts(itemElement)
});
}
else {
this.addRequiremnts(this.const_requirement)
}
}
get pdRequirements() { return this._EditPDRequirementForm.get('addtional_requirements') as FormArray; }
createRequiremnt(receive:any): FormGroup {
return this._fb.group({
add_req_id:[receive.add_req_id],
add_requirement: [receive.add_requirement, Validators.compose([Validators.required])],
isactive: [receive.isactive],
});
};
addRequiremnts(getData:any) {
if(this._EditPDRequirementForm.valid){
this.addtional_requirements = this._EditPDRequirementForm.get('addtional_requirements') as FormArray;
this.addtional_requirements.push(this.createRequiremnt(getData));
}
else {
this.validateAllFormFields(this._EditPDRequirementForm);
}
}
// removeRequirements(index: number) {
// const requirement_control = <FormArray>this._EditPDRequirementForm.controls['additional_requirements'];
// requirement_control.removeAt(index);
// }
updateAdditionalRequirement(formValue: any) {
if(this._EditPDRequirementForm.invalid) {
this.validateAllFormFields(this._EditPDRequirementForm)
return;
}
else {
let records:any=formValue;
this._pd.saveAdditionalRequirements(records).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'Additional Requirements Updated.');
this.dialogRef.close();
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
}
// validate all form group and form array fields
validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
control.markAsTouched({ onlySelf: true });
} else if (control instanceof FormGroup) {
this.validateAllFormFields(control);
} else if (control instanceof FormArray) {
this.validateAllFormFields(control);
}
});
}
}

View File

@ -0,0 +1,30 @@
<h2 mat-dialog-title>{{dialoge_title_content}}</h2>
<mat-dialog-content>
<div fxFlex="100">
<p align="center">
{{dialoge_content}}
</p>
<span *ngIf="!CompletenessCheck">
<span *ngIf="!Loading">
<p align="center" style="color: red !important;"> {{completeness_message}} </p>
<ul><li *ngFor="let forms of dialoge_subcontent" style="color: red !important;">
{{ forms }}
</li></ul>
</span>
<span *ngIf="Loading">
<div fxLayoutAlign="center">
<mat-progress-spinner mode="indeterminate"></mat-progress-spinner>
</div>
</span>
</span>
</div>
</mat-dialog-content>
<mat-dialog-actions align="end" *ngIf="CompletenessCheck">
<button *ngIf="enableAddonPD===true" mat-raised-button color="primary" (click)="changePDStatus(addonStatus)"><strong> Yes / Allow Addon PD</strong></button>
<button mat-raised-button color="primary" (click)="changePDStatus(this.data.pd_status)"><strong>Yes</strong></button>
<button mat-raised-button mat-dialog-close><strong> No </strong></button>
</mat-dialog-actions>
<mat-dialog-actions align="end" *ngIf="!CompletenessCheck">
<button mat-raised-button mat-dialog-close><strong> Ok </strong></button>
</mat-dialog-actions>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PdStatusChangeDialogueComponent } from './pd-status-change-dialogue.component';
describe('PdStatusChangeDialogueComponent', () => {
let component: PdStatusChangeDialogueComponent;
let fixture: ComponentFixture<PdStatusChangeDialogueComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PdStatusChangeDialogueComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PdStatusChangeDialogueComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,79 @@
import { Component, OnInit, ViewChild , Input, Inject} from '@angular/core';
import { NotifierService } from "angular-notifier";
import {MatDialog,MatDialogRef,MAT_DIALOG_DATA } from '@angular/material';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
@Component({
selector: 'app-pd-status-change-dialogue',
templateUrl: './pd-status-change-dialogue.component.html',
styleUrls: ['./pd-status-change-dialogue.component.scss']
})
export class PdStatusChangeDialogueComponent implements OnInit {
conformation: Boolean = false;
private notifier: NotifierService;
dialoge_title_content: string;
dialoge_content: string;
dialoge_subcontent : any = [];
completeness_message: string;
enableAddonPD : boolean;
CompletenessCheck: boolean;
addonStatus: string ="ADD_ON_PENDING";
public Loading: boolean;
constructor(notifier: NotifierService , private pd: PdTrigerService,private dialogRef: MatDialogRef<PdStatusChangeDialogueComponent>,@Inject(MAT_DIALOG_DATA) public data: any)
{
this.notifier = notifier;
this.dialoge_title_content = this.data.pd_status=='INPROGRESS' ? 'Start Discussion' : this.data.pd_status=='COMPLETED' ? 'Complete Discussion' : 'Change Discussion';
this.dialoge_content = this.data.pd_status=='INPROGRESS' ? 'Are you starting the Discussion ?' : this.data.pd_status=='COMPLETED' ? 'Please confirm you are completing the Discussion and forwarding for Quality Check ?' : 'Change Discussion';
this.enableAddonPD = false;
this.CompletenessCheck = this.data.pd_status=='INPROGRESS' ? true : this.data.pd_status=='COMPLETED' ? false : true;
this.Loading = this.data.pd_status=='INPROGRESS' ? false : this.data.pd_status=='COMPLETED' ? true : false;
}
ngOnInit() {
if(this.data.pd_status=='COMPLETED'){
let params: any={};
params.pd_id = this.data.pdid;
this.pd.pdFormsCompletenessCheck(this.data.pdid).subscribe(result => {
if (result.dataStatus === true) {
if(result.records.length > 0){
this.completeness_message = result.msg ;
this.dialoge_subcontent = result.records;
this.Loading = false;
}
else{
this.CompletenessCheck = true;
this.Loading = false;
this.pd.getPDCompleteDetails(params).subscribe(result => {
if (result.dataStatus === true) {
this.enableAddonPD = result.records.address_count>0 ? true: false;
}
});
}
}
});
}
}
changePDStatus(status: string): void {
let update_status = {
"pd_id":this.data.pdid,
};
this.pd.editPdMasterDetails(update_status, status).subscribe(result => {
if (result.status == 200) {
this.dialogRef.close({update_status:true});
this.notifier.notify('success', this.data.pd_status=='INPROGRESS' ? 'Discussions Started Successfully' : this.data.pd_status=='COMPLETED' ? 'Discussions Completed Successfully' : 'Discussions Updated Successfully');
}
else {
this.dialogRef.close({update_status:false});
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.dialogRef.close({update_status:false});
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
}

View File

@ -0,0 +1,124 @@
<mat-card-content>
<mat-expansion-panel [(expanded)]="xpandStatus">
<mat-expansion-panel-header>
<mat-panel-title class="text-xs-left">
<!-- <h6 class="mt-0"><mat-icon>filter_list</mat-icon> Filter</h6> -->
<mat-toolbar-row>
<mat-icon>filter_list</mat-icon>
<span class="toolbar-space"></span>
<span>Advance Filter</span>
</mat-toolbar-row>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-list class="m-gap p-gap">
<div [formGroup]="searchForm">
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_type" placeholder="PD Type">
<mat-option *ngFor="let type of PDType" [value]="type.pd_type_id">{{type.type_name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<!-- <mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_status" placeholder="PD Status">
<mat-option *ngFor="let status of pdStatus" [value]="status.pd_status_name">{{status.pd_status_name}}</mat-option>
</mat-select>
</mat-form-field> -->
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker" [max]="todaydate" (blur)="checkDate($event)" formControlName="pd_from_date" placeholder="Choose a From date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>&nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value"formControlName="pd_to_date" placeholder="Choose a todate">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_products" placeholder="Products">
<mat-option *ngFor="let pro of PRODUCTS" [value]="pro.product_id">{{pro.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_city" placeholder="City">
<mat-option *ngFor="let city of CITY" [value]="city.city_id">{{city.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_lender" placeholder="Lender Name">
<mat-option *ngFor="let ent of ENTITY" [value]="ent.entity_id">{{ent.full_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_name" placeholder="Applicant Name">
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
</mat-form-field>
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
matTooltip="Reset" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary">
<mat-icon>settings_backup_restore</mat-icon>
</button>
<button type="button" mat-raised-button mat-icon-button (click)="searchItem()"
matTooltip="Search" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>search</mat-icon>
</button>
</div>
</div>
</mat-list>
</mat-expansion-panel>
<br/>
<mat-table [dataSource]="dataSourceTab5" matSort *ngIf="qcCompletedPdListData.length > 0" >
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="10" fxFlex.lg="10" fxFlex.xl="10" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold'}" mat-line>{{details.pd_id}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<!-- <span *ngIf="details.applicant_name" mat-line><b>{{details.applicant_name}}</b></span><br> -->
<span *ngIf="details.is_child" mat-line>
<b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b>
</span><br>
<span class="fontsize"> {{details.lender_applicant_id}}</span> <span class="fontsize" *ngIf="details.customer_segment_abbr">-({{details.customer_segment_abbr}} )</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Lenderid">
<mat-cell class="cell" *matCellDef="let details">
<span *ngIf="details.lender_short_name" mat-line> {{details.lender_short_name}} </span><br>
<span *ngIf="details.product_abbr" mat-line class="fontsize"> {{details.product_abbr}}<span *ngIf="details.subproduct_abbr">/{{details.subproduct_abbr}}</span></span> <br>
<span *ngIf="details.loan_amount" class="fontsize"><i class="fa-1x fa fa-rupee"></i> {{details.loan_amount}}</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Address">
<mat-cell class="cell" *matCellDef="let details;">
<span matTooltip="Initiated Date" matTooltipPosition="above">{{details.pd_date_of_initiation}}</span><br>
<span class="fontsize" *ngIf="details.city_name"> <i class="fa-1x fa fa-map-marker"> </i> {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }} </span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Status">
<mat-cell class="cell center" *matCellDef="let details;">
<span > QC COMPLETED</span><br>
<span class="fontsize" matTooltip="QC Completed" matTooltipPosition="above">{{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }}
</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Action">
<mat-cell class="cell center" *matCellDef="let details;">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id)" matTooltip="View" matTooltipPosition="above" color="primary"><mat-icon>visibility</mat-icon></button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
</mat-card-content>
<mat-paginator *ngIf="!recordStatus" #paginator class="mat-elevation-z1" [length]="qcCompletedPdListData.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>

View File

@ -0,0 +1,19 @@
.ic-change:hover {
transform: scale(1.1);
color: green;
}
.cell{
display:inline !important;
}
.cellhide{
display: none !important;
}
.center{
text-align:center;
}
.fontsize{
font-size:14px;
}
.toolbar-space {
flex: 0.01 0 auto;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { QcCompletedPdComponent } from './qc-completed-pd.component';
describe('QcCompletedPdComponent', () => {
let component: QcCompletedPdComponent;
let fixture: ComponentFixture<QcCompletedPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ QcCompletedPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(QcCompletedPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,207 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter, OnDestroy, AfterViewInit, OnChanges, SimpleChanges } from '@angular/core';
import { PdTrigerService } from './../../../pd-service/pd-triger.service';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { FormBuilder, FormGroup } from '@angular/forms';
import { DatePipe } from '@angular/common';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-qc-completed-pd',
templateUrl: './qc-completed-pd.component.html',
styleUrls: ['./qc-completed-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class QcCompletedPdComponent implements OnInit, OnChanges {
xpandStatus: boolean = false;
PRODUCTS: any[] = [];
ENTITY: any[] = [];
CITY: any[] = [];
PDType: any[] = [];
pdStatus: any[] = [];
recordStatus: boolean;
errorMessage: any[] = [];
tabStatus: string = "QC_COMPLETED";
pipe = new DatePipe('en-US');
todaydate:Date = new Date();
public dataLengthTab5: number;
public dataSourceTab5 = new MatTableDataSource();
searchForm: FormGroup;
displayedColumns = ['PDType', 'Name', 'Lenderid', 'Address', 'Status', 'Action'];
private notifier: NotifierService;
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@Input() bindFilterValue: string;
@Output() loadPdView = new EventEmitter<string>();
// data source variable details
qcCompletedPdListData: any[] = [];
// pagination variable details
length = 5;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
constructor(private _pd: PdTrigerService, public _fb: FormBuilder,notifier: NotifierService,) {
this.notifier = notifier;
this.searchForm = this._fb.group(
{
pd_type: [null],
pd_status: ['QC_COMPLETED'],
pd_from_date: [null],
pd_to_date: [null],
pd_city: [null],
pd_products: [null],
pd_lender: [null],
pd_name: [null],
pd_applicant_id: [null],
});
this.getcommonDropDown();
}
ngOnInit() {
this.recordStatus = false;
// this.loadPDDetails();
// this.getcommonDropDown();
}
ngAfterViewInit() {
this.dataSourceTab5.paginator = this.paginator;
this.dataSourceTab5.sort = this.sort;
}
// get changes for filter from parent componnet filter
ngOnChanges(changes: SimpleChanges) {
let filteredText = changes.bindFilterValue.currentValue;
filteredText = filteredText ? filteredText.trim() : filteredText;
filteredText = filteredText ? filteredText.toLowerCase() : filteredText;
this.dataSourceTab5.filter = filteredText;
}
// load inprogress pd list
loadPDDetails() {
this._pd.getTabStatusPdDetails(this.tabStatus)
.subscribe(
data => {
if (data.status == 200) {
this.qcCompletedPdListData = data.records;
this.dataLengthTab5 = data.records.length;
this.dataSourceTab5.data = this.qcCompletedPdListData;
}
else {
this.qcCompletedPdListData = [];
this.dataLengthTab5 = null;
this.recordStatus = true;
}
}
// , error => this.errorMessage = <any>error);
,error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
pageChange(e) {
console.log(e);
}
viewPD(pdid: string) {
this.loadPdView.next(pdid);
}
titleCaseWord(word: string) {
if (!word) return word;
return word[0].toUpperCase() + word.substr(1).toLowerCase();
}
/**
* Common Search
* sriram
*/
getcommonDropDown():void {
this._pd.getAllMasterDatas('PDSTATUS').subscribe(res => {
if (res.dataStatus == true) {
this.pdStatus = res.records.filter(status => status.isactive == 1 && status.pd_status_name == this.tabStatus);
// this.searchForm.controls['pd_status'].setValue(this.pdStatus[0]);
}
});
this._pd.getAllMasterDatas('PDTYPE').subscribe(res => {
if (res.dataStatus == true) {
this.PDType = res.records.filter(type => type.isactive == 1);
}
});
// this._pd.getAllMasterDatas('CITY').subscribe(res => {
// if (res.dataStatus == true) {
// this.CITY = res.records.filter(city => city.isactive == 1);
// }
// });
this._pd.getListOfCities().subscribe(res=>
{
if(res.dataStatus==true)
{
this.CITY = res.records;
}
});
this._pd.getAllMasterDatas('ENTITY').subscribe(res => {
if (res.dataStatus == true) {
this.ENTITY = res.records.filter(ent => ent.isactive == 1);
}
});
this._pd.getAllMasterDatas('PRODUCTS').subscribe(res => {
if (res.dataStatus == true) {
this.PRODUCTS = res.records.filter(pro => pro.isactive == 1);
}
});
}
checkDate(e) {
console.log(e);
}
searchItem() {
if (this.searchForm.value.pd_type != null) {
} else {
this.searchForm.value.pd_type = [];
}
if (this.searchForm.value.pd_status != null) {
} else {
this.searchForm.value.pd_status = [];
}
this.searchForm.value.pd_from_date = this.pipe.transform(this.searchForm.value.pd_from_date, 'yyyy-MM-dd');
this.searchForm.value.pd_to_date = this.pipe.transform(this.searchForm.value.pd_to_date, 'yyyy-MM-dd');
this._pd.overAllSearchFormDetails(this.searchForm.value).subscribe(res => {
this.xpandStatus = false;
if (res['dataStatus'] == true) {
this.dataSourceTab5 = res['records'];
this.dataSourceTab5.paginator = this.paginator;
}else{
this.notifier.notify('warning', 'No Records Found !');
this.dataSourceTab5.paginator['length'] = 0;
this.dataSourceTab5.paginator['pageIndex'] = 0;
this.dataSourceTab5.data = [];
}
},error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
onReset(){
this.searchForm.reset();
this.loadPDDetails();
this.xpandStatus = false;
}
}

View File

@ -0,0 +1,126 @@
<mat-card-content>
<mat-expansion-panel [(expanded)]="xpandStatus">
<mat-expansion-panel-header>
<mat-panel-title class="text-xs-left">
<!-- <h6 class="mt-0"><mat-icon>filter_list</mat-icon> Filter</h6> -->
<mat-toolbar-row>
<mat-icon>filter_list</mat-icon>
<span class="toolbar-space"></span>
<span>Advance Filter</span>
</mat-toolbar-row>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-list class="m-gap p-gap">
<div [formGroup]="searchForm">
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_type" placeholder="PD Type">
<mat-option *ngFor="let type of PDType" [value]="type.pd_type_id">{{type.type_name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<!-- <mat-form-field style="width:40%">
<mat-select formControlName="pd_status" placeholder="PD Status">
<mat-option *ngFor="let status of pdStatus" [value]="status.pd_status_name" [disabled]="'true'">{{status.pd_status_name}}</mat-option>
</mat-select>
</mat-form-field> -->
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker" [max]="todaydate" (blur)="checkDate($event)" formControlName="pd_from_date" placeholder="Choose a From date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput [matDatepicker]="picker1" [max]="todaydate" [min]="searchForm.get('pd_from_date').value"formControlName="pd_to_date" placeholder="Choose a todate">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_products" placeholder="Products">
<mat-option *ngFor="let pro of PRODUCTS" [value]="pro.product_id">{{pro.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_city" placeholder="City">
<mat-option *ngFor="let city of CITY" [value]="city.city_id">{{city.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<mat-select multiple formControlName="pd_lender" placeholder="Lender Name">
<mat-option *ngFor="let ent of ENTITY" [value]="ent.entity_id">{{ent.full_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_name" placeholder="Applicant Name">
</mat-form-field> &nbsp; &nbsp;
<mat-form-field style="width:30%">
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
</mat-form-field>
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
matTooltip="Reset" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary">
<mat-icon>settings_backup_restore</mat-icon>
</button>
<button type="button" mat-raised-button mat-icon-button (click)="searchItem()"
matTooltip="Search" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>search</mat-icon>
</button>
</div>
</div>
</mat-list>
</mat-expansion-panel>
<br/>
<mat-table [dataSource]="dataSourceTab3" matSort *ngIf="scheduledPdListData.length > 0" >
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="10" fxFlex.lg="10" fxFlex.xl="10" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold'}" mat-line>{{details.pd_id}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<!-- <span *ngIf="details.applicant_name" mat-line><b>{{details.applicant_name}}</b></span><br> -->
<span *ngIf="details.is_child" mat-line>
<b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b>
</span><br>
<span class="fontsize"> {{details.lender_applicant_id}}</span> <span class="fontsize" *ngIf="details.customer_segment_abbr">-({{details.customer_segment_abbr}} )</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Lenderid">
<mat-cell class="cell" *matCellDef="let details">
<span *ngIf="details.lender_short_name" mat-line> {{details.lender_short_name}} </span><br>
<span *ngIf="details.product_abbr" mat-line class="fontsize"> {{details.product_abbr}}<span *ngIf="details.subproduct_abbr">/{{details.subproduct_abbr}}</span></span> <br>
<span *ngIf="details.loan_amount" class="fontsize"><i class="fa-1x fa fa-rupee"></i> {{details.loan_amount}}</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Address">
<mat-cell class="cell" *matCellDef="let details;">
<span>{{details.pd_date_of_initiation}}</span><br>
<span class="fontsize" *ngIf="details.city_name"> <i class="fa-1x fa fa-map-marker"> </i> {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }} </span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Status">
<mat-cell class="cell center" *matCellDef="let details;">
<span> {{details.pd_status}}</span><br>
<!-- <span class="fontsize">{{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }}
</span> -->
<span class="fontsize">{{details.scheduled_on}}
</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Action">
<mat-cell class="cell center" *matCellDef="let details;">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id)" color="primary" matTooltip="View" matTooltipPosition="above"><mat-icon>visibility</mat-icon></button>
</mat-cell>
</ng-container>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
</mat-card-content>
<mat-paginator *ngIf="!recordStatus" #paginator class="mat-elevation-z1" [length]="scheduledPdListData.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>

View File

@ -0,0 +1,19 @@
.ic-change:hover {
transform: scale(1.1);
color: green;
}
.cell{
display:inline !important;
}
.cellhide{
display: none !important;
}
.center{
text-align:center;
}
.fontsize{
font-size:14px;
}
.toolbar-space {
flex: 0.01 0 auto;
}

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RegionsListComponent } from './regions-list.component';
import { ScheduledPdComponent } from './scheduled-pd.component';
describe('RegionsListComponent', () => {
let component: RegionsListComponent;
let fixture: ComponentFixture<RegionsListComponent>;
describe('ScheduledPdComponent', () => {
let component: ScheduledPdComponent;
let fixture: ComponentFixture<ScheduledPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RegionsListComponent ]
declarations: [ ScheduledPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RegionsListComponent);
fixture = TestBed.createComponent(ScheduledPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,225 @@
import { Component,ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter, OnDestroy, AfterViewInit, OnChanges, SimpleChanges } from '@angular/core';
import { PdTrigerService } from './../../../pd-service/pd-triger.service';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { FormBuilder, FormGroup } from '@angular/forms';
import { DatePipe } from '@angular/common';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-scheduled-pd',
templateUrl: './scheduled-pd.component.html',
styleUrls: ['./scheduled-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ScheduledPdComponent implements OnInit, OnChanges {
xpandStatus: boolean = false;
PRODUCTS: any[]=[];
ENTITY: any[]=[];
CITY: any[]=[];
PDType: any[]=[];
pdStatus: any[]=[];
recordStatus: boolean;
errorMessage:any[]=[];
tabStatus:string="SCHEDULED";
pipe = new DatePipe('en-US');
searchForm:FormGroup;
todaydate:Date = new Date();
public dataLengthTab3: number;
public dataSourceTab3 = new MatTableDataSource();
private notifier: NotifierService;
displayedColumns = ['PDType','Name','Lenderid','Address','Status','Action'];
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@Input() bindFilterValue: string;
@Output() loadPdView = new EventEmitter<string>();
// data source variable details
scheduledPdListData:any[] = [];
// pagination variable details
length = 5;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,) {
this.notifier = notifier;
this.searchForm = this._fb.group(
{
pd_type:[null],
pd_status:['SCHEDULED'],
pd_from_date:[null],
pd_to_date:[null],
pd_city:[null],
pd_products:[null],
pd_lender:[null],
pd_name:[null],
pd_applicant_id:[null],
});
this.getcommonDropDown();
}
ngOnInit() {
this.recordStatus=false;
// this.loadPDDetails();
//this.getcommonDropDown();
}
ngAfterViewInit() {
this.dataSourceTab3.paginator = this.paginator;
this.dataSourceTab3.sort = this.sort;
}
// get changes for filter from parent componnet filter
ngOnChanges(changes: SimpleChanges) {
// let filteredText = changes.bindFilterValue.currentValue;
// filteredText = filteredText ? filteredText.trim() : filteredText;
let filteredText = changes.bindFilterValue.currentValue ? changes.bindFilterValue.currentValue.trim() : changes.bindFilterValue.currentValue;
filteredText = filteredText ? filteredText.toLowerCase() : filteredText;
this.dataSourceTab3.filter = filteredText;
}
// load inprogress pd list
loadPDDetails() {
this._pd.getTabStatusPdDetails(this.tabStatus)
.subscribe(
data => {
if (data.status == 200) {
this.scheduledPdListData = data.records;
this.dataLengthTab3 = data.records.length;
this.dataSourceTab3.data = this.scheduledPdListData;
}
else{
this.scheduledPdListData=[];
this.dataLengthTab3 = null;
this.recordStatus=true;
}
}
// , error => this.errorMessage = <any> error);
,error => {
this.errorMessage.push(error);
alert(error.html_format);
});
}
pageChange(e) {
console.log(e);
}
viewPD(pdid:string){
this.loadPdView.next(pdid);
}
titleCaseWord(word:string) {
if (!word) return word;
return word[0].toUpperCase() + word.substr(1).toLowerCase();
}
/**
* Common Search
* sriram
*/
getcommonDropDown() : void
{
this._pd.getAllMasterDatas('PDSTATUS').subscribe(res=>
{
if(res.dataStatus==true)
{
this.pdStatus = res.records.filter(status=>status.isactive==1 && status.pd_status_name==this.tabStatus);
// this.searchForm.controls['pd_status'].setValue(this.pdStatus[0]);
}
});
this._pd.getAllMasterDatas('PDTYPE').subscribe(res=>
{
if(res.dataStatus==true)
{
this.PDType = res.records.filter(type=>type.isactive==1);
}
});
// this._pd.getAllMasterDatas('CITY').subscribe(res=>
// {
// if(res.dataStatus==true)
// {
// this.CITY = res.records.filter(city=>city.isactive==1);
// }
// });
this._pd.getListOfCities().subscribe(res=>
{
if(res.dataStatus==true)
{
this.CITY = res.records;
}
});
this._pd.getAllMasterDatas('ENTITY').subscribe(res=>
{
if(res.dataStatus==true)
{
this.ENTITY = res.records.filter(ent=>ent.isactive==1);
}
});
this._pd.getAllMasterDatas('PRODUCTS').subscribe(res=>
{
if(res.dataStatus==true)
{
this.PRODUCTS = res.records.filter(pro=>pro.isactive==1);
}
});
}
checkDate(e)
{
console.log(e);
}
searchItem()
{
if(this.searchForm.value.pd_type !=null)
{
}else
{
this.searchForm.value.pd_type = [];
}
if(this.searchForm.value.pd_status !=null)
{
}else
{
this.searchForm.value.pd_status = [];
}
this.searchForm.value.pd_from_date = this.pipe.transform(this.searchForm.value.pd_from_date,'yyyy-MM-dd');
this.searchForm.value.pd_to_date = this.pipe.transform(this.searchForm.value.pd_to_date,'yyyy-MM-dd');
this._pd.overAllSearchFormDetails(this.searchForm.value).subscribe(res=>
{
this.xpandStatus = false;
if(res['dataStatus']==true)
{
this.dataSourceTab3 = res['records'];
this.dataSourceTab3.paginator = this.paginator;
}else{
this.notifier.notify('warning', 'No Records Found !');
this.dataSourceTab3.paginator['length'] = 0;
this.dataSourceTab3.paginator['pageIndex'] = 0;
this.dataSourceTab3.data = [];
}
},error => {
this.errorMessage.push(error);
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
alert(error.html_format);
});
}
onReset(){
this.searchForm.reset();
this.loadPDDetails();
this.xpandStatus = false;
}
}

Some files were not shown because too many files have changed in this diff Show More