This commit is contained in:
sriram-at-840620226347 2020-06-19 07:08:59 +05:30
commit 2e38443b48
681 changed files with 257220 additions and 0 deletions

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# Sparq Lender

41
ng6-seed/.gitignore vendored Executable file
View File

@ -0,0 +1,41 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
#System Files
.DS_Store
Thumbs.db

197
ng6-seed/angular.json Executable file
View File

@ -0,0 +1,197 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"optima": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico",
"src/firebase-messaging-sw.js",
"src/manifest.json"
],
"styles": [
"node_modules/quill/dist/quill.snow.css",
"node_modules/dragula/dist/dragula.css",
"node_modules/leaflet/dist/leaflet.css",
"node_modules/angular-calendar/scss/angular-calendar.scss",
"node_modules/@swimlane/ngx-datatable/release/index.css",
"node_modules/@swimlane/ngx-datatable/release/themes/material.css",
"src/assets/fonts/pe/css/pe-icon-set-weather.css",
"src/assets/fonts/data-table/icons.css",
"src/assets/styles/app.scss",
"src/assets/cropper/cropper.css",
"src/assets/glyphicons/glyphicons.css",
"node_modules/font-awesome/scss/font-awesome.scss",
"node_modules/perfect-scrollbar/css/perfect-scrollbar.css",
"node_modules/simple-line-icons/scss/simple-line-icons.scss"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/tether/dist/js/tether.min.js",
"node_modules/hammerjs/hammer.min.js",
"node_modules/sortablejs/Sortable.js",
"node_modules/chart.js/dist/Chart.bundle.min.js",
"src/assets/cropper/cropper.js"
]
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
},
"staging": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.stage.ts"
}]
},
"test":
{
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.stage.ts"
}]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "optima:build"
},
"configurations": {
"production": {
"browserTarget": "optima:build:production"
},
"test":{
"browserTarget": "optima:build:test"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "optima:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/tether/dist/js/tether.min.js",
"node_modules/hammerjs/hammer.min.js",
"node_modules/sortablejs/Sortable.js",
"node_modules/chart.js/dist/Chart.bundle.min.js",
"src/assets/cropper/cropper.js"
],
"styles": [
"node_modules/quill/dist/quill.snow.css",
"node_modules/dragula/dist/dragula.css",
"node_modules/leaflet/dist/leaflet.css",
"node_modules/angular-calendar/scss/angular-calendar.scss",
"node_modules/@swimlane/ngx-datatable/release/index.css",
"node_modules/@swimlane/ngx-datatable/release/themes/material.css",
"src/assets/fonts/pe/css/pe-icon-set-weather.css",
"src/assets/fonts/data-table/icons.css",
"src/assets/styles/app.scss",
"src/assets/cropper/cropper.css",
"src/assets/glyphicons/glyphicons.css",
"node_modules/font-awesome/scss/font-awesome.scss",
"node_modules/perfect-scrollbar/css/perfect-scrollbar.css",
"node_modules/simple-line-icons/scss/simple-line-icons.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": []
}
}
}
},
"optima-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "optima:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": []
}
}
}
}
},
"defaultProject": "optima",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}

View File

@ -0,0 +1,13 @@
import { PrimerPage } from './app.po';
describe('primer App', function() {
let page: PrimerPage;
beforeEach(() => {
page = new PrimerPage();
});
it('should expect true to be true', () => {
expect(true).toBe(true);
});
});

11
ng6-seed/e2e/app.po.ts Normal file
View File

@ -0,0 +1,11 @@
import { browser, element, by } from 'protractor';
export class PrimerPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2016"
],
"outDir": "../dist/out-tsc-e2e",
"module": "commonjs",
"target": "es6",
"types":[
"jasmine",
"node"
]
}
}

44
ng6-seed/karma.conf.js Normal file
View File

@ -0,0 +1,44 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
],
preprocessors: {
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};

12298
ng6-seed/package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

103
ng6-seed/package.json Executable file
View File

@ -0,0 +1,103 @@
{
"name": "optima",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"production": "node --max_old_space_size=6144 node_modules/@angular/cli/bin/ng build --prod --build-optimizer=true",
"staging": "node --max_old_space_size=6144 node_modules/@angular/cli/bin/ng build --prod --configuration=staging",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.5",
"@angular/animations": "^6.1.10",
"@angular/cdk": "^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.1.10",
"@angular/http": "^6.0.0-rc.6",
"@angular/material": "^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",
"@types/file-saver": "^2.0.0",
"amazon-cognito-identity-js": "^2.0.30",
"angular-calendar": "0.23.3",
"angular-notifier": "^4.1.1",
"angular-sortablejs": "^2.7.0",
"angular-split": "^3.0.2",
"angular-tree-component": "6.1.0",
"chart.js": "2.6.0",
"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.4.1",
"karma-jasmine": "^1.1.1",
"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-daterange-picker": "^1.1.4",
"ngx-mat-select-search": "^1.8.0",
"ngx-perfect-scrollbar": "5.0.0-7",
"ngx-viewer": "^1.0.1",
"node-sass": "^4.12.0",
"perfect-scrollbar": "^1.3.0",
"quill": "^1.2.0",
"rxjs": "^6.5.1",
"rxjs-compat": "^6.5.1",
"screenfull": "^3.2.2",
"simple-line-icons": "^2.4.1",
"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.12.4",
"@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-html-reporter": "^0.2.2",
"protractor": "5.1.2",
"ts-node": "~5.0.0",
"tslint": "~5.9.1",
"typescript": "^2.7.2"
}
}

644
ng6-seed/prepros-6.config Normal file
View File

@ -0,0 +1,644 @@
{
"name": "ng5",
"firstRun": false,
"exportConfig": true,
"fileConfigs": [
{
"path": "src/assets/styles/app.scss",
"configJson": "{\"forceCompile\":false,\"customOutput\":\"../../../../../../../../../Desktop/app.css\",\"autoCompile\":true,\"sourceMap\":false,\"compiler-node-sass\":{\"enabled\":true,\"outputStyle\":\"nested\"},\"compiler-autoprefixer\":{\"enabled\":true},\"compiler-minify-css\":{\"enabled\":false}}"
}
],
"fileTree": {
"expandedDirs": [
"src",
"src/assets",
"src/assets/styles"
],
"hideSystemFiles": true,
"systemFiles": [
".*",
"desktop.ini",
"prepros.config",
"$RECYCLE.BIN",
"prepros.cfg",
"prepros-6.config",
"Prepros Export"
],
"hideUnwatchedFiles": false
},
"imports": [
{
"path": "src/assets/styles/app.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/_material.themes.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/_core.scss",
"src/assets/styles/scss/_material.scss",
"src/assets/styles/scss/utilities/utilities.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss",
"src/assets/styles/scss/core/_scaffolding.scss",
"src/assets/styles/scss/core/_typography.scss",
"src/assets/styles/scss/core/_main-sidebar.scss",
"src/assets/styles/scss/core/_main-header.scss",
"src/assets/styles/scss/core/_main-panel.scss",
"src/assets/styles/scss/core/_notification-sidebar.scss",
"src/assets/styles/scss/core/_sessions.scss",
"src/assets/styles/scss/components/_perfect-scrollbar.scss",
"src/assets/styles/scss/components/_table.scss",
"src/assets/styles/scss/components/_custom.scss",
"src/assets/styles/scss/material/_buttons.scss",
"src/assets/styles/scss/material/_cards.scss",
"src/assets/styles/scss/material/_dialog.scss",
"src/assets/styles/scss/material/_lists.scss",
"src/assets/styles/scss/material/_select.scss",
"src/assets/styles/scss/material/_menus.scss",
"src/assets/styles/scss/material/_tabs.scss",
"src/assets/styles/scss/utilities/_background.scss",
"src/assets/styles/scss/utilities/_general.scss",
"src/assets/styles/scss/utilities/_spacing.scss",
"src/assets/styles/scss/utilities/_text.scss"
]
},
{
"path": "src/app/apps/chat/chat.component.scss",
"imports": [
"src/assets/styles/scss/components/_chat.scss",
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/app/apps/fullcalendar/fullcalendar.component.scss",
"imports": [
"src/assets/styles/scss/components/_calendar.scss",
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/app/apps/mail/mail.component.scss",
"imports": [
"src/assets/styles/scss/components/_messages.scss",
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/app/apps/social/social.component.scss",
"imports": [
"src/assets/styles/scss/components/_social.scss",
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/app/forms/editor/editor.component.scss",
"imports": [
"src/assets/styles/scss/components/_editor.scss",
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/app/forms/form-tree/form-tree.component.scss",
"imports": [
"src/assets/styles/scss/components/_treeview.scss",
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/app/forms/form-upload/form-upload.component.scss",
"imports": [
"src/assets/styles/scss/components/_upload.scss",
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/app/maps/map-google/map-google.component.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss"
]
},
{
"path": "src/assets/styles/scss/_core.scss",
"imports": [
"src/assets/styles/scss/core/_scaffolding.scss",
"src/assets/styles/scss/core/_typography.scss",
"src/assets/styles/scss/core/_main-sidebar.scss",
"src/assets/styles/scss/core/_main-header.scss",
"src/assets/styles/scss/core/_main-panel.scss",
"src/assets/styles/scss/core/_notification-sidebar.scss",
"src/assets/styles/scss/core/_sessions.scss",
"src/assets/styles/scss/components/_perfect-scrollbar.scss",
"src/assets/styles/scss/components/_table.scss",
"src/assets/styles/scss/components/_custom.scss"
]
},
{
"path": "src/assets/styles/scss/_material.scss",
"imports": [
"src/assets/styles/scss/material/_buttons.scss",
"src/assets/styles/scss/material/_cards.scss",
"src/assets/styles/scss/material/_dialog.scss",
"src/assets/styles/scss/material/_lists.scss",
"src/assets/styles/scss/material/_select.scss",
"src/assets/styles/scss/material/_menus.scss",
"src/assets/styles/scss/material/_tabs.scss"
]
},
{
"path": "src/assets/styles/scss/_mixins.scss",
"imports": [
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_calendar.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_chat.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_editor.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_messages.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_pricing.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_social.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_timeline.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_treeview.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/components/_upload.scss",
"imports": [
"src/assets/styles/scss/_material.variables.scss",
"src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"src/assets/styles/scss/_app.variables.scss",
"src/assets/styles/scss/_mixins.scss",
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss",
"src/assets/styles/scss/mixins/_breakpoints.scss",
"src/assets/styles/scss/mixins/_hover.scss",
"src/assets/styles/scss/mixins/_text-emphasis.scss",
"src/assets/styles/scss/mixins/_clearfix.scss",
"src/assets/styles/scss/mixins/_flex.scss",
"src/assets/styles/scss/mixins/_misc.scss"
]
},
{
"path": "src/assets/styles/scss/utilities/utilities.scss",
"imports": [
"src/assets/styles/scss/utilities/_background.scss",
"src/assets/styles/scss/utilities/_general.scss",
"src/assets/styles/scss/utilities/_spacing.scss",
"src/assets/styles/scss/utilities/_text.scss"
]
},
{
"path": "src/assets/styles/scss/mixins/bi-app/_bi-app-ltr.scss",
"imports": [
"src/assets/styles/scss/mixins/bi-app/_variables-ltr.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss"
]
},
{
"path": "src/assets/styles/scss/mixins/bi-app/_bi-app-rtl.scss",
"imports": [
"src/assets/styles/scss/mixins/bi-app/_variables-rtl.scss",
"src/assets/styles/scss/mixins/bi-app/_mixins.scss"
]
}
],
"projectView": {
"selectedView": "log"
},
"fileWatcher": {
"enabled": true,
"watchedExtensions": [
"less",
"sass",
"scss",
"styl",
"md",
"markdown",
"coffee",
"js",
"jade",
"haml",
"slim",
"ls",
"kit",
"png",
"jpg",
"jpeg",
"ts",
"pug",
"css",
"html",
"htm",
"php"
]
},
"pathFilters": [
"node_modules",
".*",
"bower_components",
"prepros.config",
"Prepros Export",
"prepros-6.config",
"prepros.cfg",
"wp-admin",
"wp-includes"
],
"server": {
"port": 7879,
"assignNewPortAutomatically": true,
"enable": true,
"proxy": {
"enable": false,
"url": ""
}
},
"browser-sync": {
"enable": false,
"clicks": true,
"forms": true,
"scroll": true
},
"live-reload": {
"enable": true,
"animate": true,
"delay": 0
},
"ftp-deploy": {
"connectionType": "ftp",
"remotePath": "",
"uploadTimeout": 20000,
"uploadOnChange": false,
"ftp": {
"secure": false,
"host": "",
"port": 21,
"user": "",
"password": ""
},
"sftp": {
"host": "",
"port": 22,
"usePrivateKey": false,
"username": "",
"password": "",
"privateKey": "",
"passphrase": ""
},
"pathFilters": [
"config.rb",
"prepros.config",
"prepros-6.config",
"node_modules",
"Prepros Export",
".git",
".idea",
".sass-cache",
".hg",
".svn",
".cache",
".DS_Store",
"*.sass",
"*.scss",
"*.less",
"*.pug",
"*.jade",
"*.styl",
"*.haml",
"*.slim",
"*.coffee",
"*.ls",
"*.kit",
"*.ts"
],
"history": []
},
"file-type-sass": "{\"compilers\":[\"node-sass\",\"autoprefixer\",\"minify-css\"]}",
"file-type-less": "{\"compilers\":[\"less\",\"autoprefixer\",\"minify-css\"]}",
"autoprefixer": {
"browsers": "last 5 versions"
},
"file-type-pug": "{\"compilers\":[\"pug\"]}",
"file-type-css": "{\"compilers\":[\"autoprefixer\",\"cssnext\",\"minify-css\"]}",
"file-type-javascript": "{\"compilers\":[\"concat-js\",\"babel\",\"uglify-js\"]}",
"file-type-stylus": "{\"compilers\":[\"stylus\",\"autoprefixer\",\"minify-css\"]}",
"file-type-markdown": "{\"compilers\":[\"markdown\"]}",
"file-type-haml": "{\"compilers\":[\"haml\"]}",
"file-type-slim": "{\"compilers\":[\"slim\"]}",
"file-type-coffee-script": "{\"compilers\":[\"coffee-script\",\"uglify-js\"]}",
"file-type-livescript": "{\"compilers\":[\"livescript\",\"uglify-js\"]}",
"file-type-kit": "{\"compilers\":[\"kit\"]}",
"uglify-js": {
"ie8": false,
"compress": {
"sequences": true,
"properties": true,
"dead_code": true,
"drop_debugger": true,
"unsafe": false,
"unsafe_comps": false,
"unsafe_math": false,
"unsafe_proto": false,
"unsafe_regexp": false,
"conditionals": true,
"comparisons": true,
"evaluate": true,
"booleans": true,
"loops": true,
"unused": true,
"toplevel": false,
"top_retain": "",
"hoist_funs": true,
"hoist_vars": false,
"if_return": true,
"join_vars": true,
"cascade": true,
"collapse_vars": true,
"reduce_vars": true,
"warnings": true,
"negate_iife": true,
"pure_getters": false,
"pure_funcs": [],
"drop_console": false,
"expression": false,
"keep_fargs": true,
"keep_fnames": false,
"passes": 1,
"keep_infinity": false,
"side_effects": true,
"global_defs": []
},
"output": {
"ascii_only": false,
"beautify": true,
"bracketize": false,
"comments": "",
"indent_level": 4,
"indent_start": 0,
"inline_script": false,
"keep_quoted_props": false,
"max_line_len": false,
"preamble": "",
"preserve_line": false,
"quote_keys": false,
"quote_style": 0,
"semicolons": true,
"shebang": true,
"width": 80
}
},
"cssnext": {
"customProperties": true,
"applyRule": true,
"calc": false,
"nesting": true,
"customMedia": true,
"mediaQueriesRange": true,
"customSelectors": true,
"attributeCaseInsensitive": true,
"colorRebeccapurple": true,
"colorHwb": true,
"colorGray": true,
"colorHexAlpha": true,
"colorFunction": true,
"fontVariant": true,
"filter": true,
"initial": true,
"rem": true,
"pseudoElements": true,
"pseudoClassMatches": true,
"pseudoClassNot": true,
"pseudoClassAnyLink": true,
"colorRgba": true,
"overflowWrap": true
},
"file-type-typescript": "{\"compilers\":[\"typescript\",\"uglify-js\"]}",
"babel": {
"useBabelRc": true,
"presets": {
"babel-preset-es2015": true
},
"plugins": {
"babel-plugin-syntax-jsx": true,
"babel-plugin-transform-react-jsx": true,
"babel-plugin-transform-async-to-generator": true,
"babel-plugin-transform-class-properties": true,
"babel-plugin-transform-object-rest-spread": true
}
},
"file-type-png": "{\"compilers\":[\"png\"]}",
"file-type-jpg": "{\"compilers\":[\"jpg\"]}"
}

View File

@ -0,0 +1,30 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

View File

@ -0,0 +1,790 @@
import { Injectable } from "@angular/core";
import {
AuthenticationDetails,
CognitoUserPool,
CognitoUser,
CognitoUserAttribute,
ICognitoUserAttributeData,
ISignUpResult,
CognitoUserSession
} from "amazon-cognito-identity-js";
import * as AWS from "aws-sdk";
import { Observable } from "rxjs/Observable";
import "rxjs/add/operator/map";
// import AWS from "aws-sdk/dist/aws-sdk";
//environment
import { environment } from '../../environments/environment';
import { Http, Headers, RequestOptions } from '@angular/http';
import { HttpClient } from '@angular/common/http';
import 'rxjs/add/operator/map';
import { CognitoService } from './cognito.service';
// const sineedge_poolData = {
// UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
// ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
// };
const sineedgedev_poolData = {
UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV
ClientId: "67b4fnbuols5upms5to8bvqddh"// ClientName: SINEEDGE_DEV_WEB
}
// client id changed on 12-04-2019 by kms
//ClientId: "2o5c3cs9k3als16nqhp3irh8rs"
const lender_poolData = {
UserPoolId: environment.lenUserPoolId, // Username :SPARQ_LENDER_DEV
ClientId: environment.lenClientId // ClientName:LENDER_DEV_WEB
};
const vendor_poolData = {
// UserPoolId: "ap-south-1_K57yPaWxV",
UserPoolId: environment.venUserPoolId, // Username :SPARQ_VENDER_DEV
ClientId: environment.venClientId // ClientName:VENDER_DEV_WEB
}
// const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
const lenderUserPool = new CognitoUserPool(lender_poolData);
const vendorUserPool = new CognitoUserPool(vendor_poolData);
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
/**
* Identity PoolID
*/
const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
const vendorIdenttiy = "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874";
// serviceProvider
const apiurl = environment.apiEndpoint;
//const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
//const apiurl = "http://localhost/sparqapi/api/";
@Injectable({
providedIn: "root"
})
export class AwsService {
//public static _REGION = environment.region;
mySecData: any;
cognitoUser: any;
jwttoken: any;
cognitousers: any;
localUserId:any = '';
constructor(public http: Http, public RequestOptions: RequestOptions,public shared:CognitoService) { }
/**
* Login Function
* @param authenticationData inside of(email and password for login user)
* By sriram
*/
dologin(authenticationData) {
//(authenticationData);
const authenticationDetails = new AuthenticationDetails(authenticationData);
let Newpassword = authenticationData.newpassword;
let attributesData = [];
const userData = {
Username: authenticationData.Username, // User email id
Pool: vendorUserPool // user Pool ID
};
let cognitoUser = new CognitoUser(userData);
return Observable.create(observer => {
cognitoUser.authenticateUser(authenticationDetails, {
newPasswordRequired: (userAttributes, requiredAttributes) => { // new password set
cognitoUser.completeNewPasswordChallenge(
Newpassword,
attributesData,
{
onSuccess: function (result) {
observer.next(result);
observer.complete();
},
onFailure: function (err) {
//(err);
observer.error(err);
//LoginComponent.prototype.open();
}
}
);
},
onSuccess: function (result) { // success user login
// let accessToken = result.getAccessToken().getJwtToken();
////(result);
//window.localStorage.setItem('Currentuser', '1');
observer.next(result);
observer.complete();
},
onFailure: function (err) { // error user login
alert(err.message);
observer.error(err);
}
});
});
}
/**
* End of the login function
*/
/**
* User forget password
*/
userforgotpass(auth) {
////(auth);
const userData = {
Username: auth.Username,
Pool: vendorUserPool
};
let cognitoUser = new CognitoUser(userData);
return Observable.create(observe => {
cognitoUser.forgotPassword({
onSuccess: function (data) {
// successfully initiated reset password request
//('CodeDeliveryData from forgotPassword: ' + data);
observe.next(data);
},
onFailure: function (err) {
alert(err.message || JSON.stringify(err));
},
//Optional automatic callback
inputVerificationCode: function (data) {
//('Code sent to: ' + data);
var verificationCode = prompt('Enter Verification Code Sent to Mobile ', '');
var newPassword = prompt('Enter New Password ', '');
cognitoUser.confirmPassword(verificationCode, newPassword, {
onSuccess() {
//('Password confirmed!');
},
onFailure(err) {
//('Password not confirmed!');
}
});
}
});
});
}
/**
* End of the function
*/
/**
* Logout function
*/
logout(){
return Observable.create(observe=>{
this.shared.getCurrentUser().signOut();
observe.next();
observe.complete();
});
}
/**
* Config function
*/
getconfig() {
let session:any = this.shared.getAccessToken() || "";
let config = "";
config += AWS.config.region = "ap-south-1";
config += AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 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 */
};
} else if (userdata.fk_entity_type_id == 3) {
params = {
UserPoolId: vendor_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 */
};
} else if (userdata.fk_entity_type_id == 3) {
params = {
UserPoolId: vendor_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 */
};
}else if(awsuser.fk_entity_id ==3){
params= {
UserPoolId: vendor_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 */
};
}else if(aws.fk_entity_id ==3){
params= {
UserPoolId: vendor_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
}
}else if(enitiy ==3){
params = {
UserPoolId:vendor_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);}
})
});
}
}

View File

@ -0,0 +1,206 @@
import { Injectable } from '@angular/core';
import * as AWS from "aws-sdk";
import { CanActivateChild, Router } from '@angular/router';
import {
AuthenticationDetails,
CognitoUserPool,
CognitoUser,
CognitoUserAttribute,
ICognitoUserAttributeData,
ISignUpResult,
CognitoUserSession
} from "amazon-cognito-identity-js";
import { environment } from '../../environments/environment';
import { BehaviorSubject,Observable,of } from 'rxjs';
const sineedge_poolData = {
UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
};
const sineedgedev_poolData = {
UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV
ClientId: "67b4fnbuols5upms5to8bvqddh" // ClientName: SINEEDGE_DEV_WEB
}
const lender_poolData = {
UserPoolId: environment.lenUserPoolId, // Username :SPARQ_LENDER_DEV
ClientId: environment.lenClientId // ClientName:LENDER_DEV_WEB
};
const vendor_poolData = {
// UserPoolId: "ap-south-1_K57yPaWxV",
UserPoolId: environment.venUserPoolId, // Username :SPARQ_VENDER_DEV
ClientId: environment.venClientId // ClientName:VENDER_DEV_WEB
}
const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
const lenderUserPool = new CognitoUserPool(lender_poolData);
const vendorUserPool = new CognitoUserPool(vendor_poolData);
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
/**
* Identity PoolID
*/
const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
const vendorIdenttiy = "";
// serviceProvider
//const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
const apiurl = environment.apiEndpoint;
// const apiurl = "http://localhost/sparqapi/api/";
export interface Callback {
callback(): void;
callbackWithParam(result: any): void;
}
@Injectable({
providedIn: 'root'
})
export class CognitoService implements CanActivateChild {
public loggedIn :boolean = false;
// public static _REGION = environment.region;
// public static _IDENTITY_POOL_ID = environment.identityPoolId;
// public static _USER_POOL_ID = environment.UserPoolId;
// public static _CLIENT_ID = environment.ClientId;
// public static _POOL_DATA: any = {
// UserPoolId: CognitoService._USER_POOL_ID,
// ClientId: CognitoService._CLIENT_ID
// };
get isLoggedIn() {
if(vendorUserPool.getCurrentUser() !=null){
this.loggedIn = true;
}else{
this.loggedIn = false;
}
return this.loggedIn; // {2}
}
canActivateChild(){
if(this.getToken()){
//alert('session valid')
return true;
}else{
this.route.navigate(['/authentication/login']);
//alert('session valid timeout');
return false;
}
}
public cognitoCreds: AWS.CognitoIdentityCredentials;
isloggin:boolean = false;
// getUserPool() {
// if (environment.cognito_idp_endpoint) {
// CognitoService.sineedgedev_poolData.endpoint = environment.cognito_idp_endpoint;
// }
// return new CognitoUserPool(CognitoService.sineedgedev_poolData);
// }
getCurrentUser() {
return vendorUserPool.getCurrentUser();
}
constructor(public route:Router) { }
// getAccessToken(callback: Callback): void {
// if (callback == null) {
// throw("CognitoUtil: callback in getAccessToken is null...returning");
// }
// if (this.getCurrentUser() != null) {
// this.getCurrentUser().getSession(function (err, session) {
// if (err) {
// console.log("CognitoUtil: Can't set the credentials:" + err);
// callback.callbackWithParam(null);
// }
// else {
// if (session.isValid()) {
// console.log("62");
// callback.callbackWithParam(session.getAccessToken().getJwtToken());
// }
// }
// });
// }
// else {
// callback.callbackWithParam(null);
// }
// }
refresh() {
let tokenexp:boolean;
this.getCurrentUser().getSession(function (err, session) {
if (err) {
}
else {
if (session.isValid()) {
tokenexp = session.isValid();
of(tokenexp)
} else {
tokenexp = session.isValid();
}
}
return tokenexp;
});
}
getAccessToken(){
this.refresh();
let jwttoken = '';
if (this.getCurrentUser() != null) {
//console.log(JSON.stringify(this.getCurrentUser()));
// console.log('76 if');
this.getCurrentUser().getSession(function (err, session) {
if (err) {
jwttoken ='';
// console.log('81 if')
}
else {
if (session.isValid()) {
// console.log('85 else if');
jwttoken = session;
} else {
}
}
});
}
else {
//console.log("else");
}
return jwttoken;
}
getToken():boolean {
let isloggin = false;
if (this.getCurrentUser() != null) {
//console.log(JSON.stringify(this.getCurrentUser()));
//console.log('76 if');
this.getCurrentUser().getSession(function (err, session) {
if (err) {
// console.log("CognitoUtil: Can't set the credentials:" + err);
isloggin = false;
//console.log('81 if')
}
else {
if (session.isValid()) {
// console.log('85 else if');
isloggin = true;
} else {
isloggin = false;
}
}
});
}
else {
// console.log("else");
isloggin = false;
}
return isloggin;
}
}

View File

@ -0,0 +1,48 @@
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router';
import { Observable , of } from 'rxjs';
import { CognitoService } from '../AwsService/cognito.service';
@Injectable()
export class AuthGuard implements CanActivate, CanActivateChild {
constructor(private router: Router,public shared:CognitoService) { }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (this.shared.getToken()) {
alert("if");
// this.router.navigate(['']);
return true
} else {
alert("else");
this.router.navigate(['/login']);
return false;
}
}
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
if (this.shared.getToken()) {
// alert("if");
return true;
} else {
// alert("else");
setTimeout(() => {
this.router.navigate(['authentication/login']);
return false;
},1000);
}
}
// public getToken(): string {
// return localStorage.getItem('token');
// }
// public logOut() {
// localStorage.clear();
// if(localStorage.getItem('token') === null){
// this.router.navigate(['/login']);
// }
// }
}

View File

@ -0,0 +1,72 @@
import { Injectable } from '@angular/core';
import {
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor,
HttpHeaders,
HttpResponse
} from '@angular/common/http';
// import { AuthGuard } from './auth.guard';
import { Observable, of } from 'rxjs';
import { Router } from '@angular/router';
import { catchError, map, tap } from 'rxjs/operators';
import { HttpErrorResponse } from "@angular/common/http";
import { CognitoService } from '../AwsService/cognito.service';
import {environment} from '../../environments/environment'
import { LoaderService } from 'app/shared/loaderService/loader.service';
@Injectable()
export class TokenInterceptor implements HttpInterceptor{
constructor( private router: Router,public shared:CognitoService,private loaderService:LoaderService) {}
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// request = request.clone({
// setHeaders: {
// Authorization: `${this.auth.getToken()}`
// }
// });
this.showLoader();
let token:any = this.shared.getAccessToken() ||"";
//console.log(token);
let requests = request.clone({
headers:new HttpHeaders({
'Authorization': environment.authorization,
'Token': token.getIdToken().getJwtToken()
})
});
return next.handle(requests).pipe(tap((event:HttpEvent<any>)=>{
if (event instanceof HttpResponse) {
this.onEnd();
}
},
(err: any) => {
this.onEnd();
this.handleError<any>('role',err);
}));
}
private handleError<T> (operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
if(error instanceof HttpErrorResponse){
console.error("Error: " + error.status);
if(error.status == 401){
localStorage.clear();
this.router.navigate(['/authentication/login']);
}
return of(result as T);
}
};
}
private onEnd(): void {
this.hideLoader();
}
private showLoader(): void {
this.loaderService.show();
}
private hideLoader(): void {
this.loaderService.hide();
}
}

View File

@ -0,0 +1,3 @@
<h1>
{{title}}
</h1>

View File

@ -0,0 +1,5 @@
describe('App: Optima', () => {
it('should expect true to be true', () => {
expect(true).toBe(true);
});
});

View File

@ -0,0 +1,16 @@
import { Component } from '@angular/core';
import { TranslateService} from '@ngx-translate/core';
@Component({
selector: 'app-root',
template: '<router-outlet></router-outlet>'
})
export class AppComponent {
constructor(translate: TranslateService) {
translate.addLangs(['en', 'fr']);
translate.setDefaultLang('en');
const browserLang: string = translate.getBrowserLang();
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
}
}

128
ng6-seed/src/app/app.module.ts Executable file
View File

@ -0,0 +1,128 @@
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } 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';
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {TranslateService} from '@ngx-translate/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { DemoMaterialModule } from './shared/demo.module';
import {MatSidenavModule} from '@angular/material/sidenav';
import {MatInputModule} from '@angular/material/input';
import {MatIconModule} from '@angular/material/icon';
import {MatListModule} from '@angular/material/list';
import {MatMenuModule} from '@angular/material/menu';
import {MatToolbarModule} from '@angular/material/toolbar';
import {MatTabsModule} from '@angular/material/tabs';
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';
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';
import { SalesPdComponent } from './sales-pd/sales-pd.component';
import { PdTrigerService } from './personal-discussion/pd-service/pd-triger.service';
import { LoaderService } from './shared/loaderService/loader.service';
import { HttpLoaderComponent } from './layouts/http-loader/http-loader.component';
import { AdvanceFilterComponent } from './sales-pd/advance-filter/advance-filter.component';
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}
export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
suppressScrollX: true
};
@NgModule({
declarations: [
AppComponent,
AdminLayoutComponent,
AuthLayoutComponent,
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, SalesPdComponent,
HttpLoaderComponent,
AdvanceFilterComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
SharedModule,
RouterModule.forRoot(AppRoutes),
FormsModule,
HttpModule,
MatSidenavModule,
MatInputModule,
MatIconModule,
MatListModule,
MatMenuModule,
MatToolbarModule,
MatTabsModule,
MatCheckboxModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatSelectModule,
MatCardModule,
MatBadgeModule,
DemoMaterialModule,
MatFormFieldModule,
HttpClientModule,
ResizableModule,
ReactiveFormsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
}
}),
FlexLayoutModule,
],
providers: [
{
provide: LocationStrategy,
useClass: HashLocationStrategy,
},
AwsService,AuthGuard,
TranslateService,
PdTrigerService,LoaderService,
// {
// provide: PERFECT_SCROLLBAR_CONFIG,
// useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
// },
{
provide:HTTP_INTERCEPTORS,
useClass: TokenInterceptor,
multi: true
}
],
entryComponents: [NewPasswordDialog,ForgotPass,ChangePasswordDialog],
bootstrap: [AppComponent]
})
export class AppModule { }

54
ng6-seed/src/app/app.routing.ts Executable file
View File

@ -0,0 +1,54 @@
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';
import { SalesPdComponent } from './sales-pd/sales-pd.component';
export const AppRoutes: Routes = [{
path: '',
redirectTo: 'personal_discussion',
pathMatch: 'full',
}, {
path: '',
component: AdminLayoutComponent,
canActivateChild:[AuthGuard],
children: [{
path: 'home',
loadChildren: './dashboard/dashboard.module#DashboardModule'
},{
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:'sales-pd-list',
component:SalesPdComponent
},
{
path:'reports',
loadChildren:'./reports/reports.module#ReportsModule'
},
]
}, {
path: '',
component: AuthLayoutComponent,
children: [{
path: 'authentication',
loadChildren: './session/session.module#SessionModule'
},{
path: 'error',
loadChildren: './error/error.module#ErrorModule'
},]
}, {
path: '**',
redirectTo: 'session/404'
}];

View File

@ -0,0 +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: '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
}
]
}
];

View File

@ -0,0 +1,141 @@
<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>

View File

@ -0,0 +1,74 @@
$red: #f5515f;
$blue: #05abe0;
$grey: #343434;
$p: 12px;
::ng-deep .ngx-mat-drp-date-input{text-overflow:ellipsis !important;color:#fff !important;}
mat-card-title{
background-color:#E00201 !important;
color:#fff;
}
.mat-input-wrapper {
background: #fff;
}
li
{
display:inline-block;
//float:left;
}
.example-full-width {
width: 95%;
}
.oval {
height: 13px;
width: 25px;
border-radius: 50%;
}
// .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%;
}
.donut-inner{
margin-top: -165px;
// margin-left: 120px;
}
.donut-inner h5 {
margin-bottom: 5px;
margin-top: 0;
}
.donut-inner span{
font-size:1rems;
}
mat-card-content{
min-height: 400px;
}
.chart{
padding: 0.8rem;
}
::ng-deep .body-container{
padding: 0rem !important;
}

View File

@ -0,0 +1,41 @@
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 {
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);
}
}

View File

@ -0,0 +1,38 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ChartsModule } from 'ng2-charts/ng2-charts';
import { NgxChartsModule} from '@swimlane/ngx-charts';
import { MatIconModule,
MatCardModule,
MatTabsModule,
MatButtonModule} from '@angular/material';
import { DashboardComponent } from './dashboard.component';
import { DashboardRoutes } from './dashboard.routing';
/** Dashboard Service */
import { DashboardService } from './dashboard.service';
import { PersonalDiscussionModule } from 'app/personal-discussion/personal-discussion.module';
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(DashboardRoutes),
MatIconModule,
MatCardModule,
MatTabsModule,
MatButtonModule,
ChartsModule,
NgxChartsModule,
MatCardModule,
FlexLayoutModule
],
providers: [ DashboardService ],
declarations: [ DashboardComponent ]
})
export class DashboardModule {}

View File

@ -0,0 +1,17 @@
import { Routes } from '@angular/router';
export const DashboardRoutes: Routes = [
// {
// path: '',
// component: DashboardComponent
// },
// {
// path: '',
// redirectTo: 'personal_discussion',
// pathMatch: 'full',
// },
// {
// path:'personal_discussion',
// loadChildren:'./personal-discussion/personal-discussion.module#PersonalDiscussionModule'
// }
];

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,28 @@
/** 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) { }
getCommonSettingsConfig(){
return this._http.post(this.apiUrl+'getCommonConfig', '');
}
}

View File

@ -0,0 +1,17 @@
<div class="relative">
<div class="form-bg">
<div class="relative error-wrapper">
<h1>
Oops!</h1>
<span class="error-text">404</span>
<h2>
Not Found</h2>
<div class="error-details">
<p> Sorry, an error has occured, Requested page not found!</p>
</div>
<div class="error-actions">
<button class="mat-blue" mat-raised-button>Take me to home</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,20 @@
import { Component, OnInit,ViewEncapsulation } from '@angular/core';
@Component({
selector: 'ms-error-404',
templateUrl:'./error-404-component.html',
styleUrls: ['./error-404-component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ErrorOneComponent implements OnInit {
constructor() {}
ngOnInit() {
}
}

View File

@ -0,0 +1,17 @@
<div class="relative">
<div class="form-bg">
<div class="relative error-wrapper">
<h1>
Error!</h1>
<span class="error-text">505</span>
<h2>
Service is currently unavailbale</h2>
<div class="error-details">
<p>Sorry, but the page you were trying to view does not exist</p>
</div>
<div class="error-actions">
<button class="mat-blue" mat-raised-button>Take me to home</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,20 @@
import { Component, OnInit,ViewEncapsulation } from '@angular/core';
@Component({
selector: 'ms-error-503',
templateUrl:'./error-503-component.html',
styleUrls: ['./error-503-component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ErrorTwoComponent implements OnInit {
constructor() {}
ngOnInit() {
}
}

View File

@ -0,0 +1,38 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { MatIconModule} from '@angular/material';
import {
MatCardModule,
MatInputModule,
MatRadioModule,
MatButtonModule,
MatProgressBarModule,
MatToolbarModule } from '@angular/material';
import { ErrorOneComponent} from './404/error-404.component';
import { ErrorTwoComponent} from './503/error-503.component';
import { ErrorRoutes } from './error.routing';
@NgModule({
imports: [
CommonModule,
FormsModule,
MatIconModule,
MatCardModule,
MatIconModule,
MatInputModule,
MatRadioModule,
MatButtonModule,
MatProgressBarModule,
MatToolbarModule,
RouterModule.forChild(ErrorRoutes)
],
declarations: [
ErrorOneComponent,
ErrorTwoComponent,
]
})
export class ErrorModule {}

View File

@ -0,0 +1,19 @@
import { Routes } from '@angular/router';
import { ErrorOneComponent} from './404/error-404.component';
import { ErrorTwoComponent} from './503/error-503.component';
export const ErrorRoutes: Routes = [{
path: '',
redirectTo: '404',
pathMatch: 'full',
},{
path: '',
children: [{
path: '404',
component: ErrorOneComponent
}, {
path: '503',
component: ErrorTwoComponent
}]
}];

View File

@ -0,0 +1,603 @@
<div class="app search-i" [dir]="layoutDir" [ngClass]="[ menuLayout, selectedSidebarImage, selectedSidebarColor, selectedHeaderColor, collapsedClass]" [class.app-dark]="dark" [class.boxed]="boxed" [class.collapsed-sidebar]="collapseSidebar" [class.compact-sidebar]="compactSidebar" [class.bg-img-disable]="!sidebarBg">
<mat-sidenav-container class="app-inner">
<mat-sidenav #sidemenu class="sidebar-panel" id="sidebar-panel" [mode]="isOver() ? 'over' : 'side'" [opened]="!isOver()" (mouseover)="menuMouseOver()" (mouseout)="menuMouseOut()">
<div class="opt-side relative ">
<div class="sidebar-container ">
<div class="branding text-center">
<!-- <h2><i class="fa fa-superpowers" aria-hidden="true"></i> <span> OPTIMA</span>
</h2> -->
<h2>
<img src="assets/images/PD.jpeg" style="height: 50px;"> <!-- <span> {{userDep}} </span> -->
</h2>
</div>
<div class="main-nav">
<div class="user-pro-wrap">
<div class="user-profile-thumb text-center">
<div class="user-i">
<div><h3>{{userDep}} </h3></div>
<img [src]="profileurl ||'http://image.ibb.co/mGjZB9/usernew.png'" class="rad-full mb-1" width="100" height="100" alt="">
<div><h4>{{fullName}}</h4></div>
<div><h5>{{roleName}}</h5></div>
</div>
</div>
<div class="most-used text-center">
<a class="most-link" color="primary" (click)="menunav('HOME')">
<mat-icon>home</mat-icon>
</a>
<a class="most-link" color="primary" (click)="menunav('USERS')">
<mat-icon>person</mat-icon>
</a>
<!---- <a class="most-link" color="primary" (click)="menunav('SETTINGS')">
<mat-icon>settings</mat-icon>
</a>-->
</div>
</div>
<mat-nav-list appAccordion class="navigation relative">
<mat-list-item appAccordionLink *ngFor="let menuitem of currentUser.short_name == 'MWISE' ? menuItems.salesgetAll() : menuItems.getAll() | roleMenuItems:'2'">
<a appAccordionToggle class="relative" mat-ripple [routerLink]="['/', menuitem.state]" *ngIf="menuitem.type === 'link'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<span>{{ menuitem.name | translate }}</span>
<span fxFlex></span>
<span class="menu-badge mat-{{ badge.type }}" *ngFor="let badge of menuitem.badge">{{ badge.value }}</span>
</a>
<a appAccordionToggle class="relative" mat-ripple href="{{menuitem.state}}" *ngIf="menuitem.type === 'extLink'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<span>{{ menuitem.name | translate }}</span>
<span fxFlex></span>
<span class="menu-badge mat-{{ badge.type }}" *ngFor="let badge of menuitem.badge">{{ badge.value }}</span>
</a>
<a appAccordionToggle class="relative" mat-ripple href="{{menuitem.state}}" target="_blank" *ngIf="menuitem.type === 'extTabLink'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<span>{{ menuitem.name | translate }}</span>
<span fxFlex></span>
<span class="menu-badge mat-{{ badge.type }}" *ngFor="let badge of menuitem.badge">{{ badge.value }}</span>
</a>
<a appAccordionToggle class="relative" mat-ripple href="javascript:;" *ngIf="menuitem.type === 'sub'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<span>{{ menuitem.name | translate }}</span>
<span fxFlex></span>
<span class="menu-badge mat-{{ badge.type }}" *ngFor="let badge of menuitem.badge">{{ badge.value }}</span>
<mat-icon class="menu-caret">arrow_drop_down</mat-icon>
</a>
<mat-nav-list class="sub-menu" *ngIf="menuitem.type === 'sub'">
<mat-list-item *ngFor="let childitem of menuitem.children" routerLinkActive="open">
<a [routerLink]="['/', menuitem.state, childitem.state ]" class="relative" mat-ripple>{{ childitem.name | translate }}</a>
</mat-list-item>
</mat-nav-list>
<!-- Multi-->
<a appAccordionToggle class="relative" mat-ripple href="javascript:;" *ngIf="menuitem.type === 'multi'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<span>{{ menuitem.name | translate }}</span>
<span fxFlex></span>
<span class="menu-badge mat-{{ badge.type }}" *ngFor="let badge of menuitem.badge">{{ badge.value }}</span>
<mat-icon class="menu-caret">arrow_drop_down</mat-icon>
</a>
<div *ngFor="let multichild of menuitem.multichild" >
<mat-nav-list class="sub-menu" *ngIf="multichild.type === 'sub'">
<mat-list-item *ngFor="let childitem of multichild.children" routerLinkActive="open">
<a [routerLink]="['/', multichild.state, childitem.state ]" class="relative" mat-ripple>{{ childitem.name | translate }}</a>
</mat-list-item>
</mat-nav-list>
</div>
<!--End-->
</mat-list-item>
<mat-divider></mat-divider>
<!-- <mat-list-item>
<a (click)="addMenuItem()">
<mat-icon>add</mat-icon>
<span>Add</span>
</a>
</mat-list-item> -->
</mat-nav-list>
</div>
</div>
</div>
<div class="bg-overlay"></div>
</mat-sidenav>
<mat-toolbar class="main-header" style="border-bottom:2px solid #f44336;">
<div class="horizontal-top-bar w-100">
<div fxFlex.sm="100" fxFlex.xs="100" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33" fxFlex="100">
<div class="horizontal-logo">
<div class="branding">
<!-- <h2><i class="fa fa-superpowers" aria-hidden="true"></i> <span> OPTIMA</span>
</h2> -->
<!--<h2><i class="fa fa-superpowers" aria-hidden="true"></i> <span> {{userDep}}({{fullName}})</span>
</h2>-->
<a (click)="menunav('HOME')">
<img [routerLink]="['/dashboard']" src="assets/images/PD.jpeg" style="height: 35px;"> <strong> | </strong> <span> {{userDep}} </span>
</a>
</div>
</div>
</div>
<div fxFlex.sm="100" fxFlex.xs="100" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33" fxFlex="100">
<!--<div class="search-bar" fxFlex>
<form class="search-form">
<mat-icon>search</mat-icon>
<input type="text" placeholder="Search" autofocus="true" />
</form>
</div>-->
</div>
<div fxFlex.sm="100" fxFlex.xs="100" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33" fxFlex="100">
<div class="menu-links">
<span *ngFor="let menuitem of currentUser.short_name == 'MWISE' ? horizontalMenuItems.salesgetAll() : horizontalMenuItems.getAll() | roleMenuItems:'1'">
<button mat-icon-button matTooltip="{{ menuitem.name}}" matTooltipPosition="below" [routerLink]="['/'+menuitem.state]" *ngIf="menuitem.type === 'link'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<!--<span>{{ menuitem.name | translate }}</span>-->
</button>
</span>
<!-- <span *ngFor="let menuitem of horizontalMenuItems.getAll()">
<span *ngIf="menuitem.type === 'multi'">
<button [mat-menu-trigger-for]="multi" matTooltip="{{ menuitem.name}}" matTooltipPosition="below" mat-icon-button class="ml-xs" *ngIf="userRoleType=='10'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
</button>
<mat-menu #multi="matMenu" class="opt-menu" x-position="before">
<div mat-menu-item class="head-menu grad-blue">
{{ menuitem.name}}
</div>
<div class="dropdown">
<div *ngFor="let childitem of menuitem.children">
<button mat-menu-item [routerLink]="['/'+childitem.state ]">{{ childitem.name | translate }}</button>
</div>
</div>
</mat-menu>
</span>
</span> -->
<!-- <button appToggleFullscreen matTooltip="Fullscreen" matTooltipPosition="below" mat-icon-button>
<mat-icon>fullscreen</mat-icon>
</button> -->
<!--<button [mat-menu-trigger-for]="user2" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>message</mat-icon>
</button>
<mat-menu #user2="matMenu" class="opt-menu" x-position="after">
<div mat-menu-item class="head-menu grad-blue">
Message Menu
</div>
<button mat-menu-item>
<img width="40" src="assets/images/user-1.jpg" alt="">
Next Update for angular 5
</button>
<button mat-menu-item>
<img width="40" src="assets/images/user-2.jpg" alt="">
Check out our new admin theme
</button>
<button mat-menu-item>
<img width="40" src="assets/images/user-3.jpg" alt="">
Expedita quo, laboriosam officia.
</button>
<button mat-menu-item>
<img width="40" src="assets/images/user-4.jpg" alt="">
Lorem ipsum dolor sit amet consectetur.
</button>
</mat-menu>
<button [mat-menu-trigger-for]="user1" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>reorder</mat-icon>
<span class="notification-label">3</span>
</button> -->
<!-- <mat-menu #user1="matMenu" class="opt-menu" x-position="before">
<div mat-menu-item class="head-menu grad-blue">
User Menu
</div>
<button mat-menu-item>
<mat-icon>show_chart</mat-icon>
Charts
</button>
<button mat-menu-item>
<mat-icon>navigation</mat-icon>
Maps
</button>
<button mat-menu-item>
<mat-icon>web</mat-icon>
Calendar Settings
</button>
</mat-menu> -->
<!-- <button (click)="end.toggle()" matTooltip="Notifications" matTooltipPosition="below" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>notifications</mat-icon> -->
<!-- <span class="notification-label">2</span> -->
<!-- <span *ngIf="alertCount != 0" style = "width:23px" class="notification-label" >{{alertCount}}</span>
</button> -->
<button [mat-menu-trigger-for]="user" mat-icon-button class="ml-xs">
<mat-icon>person</mat-icon>
</button>
<mat-menu #user="matMenu" class="opt-menu" x-position="before">
<div mat-menu-item class="head-menu grad-blue">
Settings
</div>
<button mat-menu-item>
<mat-icon>settings</mat-icon>
Setting
</button>
<button mat-menu-item (click)="userprofile()">
<mat-icon>account_box</mat-icon>
Profile
</button>
<!-- <button mat-menu-item>
<mat-icon>notifications_off</mat-icon>
Disable notifications
</button> -->
<button mat-menu-item (click)="logout()">
<mat-icon>exit_to_app</mat-icon>
Sign Out
</button>
</mat-menu>
</div>
</div>
</div>
<div class="vertical-menu w-100">
<button (click)="menuToggleFunc()" mat-icon-button class="lines-btn">
<mat-icon>menu</mat-icon>
</button>
<!-- <div class="search-bar" fxFlex>
<form class="search-form" fxShow="false" fxShow.gt-xs>
<mat-icon>search</mat-icon>
<input type="text" placeholder="Search" autofocus="true" />
</form>
</div> -->
<span fxFlex></span>
<!-- <button appToggleFullscreen mat-icon-button>
<mat-icon>fullscreen</mat-icon>
</button> -->
<!-- <button [mat-menu-trigger-for]="user2" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>message</mat-icon>
</button>
<mat-menu #user2="matMenu" class="opt-menu" x-position="after">
<div mat-menu-item class="head-menu grad-blue">
Message Menu
</div>
<button mat-menu-item>
<img width="40" src="assets/images/user-1.jpg" alt="">
Next Update for angular 5
</button>
<button mat-menu-item>
<img width="40" src="assets/images/user-2.jpg" alt="">
Check out our new admin theme
</button>
<button mat-menu-item>
<img width="40" src="assets/images/user-3.jpg" alt="">
Expedita quo, laboriosam officia.
</button>
<button mat-menu-item>
<img width="40" src="assets/images/user-4.jpg" alt="">
Lorem ipsum dolor sit amet consectetur.
</button>
</mat-menu>
<button [mat-menu-trigger-for]="user1" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>reorder</mat-icon>
<span class="notification-label">3</span>
</button>
<mat-menu #user1="matMenu" class="opt-menu" x-position="before">
<div mat-menu-item class="head-menu grad-blue">
User Menu
</div>
<button mat-menu-item>
<mat-icon>show_chart</mat-icon>
Charts
</button>
<button mat-menu-item>
<mat-icon>navigation</mat-icon>
Maps
</button>
<button mat-menu-item>
<mat-icon>web</mat-icon>
Calendar Settings
</button>
</mat-menu> -->
<!-- <button (click)="end.toggle()" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>notifications</mat-icon>
</button> -->
<button [mat-menu-trigger-for]="user" matTooltip="Person" matTooltipPosition="below" mat-icon-button class="ml-xs">
<mat-icon>person</mat-icon>
</button>
<mat-menu #user="matMenu" class="opt-menu" x-position="before">
<div mat-menu-item class="head-menu grad-blue">
{{fullName}}
</div>
<!--<button mat-menu-item>
<mat-icon>settings</mat-icon>
Setting
</button>-->
<button mat-menu-item (click)="userprofile()">
<mat-icon>account_box</mat-icon>
Profile
</button>
<!-- <button mat-menu-item>
<mat-icon>notifications_off</mat-icon>
Disable notifications
</button> -->
<button mat-menu-item (click)="logout()">
<mat-icon>exit_to_app</mat-icon>
Sign Out
</button>
</mat-menu>
</div>
</mat-toolbar>
<!--<div class="horizontal-menu text-center">
<nav>
<ul class="main-h-list">
<li *ngFor="let menuitem of horizontalMenuItems.getAll()">
<a [routerLink]="['/'+menuitem.state]" *ngIf="menuitem.type === 'link'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<span>{{ menuitem.name | translate }}</span>
</a>
<a [routerLink]="['/'+menuitem.state]" *ngIf="menuitem.type === 'sub'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<span>{{ menuitem.name | translate }}</span>
</a>
<ul class="dropdown" *ngIf="menuitem.type === 'sub'">
<li *ngFor="let childitem of menuitem.children">
<a [routerLink]="['/'+childitem.state ]">{{ childitem.name | translate }}</a>
<ul class="dropdown" *ngIf="childitem.type === 'super-sub'">
<li *ngFor="let subchild of childitem.subchildren">
<a [routerLink]="['/'+subchild.state ]">{{subchild.name | translate}}</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
</div>-->
<app-http-loader></app-http-loader>
<div class="body-container">
<router-outlet></router-outlet>
</div>
<mat-sidenav #end position="end" mode="over" opened="false">
<div style="text-align: center;">Not Yet Scheduled</div>
<mat-tab-group [selectedIndex]="1" mat-stretch-tabs>
<mat-tab>
<ng-template mat-tab-label>Triggered</ng-template>
<div class="scroll">
<mat-nav-list>
<ng-template let-item let-last="last" ngFor [ngForOf]="alertMsgTriggerType">
<mat-list-item>
<h3 mat-line> {{item.applicant_name}} </h3>
<p mat-line> {{item.lender_applicant_id}}</p>
<p mat-line> {{item.entity_name}} - {{item.pd_status}} </p>
</mat-list-item>
</ng-template>
</mat-nav-list>
</div>
</mat-tab>
<!--<mat-tab>
<ng-template mat-tab-label>Today</ng-template>
<ng-template mat-tab-label>Allocated</ng-template>
<div class="scroll">
<mat-list class="pt-1 pb-1">
<mat-list-item>
<div fxLayout="column">
<h2 class="ma-0">{{ today | date:'EEEE' }}</h2>
<h6 class="mat-text-muted ma-0"><span>{{ today | date:'dd' }}</span>&nbsp;<span>{{ today | date:'MMMM' }}</span></h6>
</div>
</mat-list-item>
</mat-list>
<mat-nav-list>
<mat-divider></mat-divider>
<h3 mat-subheader class="text-uppercase font-weight-bold">Projects Stats</h3>
<mat-list-item>
<p class="text-mat" mat-line>Project A</p>
<mat-progress-bar mat-line mode="determinate" color="warn" value="20"></mat-progress-bar>
</mat-list-item>
<mat-list-item>
<p class="text-mat" mat-line>Project B </p>
<mat-progress-bar mat-line mode="determinate" color="accent" value="80"></mat-progress-bar>
</mat-list-item>
<mat-list-item>
<p class="text-mat" mat-line>Project C</p>
<mat-progress-bar mat-line mode="determinate" value="30"></mat-progress-bar>
</mat-list-item>
<mat-divider></mat-divider>
<h3 mat-subheader class="text-uppercase font-weight-bold">Todo</h3>
<mat-list-item>
<a mat-line href="javascript:;">Consectetur adipisicing elit. Nemo omnis.</a>
<p mat-line class="mat-text-muted text-mat">2:45PM</p>
</mat-list-item>
<mat-list-item>
<a mat-line href="javascript:;"> Temporibus cumque cupiditate </a>
<p mat-line class="mat-text-muted text-mat">3:20PM</p>
</mat-list-item>
<mat-list-item>
<a mat-line href="javascript:;">Libero voluptatibus harum quis accusamus</a>
<p mat-line class="mat-text-muted text-mat">16:00PM</p>
</mat-list-item>
</mat-nav-list>
</div>
</mat-tab>-->
<mat-tab>
<ng-template mat-tab-label>Allocated</ng-template>
<div class="scroll">
<mat-nav-list>
<ng-template let-item let-last="last" ngFor [ngForOf]="alertMsgAllocateType">
<mat-list-item>
<h3 mat-line> {{item.applicant_name}} </h3>
<p mat-line> {{item.lender_applicant_id}}</p>
<p mat-line> {{item.entity_name}} - {{item.pd_status}} </p>
</mat-list-item>
</ng-template>
</mat-nav-list>
<!-- <mat-nav-list>
<mat-list-item>
<mat-icon mat-list-avatar class="mat-text-primary">people</mat-icon>
<h4 mat-line>Social</h4>
<p mat-line> 5 new members joined today</p>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-avatar class="mat-text-warn">local_offer</mat-icon>
<h4 mat-line>Promotions</h4>
<p mat-line>Updated your email
</p>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-avatar class="mat-text-accent">info</mat-icon>
<h4 mat-line>Updates</h4>
<p mat-line> 15 new product added</p>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-avatar class="mat-deep-purple">delete_sweep</mat-icon>
<h4 mat-line> 2 order cancelled</h4>
<span class="text-mat mat-text-muted" mat-line>{{ 1427207139000 | date: 'fullDate' }}</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-avatar>check_circle</mat-icon>
<h4 mat-line>System Scan completed</h4>
<span class="text-mat mat-text-muted" mat-line>{{ 1427412725000 | date: 'fullDate' }}</span>
</mat-list-item>
<mat-list-item>
<mat-icon mat-list-avatar>person_add</mat-icon>
<h4 mat-line>4 Users connected</h4>
<span class="text-mat mat-text-muted" mat-line>{{ 1428275520000 | date: 'fullDate' }}</span>
</mat-list-item>
</mat-nav-list> -->
</div>
</mat-tab>
</mat-tab-group>
</mat-sidenav>
</mat-sidenav-container>
<!-- Settings icon -->
<!-- <button mat-fab color="warn" class="mat-fab-bottom-right" (click)="showSettings = true">
<mat-icon class="mat-24">settings</mat-icon>
</button>-->
<mat-card class="settings-panel" *ngIf="showSettings">
<mat-toolbar color="warn">
<span fxFlex>Options</span>
<button mat-icon-button (click)="showSettings = false">
<mat-icon>close</mat-icon>
</button>
</mat-toolbar>
<mat-card-content class="demo-checkbox">
<span class="mb-2 d-block"><strong>Sidebar Image</strong></span>
<div class="bg-img clearfix">
<div class="pb-1" [ngClass]="{'border-active' : isBgActive('bg-1')}">
<a (click)="onSelectSidebarImage('bg-1')">
<img src="assets/images/bg-5.jpg" alt="">
</a>
</div>
<div class="pb-1" [ngClass]="{'border-active' : isBgActive('bg-2')}">
<a (click)="onSelectSidebarImage('bg-2')">
<img src="assets/images/bg-2.jpg" alt="">
</a>
</div>
<div class="pb-1" [ngClass]="{'border-active' : isBgActive('bg-3')}">
<a (click)="onSelectSidebarImage('bg-3')">
<img src="assets/images/bg-3.jpg" alt="">
</a>
</div>
<div class="pb-2" [ngClass]="{'border-active' : isBgActive('bg-4')}">
<a (click)="onSelectSidebarImage('bg-4')">
<img src="assets/images/bg-4.jpg" alt="">
</a>
</div>
</div>
<div class="color-sidebar clearfix">
<div class="pb-1">
<mat-checkbox [(ngModel)]="sidebarBg">Sidebar Image</mat-checkbox>
</div>
<span class="mb-2 d-block"><strong>Sidebar Color</strong></span>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-default')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-default')"><i aria-hidden="true" class="color-default fa fa-circle fa-lg def"></i>
Default</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-green')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-green')"><i aria-hidden="true" class="color-green fa fa-circle fa-lg"></i>
Green</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-red')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-red')"><i aria-hidden="true" class="color-red fa fa-circle fa-lg"></i>
Red</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-purple')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-purple')"><i aria-hidden="true" class="color-purple fa fa-circle fa-lg"></i>
Purple</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-pink')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-pink')"><i aria-hidden="true" class="color-pink fa fa-circle fa-lg"></i>
Pink</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-blue')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-blue')"><i aria-hidden="true" class="color-blue fa fa-circle fa-lg"></i>
Blue</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-green-deep')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-green-deep')"><i aria-hidden="true" class="color-green-deep fa fa-circle fa-lg"></i>
Green Deep</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-brown')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-brown')"><i aria-hidden="true" class="color-brown fa fa-circle fa-lg"></i>
Brown</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isSidebarActive('sidebar-orange')}">
<a href="javascript:void(0)" (click)="onSelectedSidebarColor('sidebar-orange')"><i aria-hidden="true" class="color-orange fa fa-circle fa-lg"></i>
Orange</a>
</div>
</div>
<div class="color-header clearfix">
<span class="mb-2 d-block"><strong>Header Color</strong></span>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-default')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-default')"><i aria-hidden="true" class="color-default fa fa-circle fa-lg def"></i>
Default</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-green')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-green')"><i aria-hidden="true" class="color-green fa fa-circle fa-lg"></i>
Green</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-red')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-red')"><i aria-hidden="true" class="color-red fa fa-circle fa-lg"></i>
Red</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-purple')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-purple')"><i aria-hidden="true" class="color-purple fa fa-circle fa-lg"></i>
Purple</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-pink')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-pink')"><i aria-hidden="true" class="color-pink fa fa-circle fa-lg"></i>
Pink</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-blue')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-blue')"><i aria-hidden="true" class="color-blue fa fa-circle fa-lg"></i>
Blue</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-green-deep')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-green-deep')"><i aria-hidden="true" class="color-green-deep fa fa-circle fa-lg"></i>
Green Deep</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-brown')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-brown')"><i aria-hidden="true" class="color-brown fa fa-circle fa-lg"></i>
Brown</a>
</div>
<div class="mb-1" [ngClass]="{'border-active' : isHeaderActive('header-orange')}">
<a href="javascript:void(0)" (click)="onSelectedHeaderColor('header-orange')"><i aria-hidden="true" class="color-orange fa fa-circle fa-lg"></i>
Orange</a>
</div>
</div>
<div class="pb-1">
<mat-checkbox (change)="changeMenuLayout($event.checked)">Horizontal Menu</mat-checkbox>
</div>
<div class="pb-1">
<mat-checkbox [(ngModel)]="collapseSidebar" (change)="compactSidebar = false">Collapsed Sidebar</mat-checkbox>
</div>
<div class="pb-1">
<mat-checkbox [(ngModel)]="compactSidebar" (change)="collapseSidebar = false">Compact Sidebar</mat-checkbox>
</div>
<div class="pb-1">
<mat-checkbox [(ngModel)]="boxed">Boxed Layout</mat-checkbox>
</div>
<div class="pb-1">
<mat-checkbox [(ngModel)]="dark" >Dark Mode</mat-checkbox>
</div>
<div class="pb-1">
<mat-checkbox (change)="layoutDir = (layoutDir == 'rtl' ? 'ltr' : 'rtl')" >RTL</mat-checkbox>
</div>
<div class="pb-3">
<mat-form-field>
<mat-select placeholder="Language" class="mt-1" [(ngModel)]="currentLang" #langSelect="ngModel" (ngModelChange)="translate.use(currentLang)">
<mat-option *ngFor="let lang of translate.getLangs()" [value]="lang">{{ lang }}</mat-option>
</mat-select>
</mat-form-field>
</div>
</mat-card-content>
</mat-card>
<!-- /Demo Purposes Only -->
</div>

View File

@ -0,0 +1,311 @@
import { Component, OnInit, OnDestroy, ViewChild, HostListener } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { MenuItems } from '../../shared/menu-items/menu-items';
import { HorizontalMenuItems } from '../../shared/menu-items/horizontal-menu-items';
import { Subscription } from 'rxjs';
import { filter } from 'rxjs/operators';
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',
providers: [RoleMenuItemsPipe],
})
export class AdminLayoutComponent implements OnInit, OnDestroy {
profileurl: any;
commonDetails: any;
userDep: string;
fullName: any;
roleName:any;
currentUser: any={short_name : ''};
private _router: Subscription;
today: number = Date.now();
url: string;
showSettings = false;
dark: boolean;
boxed: boolean;
collapseSidebar: boolean;
compactSidebar: boolean;
sidebarBg: boolean = true;
currentLang = 'en';
layoutDir = 'ltr';
menuLayout : any = 'top-menu';
selectedSidebarImage : any = 'bg-1';
selectedSidebarColor : any = 'sidebar-red';
selectedHeaderColor : any = 'header-default';
collapsedClass : any = 'side-panel-opened';
@ViewChild('sidemenu') sidemenu;
public config: PerfectScrollbarConfigInterface = {};
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];
localStorage.setItem("LocalSetEntity",this.currentUser.fk_entity_id);
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('VendorRoleID', 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') {
const ps = new PerfectScrollbar(elemSidebar, {
wheelSpeed: 2,
suppressScrollX: true
});
}
this._router = this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => {
this.url = event.url;
if (this.isOver()) {
this.sidemenu.close();
}
if (window.matchMedia(`(min-width: 960px)`).matches && !this.isMac() && !this.compactSidebar && this.layoutDir != 'rtl') {
// Ps.update(elemContent);
}
});
this.getCommonSettings();
}
@HostListener('click', ['$event'])
onClick(e: any) {
const elemSidebar = <HTMLElement>document.querySelector('.sidebar-container ');
setTimeout(() => {
if (window.matchMedia(`(min-width: 960px)`).matches && !this.isMac() && !this.compactSidebar && this.layoutDir != 'rtl') {
const ps = new PerfectScrollbar(elemSidebar, {
wheelSpeed: 2,
suppressScrollX: true
});
}
}, 350);
}
ngOnDestroy() {
this._router.unsubscribe();
}
isOver(): boolean {
if (this.url === '/apps/messages' || this.url === '/apps/calendar' || this.url === '/apps/media' || this.url === '/maps/leaflet') {
return true;
} else {
return window.matchMedia(`(max-width: 960px)`).matches;
}
}
isMac(): boolean {
let bool = false;
if (navigator.platform.toUpperCase().indexOf('MAC') >= 0 || navigator.platform.toUpperCase().indexOf('IPAD') >= 0) {
bool = true;
}
return bool;
}
menuMouseOver(): void {
if (window.matchMedia(`(min-width: 960px)`).matches && this.collapseSidebar) {
this.sidemenu.mode = 'over';
}
}
menuMouseOut(): void {
if (window.matchMedia(`(min-width: 960px)`).matches && this.collapseSidebar) {
this.sidemenu.mode = 'side';
}
}
menuToggleFunc()
{
this.sidemenu.toggle();
if(this.collapsedClass == 'side-panel-opened')
{
this.collapsedClass = 'side-panel-closed';
}
else
{
this.collapsedClass= 'side-panel-opened';
}
}
changeMenuLayout(value)
{
// console.log(value)
if(value)
{
this.menuLayout = 'top-menu';
}
else
{
this.menuLayout = 'vertical-menu';
}
}
onSelectSidebarImage(selectedClass, event)
{
this.selectedSidebarImage = selectedClass;
}
onSelectedSidebarColor(selectedClass)
{
this.selectedSidebarColor = selectedClass;
}
onSelectedHeaderColor(selectedClass)
{
this.selectedHeaderColor = selectedClass;
}
isBgActive(value)
{
if(value == this.selectedSidebarImage)
{
return true;
}
else
{
return false;
}
}
isSidebarActive(value)
{
if(value == this.selectedSidebarColor)
{
return true;
}
else
{
return false;
}
}
isHeaderActive(value)
{
if(value == this.selectedHeaderColor)
{
return true;
}
else
{
return false;
}
}
addMenuItem(): void {
this.menuItems.add({
state: 'menu',
name: 'MENU',
type: 'sub',
icon: 'trending_flat',
children: [
{state: 'menu', name: 'MENU'},
{state: 'timelmenuine', name: 'MENU'}
]
});
}
userprofile(){
this.router.navigate(['setting/users/userprofile']);
}
logout(){
//alert();
this.aws.logout().subscribe(res=>{
//alert("res");
localStorage.removeItem('VendorRoleID')
localStorage.removeItem('LocalSetEntity')
this.router.navigate(['/authentication/login']);
})
}
menunav(active){
switch(active){
case 'HOME':
this.router.navigate(['/']);
break;
case 'USERS':
this.router.navigate(['/setting/users/userprofile']);
break;
case 'SETTING':
break;
}
}
getCommonSettings(){
this._dashboardService.getCommonSettingsConfig().subscribe(res=>{
this.commonDetails = res;
if(this.commonDetails.dataStatus == true){
localStorage.setItem("commonSettings",JSON.stringify(this.commonDetails.records));
}
})
}
}

View File

@ -0,0 +1,3 @@
<mat-sidenav-container>
<router-outlet></router-outlet>
</mat-sidenav-container>

View File

@ -0,0 +1,8 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-layout',
styles: [':host /deep/ .mat-sidenav-content {padding: 0;} .mat-sidenav-container {z-index: 1000}'],
templateUrl: './auth-layout.component.html'
})
export class AuthLayoutComponent {}

View File

@ -0,0 +1,6 @@
<div [class.hidden]="!show">
<div class="loader-overlay">
<!-- <div *ngIf="show" class="loader"></div> -->
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
</div>
</div>

View File

@ -0,0 +1,34 @@
.hidden {
visibility: hidden;
}
.loader-overlay {
position: absolute;
width: 100%;
z-index: 500000;
top: 0;
}
// .loader {
// height: 4px;
// width: 100%;
// position: relative;
// overflow: hidden;
// background-color: #FFF;
// }
// .loader:before {
// display: block;
// position: absolute;
// content: "";
// left: -200px;
// width: 200px;
// height: 4px;
// background-color: red;
// animation: loading 2s linear infinite;
// }
// @keyframes loading {
// from {left: -200px; width: 30%;}
// 50% {width: 30%;}
// 70% {width: 70%;}
// 80% {left: 50%;}
// 95% {left: 120%;}
// to {left: 100%;}
// }

View File

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

View File

@ -0,0 +1,29 @@
import { Component, OnInit } from '@angular/core';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import { Subscription } from 'rxjs';
export interface LoaderState {
show: boolean;
}
@Component({
selector: 'app-http-loader',
templateUrl: './http-loader.component.html',
styleUrls: ['./http-loader.component.scss']
})
export class HttpLoaderComponent implements OnInit {
show = false;
private subscription: Subscription;
constructor( private loaderService: LoaderService) { }
ngOnInit() {
this.subscription = this.loaderService.loaderState
.subscribe((state: LoaderState) => {
this.show = state.show;
});
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
}

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,430 @@
<mat-card>
<mat-card-content>
<div *ngIf="!loadControl">
<div fxLayoutAlign="center">
<mat-progress-spinner mode="indeterminate" class="primary"></mat-progress-spinner>
</div>
<p class="nocontent">Loading....</p>
</div>
<form [formGroup]="_PDtriggerForm" *ngIf="loadControl">
<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)="getContactPerson();getProCusType($event.value)">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option> Select </mat-option>
<mat-option (click)="selectedLender(LL.entity_id)" *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="Case Booked In" formControlName="sub_entity_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option> Select </mat-option>
<mat-option *ngFor="let LL of billingtolist" [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)="getContactPerson()">
<!-- (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" (change)="checkExistPd($event.target.value,1)">
<!-- <mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error> -->
</mat-form-field>
<!-- <div *ngIf="sales_and_credit_enable"> -->
<mat-form-field style="width: 28%" *ngIf="userDetails.short_name != 'IIB'">
<mat-select placeholder="Lender Sales Person" formControlName="lender_sales_person">
<mat-option>Select</mat-option>
<mat-option *ngFor="let person of sales_and_credit_person.sales_person" [value]="person.userid">{{person.user_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%">
<mat-select placeholder="Lender Credit Person" formControlName="lender_credit_person">
<mat-option>Select</mat-option>
<mat-option *ngFor="let person of sales_and_credit_person.credit_person" [value]="person.userid">{{person.user_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%" *ngIf="sales_and_credit_enable">
<!-- <input matInput autocomplete="off" placeholder="Financial Institution" formControlName="imgc_fin_institute"> -->
<mat-select placeholder="Financial Institution" formControlName="imgc_fin_institute">
<mat-option>Select</mat-option>
<mat-option *ngFor="let insti of finInstitutionList" [value]="insti.entity_fin_institution_id">{{insti.institute_name}}</mat-option>
</mat-select>
</mat-form-field><br/>
<!-- </div> -->
<!-- <mat-form-field style="width: 28%">
<input matInput autocomplete="off" placeholder="Lender Contact Person" formControlName="lender_contact_person" type="text" >
<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" (selectionChange)="cusSegChange($event.value)">
<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-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>
<ngx-mat-select-search formControlName="stateSearch" (keyup)="searchFun(addresses,i,'state')"
[placeholderLabel]="'Search State...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</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>
<ngx-mat-select-search formControlName="citySearch" (keyup)="searchFun(addresses,i,'city')"
[placeholderLabel]="'Search City...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</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>
<ngx-mat-select-search formControlName="pinSearch" (keyup)="searchFun(addresses,i,'pin')"
[placeholderLabel]="'Search Pincode...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</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" (change)="checkExistPd($event.target.value,2)">
<!-- <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]="cus_abbr_value == 'SEP_INDV' ? 'Nature of Service' : '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" (change)="checkExistPd($event.target.value,2)">
<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]="cus_abbr_value == 'SEP_INDV' ? 'Nature of Service' : '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>Credit Managers Specific Queries</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="Queries" 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 Credit Managers Specific Queries" 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>Documents to be collected</mat-card-title>
</mat-card-header>
<mat-card-content formArrayName="docs_to_be_collected" *ngFor="let Documentstobecollected of pdDocumentstobecollected.controls; let i = index;">
<mat-card>
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 90%;">
<input matInput autocomplete="off" placeholder="Documents to be collected" formControlName="doc_name">
</mat-form-field>
<button mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="removeDocumentstobecollected(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)="addDocumentstobecollected()"
matTooltip="Add More Documents to be collected" 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

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,162 @@
<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>
<p class="note" *ngIf="!recordStatus && limitMsg">Showing data for last {{common}}. To see older records, please use advanced filter</p>
<br/>
<mat-table [dataSource]="dataSourceTab1" matSort *ngIf="PdListData.length > 0">
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="13" fxFlex.lg="15" fxFlex.xl="13" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold','font-size':'16px'}" mat-line>{{details.pd_sno}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="22" fxFlex.lg="24" fxFlex.xl="16" class="cell" *matCellDef="let details;">
<span *ngIf="details.is_child" mat-line>
<b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD' }}</b>
</span>
<br>
<span class="fontsize" *ngIf="!details.lender_applicant_id"> Not Provided</span>
<span class="fontsize" *ngIf="details.lender_applicant_id"> {{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,details.random_string)"
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>
<div [hidden]="recordStatus">
<mat-paginator #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>
</div>
<mat-card-content *ngIf="recordStatus">
<h5 align="center" style="font-weight: bold;
color: brown;">Showing data for last {{common}}. To see older records, please use advanced filter</h5>
</mat-card-content>
<notifier-container></notifier-container>

View File

@ -0,0 +1,29 @@
.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;
}
p.note {
// float: right;
text-align: right;
font-size: 12px;
color: grey;
font-weight: bold;
}

View File

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

View File

@ -0,0 +1,262 @@
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';
import { AwsService } from 'app/AwsService/aws.service';
import { UserService } from 'app/settings/service/user.service';
@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();
user_role_name: string;
limitMsg: boolean = false;
common: any;
constructor(private _pd: PdTrigerService,private _fb:FormBuilder,notifier: NotifierService,private userService:UserService) {
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();
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
this.common = this.common.count+' '+this.common.factor
}
ngOnInit() {
this.userService.getroles().subscribe(res=>{
let len_id=res['records'][0].fk_entity_id
// this.searchForm.controls['pd_lender'].setValue(len_id)
let role_name = this.userService.takeDecisionRouting(res['records'][0])
localStorage.setItem('ven_user_role',role_name);
this.user_role_name=role_name
if(this.user_role_name == 'sales'){
this.displayedColumns = this.displayedColumns.filter(val=>val != 'Action')
}
})
this.recordStatus=false;
// this.loadPDDetails();
//this.getcommonDropDown();
console.log(this.displayedColumns)
}
// 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;
// console.log("changes",this.bindFilterValue)
}
// load inprogress pd list
public VendorRoleID : string = localStorage.getItem('VendorRoleID');
loadPDDetails() {
//this._pd.getTabStatusPdDetails(this.tabStatus)
this._pd.getPdDetails(this.VendorRoleID)
.subscribe(
data => {
if (data.status == 200) {
this.PdListData = data.records;
this.dataLengthTab1 = data.records.length;
this.dataSourceTab1.data = this.PdListData;
this.recordStatus=false;
this.limitMsg = true
}
else{
this.PdListData=[];
this.dataSourceTab1.data = [];
this.recordStatus=true;
this.limitMsg = false
}
}
// , 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,randomString){
// console.log(pdid,randomString);
let pdidwithRandomString:any = {'id':pdid,'string': randomString};
// console.log(pdidwithRandomString);
this.loadPdView.emit(pdidwithRandomString);
}
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;
console.log("Res",res['dataStatus'])
if(res['dataStatus'])
{
this.PdListData = res['records'];
this.dataSourceTab1.data = res['records'];
// console.log('records',res['records']);
this.dataSourceTab1.paginator = this.paginator;
this.recordStatus=false
this.limitMsg = false
}else{
this.notifier.notify('warning', 'No Records Found !');
this.dataSourceTab1.paginator['length'] = 0;
this.dataSourceTab1.paginator['pageIndex'] = 0;
this.dataSourceTab1.data = [];
this.PdListData = [];
this.recordStatus = true;
this.limitMsg = false
// 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,133 @@
<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>
<p class="note" *ngIf="!recordStatus && limitMsg">Showing data for last {{common}}. To see older records, please use advanced filter</p>
<br/>
<mat-table [dataSource]="dataSourceTab4" matSort *ngIf="completedPdListData.length > 0" >
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="13" fxFlex.lg="15" fxFlex.xl="13" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold','font-size':'16px'}" mat-line>{{details.pd_sno}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="22" fxFlex.lg="24" fxFlex.xl="16" 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' }}</b>
</span><br>
<span class="fontsize" *ngIf="!details.lender_applicant_id"> Not Provided</span>
<span class="fontsize" *ngIf="details.lender_applicant_id"> {{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,details.random_string)" 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>
<div [hidden]="recordStatus">
<mat-paginator #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>
</div>
<mat-card-content *ngIf="recordStatus">
<h5 align="center" style="font-weight: bold;
color: brown;">Showing data for last {{common}}. To see older records, please use advanced filter</h5>
</mat-card-content>

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;
}
.toolbar-space {
flex: 0.01 0 auto;
}
p.note {
// float: right;
text-align: right;
font-size: 12px;
color: grey;
font-weight: bold;
}

View File

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

View File

@ -0,0 +1,265 @@
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';
import { UserService } from 'app/settings/service/user.service';
@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();
user_role_name: string;
limitMsg: boolean = false;
common: any;
constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService) {
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();
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
this.common = this.common.count+' '+this.common.factor
}
ngOnInit() {
this.userService.getroles().subscribe(res=>{
let len_id=res['records'][0].fk_entity_id
// this.searchForm.controls['pd_lender'].setValue(len_id)
let role_name = this.userService.takeDecisionRouting(res['records'][0])
this.user_role_name=role_name
if(this.user_role_name == 'sales'){
this.displayedColumns = this.displayedColumns.filter(val=>val != 'Action')
}
})
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
public VendorRoleID : any = localStorage.getItem('VendorRoleID');
loadPDDetails() {
this._pd.getTabStatusPdDetails(this.tabStatus,this.VendorRoleID)
.subscribe(
data => {
if (data.status == 200) {
this.completedPdListData = data.records;
this.dataLengthTab4 = data.records.length;
this.dataSourceTab4.data = this.completedPdListData;
this.recordStatus = false
this.limitMsg = true
}
else{
this.dataSourceTab4.data =[]
this.completedPdListData=[];
this.dataLengthTab4= null;
this.recordStatus=true;
this.limitMsg = false
}
}
// , 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,randomString){
console.log(pdid,randomString);
let pdidwithRandomString:any = {'id':pdid,'string': randomString};
// console.log(pdidwithRandomString);
this.loadPdView.emit(pdidwithRandomString);
}
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.completedPdListData=res['records'];
this.dataSourceTab4.data = res['records'];
this.dataSourceTab4.paginator = this.paginator;
this.recordStatus=false;
this.limitMsg = false
}else{
this.notifier.notify('warning', 'No Records Found !');
this.recordStatus=true;
this.dataSourceTab4.paginator['length'] = 0;
this.dataSourceTab4.paginator['pageIndex'] = 0;
this.dataSourceTab4.data = [];
this.limitMsg = false
}
},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]="CSAbbr == 'SEP_INDV' ? 'Nature of Service' : '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]="CSAbbr == 'SEP_INDV' ? 'Nature of Service' : '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

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

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,298 @@
<form [formGroup]="_EditPDtriggerForm" novalidate *ngIf="loadControl">
<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" (selectionChange)="getContactPerson();getProCusType($event.value,true)">
<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%">
<mat-select placeholder="Case Booked In" formControlName="sub_entity_id">
<mat-option>
Select
</mat-option>
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > -->
<mat-option *ngFor="let LL of billingtolist"
[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: 28%">
<mat-select placeholder="Branch" formControlName="pd_branch_id" (selectionChange)="getContactPerson()">
<!-- (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%">
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id"
type="text">
</mat-form-field>
<!-- <div *ngIf="sales_and_credit_enable"> -->
<mat-form-field style="width: 28%" *ngIf="userDetails.short_name != 'IIB'">
<mat-select placeholder="Lender Sales Person" formControlName="lender_sales_person">
<mat-option>Select</mat-option>
<mat-option *ngFor="let person of sales_and_credit_person.sales_person" [value]="person.userid">{{person.user_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%">
<mat-select placeholder="Lender Credit Person" formControlName="lender_credit_person">
<mat-option>Select</mat-option>
<mat-option *ngFor="let person of sales_and_credit_person.credit_person" [value]="person.userid">{{person.user_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%" *ngIf="sales_and_credit_enable">
<!-- <input matInput autocomplete="off" placeholder="Financial Institution" formControlName="imgc_fin_institute"> -->
<!-- <input matInput autocomplete="off" placeholder="Financial Institution" formControlName="imgc_fin_institute"> -->
<mat-select placeholder="Financial Institution" formControlName="imgc_fin_institute">
<mat-option>Select</mat-option>
<mat-option *ngFor="let insti of finInstitutionList" [value]="insti.entity_fin_institution_id">{{insti.institute_name}}</mat-option>
</mat-select>
</mat-form-field>
<!-- </div> -->
<!-- <mat-form-field style="width: 28%">
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person"
type="text" >
</mat-form-field>
<mat-form-field style="width: 23%">
<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>
<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: 15%">
<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> -->
<!-- <span matPrefix>+91</span> -->
<!-- <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-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>
<ngx-mat-select-search formControlName="stateSearch" (keyup)="searchFun(addresses,i,'state')"
[placeholderLabel]="'Search State...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<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>
<ngx-mat-select-search formControlName="citySearch" (keyup)="searchFun(addresses,i,'city')"
[placeholderLabel]="'Search City...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<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>
<ngx-mat-select-search formControlName="pinSearch" (keyup)="searchFun(addresses,i,'pin')"
[placeholderLabel]="'Search Pincode...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<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

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

View File

@ -0,0 +1,987 @@
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';
import { getRandomString } from 'selenium-webdriver/safari';
import { UserService } from 'app/settings/service/user.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@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 {
protected _onDestroy = new Subject<void>();
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;
loadControl:boolean=false;
pincodeflag : any = [];
public _EditPDtriggerForm:FormGroup;
public notifier: NotifierService;
addresses: FormArray;
public masterRandomString : string;
// 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;
sales_and_credit_enable: boolean=false;
sales_and_credit_person: any=[];
userDetails: any;
finInstitutionList: any=[];
stateData: any=[];
cityData: any=[];
pincodeData: any=[];
billingtolist: any;
removedControl: any = [];
lender_other_config: any;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<EditPdMasterComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,private titleCase : TitleCasePipe,private userService:UserService) {
// console.log("hsdf",this.data)
this.notifier=notifier
this.currentPDStatus = data.records.pd_status;
this.pdid = data.records.pd_id;
this.masterRandomString = data.records.random_string;
this.disableAfterSubmit = false;
this.getCustomerSegmentList();
this.getUserDetails();
}
ngOnInit() {
// this.getProductsList()
// this.draftStatus="DRAFT";
// this.PDTriggerStatus="TRIGGERED";
// this.getProductsList();
this.getStateCityList();
// this.getPDTypeList();
// this.getAddresses();
this.applicantLength=this.data.applicantLength;
}
getUserDetails(){
this.userService.getroles().subscribe(res=>{
if(res['dataStatus']){
this.userDetails=res['records'][0];
}
// console.log(this.userDetails)
// this.loadFormData();
this.getProCusType(this.userDetails.fk_entity_id,false)
this.sales_and_credit_person.credit_person=[{userid:this.userDetails.userid,user_name:this.userDetails.user_first_name+' '+this.userDetails.user_last_name}]
})
}
getProCusType(entity_id,flag?){
console.log("u",this.userDetails)
this._pd.getEntityPreferences(entity_id).subscribe(Response=>{
if(Response['dataStatus']){
this.pdTypeList=Response['records'].pd_types
this.customerSegmentAllList=Response['records'].customer_segments
this.productAllList=Response['records'].products
this.productList=this.productAllList
if(this.data.records.fk_product_id){
// console.log(this.data.fk_product_id)
// console.log("vv",this.productAllList.filter(val=>val.product_id == this.data.records.fk_product_id).length > 0)
if(this.productAllList.filter(val=>val.product_id == this.data.records.fk_product_id).length > 0){
this.getSubproductList(this.data.records.fk_product_id,1);
}
}
this.finInstitutionList=Response['records'].financial_institutions
if(flag == true){
this._EditPDtriggerForm.controls['fk_product_id'].setValue(Response['records'].default_product);
this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue(Response['records'].default_sub_product);
this._EditPDtriggerForm.controls['fk_customer_segment'].setValue(Response['records'].default_customer_segment);
}else
if(flag ==false){
this.getLenderList();
}
this.lender_other_config = Response['records'].lender_other_config
this.lender_other_config = JSON.parse(this.lender_other_config)
}
// this.loadFormData();
})
}
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.billingtolist = this.lenderList
if(this.userDetails.short_name == 'CHFPL'){
this.billingtolist = data.records.filter(item=> item.short_name == 'CHFPL' || item.short_name == 'CLIX');
console.log('filter lender',this.billingtolist);
}
this.filterProductAbbr(x[0]['short_name'],1);
}
}
this.loadFormData();
if(this.lender_other_config != null){
this.removedControl = this.lender_other_config.non_mandatory_fields
this.lender_other_config.non_mandatory_fields.forEach(lender_config=>{
console.log('lendercofig',lender_config)
this._EditPDtriggerForm.controls[lender_config].clearValidators();
this._EditPDtriggerForm.controls[lender_config].updateValueAndValidity()
})
}
else{
if(this.removedControl.length > 0) {
this.removedControl.forEach(lender_set_config=>{
console.log('lendercofig',lender_set_config)
this._EditPDtriggerForm.controls[lender_set_config].setValidators(Validators.compose([Validators.required]));
this._EditPDtriggerForm.controls[lender_set_config].updateValueAndValidity()
})
}
}
}
//, error => this.errorMessage = <any> error);
, error => {
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
});
}
// selectedLender(lender){
// // 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);
// }
/** FOR Dropdowns */
selectedLender(lender) {
// console.log('lender',lender);
this.lenderBranchList = lender['branches'];
this.lenderShortName = lender['short_name'];
// console.log(this.lenderShortName);
this._EditPDtriggerForm.controls.pd_branch_id.setValue(null);
this.productList = this.productAllList;
// 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._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('');
// if(this.lenderShortName == "IIB"){ //FOR INDUSLAND BANK
// // console.log("entered");
// this._EditPDtriggerForm.controls['fk_product_id'].setValue("3")
// this._EditPDtriggerForm.controls['fk_pd_type'].setValue("1");
// this.getSubproductList("3",2)
// }
// console.log("len",lender)
}
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 => {
this.getLenderList();
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);
}
}
// console.log("Product",this.productAllList)
}, 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);
this.stateData=this.stateList
}
});
}
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;
// console.log("this.userd",this.userDetails);
console.log(this.userDetails.short_name)
this._EditPDtriggerForm = this._fb.group({
pd_id: [this.data.records.pd_id],
fk_lender_id: [{value:this.data.records.fk_lender_id,disabled: true}],
sub_entity_id: [{value:this.data.records.sub_entity_id,disabled: this.userDetails.short_name != 'CHFPL' ? true : false}],
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],
lender_sales_person:[this.data.records.lender_sales_person],
lender_credit_person:[{value:this.data.records.lender_credit_person,disabled:false}],
imgc_fin_institute:[this.data.records.imgc_fin_institute],
// 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 || '1'],
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));
}
});
this.getContactPerson()
this.loadControl=true;
}
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;
this.cityData[i]=this.cityList[i]
this.pincodeData[i]=this.pincodeList[i]
}
});
}
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)]) */
stateSearch:[null],
citySearch:[null],
pinSearch:[null],
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],
stateSearch:[null],
citySearch:[null],
pinSearch:[null],
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) {
// if((formValue.pd_contact_person == null || formValue.pd_contact_person == '') && (formValue.lender_sales_person =='' || formValue.lender_sales_person ==null)){
// this.notifier.notify("warning","Lender Sales Person or Lender Contact person required");
// return
// }
// 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['lender_sales_person'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['lender_sales_person'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['lender_credit_person'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['lender_credit_person'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['imgc_fin_institute'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['imgc_fin_institute'].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;
my_array.fk_lender_id=this._EditPDtriggerForm.controls['fk_lender_id'].value; //disabled field value
my_array.lender_credit_person=this._EditPDtriggerForm.controls['lender_credit_person'].value; //disabled field 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;
// }
if(concat_landline != ''){
}
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,
"sub_entity_id": my_array.sub_entity_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,
"lender_sales_person":my_array.lender_sales_person,
"lender_credit_person":my_array.lender_credit_person,
"imgc_fin_institute":my_array.imgc_fin_institute,
// "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 || '1',
"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,
"random_string":this.masterRandomString
}
this.disableAfterSubmit = true;
if(my_array.addresses.length > 0){
my_array.addresses.forEach(vla=>{
delete vla.stateSearch
delete vla.citySearch
delete vla.pinSearch
})
}
// console.log('this.masterRandomString',this.masterRandomString);
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 Went Wrong in Address Try Again.!');
}//else
}, error => {
// this.notifier.notify('warning', 'Something Went Wrong in Address Try Again.!');
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
});
}
else {
this.disableAfterSubmit = false;
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
}//else
}, error => {
// this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
this.disableAfterSubmit = false;
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
});//error closed
}//else closed
}
/** 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);
}
});
}
//FOR IMGC
getContactPerson(){
// console.log(this._EditPDtriggerForm.controls['fk_lender_id'].value )
// alert(this._EditPDtriggerForm.value.pd_branch_id);
if(this._EditPDtriggerForm.controls['fk_lender_id'].value !=null){
let lender_filter= this.checkLender(this._EditPDtriggerForm.controls['fk_lender_id'].value)
// console.log(lender_filter)
if(lender_filter != ''){
if(lender_filter=="IMGC"){
this.sales_and_credit_enable=true;
// console.log("Form",this._EditPDtriggerForm)
}
else{
this.sales_and_credit_enable=false;
this._EditPDtriggerForm.controls['lender_sales_person'].setValue(null)
this._EditPDtriggerForm.controls['imgc_fin_institute'].setValue(null)
this._EditPDtriggerForm.controls['imgc_fin_institute'].clearValidators()
this._EditPDtriggerForm.controls['imgc_fin_institute'].updateValueAndValidity()
// this._EditPDtriggerForm.controls['pd_contact_person'].setValidators(Validators.compose([Validators.required]))
// this._EditPDtriggerForm.controls['pd_contact_person'].updateValueAndValidity();
}
// this._EditPDtriggerForm.controls['pd_contact_person'].setValue(null)
// this._EditPDtriggerForm.controls['pd_contact_person'].clearValidators()
// this._EditPDtriggerForm.controls['pd_contact_person'].updateValueAndValidity()
// if( this._EditPDtriggerForm.value.pd_branch_id !=null){
let param={fk_lender_id:this._EditPDtriggerForm.controls['fk_lender_id'].value}
this._pd.getLenderContactPersons(param).subscribe(result=>{
if(result['dataStatus']){
let records=result['records']
if(records.length >0){
this.sales_and_credit_person.sales_person=records.filter(val=>val.role_type == "SALES")
this.sales_and_credit_person.credit_person=records.filter(val=>val.role_type == "CREDIT")
}
}
else{
this._EditPDtriggerForm.controls['lender_sales_person'].setValue(null)
this.sales_and_credit_person.sales_person=[]
this.notifier.notify("warning",result['msg'])
}
},err=>{this.notifier.notify("error","Network Error")})
// }
// else{
// this.sales_and_credit_enable=false;
// this._EditPDtriggerForm.controls['lender_sales_person'].setValue(null)
// this._EditPDtriggerForm.controls['imgc_fin_institute'].setValue(null)
// this._EditPDtriggerForm.controls['imgc_fin_institute'].clearValidators()
// this._EditPDtriggerForm.controls['imgc_fin_institute'].updateValueAndValidity()
// this._EditPDtriggerForm.controls['pd_contact_person'].setValidators(Validators.compose([Validators.required]))
// this._EditPDtriggerForm.controls['pd_contact_person'].updateValueAndValidity();
// }
}
}
}
checkLender(value){
if(value != null){
return this.lenderList.filter(val=>val.entity_id == value).map(mapping=>mapping.short_name)[0]
}
}
searchFun(control:any,i:number,option){
console.log("control",control)
if (option == 'city') {
// this.cityData[i]=this.filterCity(this.stateList,control.value.state_name)
control.controls['citySearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.SearchCity(control.controls['citySearch'].value, i);
})
}
if (option == 'state') {
console.log("state")
control.controls['stateSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchState(control.controls['stateSearch'].value)
})
}
if (option == 'pin') {
console.log("pin")
control.controls['pinSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchPin(control.controls['pinSearch'].value,i)
})
}
}
searchPin(val:any,index:number){
if(!this.pincodeData[index]){
return
}
let searchValue=val
if(!searchValue){
this.pincodeList[index]=this.pincodeData[index].slice()
return
}else{
searchValue=searchValue.toLowerCase()
}
this.pincodeList[index]=this.pincodeData[index].filter(value=>value.pincode.toLowerCase().indexOf(searchValue) > -1)
}
SearchCity(val: any, i: number) {
// let cityData=
console.log(this.cityData[i])
if (!this.cityData[i]) {
return
}
let searchValue = val
if (!searchValue) {
this.cityList[i]=this.cityData[i].slice()
return
} else {
searchValue = searchValue.toLowerCase()
}
this.cityList[i]=
this.cityData[i].filter(val=>val.city_name.toLowerCase().indexOf(searchValue)> -1)
console.log("City Data value",this.cityList[i])
// this.filteredCity.next(
// this.cityData[i].filter(value => value.city_name.toLowerCase().indexOf(searchValue) > -1)
// )
}
searchState(val: any) {
console.log("statedata")
if (!this.stateData) {
return
}
let searchVal = val
if (!searchVal) {
// this.filteredState.next(this.stateList.slice())
this.stateList=this.stateData.slice()
return
}
else {
searchVal = searchVal.toLowerCase()
}
this.stateList=this.stateData.filter(res => res.name.toLowerCase().indexOf(searchVal) > -1)
// this.filteredState.next(
// this.stateList.filter(res => res.state_name.toLowerCase().indexOf(searchVal) > -1)
// )
}
}

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,130 @@
<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>
<p class="note" *ngIf="!recordStatus && limitMsg">Showing data for last {{common}}. To see older records, please use advanced filter</p>
<br/>
<mat-table [dataSource]="dataSourceTab2" matSort *ngIf="progressPdListData.length > 0" >
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="13" fxFlex.lg="15" fxFlex.xl="13" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold','font-size':'16px'}" mat-line>{{details.pd_sno}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="22" fxFlex.lg="24" fxFlex.xl="16" 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' }}</b>
</span><br>
<span class="fontsize" *ngIf="!details.lender_applicant_id"> Not Provided</span>
<span class="fontsize" *ngIf="details.lender_applicant_id"> {{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,details.random_string)" 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>
<div [hidden]="recordStatus">
<mat-paginator #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>
</div>
<mat-card-content *ngIf="recordStatus">
<h5 align="center" style="font-weight: bold;
color: brown;">Showing data for last {{common}}. To see older records, please use advanced filter</h5>
</mat-card-content>

View File

@ -0,0 +1,26 @@
.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;
}
p.note {
// float: right;
text-align: right;
font-size: 12px;
color: grey;
font-weight: bold;
}

View File

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

View File

@ -0,0 +1,254 @@
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';
import { UserService } from 'app/settings/service/user.service';
@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;
user_role_name: string;
limitMsg: boolean = false;
common: any;
constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService) {
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();
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
this.common = this.common.count+' '+this.common.factor
}
ngOnInit() {
this.userService.getroles().subscribe(res=>{
let len_id=res['records'][0].fk_entity_id
// this.searchForm.controls['pd_lender'].setValue(len_id)
let role_name = this.userService.takeDecisionRouting(res['records'][0])
this.user_role_name=role_name
if(this.user_role_name == 'sales'){
this.displayedColumns = this.displayedColumns.filter(val=>val != 'Action')
}
})
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
public VendorRoleID : string = localStorage.getItem('VendorRoleID');
loadPDDetails() {
this._pd.getTabStatusPdDetails(this.tabStatus,this.VendorRoleID)
.subscribe(
data => {
if (data.status == 200) {
this.progressPdListData = data.records;
this.dataLengthTab2 = data.records.length;
this.dataSourceTab2.data = this.progressPdListData;
this.recordStatus=false
this.limitMsg = true
}else{
this.progressPdListData =[];
this.progressPdListData = [];
this.dataSourceTab2.data = [];
this.recordStatus=true;
this.limitMsg = false
}
},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,randomString){
// console.log(pdid,randomString);
let pdidwithRandomString:any = {'id':pdid,'string': randomString};
// console.log(pdidwithRandomString);
this.loadPdView.emit(pdidwithRandomString);
}
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.progressPdListData = res['records'];
this.dataSourceTab2.data = res['records'];
this.dataSourceTab2.paginator = this.paginator;
this.recordStatus=false
this.limitMsg = false
}else{
this.notifier.notify('warning', 'No Records Found !');
this.dataSourceTab2.paginator['length'] = 0;
this.dataSourceTab2.paginator['pageIndex'] = 0;
this.dataSourceTab2.data = [];
this.progressPdListData = [];
this.recordStatus=true
this.limitMsg = false
}
},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" *ngIf="user_role_name != 'sales'"> -->
<!-- <button mat-fab (click)="viewMapPdDetails()" class="mr-1 mb-1 hover-icon" matTooltip="Map view" matTooltipPosition="above"><mat-icon>map</mat-icon></button> -->
<!-- <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> -->
<!-- </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

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

View File

@ -0,0 +1,114 @@
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';
import { UserService } from 'app/settings/service/user.service';
@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;
public VendorRoleID : any = +localStorage.getItem('VendorRoleID');
user_role_name: string;
currentUser: Object;
constructor( notifier: NotifierService, private route: ActivatedRoute,
private router: Router, private _pd: PdTrigerService,private userService:UserService) {
this.notifier = notifier;
this.roleAccessDetails=this._pd.getRoleAccessDetails();
}
ngOnInit() {
this.viewPdList = true;
this.recordStatus=false;
this.allTab=true;
this.userService.getroles().subscribe((res:any)=>{
res = res['records'][0];
localStorage.setItem('VendorRoleID',res.user_role)
localStorage.setItem('LocalSetEntity',res.fk_entity_id)
let role_name = this.userService.takeDecisionRouting(res)
localStorage.setItem('ven_user_role',role_name);
this.user_role_name=role_name
})
}
// 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(event){
console.log('after clicking view icon',event)
let pdid = event.id;
let rdmstr = event.string;
console.log("pdid = " + event.id);
console.log("randomString = " + event.string);
this.viewPdList = !this.viewPdList;
this.router.navigate([ '../pdlist/viewpd',pdid,rdmstr], { 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

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

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,63 @@
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" 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" (click)="closeAllocationComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content class="mat-typography">
<!-- <form [formGroup]="_pdAllocationForm" (submit)="onSubmit()"> -->
<mat-list role="list" *ngIf="pdOfficerList.length > 0">
<mat-list-item role="listitem" *ngFor="let officer of pdOfficerList; let i = index">
<div fxFlex="100">
<div fxLayout="row wrap">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<mat-radio-button color="primary" [value]="officer" (change)="selectedItem = $event.value">
{{officer.first_name}}
</mat-radio-button>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<span>{{officer.mobile_no}}</span>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="40" fxFlex.xl="40">
<span class="view_more" (click)="viewMoreDetails(officer)" matTooltip="View More" matTooltipPosition="right">PD in hand - {{officer.count}}</span>
</div>
</div>
</div>
</mat-list-item>
</mat-list>
<mat-list *ngIf="pdOfficerList.length == 0">
<mat-list-item>
<p>No PD officer available.</p>
</mat-list-item>
</mat-list>
<!-- </form> -->
</mat-dialog-content>
<mat-dialog-actions >
<div fxFlex="50" align="left">
<p *ngIf="selectedItem">PD Officer: {{selectedItem.first_name}}</p>
</div>
<div fxFlex="50" align="right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeAllocationComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button (click)="updatePdOfficer(selectedItem)" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="below"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>
<notifier-container></notifier-container>

View File

@ -0,0 +1,23 @@
.example-full-width{
width: 100%;
}
.view_more {
cursor: pointer;
color: #e00201 !important;
// text-decoration-line: underline;
// text-decoration-style: dotted;
// font-weight: bold;
}
.text_change {
color: #e00201 !important;
}
.cdk-global-overlay-wrapper{
justify-content: center !important;
}
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
// padding: 10px !important;
}

View File

@ -0,0 +1,106 @@
import { Component, OnInit, Inject, ViewEncapsulation } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { AllocationViewMoreComponent } from './../allocation-view-more/allocation-view-more.component';
@Component({
selector: 'app-pd-allocation',
templateUrl: './pd-allocation.component.html',
styleUrls: ['./pd-allocation.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class PdAllocationComponent implements OnInit {
public pageTitle: string = "Allocation To PD Officer";
public _pdAllocationForm: FormGroup;
public pdOfficerList: any = [];
errorMessage: any;
notifier : NotifierService;
selectedItem:any;
isDisabled: boolean;
constructor( notifier: NotifierService,
private _fb: FormBuilder,
private dialogRef: MatDialogRef<PdAllocationComponent>,
private _pd: PdTrigerService, private dialog: MatDialog,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier=notifier;
}
ngOnInit() {
this.isDisabled=true;
this.getPDOfficerList(this.data.pd_id);
// this._pdAllocationForm = this._fb.group({
// pd_primary_id: [null],
// allocation_id: [null],
// });
}
// convenience getter for easy access to form fields
// get readForm() { return this._pdAllocationForm.controls; }
// pd officer list
getPDOfficerList(pdID:string){
this._pd.getPdOfficerList(pdID).subscribe(
data => {
if (data.status == 200) {
this.pdOfficerList= data.records.pdofficers.filter(item => item.fk_pd_type_id == 1);
}
}, error => this.errorMessage = <any> error);
}
/** To update pd officer*/
updatePdOfficer(allocateDetails:any) {
if(!allocateDetails){
this.notifier.notify('warning', 'Please Choose PD Officer.!');
}
else {
let updateData = {
"pd_id":this.data.pd_id,
"fk_pd_allocated_to":allocateDetails.fk_user_id,
}
this._pd.updatePdOfficer(updateData).subscribe(
result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Allocated.!');
this.dialogRef.close();
}
else {
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
this.errorMessage = "Something Went Wrong Try Again.!";
}
}, error => {
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
// this.dialogRef.close();
});
}
}
/** For Popup Close Button */
closeAllocationComponent(): void {
this.dialogRef.close();
}
// pd officer view more
viewMoreDetails(details:any){
if(Number(details.count) > 0) {
const dialogSchedule = this.dialog.open(AllocationViewMoreComponent, {
data: details,
disableClose: true,
position: { right: '0'},
width:'100%',
// hasBackdrop:false
});
// dialogSchedule.afterClosed()
// .subscribe(dataresult => {
// });
}
else {
this.notifier.notify('warning', 'No PD In Hand');
}
}
}

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,158 @@
<!-- this is for completed pd report -->
<!-- <!-- <mat-sidenav-container
class="example-container" (backdropClick)="close('backdrop')" >
<mat-sidenav class="sidebar" #sidenav (keydown.escape)="close('escape')" disableClose position="end">
<p><button mat-button (click)="close('toggle button')">Toggle</button></p>
</mat-sidenav>
<mat-sidenav-content>
<p><button mat-button (click)="sidenav.open()">Open</button></p>
<p>Closed due to: {{reason}}</p>
</mat-sidenav-content>
</mat-sidenav-container> -->
<div class="other-sideMenu">
<!-- this is for completed pd report -->
<ng-container *ngIf="pdReportRecords != '' && pdReportRecords.pd_status=='COMPLETED' || pdReportRecords.pd_status=='QC_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> --
<button mat-icon-button color="warn" aria-label="Example icon-button with a heart icon">
<a target="_blank" href = {{pd.doc_uri}}> <mat-icon>get_app</mat-icon> </a>
</button>
<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> -->
<span class="mr-1 ml-1">PD Report</span>
<span class="empty-spacer"></span>
<span class="empty-spacer"></span>
<div style="margin-left: 65%;">
<button align="end" *ngIf="pdReportRecords.pd_status!='QC_COMPLETED'" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Score" matTooltipPosition="above" (click)="showAction()" ><mat-icon>arrow_upward</mat-icon></button>
<button *ngIf="pdReportRecords.pd_status!='QC_COMPLETED'" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="getFrameContent(IFrameContent)" style="margin-right: 2px;"><mat-icon>save</mat-icon></button>
<button *ngIf="pdReportRecords.pd_status!='QC_COMPLETED'" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="QC Notes" matTooltipPosition="above" (click)="reportReview('REMARKS')" style="margin-right: 2px;"><mat-icon>notes</mat-icon></button>
<button *ngIf="pdReportRecords.pd_status!='QC_COMPLETED'" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="PD Officer Notes" matTooltipPosition="above" (click)="reportReview('pd_officer_notes')" style="margin-right: 2px;"><mat-icon>bookmarks</mat-icon></button>
<button *ngIf="pdReportRecords.pd_status!='QC_COMPLETED'" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="QC Complete" matTooltipPosition="above" (click)="reportReview('COMPLETE')" style="margin-right: 2px;"><mat-icon>done_all</mat-icon></button>
<button *ngIf="pdReportRecords.pd_status!='QC_COMPLETED'" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Re-generate Report" matTooltipPosition="above" (click)="reGeneratePFReport()"><mat-icon>autorenew</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Download PD Report" matTooltipPosition="above" (click)="downloadPDReport()"><mat-icon>get_app</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Download PD Pictures" matTooltipPosition="above" (click)="archivePDImages()"><mat-icon>save_alt</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="loadPdViewCompoent()" style="margin-right: 2px;"><mat-icon>close</mat-icon></button>
</div>
</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 style="margin: 12px;">
<div *ngIf="reGenerateBtn" style="width: 1200px; height: 450px;">
<!-- <pdf-viewer [src]="latestPDDetails.doc_uri" [original-size]="false" [page]="1">
</pdf-viewer> -->
<!-- <iframe width="100%" frameBorder="0" [src]="urlSafe" #IFrameContent id="iframeId" style="height: -webkit-fill-available;" seamless></iframe> -->
<as-split direction="horizontal">
<as-split-area >
<as-split direction="vertical">
<as-split-area >
<p #dataContainer> </p>
</as-split-area>
</as-split>
</as-split-area>
<!-- <as-split-area style="background-color:grey;" size="50" *ngIf="pdf_src !=''">
<as-split direction="vertical">
<as-split-area>
<pdf-viewer [src]="pdf_src" [zoom]="0.8"></pdf-viewer>
</as-split-area>
</as-split>
</as-split-area> -->
</as-split>
<!-- <button style="position:absolute;z-index:2;bottom:3px;" type="button" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" matTooltip="Preview" matTooltipPosition="above" (click)="getPDreportPDF()" ><mat-icon>remove_red_eye</mat-icon></button> -->
<!-- latestPDDetails.doc_uri -->
</div>
</div>
</figure>
</div>
<div class="footer">
<!-- <button mat-raised-button color="blue" type="button" (click)="getFrameContent(IFrameContent)" style="margin-right: 2px;">Save</button>
<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;">PD report Not Generated</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'">
{{pdReportRecords.pd_status}}
<div *ngIf="reGenerateBtn" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
{{qcStatus}}
<figure style="min-height: 240px;">
<div style="margin: 12px;">
<div *ngIf="s">
<iframe width="100%" height="300" frameBorder="0" [src]="urlSafe" id="iframeId" seamless></iframe>
</div>
</div>
</figure>
</div>
<div class="footer">
</div>
</ng-container> -->
<notifier-container></notifier-container>
</div>

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

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

View File

@ -0,0 +1,430 @@
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
import { Component, ViewChild, OnInit, ViewEncapsulation, OnDestroy, Inject, ElementRef } 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,
MatSidenav
} 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";
import {environment} from 'environments/environment'
/**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;
reportRandomString: string;
randomString:string
apiUrl: string=environment.apiEndpoint;
@ViewChild('dataContainer',{read: ElementRef}) dataContainer: ElementRef;
@ViewChild('sidenav') sidenav: MatSidenav;
pdf_src: any;
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.randomString = this.route.snapshot.params['string'];
let encryptReportRandomString = this.route.snapshot.params['string'];
this.reportRandomString = this.apiUrl+'getPDReportHTML/'+encryptReportRandomString+'/'+this.startPD;
// console.log("dd",this.reportRandomString)
this.getPdReportDetails();
// 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");
}
ngAfterViewInit(){
}
ngOnInit() {
this.listPDComponent.showListView(false);
// 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;
}
getHTMLPDReport(){
let encryptReportRandomString = this.route.snapshot.params['string'];
this.pdTrigerService.getPDReportHTML(encryptReportRandomString,this.startPD).subscribe(response=>{
this.dataContainer.nativeElement.innerHTML = response
// console.log("data",this.dataContainer)
// this.loadComponent=true
})
}
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;
this.getHTMLPDReport()
} else {
// this.reGenerateBtn = true;
this.generateBtn = true;
this.message = data.msg;
}
}, err => {
})
}
getPdReportDetails() {
//OLD FUN
// this.pdTrigerService.getPdFinalReportDetails(this.startPD).subscribe(data => {
// if (data.status == 200) {
// // this.pdReportRecords = data.records.question_answers;
// this.pdReportRecords = data.records;
// this.getPdReportVersionList()
// // this.pdReportRecords = data.records.qu;
// }
// }, err => {
// })
this.pdTrigerService.getPdFinalReportDetails(this.startPD).subscribe(data => {
if (data.status == 200) {
// console.log('getPdReportDetails',data);
this.pdReportRecords = data.records;
this.qcStatus = data.records.pd_status;
// console.log(this.qcStatus);
this.generateBtn = data.records.is_original_report_created == 1 ? false : true;
// console.log(this.generateBtn);
this.reGenerateBtn = data.records.is_original_report_created == 1 ? true : false;
// console.log(this.reGenerateBtn);
}
else{
this.generateBtn = true;
// console.log('else',this.generateBtn);
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
}
this.getHTMLPDReport()
}, err => {
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
// alert(err.html_format);
})
}
// load pd view component
loadPdViewCompoent() {
this.router.navigate(['../../../viewpd', this.startPD,this.randomString], { 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.!');
})
}
getPDreportPDF(){
let modifiedHtml=this.dataContainer.nativeElement.outerHTML;
// console.log(this.dataContainer.nativeElement.outerHTML);
let encryptReportRandomString = atob(this.route.snapshot.params['string']);
this.pdTrigerService.getPDReportPDFpreview(encryptReportRandomString,this.startPD,modifiedHtml).subscribe(response=>{
if(response['dataStatus']){
this.pdf_src=response['link']
}
})
}
downloadPDReport(){
let data = {
"pd_id": this.startPD,
"random_string":this.route.snapshot.params['string']
};
this.pdTrigerService.generatePDReportPDF(data).subscribe(data => {
if (data.dataStatus) {
window.open(data.records);
this.notifier.notify('success', 'Done Successfully..!');
} else {
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
}
}, err => {
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
// alert(err.html_format);
});
}
archivePDImages(){
let data = {
"pd_id": this.startPD,
"form_id":"",
"random_string":this.route.snapshot.params['string']
};
this.pdTrigerService.archivePDImages(data).subscribe(data => {
if (data.dataStatus) {
window.open(data.records);
this.notifier.notify('success', 'Downloaded Successfully..!');
} else {
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
}
}, err => {
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
// alert(err.html_format);
});
}
}
@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> -->

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