masterdetail changes

This commit is contained in:
venbatechnologies@gmail.com 2018-09-20 20:06:42 +05:30
parent 6f056397fc
commit 554bd2639e
52 changed files with 305 additions and 352 deletions

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

@ -34,7 +34,7 @@ export class BranchDialogComponent implements OnInit {
});
//console.log(this._branchForm);
this._mastersService.getAllCityData()
this._mastersService.getAllMasterData('CITY')
.subscribe(
data => {

View File

@ -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<any> {

View File

@ -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) {

View File

@ -78,7 +78,7 @@ export class CityListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.CityList = dataresult.records;
}
})

View File

@ -77,7 +77,7 @@ export class CommentsOnLocalityListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.CommentsOnLocalityList = dataresult.records;
}
})

View File

@ -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 = <any> 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 = <any> error);

View File

@ -79,7 +79,7 @@ export class CompanyListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.CompanyList = dataresult.records;
}
})

View File

@ -78,7 +78,7 @@ export class CustomerBehaviourListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.CustomerBehaviourList = dataresult.records;
}
})

View File

@ -77,7 +77,7 @@ export class CustomerSegmentListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.CustomerSegmentList = dataresult.records;
}
})

View File

@ -79,7 +79,7 @@ export class DesignationListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.DesignationList = dataresult.records;
}
})

View File

@ -78,7 +78,7 @@ export class FrequencyListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.FrequencyList = dataresult.records;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Industry Classification</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Industry Classification</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -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{

View File

@ -9,9 +9,9 @@ fxLayout.xs="column"
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Lender Hierarchy </div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Lender Hierarchy </div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -10,7 +10,7 @@
<table style="border-collapse: collapse">
<thead>
<th style="text-align: center;">#</th>
<th style="text-align: center;">LenderHierarchy Name</th>
<th style="text-align: center;">Lender Hierarchy Name</th>
<th style="text-align: center;">IsActive</th>
<th style="text-align: center;">Action</th>
</thead>
@ -18,7 +18,7 @@
<tr *ngIf="LenderHierarchyList.length === 0" > <td colspan="4" style="text-align: center;"> No Records </td></tr>
<tr *ngFor="let LHL of LenderHierarchyList; let i=index">
<td style="text-align: center;">{{i+1}}</td>
<td style="text-align: center;">{{LHL.lender_hierarchy_id}} {{LHL.lender_hierarchy}} </td>
<td style="text-align: center;">{{LHL.lender_hierarchy}} </td>
<td style="text-align: center;">{{LHL.isactive}} </td>
<td style="text-align: center;">
<a (click)="editLenderHierarchy(LHL)"><mat-icon>edit</mat-icon></a>

View File

@ -78,7 +78,7 @@ export class LenderHierarchyListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.LenderHierarchyList = dataresult.records;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Occupation of Non earning members </div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Occupation of Non earning members </div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2" ></div>
</div>

View File

@ -79,7 +79,7 @@ export class MembersOccupationListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.MemberOccupationList = dataresult.records;
}
})

View File

@ -10,9 +10,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">PD Allocation Type</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">PD Allocation Type</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>
<form [formGroup]="_PDAllocationTypeForm" (submit)="onSubmit()">

View File

@ -78,7 +78,7 @@ export class PdAllocationTypeListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.PDAllocationTypeList = dataresult.records;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">PD Location Approach</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">PD Location Approach</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -79,7 +79,7 @@ export class PdLocationApproachListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.PdLocationApproachList = dataresult.records;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">PD type</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">PD type</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2" ></div>
</div>

View File

@ -79,7 +79,7 @@ export class PdTypeListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.PDTypeList = dataresult.records;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Product Details</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Product Details</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -90,7 +90,7 @@ export class ProductListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.ProductMasterList = dataresult.records;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Region</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Region</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -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;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Relation Ship</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Relation Ship</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -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;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">State</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">State</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -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 => {

View File

@ -78,7 +78,7 @@ export class StatesListComponent implements OnInit {
this.loader = false;
if (dataresult.status == 200) {
if (dataresult.dataStatus  === true) {
this.StateList = dataresult.records;
}
})

View File

@ -10,9 +10,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Sub Product Details</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Sub Product Details</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -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 => {

View File

@ -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;
}
})

View File

@ -9,9 +9,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Title</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Title</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -23,8 +23,8 @@
<td style="text-align: center;">{{TL.abbr}}</td>
<td style="text-align: center;">{{TL.isactive}} </td>
<td style="text-align: center;">
<a (click)="editTitle(user)"><mat-icon>edit</mat-icon></a>
<a (click)="deleteTitle(user.title_id)"><mat-icon>delete_outline</mat-icon></a>
<a (click)="editTitle(TL)"><mat-icon>edit</mat-icon></a>
<a (click)="deleteTitle(TL.title_id)"><mat-icon>delete_outline</mat-icon></a>
</td>
</tr>
</table>

View File

@ -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;
}
})

View File

@ -10,9 +10,9 @@
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Type of activity</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Type of activity</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -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;
}
})

View File

@ -9,9 +9,9 @@ fxLayout.xs="column"
fxLayoutAlign="center"
fxLayoutGap="35px"
fxLayoutGap.xs="0">
<div class="mat-dialog-title" fxFlex="15px">Unit of Measurement</div>
<div class="mat-dialog-title" fxFlex fxFlexOrder="1">Unit of Measurement</div>
<div fxFlex="20px" fxFlexOrder="3" style="text-align:right;"><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button></div>
<div fxFlex></div>
<div fxFlex="15px" fxFlexOrder="2"></div>
</div>

View File

@ -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;
}
})

View File

@ -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<any> {
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<any>(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<any> {
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<any>(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<any> {
//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<any>(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<any> {
//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<any>(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<any> {
return this._http.post<any>(this.apiUrl+"getListOfMaster", { "master_name":TableName })
.pipe(
catchError(this.handleError('role', []))
)
}
// OldFunction_getAllMasterData(): Observable<Master[]> {
// 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<any> {
// 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<any> {
return this._http.post<any>(this.apiUrl+"getListOfMaster", { "master_name":TableName })
.pipe(
catchError(this.handleError('role', []))
)
}
private handleError<T>(operation = 'operation', result?: T) {
//alert();
console.log('handleError');
return (error: any): Observable<T> => {
return of(result as T);
};
}
// +++++++++++++++++++++++++++++
/** Get All Branch Data using API call With master Keyword */
// OldFunction_getAllBranch(): Observable<Branch[]> {
// 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<any> {
return this._http.get(this.apiUrl+'getListOfBranches')
.pipe(
@ -211,26 +118,11 @@ private handleError<T>(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<any> {
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<any> {
return this._http.get(this.apiUrl+'getListOfSubProduct')
@ -238,24 +130,12 @@ private handleError<T>(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<any> {
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<any> {
return this._http.get(this.apiUrl+'getListOfState')
@ -266,75 +146,36 @@ private handleError<T>(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<any> {
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<any> {
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<any> {
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<any> {
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<any> {
// 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<T>(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<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
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<any> {
// console.error('An error occurred', error);
// return Promise.reject(error.message || error);
// }
}