From 554bd2639e449dcf1add93be371f1490ee053a6a Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 20 Sep 2018 20:06:42 +0530 Subject: [PATCH] masterdetail changes --- .../app/error/404/error-404-component.html | 17 + .../app/error/404/error-404-component.scss | 0 .../src/app/error/404/error-404.component.ts | 20 + .../app/error/503/error-503-component.html | 17 + .../app/error/503/error-503-component.scss | 0 .../src/app/error/503/error-503.component.ts | 20 + sineedge/src/app/error/error.module.ts | 38 ++ sineedge/src/app/error/error.routing.ts | 19 + .../branch-dialog/branch-dialog.component.ts | 2 +- .../branch-list/branch-list.component.ts | 23 +- .../city/city-dialog/city-dialog.component.ts | 2 +- .../city/city-list/city-list.component.ts | 2 +- .../comments-on-locality-list.component.ts | 2 +- .../company-dialog.component.ts | 8 +- .../company-list/company-list.component.ts | 2 +- .../customer-behaviour-list.component.ts | 2 +- .../customer-segment-list.component.ts | 2 +- .../designation-list.component.ts | 2 +- .../frequency-list.component.ts | 2 +- ...ustry_classification-dialog.component.html | 4 +- .../industry_classification-list.component.ts | 2 +- .../lender-hierarchy-dialog.component.html | 4 +- .../lender-hierarchy-list.component.html | 4 +- .../lender-hierarchy-list.component.ts | 2 +- .../members-occupation-dialog.component.html | 4 +- .../members-occupation-list.component.ts | 2 +- .../pd-allocation-type-dialog.component.html | 4 +- .../pd-allocation-type-list.component.ts | 2 +- ...pd-location-approach-dialog.component.html | 4 +- .../pd-location-approach-list.component.ts | 2 +- .../pd-type-dialog.component.html | 4 +- .../pd/pd-type-list/pd-type-list.component.ts | 2 +- .../product-dialog.component.html | 4 +- .../product-list/product-list.component.ts | 2 +- .../regions-dialog.component.html | 4 +- .../regions-list/regions-list.component.ts | 4 +- .../relation-ship-dialog.component.html | 4 +- .../relation-ship-list.component.ts | 4 +- .../states-dialog.component.html | 4 +- .../states-dialog/states-dialog.component.ts | 2 +- .../states-list/states-list.component.ts | 2 +- .../sub-product-dialog.component.html | 4 +- .../sub-product-dialog.component.ts | 2 +- .../sub-product-list.component.ts | 4 +- .../title-dialog/title-dialog.component.html | 4 +- .../title-list/title-list.component.html | 4 +- .../title/title-list/title-list.component.ts | 4 +- .../activity-dialog.component.html | 4 +- .../activity-list/activity-list.component.ts | 4 +- .../uom/uom-dialog/uom-dialog.component.html | 4 +- .../uom/uom-list/uom-list.component.ts | 4 +- .../service/master/masters.service.ts | 369 +++++------------- 52 files changed, 305 insertions(+), 352 deletions(-) create mode 100644 sineedge/src/app/error/404/error-404-component.html create mode 100644 sineedge/src/app/error/404/error-404-component.scss create mode 100644 sineedge/src/app/error/404/error-404.component.ts create mode 100644 sineedge/src/app/error/503/error-503-component.html create mode 100644 sineedge/src/app/error/503/error-503-component.scss create mode 100644 sineedge/src/app/error/503/error-503.component.ts create mode 100644 sineedge/src/app/error/error.module.ts create mode 100644 sineedge/src/app/error/error.routing.ts diff --git a/sineedge/src/app/error/404/error-404-component.html b/sineedge/src/app/error/404/error-404-component.html new file mode 100644 index 0000000..b07de6d --- /dev/null +++ b/sineedge/src/app/error/404/error-404-component.html @@ -0,0 +1,17 @@ +
+
+
+

+ Oops!

+ 404 +

+ Not Found

+
+

Sorry, an error has occured, Requested page not found!

+
+
+ +
+
+
+
\ No newline at end of file diff --git a/sineedge/src/app/error/404/error-404-component.scss b/sineedge/src/app/error/404/error-404-component.scss new file mode 100644 index 0000000..e69de29 diff --git a/sineedge/src/app/error/404/error-404.component.ts b/sineedge/src/app/error/404/error-404.component.ts new file mode 100644 index 0000000..3aac1d4 --- /dev/null +++ b/sineedge/src/app/error/404/error-404.component.ts @@ -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() { + + } + + +} + + diff --git a/sineedge/src/app/error/503/error-503-component.html b/sineedge/src/app/error/503/error-503-component.html new file mode 100644 index 0000000..e9e44f2 --- /dev/null +++ b/sineedge/src/app/error/503/error-503-component.html @@ -0,0 +1,17 @@ +
+
+
+

+ Error!

+ 505 +

+ Service is currently unavailbale

+
+

Sorry, but the page you were trying to view does not exist

+
+
+ +
+
+
+
\ No newline at end of file diff --git a/sineedge/src/app/error/503/error-503-component.scss b/sineedge/src/app/error/503/error-503-component.scss new file mode 100644 index 0000000..e69de29 diff --git a/sineedge/src/app/error/503/error-503.component.ts b/sineedge/src/app/error/503/error-503.component.ts new file mode 100644 index 0000000..d21ae07 --- /dev/null +++ b/sineedge/src/app/error/503/error-503.component.ts @@ -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() { + + } + + +} + + diff --git a/sineedge/src/app/error/error.module.ts b/sineedge/src/app/error/error.module.ts new file mode 100644 index 0000000..9cfaec2 --- /dev/null +++ b/sineedge/src/app/error/error.module.ts @@ -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 {} diff --git a/sineedge/src/app/error/error.routing.ts b/sineedge/src/app/error/error.routing.ts new file mode 100644 index 0000000..66cb25a --- /dev/null +++ b/sineedge/src/app/error/error.routing.ts @@ -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 + }] +}]; diff --git a/sineedge/src/app/settings/component/branch/branch-dialog/branch-dialog.component.ts b/sineedge/src/app/settings/component/branch/branch-dialog/branch-dialog.component.ts index cfa875f..629cb4e 100644 --- a/sineedge/src/app/settings/component/branch/branch-dialog/branch-dialog.component.ts +++ b/sineedge/src/app/settings/component/branch/branch-dialog/branch-dialog.component.ts @@ -34,7 +34,7 @@ export class BranchDialogComponent implements OnInit { }); //console.log(this._branchForm); - this._mastersService.getAllCityData() + this._mastersService.getAllMasterData('CITY') .subscribe( data => { diff --git a/sineedge/src/app/settings/component/branch/branch-list/branch-list.component.ts b/sineedge/src/app/settings/component/branch/branch-list/branch-list.component.ts index 1459bce..9cbf8c6 100644 --- a/sineedge/src/app/settings/component/branch/branch-list/branch-list.component.ts +++ b/sineedge/src/app/settings/component/branch/branch-list/branch-list.component.ts @@ -1,12 +1,11 @@ -import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { MatDialog, MatDialogRef, MatDialogConfig,MatPaginator, MatSort,MatTableDataSource } from '@angular/material'; -import { Observable, Subject } from 'rxjs'; -import { Http, Response } from '@angular/http'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; +import { map } from 'rxjs/operators'; import { DataSource } from '@angular/cdk/collections'; -import { map } from 'rxjs/operators'; import { of as observableOf, merge } from 'rxjs'; import { MastersService } from '../../../service/master/masters.service'; @@ -25,11 +24,9 @@ export class BranchListComponent implements OnInit { loader: boolean = false; BranchList: any = []; - isactive:number; - constructor(private dialog: MatDialog, - private _mastersService: MastersService) { } + private _mastersService: MastersService) { } ngOnInit() { this.getBranch(); @@ -38,7 +35,7 @@ export class BranchListComponent implements OnInit { displayedColumns = ['branch_id','name','fk_city_id','cname', 'isactive','actions']; // dataSource = new UserDataSource(this._mastersService); - /** Popup for ADD Branch */ + /**Popup for ADD Branch */ addBranch() { this.isPopupOpened = true; const dialogRef = this.dialog.open(BranchDialogComponent, { @@ -63,29 +60,29 @@ export class BranchListComponent implements OnInit { }); } - /** Popup for EDIT Branch */ + /** To get Branch Data For Listing */ getBranch() { this.loader = true; this._mastersService.getAllBranch().subscribe(dataresult => { this.loader = false; - if (dataresult == 200) { + if (dataresult.dataStatus === true) { this.BranchList = dataresult.records; - console.log(this.BranchList); } + }) } - /** Popup for EDIT Branch */ + /** To delete Branch Datas */ deleteBranch(id: number) { var PrimaryKeyWithValue ={'branch_id':id}; this._mastersService.deleteMasterDetails(PrimaryKeyWithValue,'BRANCH').subscribe(); } } - +/** To set the All Branch value as Data sources with help of connect() */ export class UserDataSource extends DataSource { diff --git a/sineedge/src/app/settings/component/city/city-dialog/city-dialog.component.ts b/sineedge/src/app/settings/component/city/city-dialog/city-dialog.component.ts index 700b617..8e46a5a 100644 --- a/sineedge/src/app/settings/component/city/city-dialog/city-dialog.component.ts +++ b/sineedge/src/app/settings/component/city/city-dialog/city-dialog.component.ts @@ -37,7 +37,7 @@ export class CityDialogComponent implements OnInit { }); //console.log(this._cityForm); - this._MastersService.getAllStateData() + this._MastersService.getAllMasterData('STATE') .subscribe( data => { if (data.status == 200) { diff --git a/sineedge/src/app/settings/component/city/city-list/city-list.component.ts b/sineedge/src/app/settings/component/city/city-list/city-list.component.ts index e40a17d..a9f8625 100644 --- a/sineedge/src/app/settings/component/city/city-list/city-list.component.ts +++ b/sineedge/src/app/settings/component/city/city-list/city-list.component.ts @@ -78,7 +78,7 @@ export class CityListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.CityList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/comments-on-locality/comments-on-locality-list/comments-on-locality-list.component.ts b/sineedge/src/app/settings/component/comments-on-locality/comments-on-locality-list/comments-on-locality-list.component.ts index f874a30..d723327 100644 --- a/sineedge/src/app/settings/component/comments-on-locality/comments-on-locality-list/comments-on-locality-list.component.ts +++ b/sineedge/src/app/settings/component/comments-on-locality/comments-on-locality-list/comments-on-locality-list.component.ts @@ -77,7 +77,7 @@ export class CommentsOnLocalityListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.CommentsOnLocalityList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/company/company-dialog/company-dialog.component.ts b/sineedge/src/app/settings/component/company/company-dialog/company-dialog.component.ts index 69866f0..ba3d5ec 100644 --- a/sineedge/src/app/settings/component/company/company-dialog/company-dialog.component.ts +++ b/sineedge/src/app/settings/component/company/company-dialog/company-dialog.component.ts @@ -45,22 +45,22 @@ export class CompanyDialogComponent implements OnInit { logo : [this.data.logo, Validators.compose([Validators.required])] }); - this._masterService.getAllStateData() + this._masterService.getAllMasterData('STATE') .subscribe( data => { if (data.status == 200) { this.stateDatas = data.records; - this.stateDatas = this.stateDatas.filter(city=>city.isactive == 1 ); + this.stateDatas = this.stateDatas.filter(dataresult=>dataresult.isactive == 1 ); } }, error => this.errorMessage = error); - this._masterService.getAllCityData() + this._masterService.getAllMasterData('CITY') .subscribe( data => { this.citydatas = data.records; - this.citydatas = this.citydatas.filter(city=>city.isactive == 1 ); + this.citydatas = this.citydatas.filter(dataresult=>dataresult.isactive == 1 ); }, error => this.errorMessage = error); diff --git a/sineedge/src/app/settings/component/company/company-list/company-list.component.ts b/sineedge/src/app/settings/component/company/company-list/company-list.component.ts index 55e96e6..ff20f7f 100644 --- a/sineedge/src/app/settings/component/company/company-list/company-list.component.ts +++ b/sineedge/src/app/settings/component/company/company-list/company-list.component.ts @@ -79,7 +79,7 @@ export class CompanyListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.CompanyList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/customer-behaviour/customer-behaviour-list/customer-behaviour-list.component.ts b/sineedge/src/app/settings/component/customer-behaviour/customer-behaviour-list/customer-behaviour-list.component.ts index 3c63c4d..788bc68 100644 --- a/sineedge/src/app/settings/component/customer-behaviour/customer-behaviour-list/customer-behaviour-list.component.ts +++ b/sineedge/src/app/settings/component/customer-behaviour/customer-behaviour-list/customer-behaviour-list.component.ts @@ -78,7 +78,7 @@ export class CustomerBehaviourListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.CustomerBehaviourList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/customer-segment/customer-segment-list/customer-segment-list.component.ts b/sineedge/src/app/settings/component/customer-segment/customer-segment-list/customer-segment-list.component.ts index 96944ac..b38f05e 100644 --- a/sineedge/src/app/settings/component/customer-segment/customer-segment-list/customer-segment-list.component.ts +++ b/sineedge/src/app/settings/component/customer-segment/customer-segment-list/customer-segment-list.component.ts @@ -77,7 +77,7 @@ export class CustomerSegmentListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.CustomerSegmentList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/designation/designation-list/designation-list.component.ts b/sineedge/src/app/settings/component/designation/designation-list/designation-list.component.ts index e1e4ba6..c30e5e4 100644 --- a/sineedge/src/app/settings/component/designation/designation-list/designation-list.component.ts +++ b/sineedge/src/app/settings/component/designation/designation-list/designation-list.component.ts @@ -79,7 +79,7 @@ export class DesignationListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.DesignationList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/frequency/frequency-list/frequency-list.component.ts b/sineedge/src/app/settings/component/frequency/frequency-list/frequency-list.component.ts index e97ffba..8f11e31 100644 --- a/sineedge/src/app/settings/component/frequency/frequency-list/frequency-list.component.ts +++ b/sineedge/src/app/settings/component/frequency/frequency-list/frequency-list.component.ts @@ -78,7 +78,7 @@ export class FrequencyListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.FrequencyList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/industry_classification/industry_classification-dialog/industry_classification-dialog.component.html b/sineedge/src/app/settings/component/industry_classification/industry_classification-dialog/industry_classification-dialog.component.html index 2823cce..c358d22 100644 --- a/sineedge/src/app/settings/component/industry_classification/industry_classification-dialog/industry_classification-dialog.component.html +++ b/sineedge/src/app/settings/component/industry_classification/industry_classification-dialog/industry_classification-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Industry Classification
+
Industry Classification
-
+
diff --git a/sineedge/src/app/settings/component/industry_classification/industry_classification-list/industry_classification-list.component.ts b/sineedge/src/app/settings/component/industry_classification/industry_classification-list/industry_classification-list.component.ts index d01f62d..f5f7daf 100644 --- a/sineedge/src/app/settings/component/industry_classification/industry_classification-list/industry_classification-list.component.ts +++ b/sineedge/src/app/settings/component/industry_classification/industry_classification-list/industry_classification-list.component.ts @@ -88,7 +88,7 @@ export class IndustryClassificationListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.IndustryClassificationList = dataresult.records; } else{ diff --git a/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-dialog/lender-hierarchy-dialog.component.html b/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-dialog/lender-hierarchy-dialog.component.html index 0ffbc85..556e195 100644 --- a/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-dialog/lender-hierarchy-dialog.component.html +++ b/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-dialog/lender-hierarchy-dialog.component.html @@ -9,9 +9,9 @@ fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Lender Hierarchy
+
Lender Hierarchy
-
+
diff --git a/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-list/lender-hierarchy-list.component.html b/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-list/lender-hierarchy-list.component.html index 9676744..d853be3 100644 --- a/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-list/lender-hierarchy-list.component.html +++ b/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-list/lender-hierarchy-list.component.html @@ -10,7 +10,7 @@ - + @@ -18,7 +18,7 @@ - +
#LenderHierarchy NameLender Hierarchy Name IsActive Action
No Records
{{i+1}}{{LHL.lender_hierarchy_id}} {{LHL.lender_hierarchy}} {{LHL.lender_hierarchy}} {{LHL.isactive}} edit diff --git a/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-list/lender-hierarchy-list.component.ts b/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-list/lender-hierarchy-list.component.ts index 9d7ec1d..938e24a 100644 --- a/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-list/lender-hierarchy-list.component.ts +++ b/sineedge/src/app/settings/component/lender-hierarchy/lender-hierarchy-list/lender-hierarchy-list.component.ts @@ -78,7 +78,7 @@ export class LenderHierarchyListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.LenderHierarchyList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/members-occupation/members-occupation-dialog/members-occupation-dialog.component.html b/sineedge/src/app/settings/component/members-occupation/members-occupation-dialog/members-occupation-dialog.component.html index 0fd361f..05f2f3e 100644 --- a/sineedge/src/app/settings/component/members-occupation/members-occupation-dialog/members-occupation-dialog.component.html +++ b/sineedge/src/app/settings/component/members-occupation/members-occupation-dialog/members-occupation-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Occupation of Non earning members
+
Occupation of Non earning members
-
+
diff --git a/sineedge/src/app/settings/component/members-occupation/members-occupation-list/members-occupation-list.component.ts b/sineedge/src/app/settings/component/members-occupation/members-occupation-list/members-occupation-list.component.ts index 14a13bf..c9ef74a 100644 --- a/sineedge/src/app/settings/component/members-occupation/members-occupation-list/members-occupation-list.component.ts +++ b/sineedge/src/app/settings/component/members-occupation/members-occupation-list/members-occupation-list.component.ts @@ -79,7 +79,7 @@ export class MembersOccupationListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.MemberOccupationList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/pd/pd-allocation-type-dialog/pd-allocation-type-dialog.component.html b/sineedge/src/app/settings/component/pd/pd-allocation-type-dialog/pd-allocation-type-dialog.component.html index d62d273..77cec06 100644 --- a/sineedge/src/app/settings/component/pd/pd-allocation-type-dialog/pd-allocation-type-dialog.component.html +++ b/sineedge/src/app/settings/component/pd/pd-allocation-type-dialog/pd-allocation-type-dialog.component.html @@ -10,9 +10,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
PD Allocation Type
+
PD Allocation Type
-
+
diff --git a/sineedge/src/app/settings/component/pd/pd-allocation-type-list/pd-allocation-type-list.component.ts b/sineedge/src/app/settings/component/pd/pd-allocation-type-list/pd-allocation-type-list.component.ts index c8c0e55..f18299b 100644 --- a/sineedge/src/app/settings/component/pd/pd-allocation-type-list/pd-allocation-type-list.component.ts +++ b/sineedge/src/app/settings/component/pd/pd-allocation-type-list/pd-allocation-type-list.component.ts @@ -78,7 +78,7 @@ export class PdAllocationTypeListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.PDAllocationTypeList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/pd/pd-location-approach-dialog/pd-location-approach-dialog.component.html b/sineedge/src/app/settings/component/pd/pd-location-approach-dialog/pd-location-approach-dialog.component.html index 5694e99..021fedf 100644 --- a/sineedge/src/app/settings/component/pd/pd-location-approach-dialog/pd-location-approach-dialog.component.html +++ b/sineedge/src/app/settings/component/pd/pd-location-approach-dialog/pd-location-approach-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
PD Location Approach
+
PD Location Approach
-
+
diff --git a/sineedge/src/app/settings/component/pd/pd-location-approach-list/pd-location-approach-list.component.ts b/sineedge/src/app/settings/component/pd/pd-location-approach-list/pd-location-approach-list.component.ts index 0eab402..7794387 100644 --- a/sineedge/src/app/settings/component/pd/pd-location-approach-list/pd-location-approach-list.component.ts +++ b/sineedge/src/app/settings/component/pd/pd-location-approach-list/pd-location-approach-list.component.ts @@ -79,7 +79,7 @@ export class PdLocationApproachListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.PdLocationApproachList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/pd/pd-type-dialog/pd-type-dialog.component.html b/sineedge/src/app/settings/component/pd/pd-type-dialog/pd-type-dialog.component.html index 62b4a3b..fa7937d 100644 --- a/sineedge/src/app/settings/component/pd/pd-type-dialog/pd-type-dialog.component.html +++ b/sineedge/src/app/settings/component/pd/pd-type-dialog/pd-type-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
PD type
+
PD type
-
+
diff --git a/sineedge/src/app/settings/component/pd/pd-type-list/pd-type-list.component.ts b/sineedge/src/app/settings/component/pd/pd-type-list/pd-type-list.component.ts index 36dbb4f..eff98aa 100644 --- a/sineedge/src/app/settings/component/pd/pd-type-list/pd-type-list.component.ts +++ b/sineedge/src/app/settings/component/pd/pd-type-list/pd-type-list.component.ts @@ -79,7 +79,7 @@ export class PdTypeListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.PDTypeList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/product/product-dialog/product-dialog.component.html b/sineedge/src/app/settings/component/product/product-dialog/product-dialog.component.html index aa7273c..cc75e2f 100644 --- a/sineedge/src/app/settings/component/product/product-dialog/product-dialog.component.html +++ b/sineedge/src/app/settings/component/product/product-dialog/product-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Product Details
+
Product Details
-
+
diff --git a/sineedge/src/app/settings/component/product/product-list/product-list.component.ts b/sineedge/src/app/settings/component/product/product-list/product-list.component.ts index 97e739b..de6d521 100644 --- a/sineedge/src/app/settings/component/product/product-list/product-list.component.ts +++ b/sineedge/src/app/settings/component/product/product-list/product-list.component.ts @@ -90,7 +90,7 @@ export class ProductListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.ProductMasterList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/regions/regions-dialog/regions-dialog.component.html b/sineedge/src/app/settings/component/regions/regions-dialog/regions-dialog.component.html index 83b464b..2fe9eaa 100644 --- a/sineedge/src/app/settings/component/regions/regions-dialog/regions-dialog.component.html +++ b/sineedge/src/app/settings/component/regions/regions-dialog/regions-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Region
+
Region
-
+
diff --git a/sineedge/src/app/settings/component/regions/regions-list/regions-list.component.ts b/sineedge/src/app/settings/component/regions/regions-list/regions-list.component.ts index be9f967..94075ca 100644 --- a/sineedge/src/app/settings/component/regions/regions-list/regions-list.component.ts +++ b/sineedge/src/app/settings/component/regions/regions-list/regions-list.component.ts @@ -75,11 +75,11 @@ export class RegionsListComponent implements OnInit { //To get data for listing getregions() { this.loader = true; - this._regionsService.getAllMasterData('PRODUCTS').subscribe(dataresult => { + this._regionsService.getAllMasterData('REGIONS').subscribe(dataresult => { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.regionsList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/relation-ship/relation-ship-dialog/relation-ship-dialog.component.html b/sineedge/src/app/settings/component/relation-ship/relation-ship-dialog/relation-ship-dialog.component.html index 4a71c3b..df85474 100644 --- a/sineedge/src/app/settings/component/relation-ship/relation-ship-dialog/relation-ship-dialog.component.html +++ b/sineedge/src/app/settings/component/relation-ship/relation-ship-dialog/relation-ship-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Relation Ship
+
Relation Ship
-
+
diff --git a/sineedge/src/app/settings/component/relation-ship/relation-ship-list/relation-ship-list.component.ts b/sineedge/src/app/settings/component/relation-ship/relation-ship-list/relation-ship-list.component.ts index 22cbb2a..f27a6bf 100644 --- a/sineedge/src/app/settings/component/relation-ship/relation-ship-list/relation-ship-list.component.ts +++ b/sineedge/src/app/settings/component/relation-ship/relation-ship-list/relation-ship-list.component.ts @@ -79,11 +79,11 @@ export class RelationShipListComponent implements OnInit { //To get data for listing getRelationShip() { this.loader = true; - this._MastersService.getAllMasterData('PRODUCTS').subscribe(dataresult => { + this._MastersService.getAllMasterData('RELATIONSHIPS').subscribe(dataresult => { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.RelationShipList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/states/states-dialog/states-dialog.component.html b/sineedge/src/app/settings/component/states/states-dialog/states-dialog.component.html index 9135eac..73baaf8 100644 --- a/sineedge/src/app/settings/component/states/states-dialog/states-dialog.component.html +++ b/sineedge/src/app/settings/component/states/states-dialog/states-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
State
+
State
-
+
diff --git a/sineedge/src/app/settings/component/states/states-dialog/states-dialog.component.ts b/sineedge/src/app/settings/component/states/states-dialog/states-dialog.component.ts index 2b1a05d..f929e34 100644 --- a/sineedge/src/app/settings/component/states/states-dialog/states-dialog.component.ts +++ b/sineedge/src/app/settings/component/states/states-dialog/states-dialog.component.ts @@ -56,7 +56,7 @@ export class StatesDialogComponent implements OnInit { code: [this.data.code, Validators.compose([Validators.required])], fk_region_id : [this.data.fk_region_id, Validators.compose([Validators.required])] }); - this._MastersService.getAllRegionData() + this._MastersService.getAllMasterData('REGIONS') .subscribe( data => { diff --git a/sineedge/src/app/settings/component/states/states-list/states-list.component.ts b/sineedge/src/app/settings/component/states/states-list/states-list.component.ts index b7a2e7f..0008635 100644 --- a/sineedge/src/app/settings/component/states/states-list/states-list.component.ts +++ b/sineedge/src/app/settings/component/states/states-list/states-list.component.ts @@ -78,7 +78,7 @@ export class StatesListComponent implements OnInit { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.StateList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/sub-product/sub-product-dialog/sub-product-dialog.component.html b/sineedge/src/app/settings/component/sub-product/sub-product-dialog/sub-product-dialog.component.html index efd0065..bfff318 100644 --- a/sineedge/src/app/settings/component/sub-product/sub-product-dialog/sub-product-dialog.component.html +++ b/sineedge/src/app/settings/component/sub-product/sub-product-dialog/sub-product-dialog.component.html @@ -10,9 +10,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Sub Product Details
+
Sub Product Details
-
+
diff --git a/sineedge/src/app/settings/component/sub-product/sub-product-dialog/sub-product-dialog.component.ts b/sineedge/src/app/settings/component/sub-product/sub-product-dialog/sub-product-dialog.component.ts index ac9507c..d73f8c8 100644 --- a/sineedge/src/app/settings/component/sub-product/sub-product-dialog/sub-product-dialog.component.ts +++ b/sineedge/src/app/settings/component/sub-product/sub-product-dialog/sub-product-dialog.component.ts @@ -32,7 +32,7 @@ export class SubProductDialogComponent implements OnInit { abbr: [this.data.abbr, Validators.compose([Validators.required])] }); - this._MastersService.getAllProductData() + this._MastersService.getAllMasterData('PRODUCTS') .subscribe( data => { diff --git a/sineedge/src/app/settings/component/sub-product/sub-product-list/sub-product-list.component.ts b/sineedge/src/app/settings/component/sub-product/sub-product-list/sub-product-list.component.ts index 4f6ca7d..a6923f5 100644 --- a/sineedge/src/app/settings/component/sub-product/sub-product-list/sub-product-list.component.ts +++ b/sineedge/src/app/settings/component/sub-product/sub-product-list/sub-product-list.component.ts @@ -77,11 +77,11 @@ export class SubProductListComponent implements OnInit { //To get data for listing getSubProductMaster() { this.loader = true; - this._MastersService.getAllMasterData('PRODUCTS').subscribe(dataresult => { + this._MastersService.getAllMasterData('SUBPRODUCTS').subscribe(dataresult => { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.SubProductMasterList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/title/title-dialog/title-dialog.component.html b/sineedge/src/app/settings/component/title/title-dialog/title-dialog.component.html index 10a009c..ccc45b1 100644 --- a/sineedge/src/app/settings/component/title/title-dialog/title-dialog.component.html +++ b/sineedge/src/app/settings/component/title/title-dialog/title-dialog.component.html @@ -9,9 +9,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Title
+
Title
-
+
diff --git a/sineedge/src/app/settings/component/title/title-list/title-list.component.html b/sineedge/src/app/settings/component/title/title-list/title-list.component.html index 2046998..7de36b7 100644 --- a/sineedge/src/app/settings/component/title/title-list/title-list.component.html +++ b/sineedge/src/app/settings/component/title/title-list/title-list.component.html @@ -23,8 +23,8 @@
{{TL.abbr}} {{TL.isactive}} - edit - delete_outline + edit + delete_outline
diff --git a/sineedge/src/app/settings/component/title/title-list/title-list.component.ts b/sineedge/src/app/settings/component/title/title-list/title-list.component.ts index b9f290e..74726ae 100644 --- a/sineedge/src/app/settings/component/title/title-list/title-list.component.ts +++ b/sineedge/src/app/settings/component/title/title-list/title-list.component.ts @@ -80,11 +80,11 @@ export class TitleListComponent implements OnInit { //To get data for listing getTitle() { this.loader = true; - this._MastersService.getAllMasterData('PRODUCTS').subscribe(dataresult => { + this._MastersService.getAllMasterData('TITLES').subscribe(dataresult => { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.TitleList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/type-of-activity/activity-dialog/activity-dialog.component.html b/sineedge/src/app/settings/component/type-of-activity/activity-dialog/activity-dialog.component.html index 89cbf8d..4e6b095 100644 --- a/sineedge/src/app/settings/component/type-of-activity/activity-dialog/activity-dialog.component.html +++ b/sineedge/src/app/settings/component/type-of-activity/activity-dialog/activity-dialog.component.html @@ -10,9 +10,9 @@ fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Type of activity
+
Type of activity
-
+
diff --git a/sineedge/src/app/settings/component/type-of-activity/activity-list/activity-list.component.ts b/sineedge/src/app/settings/component/type-of-activity/activity-list/activity-list.component.ts index afb24d2..44fc922 100644 --- a/sineedge/src/app/settings/component/type-of-activity/activity-list/activity-list.component.ts +++ b/sineedge/src/app/settings/component/type-of-activity/activity-list/activity-list.component.ts @@ -68,11 +68,11 @@ export class ActivityListComponent implements OnInit { //To get data for listing getActivity() { this.loader = true; - this._MastersService.getAllMasterData('PRODUCTS').subscribe(dataresult => { + this._MastersService.getAllMasterData('TYPEOFACTIVITY').subscribe(dataresult => { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.ActivityList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/component/uom/uom-dialog/uom-dialog.component.html b/sineedge/src/app/settings/component/uom/uom-dialog/uom-dialog.component.html index 2072d79..0fe11fc 100644 --- a/sineedge/src/app/settings/component/uom/uom-dialog/uom-dialog.component.html +++ b/sineedge/src/app/settings/component/uom/uom-dialog/uom-dialog.component.html @@ -9,9 +9,9 @@ fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="35px" fxLayoutGap.xs="0"> -
Unit of Measurement
+
Unit of Measurement
-
+
diff --git a/sineedge/src/app/settings/component/uom/uom-list/uom-list.component.ts b/sineedge/src/app/settings/component/uom/uom-list/uom-list.component.ts index af0daa1..4df2067 100644 --- a/sineedge/src/app/settings/component/uom/uom-list/uom-list.component.ts +++ b/sineedge/src/app/settings/component/uom/uom-list/uom-list.component.ts @@ -78,11 +78,11 @@ export class UomListComponent implements OnInit { //To get data for listing getUOM() { this.loader = true; - this._MastersService.getAllMasterData('PRODUCTS').subscribe(dataresult => { + this._MastersService.getAllMasterData('UOM').subscribe(dataresult => { this.loader = false; - if (dataresult.status == 200) { + if (dataresult.dataStatus  === true) { this.UOMList = dataresult.records; } }) diff --git a/sineedge/src/app/settings/service/master/masters.service.ts b/sineedge/src/app/settings/service/master/masters.service.ts index a115490..529c6cb 100644 --- a/sineedge/src/app/settings/service/master/masters.service.ts +++ b/sineedge/src/app/settings/service/master/masters.service.ts @@ -1,208 +1,115 @@ +/** Common Import Section */ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs';//for Datatables -// import { Http, Response } from '@angular/http'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Observable } from 'rxjs';//for Datatables +import { HttpClient } from '@angular/common/http'; +import { catchError } from 'rxjs/operators'; +import { of } from 'rxjs'; -import { catchError, map, tap } from 'rxjs/operators'; -// import 'rxjs/add/operator/map';//for Datatables -// import 'rxjs/add/operator/catch'; -// import 'rxjs/add/operator/toPromise'; - -/** Service */ +/** Imported Service Files Are., */ import { SharedService } from '../../../shared.service'; import { AwsService } from '../../../aws.service'; -/** Model */ -import { PdAllocationType, PdLocationApproach ,PdStatus ,PdType } from '../../model/pd'; -import { Branch } from '../../model/branch'; -import { States } from '../../model/states'; -import { City } from '../../model/city'; -import { Uom } from '../../model/uom'; -import { Company } from '../../model/company'; -import { Activity } from '../../model/activity'; -import { Title } from '../../model/title'; -import { ProductMaster } from '../../model/product-master'; -import { SubProductMaster } from '../../model/sub-product-master'; -import { IndustryClassification } from '../../model/industry_classification'; -import { Regions } from '../../model/regions'; -import { Designation } from '../../model/designation'; -import { RelationShip } from '../../model/relation-ship'; -import { CustomerBehaviour } from '../../model/customer-behaviour'; -import { CommentsOnLocality } from '../../model/comments-on-locality'; -import { CustomerSegment } from '../../model/customer-segment'; -import { Frequency } from '../../model/frequency'; -import { LenderHierarchy } from '../../model/lender-hierarchy'; -import { MembersOccupation } from '../../model/members-occupation'; -import { EntityType } from '../../model/entity-type'; -import { State } from 'aws-sdk/clients/route53domains'; -import { parse } from 'querystring'; -import { of } from 'rxjs'; -//import {} from '../model/states'; - +/** Consant Value For Created Date And Updated Date */ const currentdate = new Date().toJSON().slice(0,19).replace('T',' '); - +/** Master Interface */ export interface Master { - master_id:number; - master_name:string; - constant_name:string; + master_id:number; + master_name:string; + constant_name:string; } -// const httpOptions = { -// headers: new HttpHeaders({ -// 'Content-Type': 'application/json', -// 'Authorization': 'sparqvenba2018' -// }) -// }; - - @Injectable() export class MastersService { - // private storeUrl = 'http://localhost/SineEdge/sparqapi/api/saveMaster'; - // private branchUrl = 'http://localhost/SineEdge/sparqapi/api/getListOfBranches'; - // private serviceUrl = 'http://localhost/SineEdge/sparqapi/api/getListOfMaster'; - private apiUrl = 'http://localhost/sparqapi/api/'; + + private apiUrl = 'http://localhost/sparqapi/api/'; - //constructor(private http: HttpClient) { } - constructor(private _http: HttpClient, - public _shared:SharedService, - private _aws:AwsService) { } + constructor(private _http: HttpClient, + public _shared:SharedService, + private _aws:AwsService) { } - headers:any = this._shared.headercofig(''); + //headers:any = this._shared.headercofig(''); - /** TO Add Data using API Call */ + /** + * TO Add Master Datas using API Call + * 1st argument is "Records": any - Set of Data To Adding to database + * 2nd argument is "MasterName" :string - Table Name To Store the Records + */ addMasterDetails(Records: any,MasterName:string): Observable { - Records.fk_createdby = this._aws.getlocale(); - Records.createdon = currentdate; + + Records.fk_createdby = this._aws.getlocale();//to get user id for who is created the Record + Records.createdon = currentdate;//to get Current date and Time for when the Record is created var ArrayData = { "master_name":MasterName, - "records": Records - } + "records": Records } - //var data = this._http.post(this.storeUrl,ArrayData,httpOptions); var data = this._http.post(this.apiUrl+'saveMaster',ArrayData); - console.log(data); + return data; } - /** TO Edit Data using API Call */ + /** + * TO Edit Master Datas using API Call + * 1st argument is "Records": any - Set of Updated Data + * 2nd argument is "MasterName" :string - Table Name + */ editMasterDetails(Records: any,MasterName:string): Observable { - console.log('b4 Records',Records); - Records.fk_updatedby = this._aws.getlocale(); - Records.updatedon = currentdate; - console.log('after Records',Records); + + Records.fk_updatedby = this._aws.getlocale();//to get user id for who is update the record + Records.updatedon = currentdate;//to get Current date and Time for when the Record is updated + var ArrayData = { "master_name":MasterName, - "records": Records - } - console.log('Edited Data IN Service Array ONLY',ArrayData); - //var data = this._http.post(this.storeUrl,ArrayData,httpOptions); + "records": Records } + var data = this._http.post(this.apiUrl+'saveMaster',ArrayData); + return data; } - /**To Inactive Array Data using API Call */ - //deleteMasterDetails(IDName:any,id: number,MasterName:string): Observable { - //console.log(' DeletedID IN Service Argument ONLY',id); - //var ID = MasterName+'ID'; - //console.log(' DeletedID IN Service Argument ONLY',ID); - //let ids = {IDName:id}; - //console.log(IDName); - //alert(JSON.stringify(IDName)); - //let ids = parseInt(IDName); - //var ArrayData = { - //"master_name":MasterName, - //"records": {branch_id:id, - // isactive:0, - // fk_updatedby:this._aws.getlocale(), - // updatedon:currentdate} - //} - //console.log('DeletedID IN Service Array',ArrayData); - //var data = this._http.post(this.apiUrl+'saveMaster',ArrayData,{headers:this.headers}); - //var data = this._http.post(this.storeUrl,ArrayData,httpOptions); - //return data; - //} - - /**To Inactive Array Master Data using API Call */ + + /** + * TO Inactive the Master Datas using API Call + * Note : Which means To delete The records + * 1st argument is "PrimaryKeyWithValue" : any - Primarykey and its value + * 2nd argument is "MasterName" :string - Table Name + */ deleteMasterDetails(PrimaryKeyWithValue:any,MasterName:string): Observable { - //console.log(' DeletedID IN Service Argument ONLY',id); - console.log(' DeletedID IN Service Argument ONLY',PrimaryKeyWithValue); + //This "otherDatas" Array is common Argument For All Master let otherDatas:any = {isactive:0, fk_updatedby:this._aws.getlocale(), updatedon:currentdate} + //This "dataWithPrimaryKey" Array is Mergeing The 'PrimaryKeyWithValue' argument with otherDatas let dataWithPrimaryKey = Object.assign(otherDatas,PrimaryKeyWithValue); var ArrayData = { "master_name":MasterName, "records":JSON.parse(JSON.stringify(dataWithPrimaryKey)) } - console.log('DeletedID IN Service Array',ArrayData); + var data = this._http.post(this.apiUrl+'saveMaster',ArrayData); - var data = this._http.post(this.apiUrl+'saveMaster',ArrayData,{headers:this.headers}); - //var data = this._http.post(this.storeUrl,ArrayData,httpOptions); return data; } + + /** + * TO Get the Master Datas using API Call + * 1st argument is "TableName" :string - Table Name + */ + getAllMasterData(TableName:string): Observable { + return this._http.post(this.apiUrl+"getListOfMaster", { "master_name":TableName }) + .pipe( + catchError(this.handleError('role', [])) + ) + } - // OldFunction_getAllMasterData(): Observable { - // var CityArr = { - // "master_name":"LISTOFMASTERS", - // } - // return this._http.post(this.serviceUrl,CityArr,{headers:this.headers}) - // .map(this.extractData) - // .catch(this.handleError); - // } - - -// getAllMasterData(TableName:string): Observable { -// var MasterTableName = { "master_name":TableName } -// //return this._http.post(this.serviceUrl,CityArr,httpOptions) -// //return this._http.post(this.serviceUrl,CityArr,{headers:this.headers}) -// return this._http.post(this.apiUrl+'getListOfMaster',MasterTableName) -// // .map(this.extractData) -// // .catchError(this.handleError); -// } - - - -// ++++++++++++++++++++++ - - - -getAllMasterData(TableName:string): Observable { - return this._http.post(this.apiUrl+"getListOfMaster", { "master_name":TableName }) - .pipe( - catchError(this.handleError('role', [])) - ) -} - -private handleError(operation = 'operation', result?: T) { - //alert(); - console.log('handleError'); - return (error: any): Observable => { - return of(result as T); - }; -} - - - -// +++++++++++++++++++++++++++++ - /** Get All Branch Data using API call With master Keyword */ - // OldFunction_getAllBranch(): Observable { - - // let tab = {'master_name':'BRANCH'}; - // return this._http.post(this.serviceUrl,tab,{headers:this.headers}) - // .map(this.extractData) - // .catch(this.handleError); - - // } - - /** Get All Branch Datas using API call With master Keyword */ - + /** + * TO get Branch Data For Listing Screen + */ getAllBranch(): Observable { return this._http.get(this.apiUrl+'getListOfBranches') .pipe( @@ -211,26 +118,11 @@ private handleError(operation = 'operation', result?: T) { } - /** Get All City Datas for city dropdown using API call With master Keyword - * 1) Branch dialog box - * 2) Company dialog box - */ - getAllCityData(): Observable { - var CityArr = { - "master_name":"CITY", - } - //return this._http.post(this.serviceUrl,CityArr,httpOptions) - return this._http.post(this.apiUrl+'getListOfMaster',CityArr) - .pipe( - catchError(this.handleError('role', [])) - ) - - } - - - /** Get All City Data For Branch SCrenn City Dropdown using API call With master Keyword */ - + + /** + * TO get Subproduct Data For Listing Screen + */ getAllSubProduct(): Observable { return this._http.get(this.apiUrl+'getListOfSubProduct') @@ -238,24 +130,12 @@ private handleError(operation = 'operation', result?: T) { catchError(this.handleError('role', [])) ) - } - /** Get All Product Datas for Product dropdown using API call With master Keyword - * 1) Sub product dialog box + + /** + * TO get State Data For Listing Screen */ - getAllProductData(): Observable { - var ProductArr = { - "master_name":"PRODUCTS", - } - //return this._http.post(this.serviceUrl,CityArr,httpOptions) - return this._http.post(this.apiUrl+'getListOfMaster',ProductArr) - .pipe( - catchError(this.handleError('role', [])) - ) - } - - getAllState(): Observable { return this._http.get(this.apiUrl+'getListOfState') @@ -266,75 +146,36 @@ private handleError(operation = 'operation', result?: T) { } - /** Get All Region Datas for Region dropdown using API call With master Keyword - * 1) state dialog box + /** + * TO get Company Data For Listing Screen */ - getAllRegionData(): Observable { - var RegionArr = { - "master_name":"REGIONS", - } - //return this._http.post(this.serviceUrl,CityArr,httpOptions) - return this._http.post(this.apiUrl+'getListOfMaster',RegionArr) - .pipe( - catchError(this.handleError('role', [])) - ) - - } - getAllCompany(): Observable { return this._http.get(this.apiUrl+'getListOfCompany') .pipe( catchError(this.handleError('role', [])) ) - - + } - /** Get All State Datas for State dropdown using API call With master Keyword - * 1) Branch dialog box - * 2) Company dialog box - */ - getAllStateData(): Observable { - var stateArr = { - "master_name":"STATE", - } - //return this._http.post(this.serviceUrl,CityArr,httpOptions) - return this._http.post(this.apiUrl+'getListOfMaster',stateArr) - .pipe( - catchError(this.handleError('role', [])) - ) - - } - /** Get All EntityType Data using API call With master Keyword */ - getAllEntityType(): Observable { - - var EntityTypeArr = { - "master_name":"ENTITYTYPE", - } - return this._http.post(this.apiUrl+'getListOfMaster',EntityTypeArr,{headers:this.headers}) - .pipe( - catchError(this.handleError('role', [])) - ) - - - } - - - - /** Using Above .map() Method. We check the Response's array Status and return to the component */ - // private extractData(res : Response) { - // console.log('extractData',res); - // if (res['dataStatus'] === true) { - // let Records = res['records']; - // return Records; - // } - // else{ - // return []; // return empty array if there is no data - // } + /** Get All EntityType Data using API call With master Keyword */ + // getAllEntityType(): Observable { + // var EntityTypeArr = { + // "master_name":"ENTITYTYPE", + // } + // return this._http.post(this.apiUrl+'getListOfMaster',EntityTypeArr,{headers:this.headers}) + // .pipe( + // catchError(this.handleError('role', [])) + // ) // } + + + /** + * Seperated Records from the res + * argument 'res' : Response + */ private extractData(res : Response) { let Response = res['_body']; @@ -344,32 +185,16 @@ private handleError(operation = 'operation', result?: T) { ? Response['records'] : []; - /* Checking Data Status is true or false., - TRUE means Return Arraydata - FALSE means Return empty array. - */ - } - + + /** + * TO Handle The Error + */ + private handleError(operation = 'operation', result?: T) { + return (error: any): Observable => { + return of(result as T); + }; +} - - // private parseData(Response) { - // //console.log('parseData called',Response); - // if(Response.dataStatus == true){ - // console.log('true part',Response.records); - // return Response.records; - // } - // else{ - // return Response; - // } - // } - - - // private handleError(error: any): Promise { - // console.error('An error occurred', error); - // return Promise.reject(error.message || error); - // } - - } \ No newline at end of file