entity master pages created - kdk

This commit is contained in:
dineshkumarkannan 2018-10-22 17:12:33 +05:30
parent 5793bf2873
commit 375af650ec
22 changed files with 305 additions and 70 deletions

View File

@ -0,0 +1,6 @@
<p>
entity-edit-billing-info works!
</p>
<h1>{{ entityId }}</h1>

View File

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

View File

@ -0,0 +1,16 @@
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-entity-edit-billing-info',
templateUrl: './entity-edit-billing-info.component.html',
styleUrls: ['./entity-edit-billing-info.component.scss']
})
export class EntityEditBillingInfoComponent implements OnInit {
@Input() entityId: number;
constructor() { }
ngOnInit() {
}
}

View File

@ -0,0 +1,3 @@
<p>
entity-edit-price works!
</p>

View File

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

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-entity-edit-price',
templateUrl: './entity-edit-price.component.html',
styleUrls: ['./entity-edit-price.component.scss']
})
export class EntityEditPriceComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -0,0 +1,3 @@
<p>
entity-edit-region works!
</p>

View File

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

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-entity-edit-region',
templateUrl: './entity-edit-region.component.html',
styleUrls: ['./entity-edit-region.component.scss']
})
export class EntityEditRegionComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -0,0 +1,3 @@
<p>
entity-edit-tat works!
</p>

View File

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

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-entity-edit-tat',
templateUrl: './entity-edit-tat.component.html',
styleUrls: ['./entity-edit-tat.component.scss']
})
export class EntityEditTatComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -1,4 +1,4 @@
<div style="max-height: 580px;"> <!--<div style="max-height: 580px;">
<form [formGroup]="_addQuesFrom" (submit)="onSubmit()"> <form [formGroup]="_addQuesFrom" (submit)="onSubmit()">
<mat-card style="padding: 6px;"> <mat-card style="padding: 6px;">
<div class="ml-xs mr-xs" style="width: 100%;" fxLayout="row" fxLayoutAlign="center"> <div class="ml-xs mr-xs" style="width: 100%;" fxLayout="row" fxLayoutAlign="center">
@ -9,8 +9,7 @@
</div> </div>
</div> </div>
<!--<div class="form-group">--> <div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start" style="padding: 6px 4px;">
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start" style="padding: 6px 4px;">
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<mat-select placeholder="Select Entity Type" formControlName="fk_entity_type_id"> <mat-select placeholder="Select Entity Type" formControlName="fk_entity_type_id">
@ -70,12 +69,10 @@
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Address 2" formControlName="addressline2"> <input matInput placeholder="Address 2" formControlName="addressline2">
<!--<mat-error *ngIf="submitted && f.addressline2.hasError('required')" class="mat-text-warn">You must Include Address.</mat-error>--> </mat-form-field>
</mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Address 3" formControlName="addressline3"> <input matInput placeholder="Address 3" formControlName="addressline3">
<!--<mat-error *ngIf="submitted && f.addressline3.hasError('required')" class="mat-text-warn">You must Include Address.</mat-error>--> </mat-form-field>
</mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Pincode" formControlName="pincode"> <input matInput placeholder="Pincode" formControlName="pincode">
<mat-error *ngIf="submitted && f.pincode.hasError('required')" class="mat-text-warn">You must Include Pincode.</mat-error> <mat-error *ngIf="submitted && f.pincode.hasError('required')" class="mat-text-warn">You must Include Pincode.</mat-error>
@ -91,8 +88,7 @@
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Alternate Email" formControlName="alt_email"> <input matInput placeholder="Alternate Email" formControlName="alt_email">
<!-- <mat-error *ngIf="submitted && f.alt_email.hasError('required')" class="mat-text-warn">You must Select Alternet Email.</mat-error>--> </mat-form-field>
</mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Phone Number" formControlName="phone_number"> <input matInput placeholder="Phone Number" formControlName="phone_number">
@ -101,7 +97,6 @@
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Mobile Number" formControlName="mobile_no"> <input matInput placeholder="Mobile Number" formControlName="mobile_no">
<!-- <mat-error *ngIf="submitted && f.mobile_no.hasError('required')" class="mat-text-warn">You must Include Mobile Number.</mat-error>-->
</mat-form-field> </mat-form-field>
</div> </div>
@ -148,17 +143,14 @@
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start"> <div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Contact Person" formControlName="contact_person"> <input matInput placeholder="Contact Person" formControlName="contact_person">
<!--<mat-error *ngIf="submitted && f.contact_person.hasError('required')" class="mat-text-warn">You must Include Contact Person.</mat-error>-->
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Email" formControlName="contact_email"> <input matInput placeholder="Email" formControlName="contact_email">
<!--<mat-error *ngIf="submitted && f.contact_email.hasError('required')" class="mat-text-warn">You must Include Email.</mat-error>--> </mat-form-field>
</mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput placeholder="Mobile Number" formControlName="contact_mobile_no"> <input matInput placeholder="Mobile Number" formControlName="contact_mobile_no">
<!--<mat-error *ngIf="submitted && f.contact_mobile_no.hasError('required')" class="mat-text-warn">You must Include Mobile Number.</mat-error>--> </mat-form-field>
</mat-form-field>
</div> </div>
</div> </div>
@ -177,18 +169,63 @@
</div> </div>
</div> </div>
<!--Error List Shown Here-->
<!--<ul>
<li *ngFor="let err of errorMessage">
<mat-error>{{err.err}}</mat-error>
</li>
</ul>-->
<div class="row" style="text-align:right;"> <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="button" <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button"
(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button> (click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button><button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div> </div>
<!--</div>-->
</mat-card> </mat-card>
</form> </form>
</div> </div>-->
<mat-card style="padding: 6px;">
<div fxLayout="row" fxLayoutAlign="end start">
<button mat-raised-button mat-icon-button color="primary" class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above"
(click)="backToList()"><mat-icon>close</mat-icon></button>
</div>
<mat-card style="padding: 6px;">
<h6>Template Name</h6>
<hr>
<!---->
<div *ngIf="templateNameRecord">
<form [formGroup]="_editTempNameFrom" (submit)="onSubmit()">
<div fxLayout="row" fxLayoutWrap fxLayoutGap="0.5%" fxLayoutAlign="start center">
<mat-form-field class="ml-xs">
<input matInput placeholder="Template Name" formControlName="template_name">
<mat-error *ngIf="submitted && f.template_name.hasError('required')" class="mat-text-warn">You must Include Template Name.</mat-error>
</mat-form-field>
<div>
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
</div>
</form>
</div>
<div *ngIf="noTemplateNameFound"> No Template Name Found.</div>
</mat-card>
<mat-card>
<mat-tab-group>
<mat-tab label="Lender Details">
<ng-template matTabContent>
<app-entity-edit-billing-info [entityId]="entity_id">
</app-entity-edit-billing-info>
</ng-template>
</mat-tab>
<!--<mat-tab label="Category">
<ng-template matTabContent>
<app-template-edit-category [questionId]="question_id">
</app-template-edit-category>
</ng-template>
</mat-tab>
<mat-tab label="Questions / Answers">
<ng-template matTabContent>
<app-template-edit-question-answer [questionId]="question_id">
</app-template-edit-question-answer>
</ng-template>
</mat-tab>-->
</mat-tab-group>
</mat-card>
</mat-card>

View File

@ -2,6 +2,7 @@
import { import {
Component, Component,
OnInit, OnInit,
OnDestroy,
Inject, Inject,
ViewChild, ViewChild,
Input Input
@ -13,6 +14,7 @@ import {
Validators, Validators,
FormArray, FormArray,
} from '@angular/forms'; } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { NotifierService } from 'angular-notifier'; import { NotifierService } from 'angular-notifier';
@ -29,10 +31,11 @@ import { EntityListComponent } from './../entity-list/entity.list.component';
templateUrl: './entity.edit.component.html', templateUrl: './entity.edit.component.html',
// styleUrls: ['./edit.component.scss'] // styleUrls: ['./edit.component.scss']
}) })
export class EntityEditComponent implements OnInit{ export class EntityEditComponent implements OnInit, OnDestroy{
@Input() public childMessage: any; @Input() public childMessage: any;
public entity_id: number;
public pageTitle: string = "Entity"; public pageTitle: string = "Entity";
public subTitle1: string = "Tax Info"; public subTitle1: string = "Tax Info";
public subTitle2: string = "Contacts"; public subTitle2: string = "Contacts";
@ -51,11 +54,14 @@ public pageTitle: string = "Entity";
constructor( constructor(
notifier: NotifierService, notifier: NotifierService,
private route: ActivatedRoute,
private router: Router,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private masterService: MastersService, private masterService: MastersService,
private entityService: EntityService, private entityService: EntityService,
private entityListComponent: EntityListComponent) { private entityListComponent: EntityListComponent) {
this.notifier = notifier; this.notifier = notifier;
this.entity_id = this.route.snapshot.params['entity-id'];
} }
@ -212,6 +218,11 @@ public pageTitle: string = "Entity";
// this.dialogRef.close(); // this.dialogRef.close();
} }
backToList(){
this.entityListComponent.showListView(true);
this.router.navigate([ '../../' ], { relativeTo: this.route });
}
/** To Save/Edited Popup Data */ /** To Save/Edited Popup Data */
onSubmit() { onSubmit() {
this.submitted = true; this.submitted = true;
@ -250,4 +261,10 @@ public pageTitle: string = "Entity";
this.loadFormData(); this.loadFormData();
this.loadAnsData(); this.loadAnsData();
} }
ngOnDestroy(): void {
//Called once, before the instance is destroyed.
//Add 'implements OnDestroy' to the class.
this.entityListComponent.showListView(true);
}
} }

View File

@ -1,42 +1,16 @@
<div *ngIf="listView"> <div *ngIf="listView">
<mat-card> <mat-card>
<div style="margin: 6px; padding: 4px;">
<div class="p_title" style="font-size: 26px; font-style: bold;">Entity Master</div>
<div style="margin: 6px; padding: 4px;"> <hr>
<div class="p_title" style="font-size: 26px; font-style: bold;">Entity Master</div> </div>
<!--<div class="sub_title" style="font-size: 11px;">List of Entity Master Details</div>--> <div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="center none">
<hr> <div fxFlex="80%">
</div>
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="center none" >
<div fxFlex="80%">
<!--<form [formGroup]="filterFormGroupCtrl">
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="0.5px" fxLayoutAlign="start none" style="padding: 6px;">
<mat-select placeholder="Category" formControlName="category">
<mat-option *ngFor="let cat of categories" [value]="cat.question_categroy_id" (click)="getQuestionsMasters()">
{{cat.categroy_name}}
</mat-option>
</mat-select>
</div>
</form>-->
</div>
<div fxFlex="20%">
<!--<a [routerLink]="['/'+'setting/entity/add' ]">-->
<!--<button mat-stroked-button color="primary" (click)="addNewQuestion()">Add New Entity</button>-->
<button mat-fab class="mr-1 mb-1" color="primary" (click)="addNewQuestion()"><mat-icon>add</mat-icon></button>
<!--</a>-->
</div>
</div>
<!--</mat-card-content>-->
<!--
<mat-card class="mat-elevation-z1">
<div style="margin: 6px; padding: 4px;">
<div class="p_title" style="font-size: 16px; font-style: bold;">Entity Master</div>
<div class="sub_title" style="font-size: 11px;">List of Entity Master Details</div>
</div> </div>
</mat-card>--> <div fxFlex="20%">
<button mat-fab class="mr-1 mb-1" color="primary" (click)="addNewQuestion()"><mat-icon>add</mat-icon></button>
</div>
</div>
<ng-container *ngIf="enityList.length > 0"> <ng-container *ngIf="enityList.length > 0">
<div style="padding: 0 12px;"> <div style="padding: 0 12px;">
<mat-card class="product-card" *ngFor="let product of dataSource.connect() | async"> <mat-card class="product-card" *ngFor="let product of dataSource.connect() | async">
@ -80,5 +54,10 @@
<app-entity-edit [childMessage]="parentMessage"></app-entity-edit> <app-entity-edit [childMessage]="parentMessage"></app-entity-edit>
</div> </div>
<button (click)="goToEdit(1)">Go To Edit</button>
<div>
<app-entity-edit ></app-entity-edit>
</div>
<notifier-container></notifier-container> <notifier-container></notifier-container>

View File

@ -51,6 +51,7 @@ export class EntityListComponent implements OnInit {
constructor(private dialog: MatDialog, constructor(private dialog: MatDialog,
private masterService: MastersService, private masterService: MastersService,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router, private router: Router,
private entityService: EntityService) { private entityService: EntityService) {
// this.filterFormGroupCtrl = this._formBuilder.group({ // this.filterFormGroupCtrl = this._formBuilder.group({
@ -135,6 +136,16 @@ export class EntityListComponent implements OnInit {
this.listView = false; this.listView = false;
} }
goToEdit(template_id : number){
this.router.navigate([ '../list/edit', template_id ], { relativeTo: this.route });
this.listView = false;
}
showListView(status: boolean){
// alert(2);
this.listView = status;
}
changeListView(){ changeListView(){
this.getEntityListMasters(); this.getEntityListMasters();
this.listView = true; this.listView = true;

View File

@ -12,7 +12,8 @@ import {
MatProgressBarModule,MatDialogModule, MatSortModule, MatProgressBarModule,MatDialogModule, MatSortModule,
MatToolbarModule,MatSelectModule, MatToolbarModule,MatSelectModule,
MatListModule, MatMenuModule, MatListModule, MatMenuModule,
MatCheckboxModule MatCheckboxModule,MatTabsModule,
MatExpansionModule
} from '@angular/material'; } from '@angular/material';
import {MatSlideToggleModule} from '@angular/material/slide-toggle'; import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@ -26,6 +27,10 @@ import { EntityAddComponent } from './entity-add/entity.add.component';
import { EntityEditComponent } from './entity-edit/entity.edit.component'; import { EntityEditComponent } from './entity-edit/entity.edit.component';
import { EntityService } from './../service/entity/entity.service'; import { EntityService } from './../service/entity/entity.service';
import { EntityEditRegionComponent } from './entity-edit/entity-edit-region/entity-edit-region.component';
import { EntityEditTatComponent } from './entity-edit/entity-edit-tat/entity-edit-tat.component';
import { EntityEditPriceComponent } from './entity-edit/entity-edit-price/entity-edit-price.component';
import { EntityEditBillingInfoComponent } from './entity-edit/entity-edit-billing-info/entity-edit-billing-info.component';
/** /**
* Custom angular notifier options * Custom angular notifier options
*/ */
@ -83,6 +88,8 @@ const customNotifierOptions: NotifierOptions = {
MatProgressBarModule,MatDialogModule, MatSortModule, MatProgressBarModule,MatDialogModule, MatSortModule,
MatToolbarModule,MatSelectModule,MatListModule, MatMenuModule, MatToolbarModule,MatSelectModule,MatListModule, MatMenuModule,
MatCheckboxModule, MatCheckboxModule,
MatTabsModule,
MatExpansionModule,
MatSlideToggleModule, MatSlideToggleModule,
FormsModule, FormsModule,
ReactiveFormsModule ReactiveFormsModule
@ -91,7 +98,11 @@ const customNotifierOptions: NotifierOptions = {
EntityComponent, EntityComponent,
EntityListComponent, EntityListComponent,
EntityEditComponent, EntityEditComponent,
EntityAddComponent EntityAddComponent,
EntityEditRegionComponent,
EntityEditTatComponent,
EntityEditPriceComponent,
EntityEditBillingInfoComponent
], ],
entryComponents: [ entryComponents: [
// EntityEditComponent // EntityEditComponent

View File

@ -19,15 +19,19 @@ const routes: Routes = [
{ {
path: 'list', path: 'list',
component: EntityListComponent, component: EntityListComponent,
children: [{
path: 'edit/:entity-id',
component: EntityEditComponent,
}]
}, },
{ // {
path: 'add', // path: 'add',
component: EntityAddComponent, // component: EntityAddComponent,
}, // },
{ // {
path: 'edit', // path: 'edit',
component: EntityEditComponent, // component: EntityEditComponent,
} // }
] ]
} }
]; ];