Masterdetails code merged
This commit is contained in:
parent
950f346081
commit
90379110e9
@ -125,6 +125,10 @@ defined('FREQUENCYID') OR define('FREQUENCYID','frequency_id');
|
|||||||
defined('CUSTOMERBEHAVIOUR') OR define('CUSTOMERBEHAVIOUR','m_customer_behaviour');
|
defined('CUSTOMERBEHAVIOUR') OR define('CUSTOMERBEHAVIOUR','m_customer_behaviour');
|
||||||
defined('CUSTOMERBEHAVIOURID') OR define('CUSTOMERBEHAVIOURID','customer_behaviour_id');
|
defined('CUSTOMERBEHAVIOURID') OR define('CUSTOMERBEHAVIOURID','customer_behaviour_id');
|
||||||
|
|
||||||
|
defined('CUSTOMERSEGMENT') OR define('CUSTOMERSEGMENT','m_customer_segment');
|
||||||
|
defined('CUSTOMERSEGMENTID') OR define('CUSTOMERSEGMENTID','customer_segment_id');
|
||||||
|
|
||||||
|
|
||||||
defined('REGIONS') OR define('REGIONS','m_regions');
|
defined('REGIONS') OR define('REGIONS','m_regions');
|
||||||
defined('REGIONSID') OR define('REGIONSID','region_id');
|
defined('REGIONSID') OR define('REGIONSID','region_id');
|
||||||
|
|
||||||
@ -137,10 +141,19 @@ defined('CITYID') OR define('CITYID','city_id');
|
|||||||
defined('BRANCH') OR define('BRANCH','m_branch');
|
defined('BRANCH') OR define('BRANCH','m_branch');
|
||||||
defined('BRANCHID') OR define('BRANCHID','branch_id');
|
defined('BRANCHID') OR define('BRANCHID','branch_id');
|
||||||
|
|
||||||
|
defined('PDALLOCATIONTYPE') OR define('PDALLOCATIONTYPE','m_pd_allocation_type');
|
||||||
|
defined('PDALLOCATIONTYPEID') OR define('PDALLOCATIONTYPEID','pd_allocation_type_id');
|
||||||
|
|
||||||
defined('PDLOCATIONAPPROACH') OR define('PDLOCATIONAPPROACH','m_pd_location_approach');
|
defined('PDLOCATIONAPPROACH') OR define('PDLOCATIONAPPROACH','m_pd_location_approach');
|
||||||
defined('PDLOCATIONAPPROACHID') OR define('PDLOCATIONAPPROACHID','pd_location_approach_id');
|
defined('PDLOCATIONAPPROACHID') OR define('PDLOCATIONAPPROACHID','pd_location_approach_id');
|
||||||
|
|
||||||
defined('LISTOFMASTERS') OR define('LISTOFMASTERS','m_list_of_masters');
|
defined('PDSTATUS') OR define('PDSTATUS','m_pd_status');
|
||||||
|
defined('PDSTATUSID') OR define('PDSTATUSID','pd_status_id');
|
||||||
|
|
||||||
|
defined('PDTYPE') OR define('PDTYPE','m_pd_type');
|
||||||
|
defined('PDTYPEID') OR define('PDTYPEID','pd_type_id');
|
||||||
|
|
||||||
|
defined('LISTOFMASTERS') OR define('LISTOFMASTERS','c_list_of_masters');
|
||||||
defined('LISTOFMASTERSID') OR define('LISTOFMASTERSID','master_id');
|
defined('LISTOFMASTERSID') OR define('LISTOFMASTERSID','master_id');
|
||||||
|
|
||||||
defined('COMMENTSONLOCALITY') OR define('COMMENTSONLOCALITY','m_comments_on_locality');
|
defined('COMMENTSONLOCALITY') OR define('COMMENTSONLOCALITY','m_comments_on_locality');
|
||||||
|
|||||||
@ -981,7 +981,7 @@ class Common_Masters_Controller extends REST_Controller {
|
|||||||
//echo $table_name;
|
//echo $table_name;
|
||||||
$result = $this->Common_Masters_Model->selectRecords(constant($table_name));
|
$result = $this->Common_Masters_Model->selectRecords(constant($table_name));
|
||||||
//print_r($result);
|
//print_r($result);
|
||||||
die();
|
//die();
|
||||||
if(count($result) > 0)
|
if(count($result) > 0)
|
||||||
{
|
{
|
||||||
$data['dataStatus'] = true;
|
$data['dataStatus'] = true;
|
||||||
@ -27,11 +27,11 @@ class SPARQ_Model extends CI_Model {
|
|||||||
|
|
||||||
public function selectRecords($table_name,$where_condition_array = array(),$print_query = '')
|
public function selectRecords($table_name,$where_condition_array = array(),$print_query = '')
|
||||||
{
|
{
|
||||||
echo $print_query;
|
// echo $print_query;
|
||||||
echo $table_name;
|
// echo $table_name;
|
||||||
|
|
||||||
$data = $this->db->get_where($table_name,$where_condition_array)->result_array();//only AND condition
|
$data = $this->db->get_where($table_name,$where_condition_array)->result_array();//only AND condition
|
||||||
print_r($data);
|
//print_r($data);
|
||||||
if($print_query == 1)
|
if($print_query == 1)
|
||||||
{
|
{
|
||||||
print_r($this->db->last_query());
|
print_r($this->db->last_query());
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class Entity_Management_Model extends SPARQ_Model {
|
|||||||
{
|
{
|
||||||
$result_data = array();
|
$result_data = array();
|
||||||
|
|
||||||
$this->db->SELECT('ENTITY.entity_id, ENTITY.full_name, ENTITY.short_name, ENTITY.fk_region,REGIONS.name as region_name, ENTITY.fk_state,STATE.name as state_name, ENTITY.fk_city,CITY.name as city_name, ENTITY.fk_branch,BRANCH.name as branch_name, ENTITY.addressline1, ENTITY.addressline2, ENTITY.official_email, ENTITY.alt_email, ENTITY.phone_number, ENTITY.mobile_no, ENTITY.remarks, ENTITY.createdon, ENTITY.fk_createdby,concat(USERPROFILE.first_name,' ',USERPROFILE.last_name) as createdby, ENTITY.updatedon, ENTITY.fk_updatedby,concat(USERPROFILE1.first_name,' ',USERPROFILE1.last_name) as updatedby, ENTITY.isactive, ENTITY.pan, ENTITY.gst_no, ENTITY.gst_state_code, addressline3, ENTITY.tat, ENTITY.fk_entity_type_id,ENTITYTYPE.name as entity_name');
|
$this->db->SELECT('ENTITY.entity_id, ENTITY.full_name, ENTITY.short_name, ENTITY.fk_region,REGIONS.name as region_name, ENTITY.fk_state,STATE.name as state_name, ENTITY.fk_city,CITY.name as city_name, ENTITY.fk_branch,BRANCH.name as branch_name, ENTITY.addressline1, ENTITY.addressline2, ENTITY.official_email, ENTITY.alt_email, ENTITY.phone_number, ENTITY.mobile_no, ENTITY.remarks, ENTITY.createdon, ENTITY.fk_createdby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby, ENTITY.updatedon, ENTITY.fk_updatedby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, ENTITY.isactive, ENTITY.pan, ENTITY.gst_no, ENTITY.gst_state_code, addressline3, ENTITY.tat, ENTITY.fk_entity_type_id,ENTITYTYPE.name as entity_name');
|
||||||
$this->db->FROM(ENTITY.' as ENTITY');
|
$this->db->FROM(ENTITY.' as ENTITY');
|
||||||
$this->db->JOIN(REGIONS.' as REGIONS','ENTITY.fk_region = REGIONS.region_id AND REGIONS.isactive = 1');
|
$this->db->JOIN(REGIONS.' as REGIONS','ENTITY.fk_region = REGIONS.region_id AND REGIONS.isactive = 1');
|
||||||
$this->db->JOIN(STATE.' as STATE','ENTITY.fk_state = STATE.state_id AND STATE.isactive = 1');
|
$this->db->JOIN(STATE.' as STATE','ENTITY.fk_state = STATE.state_id AND STATE.isactive = 1');
|
||||||
@ -29,7 +29,7 @@ class Entity_Management_Model extends SPARQ_Model {
|
|||||||
|
|
||||||
foreach($result as $key => $r)
|
foreach($result as $key => $r)
|
||||||
{
|
{
|
||||||
$this->db->SELECT('ENTITYCHILD.entity_child_id,ENTITYCHILD.contact_person,ENTITYCHILD.contact_email,ENTITYCHILD.contact_mobile_no,ENTITYCHILD.contact_person,ENTITYCHILD.isactive,ENTITYCHILD.createdon,ENTITYCHILD.fk_createdby,concat(USERPROFILE.first_name,' ',USERPROFILE.last_name) as createdby,ENTITYCHILD.updatedon,ENTITYCHILD.fk_updatedby,concat(USERPROFILE1.first_name,' ',USERPROFILE1.last_name) as updatedby');
|
$this->db->SELECT('ENTITYCHILD.entity_child_id,ENTITYCHILD.contact_person,ENTITYCHILD.contact_email,ENTITYCHILD.contact_mobile_no,ENTITYCHILD.contact_person,ENTITYCHILD.isactive,ENTITYCHILD.createdon,ENTITYCHILD.fk_createdby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,ENTITYCHILD.updatedon,ENTITYCHILD.fk_updatedby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby');
|
||||||
$this->db->FROM(ENTITYCHILD.' as ENTITYCHILD');
|
$this->db->FROM(ENTITYCHILD.' as ENTITYCHILD');
|
||||||
$this->db->JOIN(ENTITY.' as ENTITY','ENTITYCHILD.fk_entity_id = ENTITY.entity_id AND ENTITY.isactive = 1');
|
$this->db->JOIN(ENTITY.' as ENTITY','ENTITYCHILD.fk_entity_id = ENTITY.entity_id AND ENTITY.isactive = 1');
|
||||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','ENTITYCHILD.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
|
$this->db->JOIN(USERPROFILE.' as USERPROFILE','ENTITYCHILD.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
import { HttpModule, Http } from '@angular/http';
|
import { HttpModule, Http } from '@angular/http';
|
||||||
|
|
||||||
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
|
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
|
||||||
@ -21,6 +22,7 @@ import {MatListModule} from '@angular/material/list';
|
|||||||
import {MatMenuModule} from '@angular/material/menu';
|
import {MatMenuModule} from '@angular/material/menu';
|
||||||
import {MatToolbarModule} from '@angular/material/toolbar';
|
import {MatToolbarModule} from '@angular/material/toolbar';
|
||||||
import {MatTabsModule} from '@angular/material/tabs';
|
import {MatTabsModule} from '@angular/material/tabs';
|
||||||
|
import {MatTableModule} from '@angular/material';
|
||||||
import {MatCheckboxModule} from '@angular/material/checkbox';
|
import {MatCheckboxModule} from '@angular/material/checkbox';
|
||||||
import {MatProgressBarModule} from '@angular/material/progress-bar';
|
import {MatProgressBarModule} from '@angular/material/progress-bar';
|
||||||
import {MatSelectModule} from '@angular/material/select';
|
import {MatSelectModule} from '@angular/material/select';
|
||||||
@ -66,6 +68,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
|||||||
onSameUrlNavigation: 'reload'
|
onSameUrlNavigation: 'reload'
|
||||||
}),
|
}),
|
||||||
FormsModule,
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
HttpModule,
|
HttpModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
MatSidenavModule,
|
MatSidenavModule,
|
||||||
@ -94,7 +97,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
|||||||
useClass:[{AwsService,SharedService}]
|
useClass:[{AwsService,SharedService}]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
entryComponents: [JazzDialogComponent, NewPasswordDialog,ForgotPass,ChangePasswordDialog ],
|
entryComponents: [JazzDialogComponent, NewPasswordDialog,ForgotPass,ChangePasswordDialog],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|||||||
@ -19,7 +19,8 @@ export const AppRoutes: Routes = [{
|
|||||||
},{
|
},{
|
||||||
path:'settings',
|
path:'settings',
|
||||||
loadChildren:'./settings/settings.module#SettingsModule'
|
loadChildren:'./settings/settings.module#SettingsModule'
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
path: '',
|
path: '',
|
||||||
component: AuthLayoutComponent,
|
component: AuthLayoutComponent,
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import 'rxjs/add/operator/map';
|
|||||||
import { SharedService } from './shared.service';
|
import { SharedService } from './shared.service';
|
||||||
|
|
||||||
|
|
||||||
let apiurl = 'localhost/sineedge/sparqapi/api/';
|
let apiurl = 'localhost/sparqapi/api/';
|
||||||
const sineedge_poolData = {
|
const sineedge_poolData = {
|
||||||
UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
||||||
ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
||||||
@ -48,7 +48,7 @@ const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap
|
|||||||
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
|
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
|
||||||
const vendorIdenttiy = "";
|
const vendorIdenttiy = "";
|
||||||
// serviceProvider
|
// serviceProvider
|
||||||
apiurl = "http://localhost/sineedge/sparqapi/api/";
|
// apiurl = "http://localhost/sineedge/sparqapi/api/";
|
||||||
const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
|
const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
|||||||
@ -0,0 +1,65 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Branch
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">Branch</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>
|
||||||
|
|
||||||
|
<!-- {{empresas|json}} -->
|
||||||
|
|
||||||
|
<form [formGroup]="_branchForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-2">
|
||||||
|
<mat-form-field>
|
||||||
|
<!-- <ngx-select-dropdown [multiple]="false" [value]="citydatas.city_id" [options]="citydatas" ></ngx-select-dropdown> -->
|
||||||
|
<mat-select placeholder="Pick Up City name" required [formControl]="_branchForm.controls['fk_city_id']">
|
||||||
|
<!-- <mat-option (click)="onChangedData()" *ngFor="let masters of masterArray" [value]="masters.value" [disabled]="masters.disabled"> -->
|
||||||
|
<mat-option *ngFor="let cd of citydatas" [value]="cd.city_id">{{ cd.name }}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="!_branchForm.controls['fk_city_id'].valid && _branchForm.controls['fk_city_id'].touched" class="mat-text-warn">You must Pickup City Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
<!-- <small *ngIf="!_branchForm.controls['fk_city_id'].valid && _branchForm.controls['fk_city_id'].touched" class="mat-text-warn">You must Pickup City Name.</small> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field>
|
||||||
|
<input matInput type="text" placeholder="Branch Name" required [formControl]="_branchForm.controls['name']">
|
||||||
|
<mat-error *ngIf="!_branchForm.controls['name'].valid && _branchForm.controls['name'].touched">You must inculde a Name</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
<!-- <small *ngIf="!_branchForm.controls['name'].valid && _branchForm.controls['name'].touched" class="mat-text-warn">You must include a Name.</small> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
|
||||||
|
tate_id: "1", fk_region_id: "1", name: "TamilNadu", code: "TN", createdon: "2018-08-07 15:10:00", …}
|
||||||
|
1
|
||||||
|
:
|
||||||
|
{state_id: "2", fk_region_id: "0", name: "one edited", code:
|
||||||
|
<input matInput type="text" placeholder="City Name" required [formControl]="_branchForm.controls['fk_city_id']">
|
||||||
|
</mat-form-field>
|
||||||
|
<small *ngIf="!_branchForm.controls['fk_city_id'].valid && _branchForm.controls['fk_city_id'].touched" class="mat-text-warn">You must include a City Name.</small>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_branchForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
mat-dialog-container{
|
||||||
|
width:10% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
//style="width: 100%"
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { BranchDialogComponent } from './branch-dialog.component';
|
||||||
|
|
||||||
|
describe('BranchDialogComponent', () => {
|
||||||
|
let component: BranchDialogComponent;
|
||||||
|
let fixture: ComponentFixture<BranchDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ BranchDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(BranchDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
import { Branch,States,City } from '../../../model/branch';
|
||||||
|
import { Observable } from 'rxjs/Observable';//for Datatables
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './branch-dialog.component.html',
|
||||||
|
styleUrls: ['./branch-dialog.component.scss']
|
||||||
|
})
|
||||||
|
|
||||||
|
export class BranchDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
public _branchForm: FormGroup;
|
||||||
|
|
||||||
|
citydatas: City[];
|
||||||
|
errorMessage:string;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<BranchDialogComponent>,
|
||||||
|
private _mastersService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: Branch) { }
|
||||||
|
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._branchForm = this._formBuilder.group({
|
||||||
|
branch_id: [this.data.branch_id],
|
||||||
|
name: [this.data.name, Validators.compose([Validators.required])],
|
||||||
|
fk_city_id: [this.data.fk_city_id, Validators.compose([Validators.required])]
|
||||||
|
});
|
||||||
|
//console.log(this._branchForm);
|
||||||
|
|
||||||
|
this._mastersService.getAllCityData()
|
||||||
|
.subscribe(
|
||||||
|
data => {
|
||||||
|
|
||||||
|
this.citydatas = data;
|
||||||
|
this.citydatas = this.citydatas.filter(city=>city.isactive == 1 );
|
||||||
|
|
||||||
|
}, error => this.errorMessage = <any> error);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** For Popup Close Button */
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** To Save/Edited Popup Data */
|
||||||
|
onSubmit() {
|
||||||
|
|
||||||
|
var BranchFormValues = this._branchForm.value;
|
||||||
|
|
||||||
|
if(isNaN(this.data.branch_id)) {
|
||||||
|
|
||||||
|
Object.keys(BranchFormValues)
|
||||||
|
.forEach((key) => ( BranchFormValues[key] == null) && delete BranchFormValues[key]);
|
||||||
|
//console.log(BranchFormValues);
|
||||||
|
this._mastersService.addMasterDetails(BranchFormValues,'BRANCH').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
//alert("saved");
|
||||||
|
} else {
|
||||||
|
this._mastersService.editMasterDetails(BranchFormValues,'BRANCH').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
//alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** To Reset Popup Data */
|
||||||
|
onReset(){
|
||||||
|
this._branchForm.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addBranch()" [disabled]="dialogRef"> + Add Branch</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>Branch Name</th>
|
||||||
|
<th header-cell>Branch City Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let BL of BranchList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.Name}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.CityID}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editBranch(BL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteBranch(BL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="branch_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.branch_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fk_city_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> fk_city_id </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.fk_city_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="cname">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> city name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.cityname}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<!-- <ng-container matColumnDef="sname">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> state name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.statename}} </mat-cell>
|
||||||
|
</ng-container> -->
|
||||||
|
<ng-container matColumnDef="createdon">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> createdon </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.createdon}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fk_createdby">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> createdby </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.fk_createdby}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="updatedon">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> updated on </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.updatedon}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fk_updatedby">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> updatedby </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.fk_updatedby}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editBranch(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteBranch(user.branch_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
/* Structure */
|
||||||
|
.example-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example-header {
|
||||||
|
min-height: 64px;
|
||||||
|
padding: 8px 24px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-dialog-container{
|
||||||
|
width:40% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
//mat-cell{
|
||||||
|
.cell{
|
||||||
|
display:flex !important;
|
||||||
|
justify-content:center!important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// mat-header-cell {
|
||||||
|
.header-cell{
|
||||||
|
display:flex;
|
||||||
|
justify-content:center;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { BranchListComponent } from './branch-list.component';
|
||||||
|
|
||||||
|
describe('BranchListComponent', () => {
|
||||||
|
let component: BranchListComponent;
|
||||||
|
let fixture: ComponentFixture<BranchListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ BranchListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(BranchListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { BranchDialogComponent } from '../branch-dialog/branch-dialog.component';
|
||||||
|
import { Branch,States,City } from '../../../model/branch';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-branch-list',
|
||||||
|
templateUrl: './branch-list.component.html',
|
||||||
|
styleUrls: ['./branch-list.component.scss']
|
||||||
|
})
|
||||||
|
export class BranchListComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
isactive:number;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _mastersService: MastersService) { }
|
||||||
|
|
||||||
|
ngOnInit() {}
|
||||||
|
|
||||||
|
displayedColumns = ['branch_id','name','fk_city_id','cname', 'isactive','actions'];
|
||||||
|
dataSource = new UserDataSource(this._mastersService);
|
||||||
|
|
||||||
|
/** Popup for ADD Branch */
|
||||||
|
addBranch() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(BranchDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Popup for EDIT Branch */
|
||||||
|
editBranch(arr: Branch[]) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
|
||||||
|
const dialogRef = this.dialog.open(BranchDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Popup for EDIT Branch */
|
||||||
|
deleteBranch(id: number) {
|
||||||
|
|
||||||
|
this._mastersService.deleteMasterDetails(id,'BRANCH').subscribe();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _ms: MastersService) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<Branch[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
//return this._bs.getAllBranch();
|
||||||
|
console.log(this._ms.getAllBranch());
|
||||||
|
return this._ms.getAllBranch();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>City
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">City</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>
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_cityForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-select placeholder="Pick Up State Name" required [formControl]="_cityForm.controls['fk_state_id']">
|
||||||
|
<mat-option *ngFor="let sd of statedatas" [value]="sd.state_id">{{ sd.name }}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="!_cityForm.controls['fk_state_id'].valid && _cityForm.controls['fk_state_id'].touched" class="mat-text-warn">You must Pickup State Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field>
|
||||||
|
<input matInput type="text" placeholder="City Name" required [formControl]="_cityForm.controls['name']">
|
||||||
|
<mat-error *ngIf="!_cityForm.controls['name'].valid && _cityForm.controls['name'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="State Name" required [formControl]="_cityForm.controls['fk_state_id']">
|
||||||
|
</mat-form-field>
|
||||||
|
<small *ngIf="!_cityForm.controls['fk_state_id'].valid && _cityForm.controls['fk_state_id'].touched" class="mat-text-warn">You must include a State Name.</small>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_cityForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CityDialogComponent } from './city-dialog.component';
|
||||||
|
|
||||||
|
describe('CityDialogComponent', () => {
|
||||||
|
let component: CityDialogComponent;
|
||||||
|
let fixture: ComponentFixture<CityDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CityDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CityDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './city-dialog.component.html',
|
||||||
|
styleUrls: ['./city-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class CityDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
public _cityForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<CityDialogComponent>,
|
||||||
|
private _MastersService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._cityForm = this._formBuilder.group({
|
||||||
|
//City_id: any; fk_city_id: any;
|
||||||
|
|
||||||
|
city_id: [this.data.city_id],
|
||||||
|
name: [this.data.name, Validators.compose([Validators.required])],
|
||||||
|
fk_state_id: [this.data.fk_state_id, Validators.compose([Validators.required])]
|
||||||
|
});
|
||||||
|
//console.log(this._cityForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._MastersService.addCity(this._cityForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._MastersService.editCity(this._cityForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.city_id)) {
|
||||||
|
var my_array = this._cityForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._MastersService.addMasterDetails(my_array,'CITY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this._MastersService.editMasterDetails(this._cityForm.value,'CITY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._cityForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addCity()" [disabled]="dialogRef"> + Add City</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>City Name</th>
|
||||||
|
<th header-cell>City City Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let BL of CityList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.Name}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.CityID}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCity(BL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCity(BL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="city_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.city_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fk_state_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> state ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.fk_state_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCity(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCity(user.city_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CityListComponent } from './city-list.component';
|
||||||
|
|
||||||
|
describe('CityListComponent', () => {
|
||||||
|
let component: CityListComponent;
|
||||||
|
let fixture: ComponentFixture<CityListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CityListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CityListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { CityDialogComponent } from '../city-dialog/city-dialog.component';
|
||||||
|
import { City } from '../../../model/city';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-city-list',
|
||||||
|
templateUrl: './city-list.component.html',
|
||||||
|
styleUrls: ['./city-list.component.scss']
|
||||||
|
})
|
||||||
|
export class CityListComponent implements OnInit {
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
//, createdon, fk_createdby, updatedon, fk_updatedby, isactive
|
||||||
|
displayedColumns = ['city_id', 'fk_state_id', 'name', 'isactive','actions'];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _MastersService: MastersService) { }
|
||||||
|
|
||||||
|
// get CityList() {
|
||||||
|
// return this._MastersService.getAllCity();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._MastersService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addCity() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(CityDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editCity(arr: any[]) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._MastersService.getAllCity().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(CityDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteCity(id: number) {
|
||||||
|
this._MastersService.deleteMasterDetails(id,'CITY');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _bs: MastersService) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<City[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._bs.getAllCity();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>CommentOnLocality
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">Comment On Locality</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>
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_CommentOnLocalityForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Rating" required [formControl]="_CommentOnLocalityForm.controls['rating']">
|
||||||
|
<mat-error *ngIf="!_CommentOnLocalityForm.controls['rating'].valid && _CommentOnLocalityForm.controls['rating'].touched" class="mat-text-warn">You must include a Rating.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_CommentOnLocalityForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CommentsOnLocalityDialogComponent } from './comments-on-locality-dialog.component';
|
||||||
|
|
||||||
|
describe('CommentsOnLocalityDialogComponent', () => {
|
||||||
|
let component: CommentsOnLocalityDialogComponent;
|
||||||
|
let fixture: ComponentFixture<CommentsOnLocalityDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CommentsOnLocalityDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CommentsOnLocalityDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './comments-on-locality-dialog.component.html',
|
||||||
|
styleUrls: ['./comments-on-locality-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class CommentsOnLocalityDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
public _CommentOnLocalityForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<CommentsOnLocalityDialogComponent>,
|
||||||
|
private _MastersService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._CommentOnLocalityForm = this._formBuilder.group({
|
||||||
|
//branch_id: any; fk_city_id: any;
|
||||||
|
comments_on_locality_id: [this.data.comments_on_locality_id],
|
||||||
|
rating: [this.data.rating, Validators.compose([Validators.required])],
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.comments_on_locality_id)) {
|
||||||
|
var my_array = this._CommentOnLocalityForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._MastersService.addMasterDetails(my_array,'COMMENTSONLOCALITY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this._MastersService.editMasterDetails(this._CommentOnLocalityForm.value,'COMMENTSONLOCALITY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._CommentOnLocalityForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addCommentsOnLocality()" [disabled]="dialogRef"> + Add Comments On Locality</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>Branch Name</th>
|
||||||
|
<th header-cell>Branch City Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let BL of BranchList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.Name}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.CityID}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editBranch(BL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteBranch(BL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="comments_on_locality_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> No </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.comments_on_locality_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="rating">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Rating </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.rating}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCommentsOnLocality(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCommentsOnLocality(user.comments_on_locality_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CommentsOnLocalityListComponent } from './comments-on-locality-list.component';
|
||||||
|
|
||||||
|
describe('CommentsOnLocalityListComponent', () => {
|
||||||
|
let component: CommentsOnLocalityListComponent;
|
||||||
|
let fixture: ComponentFixture<CommentsOnLocalityListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CommentsOnLocalityListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CommentsOnLocalityListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { CommentsOnLocalityDialogComponent } from '../comments-on-locality-dialog/comments-on-locality-dialog.component';
|
||||||
|
import { CommentsOnLocality } from '../../../model/comments-on-locality';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-comments-on-locality-list',
|
||||||
|
templateUrl: './comments-on-locality-list.component.html',
|
||||||
|
styleUrls: ['./comments-on-locality-list.component.scss']
|
||||||
|
})
|
||||||
|
export class CommentsOnLocalityListComponent implements OnInit {
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
displayedColumns = ['comments_on_locality_id','rating','isactive','actions'];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _MastersService: MastersService) { }
|
||||||
|
|
||||||
|
// get CommentsOnLocalityList() {
|
||||||
|
// return this._MastersService.getAllCommentsOnLocality();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._MastersService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addCommentsOnLocality() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(CommentsOnLocalityDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editCommentsOnLocality(arr: any[]) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._MastersService.getAllCommentsOnLocality().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(CommentsOnLocalityDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteCommentsOnLocality(id: number) {
|
||||||
|
this._MastersService.deleteMasterDetails(id,'COMMENTSONLOCALITY');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _bs: MastersService) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<CommentsOnLocality []> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._bs.getAllCommentsOnLocality();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
<div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Company
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_companyForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
<!-- displayedColumns = ['company_id', 'name', 'addressline1', 'addressline2','addressline3', 'city', 'state', 'pincode', 'logo']; -->
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Company Name" required [formControl]="_companyForm.controls['name']">
|
||||||
|
<mat-error *ngIf="!_companyForm.controls['name'].valid && _companyForm.controls['name'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Company addressline1" required [formControl]="_companyForm.controls['addressline1']">
|
||||||
|
<mat-error *ngIf="!_companyForm.controls['addressline1'].valid && _companyForm.controls['addressline1'].touched" class="mat-text-warn">You must include a addressline1.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Company addressline2" required [formControl]="_companyForm.controls['addressline2']">
|
||||||
|
<mat-error *ngIf="!_companyForm.controls['addressline2'].valid && _companyForm.controls['addressline2'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Company addressline3" required [formControl]="_companyForm.controls['addressline3']">
|
||||||
|
<mat-error *ngIf="!_companyForm.controls['addressline3'].valid && _companyForm.controls['addressline3'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="City" required [formControl]="_companyForm.controls['city']">
|
||||||
|
<mat-error *ngIf="!_companyForm.controls['city'].valid && _companyForm.controls['city'].touched" class="mat-text-warn">You must include a City.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Pin code" required [formControl]="_companyForm.controls['pincode']">
|
||||||
|
<mat-hint>pincode should be in 6 digit format</mat-hint>
|
||||||
|
<!-- <mat-error *ngIf="_companyForm.controls['pincode'].hasError('required') && _companyForm.controls['pincode'].touched" class="mat-text-warn">You must include phone number.</mat-error> -->
|
||||||
|
<!-- <mat-error *ngIf="!_companyForm.controls['pincode'].valid && _companyForm.controls['pincode'].touched" class="mat-text-warn">You must include a pincode number.</mat-error> -->
|
||||||
|
<mat-error *ngIf="_companyForm.controls['pincode'].hasError('minlength') && form.controls['pincode'].touched" class="mat-text-warn">Your pincode must be at least 5 characters long.</mat-error>
|
||||||
|
<mat-error *ngIf="_companyForm.controls['pincode'].hasError('maxlength') && form.controls['pincode'].touched" class="mat-text-warn">Your pincode name cannot exceed 6 characters.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="state" required [formControl]="_companyForm.controls['state']">
|
||||||
|
<mat-error *ngIf="!_companyForm.controls['state'].valid && _companyForm.controls['state'].touched" class="mat-text-warn">You must include a State.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="logo" required [formControl]="_companyForm.controls['logo']">
|
||||||
|
<mat-error *ngIf="!_companyForm.controls['logo'].valid && _companyForm.controls['logo'].touched" class="mat-text-warn">You must include a logo.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_companyForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CompanyDialogComponent } from './company-dialog.component';
|
||||||
|
|
||||||
|
describe('CompanyDialogComponent', () => {
|
||||||
|
let component: CompanyDialogComponent;
|
||||||
|
let fixture: ComponentFixture<CompanyDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CompanyDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CompanyDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
|
||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
//import { CompanyService } from '../../../service/company.service';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './company-dialog.component.html',
|
||||||
|
styleUrls: ['./company-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class CompanyDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
public _companyForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<CompanyDialogComponent>,
|
||||||
|
private _masterService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._companyForm = this._formBuilder.group({
|
||||||
|
//Company_id: any; fk_city_id: any;
|
||||||
|
// <!-- displayedColumns = ['company_id', 'name', 'addressline1', 'addressline2','addressline3', 'city', 'state', 'pincode', 'logo']; -->
|
||||||
|
company_id: [this.data.company_id],
|
||||||
|
name: [this.data.name, Validators.compose([Validators.required])],
|
||||||
|
addressline1: [this.data.addressline1, Validators.compose([Validators.required])],
|
||||||
|
addressline2: [this.data.addressline2, Validators.compose([Validators.required])],
|
||||||
|
addressline3: [this.data.addressline3, Validators.compose([Validators.required])],
|
||||||
|
city: [this.data.city, Validators.compose([Validators.required])],
|
||||||
|
state: [this.data.state, Validators.compose([Validators.required])],
|
||||||
|
pincode: [this.data.pincode, Validators.compose([Validators.required, Validators.minLength(5), Validators.maxLength(6)])],
|
||||||
|
logo : [this.data.logo, Validators.compose([Validators.required])]
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._companyService.addCompany(this._companyForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._companyService.editCompany(this._companyForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.company_id)) {
|
||||||
|
var my_array = this._companyForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._masterService.addMasterDetails(my_array,'COMPANY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this._masterService.editMasterDetails(this._companyForm.value,'COMPANY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._companyForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addCompany()" [disabled]="dialogRef"> + Add Company</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>Company Name</th>
|
||||||
|
<th header-cell>Company City Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let BL of CompanyList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.Name}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.CityID}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCompany(BL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCompany(BL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- displayedColumns = ['company_id', 'name', 'addressline1', 'addressline2','addressline3', 'city', 'state', 'pincode', 'logo']; -->
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="company_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.company_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="addressline1">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> address </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.addressline1}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="addressline2">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> address 2 </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.addressline2}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="addressline3">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> address 3 </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.addressline3}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="city">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> city </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.city}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="state">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> state </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.state}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="pincode">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Pincode </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.pincode}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="logo">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> logo name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.logo}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="action">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCompany(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCompany(user.company_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CompanyListComponent } from './company-list.component';
|
||||||
|
|
||||||
|
describe('CompanyListComponent', () => {
|
||||||
|
let component: CompanyListComponent;
|
||||||
|
let fixture: ComponentFixture<CompanyListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CompanyListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CompanyListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
import { DataSource } from '@angular/cdk/collections';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
import { of as observableOf, merge } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
|
import { CompanyDialogComponent } from '../company-dialog/company-dialog.component';
|
||||||
|
import { Company } from '../../../model/company';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-company-list',
|
||||||
|
templateUrl: './company-list.component.html',
|
||||||
|
styleUrls: ['./company-list.component.scss']
|
||||||
|
})
|
||||||
|
export class CompanyListComponent implements OnInit {
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
//displayedColumns = ['Company_id', 'fk_city_id', 'name', 'createdon', 'fk_createdby', 'updatedon', 'fk_updatedby', 'isactive','actions'];
|
||||||
|
displayedColumns = ['company_id', 'name', 'addressline1', 'addressline2','addressline3', 'city', 'state', 'pincode', 'logo','action'];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _MastersService: MastersService) { }
|
||||||
|
|
||||||
|
// get CompanyList() {
|
||||||
|
// return this._MastersService.getAllCompany();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._MastersService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addCompany() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(CompanyDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editCompany(arr: any[]) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._MastersService.getAllCompany().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(CompanyDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteCompany(id: number) {
|
||||||
|
this._MastersService.deleteMasterDetails(id,'COMPANY');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _bs: MastersService) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<Company[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._bs.getAllCompany();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Customer Behaviour
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">Customer Behaviour</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_customerBehaviourForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Description" required [formControl]="_customerBehaviourForm.controls['description']">
|
||||||
|
<mat-error *ngIf="!_customerBehaviourForm.controls['description'].valid && _customerBehaviourForm.controls['description'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- customer_behaviour_id, description, createdon, fk_createdby, updatedon, fk_updatedby, isactive -->
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_customerBehaviourForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CustomerBehaviourDialogComponent } from './customer-behaviour-dialog.component';
|
||||||
|
|
||||||
|
describe('CustomerBehaviourDialogComponent', () => {
|
||||||
|
let component: CustomerBehaviourDialogComponent;
|
||||||
|
let fixture: ComponentFixture<CustomerBehaviourDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CustomerBehaviourDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CustomerBehaviourDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './customer-behaviour-dialog.component.html',
|
||||||
|
styleUrls: ['./customer-behaviour-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class CustomerBehaviourDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
public _customerBehaviourForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<CustomerBehaviourDialogComponent>,
|
||||||
|
private _MastersService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._customerBehaviourForm = this._formBuilder.group({
|
||||||
|
//branch_id: any; fk_city_id: any;
|
||||||
|
customer_behaviour_id: [this.data.customer_behaviour_id],
|
||||||
|
description: [this.data.description, Validators.compose([Validators.required])]
|
||||||
|
|
||||||
|
});
|
||||||
|
//customer_behaviour_id, description, createdon, fk_createdby, updatedon, fk_updatedby, isactive
|
||||||
|
//console.log(this._customerBehaviourForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._MastersService.addBranch(this._customerBehaviourForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._MastersService.editBranch(this._customerBehaviourForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.customer_behaviour_id)) {
|
||||||
|
var my_array = this._customerBehaviourForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._MastersService.addMasterDetails(my_array,'CUSTOMERBEHAVIOUR').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this._MastersService.editMasterDetails(this._customerBehaviourForm.value,'CUSTOMERBEHAVIOUR').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._customerBehaviourForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addCustomerBehaviour()" [disabled]="dialogRef"> + Add CustomerBehaviour</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>CustomerBehaviour Name</th>
|
||||||
|
<th header-cell>CustomerBehaviour City Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let BL of CustomerBehaviourList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.Name}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.CityID}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCustomerBehaviour(BL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCustomerBehaviour(BL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
<!-- //customer_behaviour_id, description, createdon, fk_createdby, updatedon, fk_updatedby, isactive -->
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="customer_behaviour_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.customer_behaviour_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="description">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> description </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.description}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCustomerBehaviour(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCustomerBehaviour(user.customer_behaviour_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CustomerBehaviourListComponent } from './customer-behaviour-list.component';
|
||||||
|
|
||||||
|
describe('CustomerBehaviourListComponent', () => {
|
||||||
|
let component: CustomerBehaviourListComponent;
|
||||||
|
let fixture: ComponentFixture<CustomerBehaviourListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CustomerBehaviourListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CustomerBehaviourListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { CustomerBehaviourDialogComponent } from '../customer-behaviour-dialog/customer-behaviour-dialog.component';
|
||||||
|
import { CustomerBehaviour } from '../../../model/customer-behaviour';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-customer-behaviour-list',
|
||||||
|
templateUrl: './customer-behaviour-list.component.html',
|
||||||
|
styleUrls: ['./customer-behaviour-list.component.scss']
|
||||||
|
})
|
||||||
|
export class CustomerBehaviourListComponent implements OnInit {
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
displayedColumns = ['customer_behaviour_id', 'description', 'isactive','actions'];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _MastersService: MastersService) { }
|
||||||
|
|
||||||
|
// get CustomerBehaviourList() {
|
||||||
|
// return this._MastersService.getAllCustomerBehaviour();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._MastersService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addCustomerBehaviour() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(CustomerBehaviourDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editCustomerBehaviour(arr: any[]) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._MastersService.getAllCustomerBehaviour().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(CustomerBehaviourDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteCustomerBehaviour(id: number) {
|
||||||
|
this._MastersService.deleteMasterDetails(id,'CUSTOMERBEHAVIOUR');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _bs: MastersService) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<CustomerBehaviour[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._bs.getAllCustomerBehaviour();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Customer Segment
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">Customer Segment</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_customerSegmentForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Name" required [formControl]="_customerSegmentForm.controls['name']">
|
||||||
|
<mat-error *ngIf="!_customerSegmentForm.controls['name'].valid && _customerSegmentForm.controls['name'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Abbrevation" required [formControl]="_customerSegmentForm.controls['abbr']">
|
||||||
|
<mat-error *ngIf="!_customerSegmentForm.controls['abbr'].valid && _customerSegmentForm.controls['abbr'].touched" class="mat-text-warn">You must include a Abbrevation.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_customerSegmentForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CustomerSegmentDialogComponent } from './customer-segment-dialog.component';
|
||||||
|
|
||||||
|
describe('CustomerSegmentDialogComponent', () => {
|
||||||
|
let component: CustomerSegmentDialogComponent;
|
||||||
|
let fixture: ComponentFixture<CustomerSegmentDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CustomerSegmentDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CustomerSegmentDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './customer-segment-dialog.component.html',
|
||||||
|
styleUrls: ['./customer-segment-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class CustomerSegmentDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
public _customerSegmentForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<CustomerSegmentDialogComponent>,
|
||||||
|
private _MastersService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._customerSegmentForm = this._formBuilder.group({
|
||||||
|
//CustomerSegment_id: any; fk_city_id: any;
|
||||||
|
customer_segment_id: [this.data.customer_segment_id],
|
||||||
|
name: [this.data.name, Validators.compose([Validators.required])],
|
||||||
|
abbr: [this.data.abbr, Validators.compose([Validators.required])]
|
||||||
|
});
|
||||||
|
//console.log(this._customerSegmentForm);
|
||||||
|
//customer_segment_id, name, abbr, createdon, fk_createdby, updatedon, isactive, fk_updatedby
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._MastersService.addCustomerSegment(this._customerSegmentForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._MastersService.editCustomerSegment(this._customerSegmentForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.customer_segment_id)) {
|
||||||
|
var my_array = this._customerSegmentForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._MastersService.addMasterDetails(my_array,'CUSTOMERSEGMENT').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this._MastersService.editMasterDetails(this._customerSegmentForm.value,'CUSTOMERSEGMENT').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._customerSegmentForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addCustomerSegment()" [disabled]="dialogRef"> + Add CustomerSegment</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>CustomerSegment Name</th>
|
||||||
|
<th header-cell>CustomerSegment City Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let BL of CustomerSegmentList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.Name}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.CityID}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCustomerSegment(BL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCustomerSegment(BL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
<!-- //customer_Segment_id, description, createdon, fk_createdby, updatedon, fk_updatedby, isactive -->
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="customer_segment_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.customer_segment_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="abbr">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Abbrevation </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.abbr}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editCustomerSegment(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteCustomerSegment(user.customer_segment_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CustomerSegmentListComponent } from './customer-segment-list.component';
|
||||||
|
|
||||||
|
describe('CustomerSegmentListComponent', () => {
|
||||||
|
let component: CustomerSegmentListComponent;
|
||||||
|
let fixture: ComponentFixture<CustomerSegmentListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CustomerSegmentListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CustomerSegmentListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { CustomerSegmentDialogComponent } from '../customer-segment-dialog/customer-segment-dialog.component';
|
||||||
|
import { CustomerSegment } from '../../../model/customer-segment';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-customer-segment-list',
|
||||||
|
templateUrl: './customer-segment-list.component.html',
|
||||||
|
styleUrls: ['./customer-segment-list.component.scss']
|
||||||
|
})
|
||||||
|
export class CustomerSegmentListComponent implements OnInit {
|
||||||
|
isPopupOpened = true;
|
||||||
|
displayedColumns = ['customer_segment_id', 'abbr', 'name', 'isactive','actions'];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _MastersService: MastersService) { }
|
||||||
|
|
||||||
|
// get CustomerSegmentList() {
|
||||||
|
// return this._MastersService.getAllCustomerSegment();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._MastersService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addCustomerSegment() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(CustomerSegmentDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editCustomerSegment(arr: any[]) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._MastersService.getAllCustomerSegment().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(CustomerSegmentDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteCustomerSegment(id: number) {
|
||||||
|
this._MastersService.deleteMasterDetails(id,'CUSTOMERSEGMENT');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _bs: MastersService) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<CustomerSegment[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._bs.getAllCustomerSegment();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Designation
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">Designation</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_designationForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Name" required [formControl]="_designationForm.controls['name']">
|
||||||
|
<mat-error *ngIf="!_designationForm.controls['name'].valid && _designationForm.controls['name'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- //designation_id, name, short_name, createdon, fk_createdby, updatedon, fk_updatedby, isactive -->
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Short Name" required [formControl]="_designationForm.controls['short_name']">
|
||||||
|
<mat-error *ngIf="!_designationForm.controls['short_name'].valid && _designationForm.controls['short_name'].touched" class="mat-text-warn">You must include a Short Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_designationForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DesignationDialogComponent } from './designation-dialog.component';
|
||||||
|
|
||||||
|
describe('DesignationDialogComponent', () => {
|
||||||
|
let component: DesignationDialogComponent;
|
||||||
|
let fixture: ComponentFixture<DesignationDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ DesignationDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(DesignationDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-designation-dialog',
|
||||||
|
templateUrl: './designation-dialog.component.html',
|
||||||
|
styleUrls: ['./designation-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class DesignationDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
public _designationForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<DesignationDialogComponent>,
|
||||||
|
private _MastersService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._designationForm = this._formBuilder.group({
|
||||||
|
//Designation_id: any; fk_city_id: any;
|
||||||
|
designation_id: [this.data.designation_id],
|
||||||
|
name: [this.data.name, Validators.compose([Validators.required])],
|
||||||
|
short_name: [this.data.short_name, Validators.compose([Validators.required])]
|
||||||
|
});
|
||||||
|
//console.log(this._designationForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._MastersService.addDesignation(this._designationForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._MastersService.editDesignation(this._designationForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.designation_id)) {
|
||||||
|
var my_array = this._designationForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._MastersService.addMasterDetails(my_array,'DESIGNATION').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this._MastersService.editMasterDetails(this._designationForm.value,'DESIGNATION').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._designationForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addDesignation()" [disabled]="dialogRef"> + Add Designation</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>Designation Name</th>
|
||||||
|
<th header-cell>Designation City Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let BL of DesignationList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.Name}}</td>
|
||||||
|
<td style="text-align: center;">{{BL.CityID}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editDesignation(BL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteDesignation(BL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- //designation_id, name, short_name, createdon, fk_createdby, updatedon, fk_updatedby, isactive -->
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="designation_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.designation_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="short_name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Short Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.short_name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editDesignation(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteDesignation(user.Designation_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DesignationListComponent } from './designation-list.component';
|
||||||
|
|
||||||
|
describe('DesignationListComponent', () => {
|
||||||
|
let component: DesignationListComponent;
|
||||||
|
let fixture: ComponentFixture<DesignationListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ DesignationListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(DesignationListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { DesignationDialogComponent } from '../designation-dialog/designation-dialog.component';
|
||||||
|
import { Designation } from '../../../model/designation';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-designation-list',
|
||||||
|
templateUrl: './designation-list.component.html',
|
||||||
|
styleUrls: ['./designation-list.component.scss']
|
||||||
|
})
|
||||||
|
export class DesignationListComponent implements OnInit {
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
displayedColumns = ['designation_id', 'name', 'short_name','isactive','actions'];
|
||||||
|
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _MastersService: MastersService) { }
|
||||||
|
|
||||||
|
// get DesignationList() {
|
||||||
|
// return this._MastersService.getAllDesignation();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._MastersService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addDesignation() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(DesignationDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editDesignation(arr: any[]) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._MastersService.getAllDesignation().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(DesignationDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteDesignation(id: number) {
|
||||||
|
this._MastersService.deleteMasterDetails(id,'DESIGNATION');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _bs: MastersService) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<Designation[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._bs.getAllDesignation();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
<div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Entity Type
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">Branch</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>
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_entityTypeForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Name" required [formControl]="_entityTypeForm.controls['name']">
|
||||||
|
</mat-form-field>
|
||||||
|
<small *ngIf="!_entityTypeForm.controls['name'].valid && _entityTypeForm.controls['name'].touched" class="mat-text-warn">You must include a Name.</small>
|
||||||
|
</div>
|
||||||
|
<!-- //entity_type_id, name, createdon, fk_createdby, updatedon, fk_updatedby, isactive -->
|
||||||
|
<!-- //EntityType_id, name, short_name, createdon, fk_createdby, updatedon, fk_updatedby, isactive -->
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_entityTypeForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { EntityTypeDialogComponent } from './entity-type-dialog.component';
|
||||||
|
|
||||||
|
describe('EntityTypeDialogComponent', () => {
|
||||||
|
let component: EntityTypeDialogComponent;
|
||||||
|
let fixture: ComponentFixture<EntityTypeDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ EntityTypeDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(EntityTypeDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-designation-dialog',
|
||||||
|
templateUrl: './entity-type-dialog.component.html',
|
||||||
|
styleUrls: ['./entity-type-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class EntityTypeDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
public _entityTypeForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<EntityTypeDialogComponent>,
|
||||||
|
private _ETService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._entityTypeForm = this._formBuilder.group({
|
||||||
|
//Designation_id: any; fk_city_id: any;
|
||||||
|
entity_type_id: [this.data.entity_type_id],
|
||||||
|
name: [this.data.name, Validators.compose([Validators.required])]
|
||||||
|
|
||||||
|
});
|
||||||
|
//console.log(this._entityTypeForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._MastersService.addDesignation(this._entityTypeForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._MastersService.editDesignation(this._entityTypeForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.entity_type_id)) {
|
||||||
|
var my_array = this._entityTypeForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._ETService.addMasterDetails(my_array,'ENTITYTYPE').subscribe();
|
||||||
|
//addEntityType(my_array)
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
this._ETService.editMasterDetails(this._entityTypeForm.value,'ENTITYTYPE').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._entityTypeForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addEntityType()" [disabled]="dialogRef"> + Add EntityType</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>EntityType Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let FL of EntityTypeList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{FL.Name}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editEntityType(FL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteEntityType(FL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="entity_type_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.entity_type_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editEntityType(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteEntityType(user.entity_type_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { EntityTypeListComponent } from './entity-type-list.component';
|
||||||
|
|
||||||
|
describe('EntityTypeListComponent', () => {
|
||||||
|
let component: EntityTypeListComponent;
|
||||||
|
let fixture: ComponentFixture<EntityTypeListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ EntityTypeListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(EntityTypeListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { EntityTypeDialogComponent } from '../entity-type-dialog/entity-type-dialog.component';
|
||||||
|
import { EntityType } from '../../../model/entity-type';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-entity-type-list',
|
||||||
|
templateUrl: './entity-type-list.component.html',
|
||||||
|
styleUrls: ['./entity-type-list.component.scss']
|
||||||
|
})
|
||||||
|
export class EntityTypeListComponent implements OnInit {
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
displayedColumns = ['entity_type_id', 'name','isactive','actions'];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _EtService: MastersService) { }
|
||||||
|
|
||||||
|
// get EntityTypeList() {
|
||||||
|
// return this._EtService. getAllEntityType();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._EtService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addEntityType() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(EntityTypeDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editEntityType(arr: any) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._EtService.getAllEntityType().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(EntityTypeDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteEntityType(id: number) {
|
||||||
|
this._EtService.deleteMasterDetails(id,'ENTITYTYPE');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _ets: MastersService ) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<EntityType[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._ets.getAllEntityType();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Frequency
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">Frequency</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_frequencyForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Frequency Name" required [formControl]="_frequencyForm.controls['name']">
|
||||||
|
<mat-error *ngIf="!_frequencyForm.controls['name'].valid && _frequencyForm.controls['name'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_frequencyForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { FrequencyDialogComponent } from './frequency-dialog.component';
|
||||||
|
|
||||||
|
describe('FrequencyDialogComponent', () => {
|
||||||
|
let component: FrequencyDialogComponent;
|
||||||
|
let fixture: ComponentFixture<FrequencyDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ FrequencyDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(FrequencyDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './frequency-dialog.component.html',
|
||||||
|
styleUrls: ['./frequency-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class FrequencyDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
public _frequencyForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<FrequencyDialogComponent>,
|
||||||
|
private _MastersService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._frequencyForm = this._formBuilder.group({
|
||||||
|
frequency_id: [this.data.frequency_id],
|
||||||
|
name: [this.data.name, Validators.compose([Validators.required])]
|
||||||
|
});
|
||||||
|
//console.log(this._frequencyForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.frequency_id)) {
|
||||||
|
var my_array = this._frequencyForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._MastersService.addMasterDetails(my_array,'FREQUENCY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
this._MastersService.editMasterDetails( this._frequencyForm.value,'FREQUENCY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._contactService.addIndustryMaster(this._frequencyForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._contactService.editIndustryMaster(this._frequencyForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._frequencyForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addFrequency()" [disabled]="dialogRef"> + Add Frequency</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>Frequency Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let FL of FrequencyList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{FL.Name}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editFrequency(FL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteFrequency(FL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="frequency_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.frequency_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="createdon">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> createdon </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.createdon}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fk_createdby">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> createdby </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.fk_createdby}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="updatedon">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> updated on </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.updatedon}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fk_updatedby">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> updatedby </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.fk_updatedby}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editFrequency(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteFrequency(user.frequency_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
/* Structure */
|
||||||
|
.example-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example-header {
|
||||||
|
min-height: 64px;
|
||||||
|
padding: 8px 24px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//mat-cell{
|
||||||
|
.cell{
|
||||||
|
display:flex !important;
|
||||||
|
justify-content:center!important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// mat-header-cell {
|
||||||
|
.header-cell{
|
||||||
|
display:flex;
|
||||||
|
justify-content:center;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { FrequencyListComponent } from './frequency-list.component';
|
||||||
|
|
||||||
|
describe('FrequencyListComponent', () => {
|
||||||
|
let component: FrequencyListComponent;
|
||||||
|
let fixture: ComponentFixture<FrequencyListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ FrequencyListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(FrequencyListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { FrequencyDialogComponent }from '../frequency-dialog/frequency-dialog.component';
|
||||||
|
import { Frequency } from '../../../model/frequency';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-frequency-list',
|
||||||
|
templateUrl: './frequency-list.component.html',
|
||||||
|
styleUrls: ['./frequency-list.component.scss']
|
||||||
|
})
|
||||||
|
export class FrequencyListComponent implements OnInit {
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
displayedColumns = ['frequency_id','name','createdon','fk_createdby','updatedon','isactive','fk_updatedby','actions'];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _MastersService: MastersService) { }
|
||||||
|
|
||||||
|
// get FrequencyList() {
|
||||||
|
// return this._MastersService. getAllFrequency();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._MastersService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addFrequency() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(FrequencyDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editFrequency(arr: any) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._MastersService.getAllFrequency().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(FrequencyDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteFrequency(id: number) {
|
||||||
|
this._MastersService.deleteMasterDetails(id,'FREQUENCY');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _fs: MastersService) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<Frequency[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._fs.getAllFrequency();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Industry Classification
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_IndustryClassificationForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Classification Name" required [formControl]="_IndustryClassificationForm.controls['name']">
|
||||||
|
<mat-error *ngIf="!_IndustryClassificationForm.controls['name'].valid && _IndustryClassificationForm.controls['name'].touched" class="mat-text-warn">You must include a Classified Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_IndustryClassificationForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { IndustryMasterDialogComponent } from './industry-master-dialog.component';
|
||||||
|
|
||||||
|
describe('IndustryMasterDialogComponent ', () => {
|
||||||
|
let component: IndustryMasterDialogComponent ;
|
||||||
|
let fixture: ComponentFixture<IndustryMasterDialogComponent >;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ IndustryMasterDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(IndustryMasterDialogComponent );
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './industry_classification-dialog.component.html',
|
||||||
|
styleUrls: ['./industry_classification-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class IndustryClassificationDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
public _IndustryClassificationForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<IndustryClassificationDialogComponent>,
|
||||||
|
private _contactService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._IndustryClassificationForm = this._formBuilder.group({
|
||||||
|
industry_classification_id: [this.data.industry_classification_id],
|
||||||
|
name: [this.data.name, Validators.compose([Validators.required])]
|
||||||
|
});
|
||||||
|
//console.log(this._IndustryClassificationForm);
|
||||||
|
//industry_classification_id, name, createdon, fk_createdby, updatedon, fk_updatedby, isactive
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._contactService.addIndustryClassification(this._IndustryClassificationForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._contactService.editIndustryClassification(this._IndustryClassificationForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.industry_classification_id)) {
|
||||||
|
var my_array = this._IndustryClassificationForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => (my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._contactService.addMasterDetails(my_array,'INDUSTRYCLASSIFICATION').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
this._contactService.editMasterDetails(this._IndustryClassificationForm.value,'INDUSTRYCLASSIFICATION').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._IndustryClassificationForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addIndustryClassification()" [disabled]="dialogRef"> + Add Industry Classification</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>Classification Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let IM of IndustryMasterList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{IM.ClassifiedName}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editIndustryMaster(IM.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteIndustryMaster(IM.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="industry_classification_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.industry_classification_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="createdon">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> createdon </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.createdon}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fk_createdby">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> createdby </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.fk_createdby}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="updatedon">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> updated on </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.updatedon}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="fk_updatedby">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> updatedby </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.fk_updatedby}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editIndustryClassification(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteIndustryClassification(user.industry_classification_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
/* Structure */
|
||||||
|
.example-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example-header {
|
||||||
|
min-height: 64px;
|
||||||
|
padding: 8px 24px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//mat-cell{
|
||||||
|
.cell{
|
||||||
|
display:flex !important;
|
||||||
|
justify-content:center!important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// mat-header-cell {
|
||||||
|
.header-cell{
|
||||||
|
display:flex;
|
||||||
|
justify-content:center;
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { IndustryClassificationDialogComponent } from '../industry_classification-dialog/industry_classification-dialog.component';
|
||||||
|
import { IndustryClassification } from '../../../model/industry_classification';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-industry_classification-list',
|
||||||
|
templateUrl: './industry_classification-list.component.html',
|
||||||
|
styleUrls: ['./industry_classification-list.component.scss']
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// export class TablePagingComponent implements OnInit {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
export class IndustryClassificationListComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
|
||||||
|
displayedColumns = ['industry_classification_id','name','createdon','fk_createdby','updatedon','isactive','fk_updatedby','actions'];
|
||||||
|
//industry_classification_id, name, createdon, fk_createdby, updatedon, fk_updatedby, isactive
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _IMService: MastersService) { }
|
||||||
|
|
||||||
|
// get IndustryClassificationList() {
|
||||||
|
// return this._IMService.getAllIndustryClassification();
|
||||||
|
// }
|
||||||
|
|
||||||
|
//displayedColumns: string[] = ['ID','ClassifiedName'];
|
||||||
|
dataSource = new UserDataSource(this._IMService);
|
||||||
|
|
||||||
|
|
||||||
|
ngOnInit() {}
|
||||||
|
|
||||||
|
|
||||||
|
addIndustryClassification() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(IndustryClassificationDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editIndustryClassification(arr: any) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const indu = this._IMService.getAllIndustryClassification().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(IndustryClassificationDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteIndustryClassification(id: number) {
|
||||||
|
this._IMService.deleteMasterDetails(id,'INDUSTRYCLASSIFICATION');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
constructor(private _ims: MastersService ) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<IndustryClassification[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._ims.getAllIndustryClassification();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Lender Hierarchy
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">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>
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_lenderHierarchyForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Lender Hierarchy Name" required [formControl]="_lenderHierarchyForm.controls['lender_hierarchy']">
|
||||||
|
<mat-error *ngIf="!_lenderHierarchyForm.controls['lender_hierarchy'].valid && _lenderHierarchyForm.controls['lender_hierarchy'].touched" class="mat-text-warn">You must include a Lender Hierarchy Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_lenderHierarchyForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LenderHierarchyDialogComponent } from './lender-hierarchy-dialog.component';
|
||||||
|
|
||||||
|
describe('LenderHierarchyDialogComponent', () => {
|
||||||
|
let component: LenderHierarchyDialogComponent;
|
||||||
|
let fixture: ComponentFixture<LenderHierarchyDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ LenderHierarchyDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(LenderHierarchyDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { MastersService } from '../../../service/master/masters.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-jazz-dialog',
|
||||||
|
templateUrl: './lender-hierarchy-dialog.component.html',
|
||||||
|
styleUrls: ['./lender-hierarchy-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class LenderHierarchyDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
public _lenderHierarchyForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private dialogRef: MatDialogRef<LenderHierarchyDialogComponent>,
|
||||||
|
private _MastersService: MastersService,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this._lenderHierarchyForm = this._formBuilder.group({
|
||||||
|
//Designation_id: any; fk_city_id: any;
|
||||||
|
|
||||||
|
lender_hierarchy_id: [this.data.lender_hierarchy_id],
|
||||||
|
lender_hierarchy: [this.data.lender_hierarchy, Validators.compose([Validators.required])],
|
||||||
|
|
||||||
|
});
|
||||||
|
//console.log(this._lenderHierarchyForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// onSubmit() {
|
||||||
|
// if (isNaN(this.data.ID)) {
|
||||||
|
// this._MastersService.addDesignation(this._lenderHierarchyForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// } else {
|
||||||
|
// this._MastersService.editDesignation(this._lenderHierarchyForm.value);
|
||||||
|
// this.dialogRef.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
if(isNaN(this.data.lender_hierarchy_id)) {
|
||||||
|
var my_array = this._lenderHierarchyForm.value;
|
||||||
|
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||||
|
console.log(my_array);
|
||||||
|
this._MastersService.addMasterDetails(my_array,'LENDERHIERARCHY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("saved");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this._MastersService.editMasterDetails(this._lenderHierarchyForm.value,'LENDERHIERARCHY').subscribe();
|
||||||
|
this.dialogRef.close();
|
||||||
|
alert("edited");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onReset(){
|
||||||
|
this._lenderHierarchyForm.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
<mat-card-content>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button mat-raised-button color="primary" (click)="addLenderHierarchy()" [disabled]="dialogRef"> + Add LenderHierarchy</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!-- <div class="example-container mat-elevation-z8">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th header-cell>S.no</th>
|
||||||
|
<th header-cell>LenderHierarchy Name</th>
|
||||||
|
<th header-cell>Action</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr *ngFor="let FL of LenderHierarchyList; let i=index">
|
||||||
|
<td style="text-align: center;">{{i+1}}</td>
|
||||||
|
<td style="text-align: center;">{{FL.Name}}</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editLenderHierarchy(FL.ID)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteLenderHierarchy(FL.ID)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- <mat-table [dataSource]="dataSource"> -->
|
||||||
|
|
||||||
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
<ng-container matColumnDef="lender_hierarchy_id">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.lender_hierarchy_id}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="lender_hierarchy">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> Lender Hierarchy </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.lender_hierarchy}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="isactive">
|
||||||
|
<mat-header-cell *matHeaderCellDef mat-sort-header> isactive </mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user"> {{user.isactive}} </mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef></mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let user">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editLenderHierarchy(user)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" (click)="deleteLenderHierarchy(user.lender_hierarchy_id)"><mat-icon>delete_outline</mat-icon></button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
|
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LenderHierarchyListComponent } from './lender-hierarchy-list.component';
|
||||||
|
|
||||||
|
describe('LenderHierarchyListComponent', () => {
|
||||||
|
let component: LenderHierarchyListComponent;
|
||||||
|
let fixture: ComponentFixture<LenderHierarchyListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ LenderHierarchyListComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(LenderHierarchyListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
|
||||||
|
import { Component, OnInit, OnDestroy, 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 'rxjs/add/operator/map';
|
||||||
|
|
||||||
|
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';
|
||||||
|
import { LenderHierarchyDialogComponent }from '../lender-hierarchy-dialog/lender-hierarchy-dialog.component';
|
||||||
|
import { LenderHierarchy } from '../../../model/lender-hierarchy';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-lender-hierarchy-list',
|
||||||
|
templateUrl: './lender-hierarchy-list.component.html',
|
||||||
|
styleUrls: ['./lender-hierarchy-list.component.scss']
|
||||||
|
})
|
||||||
|
export class LenderHierarchyListComponent implements OnInit {
|
||||||
|
|
||||||
|
isPopupOpened = true;
|
||||||
|
displayedColumns = ['lender_hierarchy_id', 'lender_hierarchy','isactive','actions'];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private _MastersService: MastersService) { }
|
||||||
|
|
||||||
|
// get LenderHierarchyList() {
|
||||||
|
// return this._MastersService. getAllLenderHierarchy();
|
||||||
|
// }
|
||||||
|
|
||||||
|
dataSource = new UserDataSource(this._MastersService);
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addLenderHierarchy() {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
const dialogRef = this.dialog.open(LenderHierarchyDialogComponent, {
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editLenderHierarchy(arr: any) {
|
||||||
|
this.isPopupOpened = true;
|
||||||
|
//const contact = this._MastersService.getAllLenderHierarchy().find(c => c.ID === id);
|
||||||
|
const dialogRef = this.dialog.open(LenderHierarchyDialogComponent, {
|
||||||
|
data: arr
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteLenderHierarchy(id: number) {
|
||||||
|
this._MastersService.deleteMasterDetails(id,'LENDERHIERARCHY');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UserDataSource extends DataSource<any> {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _fs: MastersService ) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(): Observable<LenderHierarchy[]> {
|
||||||
|
//return this.userService.getUser();
|
||||||
|
return this._fs.getAllLenderHierarchy();
|
||||||
|
}
|
||||||
|
disconnect() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
<mat-card>
|
||||||
|
<!-- <div class="selectedSidebarColor"> -->
|
||||||
|
<!-- <div class="app search-i" [dir]="layoutDir" [ngClass]="[ menuLayout, selectedSidebarImage, , selectedHeaderColor]" > -->
|
||||||
|
<mat-card-title><span> Master Details </span></mat-card-title>
|
||||||
|
<mat-card-subtitle> Pickup the Master to View Master Detail </mat-card-subtitle>
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxFlex.gt-sm="40" fxFlex="100"></div>
|
||||||
|
<div fxFlex.gt-sm="30" fxFlex="100">
|
||||||
|
<!-- NORMAL Search Field -->
|
||||||
|
<!-- <mat-form-field>
|
||||||
|
<mat-select placeholder="Select Master" [(ngModel)]="pickUpMasterData" required [disabled]="isDisabled" #MasterDataControl="ngModel">
|
||||||
|
<!-- <mat-option (click)="onChangedData()" *ngFor="let masters of masterArray" [value]="masters.value" [disabled]="masters.disabled"> ->
|
||||||
|
<mat-option *ngFor="let masters of masterArray" [value]="masters.code" [disabled]="masters.disabled">
|
||||||
|
{{ masters.viewValue }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field> -->
|
||||||
|
<!-- Autocomplete Field -->
|
||||||
|
<!-- <mat-form-field>
|
||||||
|
<input matInput placeholder="Select Master" [matAutocomplete]="tdAuto" [(ngModel)]="currentState" #modelDir="ngModel" required
|
||||||
|
(ngModelChange)="this.tdStates = filterStates(currentState)" [disabled]="tdDisabled">
|
||||||
|
<mat-autocomplete #tdAuto="matAutocomplete">
|
||||||
|
<mat-option *ngFor="let state of tdStates" [value]="state.viewValue">
|
||||||
|
{{ state.viewValue }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-autocomplete>
|
||||||
|
</mat-form-field> -->
|
||||||
|
<!-- Searchable dropdown Field -->
|
||||||
|
<!-- <form [formGroup]="_MasterForm" (submit)="onSubmit()">
|
||||||
|
<div class="form-group">-->
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-select placeholder="Select" #singleSelect required [formControl]="masterCtrl">
|
||||||
|
<ngx-mat-select-search [formControl]="masterFilterCtrl" ></ngx-mat-select-search>
|
||||||
|
<mat-option *ngFor="let master of filteredMasters | async" [value]="master.id">
|
||||||
|
{{master.name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<!-- <small *ngIf="masterCtrl.touched" class="mat-text-warn">You must Pick up a Master Name.</small> -->
|
||||||
|
</div>
|
||||||
|
<!--</div>
|
||||||
|
</form> -->
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div *ngIf="masterCtrl.value =='master-1'" >
|
||||||
|
|
||||||
|
<app-industry_classification-list></app-industry_classification-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-2'">
|
||||||
|
<app-branch-list></app-branch-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-3'">
|
||||||
|
<app-title-list></app-title-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-4'">
|
||||||
|
<app-relation-ship-list></app-relation-ship-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-5'">
|
||||||
|
<app-product-list></app-product-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-6'">
|
||||||
|
<app-sub-product-list></app-sub-product-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-7'" >
|
||||||
|
<app-members-occupation-list></app-members-occupation-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-8'">
|
||||||
|
<app-activity-list></app-activity-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-9'">
|
||||||
|
<app-uom-list></app-uom-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-10'">
|
||||||
|
<app-frequency-list></app-frequency-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-11'">
|
||||||
|
<app-pd-allocation-type-list></app-pd-allocation-type-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-12'">
|
||||||
|
<app-comments-on-locality-list></app-comments-on-locality-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-13'">
|
||||||
|
<app-customer-behaviour-list></app-customer-behaviour-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-14'">
|
||||||
|
<app-customer-segment-list></app-customer-segment-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-15'">
|
||||||
|
<app-designation-list></app-designation-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-16'">
|
||||||
|
<app-pd-allocation-type-list></app-pd-allocation-type-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-17'">
|
||||||
|
<app-pd-status-list></app-pd-status-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-18'">
|
||||||
|
<app-pd-type-list></app-pd-type-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-19'">
|
||||||
|
<app-company-list></app-company-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-20'">
|
||||||
|
<app-city-list></app-city-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-21'">
|
||||||
|
<app-states-list></app-states-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-22'">
|
||||||
|
<app-regions-list></app-regions-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-23'">
|
||||||
|
<app-lender-hierarchy-list></app-lender-hierarchy-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="masterCtrl.value =='master-24'">
|
||||||
|
<!-- <app-entity-type-list></app-entity-type-list> -->
|
||||||
|
</div>
|
||||||
|
<!-- <div *ngIf="masterCtrl.value =='datatable'">
|
||||||
|
<data-table></data-table></div>
|
||||||
|
<div *ngIf="masterCtrl.value =='usertable'">
|
||||||
|
<app-usertable></app-usertable>
|
||||||
|
</div> -->
|
||||||
|
<!-- <div *ngIf="currentState == 'Industry Classification'" >
|
||||||
|
<app-industry-master-list></app-industry-master-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="currentState == 'Product'" >
|
||||||
|
<app-product-list></app-product-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="currentState == 'Sub Product'" >
|
||||||
|
<app-sub-product-list></app-sub-product-list>
|
||||||
|
</div> -->
|
||||||
|
<!-- <div *ngIf="pickUpMasterData =='master-1'">
|
||||||
|
<app-industry-master-list></app-industry-master-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="pickUpMasterData =='master-2'">
|
||||||
|
<app-product-list></app-product-list>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="pickUpMasterData =='master-3'">
|
||||||
|
<app-sub-product-list></app-sub-product-list>
|
||||||
|
</div> -->
|
||||||
|
</mat-card>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { MastersComponent } from './masters.component';
|
||||||
|
|
||||||
|
describe('MastersComponent', () => {
|
||||||
|
let component: MastersComponent;
|
||||||
|
let fixture: ComponentFixture<MastersComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ MastersComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(MastersComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,180 @@
|
|||||||
|
//import { Component, OnInit } from '@angular/core';
|
||||||
|
//import { FormControl } from '@angular/forms';
|
||||||
|
//import { startWith } from 'rxjs/operators';
|
||||||
|
|
||||||
|
|
||||||
|
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||||
|
import { FormControl, FormGroup, FormBuilder } from '@angular/forms';
|
||||||
|
import { ReplaySubject } from 'rxjs';
|
||||||
|
import { MatSelect } from '@angular/material';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { take, takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
export interface Master {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// export interface masterArray {
|
||||||
|
// value: string;
|
||||||
|
// viewValue: string;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-masters',
|
||||||
|
templateUrl: './masters.component.html',
|
||||||
|
styleUrls: ['./masters.component.scss']
|
||||||
|
})
|
||||||
|
export class MastersComponent implements OnInit {
|
||||||
|
|
||||||
|
/* Normal Search Code
|
||||||
|
pickUpMasterData : string;
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
For Master Dropdown Elements
|
||||||
|
masterArray = [{ code: 'master-1', viewValue: 'Industry Classfication' },
|
||||||
|
{ code: 'master-2', viewValue: 'Product'},
|
||||||
|
{ code: 'master-3', viewValue: 'Sub Product'}
|
||||||
|
];
|
||||||
|
|
||||||
|
ngOnInit() {}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* AutoComplete Code
|
||||||
|
stateCtrl: FormControl;
|
||||||
|
currentState = '';
|
||||||
|
|
||||||
|
reactiveStates: any;
|
||||||
|
tdStates: any[];
|
||||||
|
|
||||||
|
tdDisabled = false;
|
||||||
|
|
||||||
|
tdAuto: string;
|
||||||
|
|
||||||
|
reactiveAuto: string;
|
||||||
|
|
||||||
|
masterArray = [{ code: 'master-1', viewValue: 'Industry Classfication' },
|
||||||
|
{ code: 'master-2', viewValue: 'Product'},
|
||||||
|
{ code: 'master-3', viewValue: 'Sub Product'}
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.tdStates = this.masterArray;
|
||||||
|
//this.reactiveStates = this.stateCtrl.valueChanges;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
filterStates(val: string) {
|
||||||
|
return val ? this.masterArray.filter((s) => s.viewValue.match(new RegExp(val, 'gi'))) : this.masterArray;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* Select Search Code
|
||||||
|
/** control for the selected bank */
|
||||||
|
public masterCtrl: FormControl = new FormControl();
|
||||||
|
|
||||||
|
/** control for the MatSelect filter keyword */
|
||||||
|
public masterFilterCtrl: FormControl = new FormControl();
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder) { }
|
||||||
|
|
||||||
|
/** list of masters */
|
||||||
|
private masters: Master[] = [
|
||||||
|
{id: 'master-1',name: 'Industry Classfication'},
|
||||||
|
{id: 'master-2',name: 'Branch'},
|
||||||
|
{id: 'master-3',name: 'Title'},
|
||||||
|
{id: 'master-4',name: 'Relation Ship'},
|
||||||
|
{id: 'master-5',name: 'Product'},
|
||||||
|
{id: 'master-6',name: 'Sub Product'},
|
||||||
|
{id: 'master-7',name: 'Occupation of Non earning members'},
|
||||||
|
{id: 'master-8',name: 'Type of activity'},
|
||||||
|
{id: 'master-9',name: 'Unit of Measurement'},
|
||||||
|
{id: 'master-10',name: 'Frequency'},
|
||||||
|
{id: 'master-11',name: 'Approach to PD location'},
|
||||||
|
{id: 'master-12',name: 'Comments on locality'},
|
||||||
|
{id: 'master-13',name: 'Customer Behaviour'},
|
||||||
|
{id: 'master-14',name: 'Customer Segment'},
|
||||||
|
{id: 'master-15',name: 'Designation'},
|
||||||
|
{id: 'master-16',name: 'PD Allocation Type'},
|
||||||
|
{id: 'master-17',name: 'PD Status'},
|
||||||
|
{id: 'master-18',name: 'PD Type'},
|
||||||
|
{id: 'master-19',name: 'Company Details'},
|
||||||
|
{id: 'master-20',name: 'City'},
|
||||||
|
{id: 'master-21',name: 'States'},
|
||||||
|
{id: 'master-22',name: 'Regions'},
|
||||||
|
{id: 'master-23',name: 'm_lender_hierarchy'},
|
||||||
|
{id: 'master-24',name: 'm_entity_type'},
|
||||||
|
{id: 'datatable',name: 'datatable'},
|
||||||
|
{id: 'usertable',name: 'usertable'}
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
/** list of masters filtered by search keyword */
|
||||||
|
public filteredMasters: ReplaySubject<Master[]> = new ReplaySubject<Master[]>(1);
|
||||||
|
|
||||||
|
|
||||||
|
@ViewChild('singleSelect') singleSelect: MatSelect;
|
||||||
|
|
||||||
|
/** Subject that emits when the component has been destroyed. */
|
||||||
|
private _onDestroy = new Subject<void>();
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
// load the initial master list
|
||||||
|
this.filteredMasters.next(this.masters.slice());
|
||||||
|
|
||||||
|
// listen for search field value changes
|
||||||
|
this.masterFilterCtrl.valueChanges
|
||||||
|
.pipe(takeUntil(this._onDestroy))
|
||||||
|
.subscribe(() => {
|
||||||
|
this.filterMasters();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
//this.setInitialValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this._onDestroy.next();
|
||||||
|
this._onDestroy.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Sets the initial value after the filteredMasters are loaded initially
|
||||||
|
// */
|
||||||
|
// private setInitialValue() {
|
||||||
|
// this.filteredMasters
|
||||||
|
// .pipe(take(1), takeUntil(this._onDestroy))
|
||||||
|
// .subscribe(() => {
|
||||||
|
// // setting the compareWith property to a comparison function
|
||||||
|
// // triggers initializing the selection according to the initial value of
|
||||||
|
// // the form control (i.e. _initializeSelection())
|
||||||
|
// // this needs to be done after the filteredBanks are loaded initially
|
||||||
|
// // and after the mat-option elements are available
|
||||||
|
// this.singleSelect.compareWith = (a: Bank, b: Bank) => a.id === b.id;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
private filterMasters() {
|
||||||
|
if (!this.masters) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// get the search keyword
|
||||||
|
let search = this.masterFilterCtrl.value;
|
||||||
|
if (!search) {
|
||||||
|
this.filteredMasters.next(this.masters.slice());
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
search = search.toLowerCase();
|
||||||
|
}
|
||||||
|
// filter the masters
|
||||||
|
this.filteredMasters.next(
|
||||||
|
this.masters.filter(master => master.name.toLowerCase().indexOf(search) > -1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
<!-- <div class="mb-1">
|
||||||
|
<h2 mat-dialog-title>Occupation of Non earning members
|
||||||
|
<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>
|
||||||
|
</h2>
|
||||||
|
</div> -->
|
||||||
|
<div class="container"
|
||||||
|
fxLayout
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="35px"
|
||||||
|
fxLayoutGap.xs="0">
|
||||||
|
<div class="mat-dialog-title" fxFlex="15px">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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form [formGroup]="_occupationForm" (submit)="onSubmit()">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<mat-dialog-content>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<input matInput type="text" placeholder="Name" required [formControl]="_occupationForm.controls['name']">
|
||||||
|
<mat-error *ngIf="!_occupationForm.controls['name'].valid && _occupationForm.controls['name'].touched" class="mat-text-warn">You must include a Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row" style="text-align:right;">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_occupationForm.valid"><mat-icon>save</mat-icon></button>
|
||||||
|
<!-- <button mat-button >RESET</button> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-dialog-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user