entity master details added : kdk
This commit is contained in:
parent
f27ec29900
commit
9da4a38a79
@ -5,12 +5,10 @@
|
|||||||
<h2 mat-dialog-title style="width: 50%;">{{pageTitle}}</h2>
|
<h2 mat-dialog-title style="width: 50%;">{{pageTitle}}</h2>
|
||||||
<div style="width: 20%;"></div>
|
<div style="width: 20%;"></div>
|
||||||
<div style="width: 30%;text-align:right;">
|
<div style="width: 30%;text-align:right;">
|
||||||
<button mat-raised-button mat-icon-button color="primary" class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button>
|
<button mat-raised-button mat-icon-button color="primary" class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above"
|
||||||
|
type="button" (click)="onNoClick()"><mat-icon>close</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--<div class="form-group">-->
|
|
||||||
|
|
||||||
<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">
|
||||||
<mat-select placeholder="Select Entity Type" formControlName="fk_entity_type_id">
|
<mat-select placeholder="Select Entity Type" formControlName="fk_entity_type_id">
|
||||||
@ -31,164 +29,11 @@
|
|||||||
<mat-error *ngIf="submitted && f.short_name.hasError('required')" class="mat-text-warn">You must Include Short Name.</mat-error>
|
<mat-error *ngIf="submitted && f.short_name.hasError('required')" class="mat-text-warn">You must Include Short Name.</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<mat-select placeholder="Select Region" formControlName="fk_region">
|
|
||||||
<mat-option *ngFor="let reg of geoRecords" [value]="reg.region_id" (click)="selectGeoRegionChanges(reg.state_data)">{{ reg.region_name }}</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-error *ngIf="submitted && f.fk_region.hasError('required')" class="mat-text-warn">You must Select Region.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<mat-select placeholder="Select State" formControlName="fk_state">
|
|
||||||
<mat-option *ngFor="let st of state_m" [value]="st.state_id" (click)="selectGeoStateChanges(st.city_data)">{{ st.state_name }}</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-error *ngIf="submitted && f.fk_state.hasError('required')" class="mat-text-warn">You must Select State.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<mat-select placeholder="Select City" formControlName="fk_city">
|
|
||||||
<mat-option *ngFor="let ct of city_m" [value]="ct.city_id" (click)="selectGeoCityChanges(ct.branch_data)">{{ ct.city_name }}</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-error *ngIf="submitted && f.fk_city.hasError('required')" class="mat-text-warn">You must Select City.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<mat-select placeholder="Select Branch" formControlName="fk_branch">
|
|
||||||
<mat-option *ngFor="let brn of branch_m" [value]="brn.branch_id">{{ brn.branch_name }}</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-error *ngIf="submitted && f.fk_branch.hasError('required')" class="mat-text-warn">You must Select Branch.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<input matInput placeholder="Address 1" formControlName="addressline1">
|
|
||||||
<mat-error *ngIf="submitted && f.addressline1.hasError('required')" class="mat-text-warn">You must Include Address.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<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 fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<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 fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<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-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
|
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<input matInput placeholder="Official Email" formControlName="official_email">
|
|
||||||
<mat-error *ngIf="submitted && f.official_email.hasError('required')" class="mat-text-warn">You must Include Official Email.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<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 fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<input matInput placeholder="Phone Number" formControlName="phone_number">
|
|
||||||
<mat-error *ngIf="submitted && f.phone_number.hasError('required')" class="mat-text-warn">You must Include Phone Number.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
|
|
||||||
<mat-form-field fxFlex="0 1 calc(33.3% - 32px)" class="ml-xs">
|
|
||||||
<textarea matInput placeholder="Remarks" formControlName="remarks"></textarea>
|
|
||||||
<mat-error *ngIf="submitted && f.remarks.hasError('required')" class="mat-text-warn">You must Include Remarks.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</mat-card>
|
|
||||||
<mat-card style="padding: 6px;">
|
|
||||||
<h2 mat-dialog-title style="width: 50%;">{{subTitle1}}</h2>
|
|
||||||
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<input matInput placeholder="PAN Number" formControlName="pan">
|
|
||||||
<mat-error *ngIf="submitted && f.pan.hasError('required')" class="mat-text-warn">You must Include Pan Number.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<input matInput placeholder="GST Number" formControlName="gst_no">
|
|
||||||
<mat-error *ngIf="submitted && f.gst_no.hasError('required')" class="mat-text-warn">You must Include GST Number.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<input matInput placeholder="GST State Code" formControlName="gst_state_code">
|
|
||||||
<mat-error *ngIf="submitted && f.gst_state_code.hasError('required')" class="mat-text-warn">You must Include GST State Code.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<input matInput placeholder="TAT" formControlName="tat">
|
|
||||||
<mat-error *ngIf="submitted && f.tat.hasError('required')" class="mat-text-warn">You must Include TAT.</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</mat-card>
|
|
||||||
<mat-card style="padding: 6px;">
|
|
||||||
<div fxLayout="row wrap" fxLayoutAlign="start none">
|
|
||||||
<h2 mat-dialog-title style="width: 50%;">{{subTitle2}}</h2>
|
|
||||||
<div formArrayName="entity_child" class="example-full-width">
|
|
||||||
<div *ngFor="let answ of _addQuesFrom.controls.entity_child['controls']; let i=index">
|
|
||||||
<div [formGroupName]="i">
|
|
||||||
<div fxLayout="row wrap" style="width: 100%">
|
|
||||||
<div style="width: 90%">
|
|
||||||
|
|
||||||
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<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 fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<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 fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style="width:10%">
|
|
||||||
<span *ngIf="_addQuesFrom.controls.entity_child.controls.length > 1" (click)="removeLanguage(i)">
|
|
||||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <button mat-button color="primary" matTooltip="Add More Answer" matTooltipPosition="above" (click)="addLanguage($event); false">Add More</button>-->
|
|
||||||
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="addLanguage($event); false"><mat-icon>add</mat-icon></button>
|
|
||||||
</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="reset"><mat-icon>settings_backup_restore</mat-icon></button>
|
<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"><mat-icon>save</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>
|
||||||
|
|
||||||
|
|
||||||
<notifier-container></notifier-container>
|
<notifier-container></notifier-container>
|
||||||
@ -16,11 +16,12 @@ import {
|
|||||||
|
|
||||||
import { NotifierService } from 'angular-notifier';
|
import { NotifierService } from 'angular-notifier';
|
||||||
|
|
||||||
// import {
|
import {
|
||||||
// MatDialog,
|
MatDialog,
|
||||||
// MatDialogRef,
|
MatDialogRef,
|
||||||
// MAT_DIALOG_DATA
|
MAT_DIALOG_DATA
|
||||||
// } from '@angular/material';
|
} from '@angular/material';
|
||||||
|
|
||||||
/** Service */
|
/** Service */
|
||||||
import { MastersService } from './../../service/masters/masters.service';
|
import { MastersService } from './../../service/masters/masters.service';
|
||||||
import { EntityService } from './../../service/entity/entity.service';
|
import { EntityService } from './../../service/entity/entity.service';
|
||||||
@ -41,10 +42,7 @@ export class EntityAddComponent implements OnInit {
|
|||||||
public subTitle2: string = "Contacts";
|
public subTitle2: string = "Contacts";
|
||||||
public _addQuesFrom: FormGroup;
|
public _addQuesFrom: FormGroup;
|
||||||
public submitted = false;
|
public submitted = false;
|
||||||
public categories: any = [];
|
|
||||||
public geoRecords: any = [];
|
|
||||||
public entityOptions: any = [];
|
public entityOptions: any = [];
|
||||||
public questionsOptions: any = [];
|
|
||||||
errorMessage: string;
|
errorMessage: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,7 +55,8 @@ export class EntityAddComponent implements OnInit {
|
|||||||
private _formBuilder: FormBuilder,
|
private _formBuilder: FormBuilder,
|
||||||
private masterService: MastersService,
|
private masterService: MastersService,
|
||||||
private entityService: EntityService,
|
private entityService: EntityService,
|
||||||
private router: Router) {
|
private router: Router,
|
||||||
|
private dialogRef: MatDialogRef<EntityAddComponent>) {
|
||||||
this.notifier = notifier;
|
this.notifier = notifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,96 +64,20 @@ export class EntityAddComponent implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
/** Questions Form Datas*/
|
/** Questions Form Datas*/
|
||||||
this._addQuesFrom = this._formBuilder.group({
|
this._addQuesFrom = this._formBuilder.group({
|
||||||
|
entity_id: [null],
|
||||||
fk_entity_type_id: [null, Validators.compose([Validators.required])],
|
fk_entity_type_id: [null, Validators.compose([Validators.required])],
|
||||||
full_name: [null, Validators.compose([Validators.required])],
|
full_name: [null, Validators.compose([Validators.required])],
|
||||||
short_name: [null, Validators.compose([Validators.required])],
|
short_name: [null, Validators.compose([Validators.required])],
|
||||||
fk_region: [null, Validators.compose([Validators.required])],
|
remarks: [null],
|
||||||
fk_state: [null, Validators.compose([Validators.required])],
|
isactive: [1]
|
||||||
fk_city: [null, Validators.compose([Validators.required])],
|
|
||||||
fk_branch: [null, Validators.compose([Validators.required])],
|
|
||||||
addressline1: [null, Validators.compose([Validators.required])],
|
|
||||||
pincode: [null, Validators.compose([Validators.required])],
|
|
||||||
official_email: [null, Validators.compose([Validators.required, Validators.email])],
|
|
||||||
phone_number: [null, Validators.compose([Validators.required])],
|
|
||||||
remarks: [null, Validators.compose([Validators.required])],
|
|
||||||
pan: [null, Validators.compose([Validators.required])],
|
|
||||||
gst_no: [null, Validators.compose([Validators.required])],
|
|
||||||
gst_state_code: [null, Validators.compose([Validators.required])],
|
|
||||||
tat: [null, Validators.compose([Validators.required])],
|
|
||||||
entity_child: this._formBuilder.array([
|
|
||||||
this.initAnswers(),
|
|
||||||
])
|
|
||||||
});
|
});
|
||||||
// OnInit Load Geo Details and Question Type Masters
|
|
||||||
this.getGeoLocationMaster();
|
|
||||||
this.getEntityOptionsMaster();
|
this.getEntityOptionsMaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
// convenience getter for easy access to form fields
|
// convenience getter for easy access to form fields
|
||||||
get f() { return this._addQuesFrom.controls; }
|
get f() { return this._addQuesFrom.controls; }
|
||||||
|
|
||||||
// Dynamic Form field creation Functionality : START ===>
|
|
||||||
initAnswers() {
|
|
||||||
return this._formBuilder.group({
|
|
||||||
contact_person: ['', Validators.compose([Validators.required])],
|
|
||||||
contact_email: ['', Validators.compose([Validators.required, Validators.email])],
|
|
||||||
contact_mobile_no: ['', Validators.compose([Validators.required])],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
addLanguage(e) {
|
|
||||||
const control = <FormArray>this._addQuesFrom.controls['entity_child'];
|
|
||||||
control.push(this.initAnswers());
|
|
||||||
}
|
|
||||||
removeLanguage(i: number) {
|
|
||||||
const control = <FormArray>this._addQuesFrom.controls['entity_child'];
|
|
||||||
control.removeAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// END ===>
|
|
||||||
|
|
||||||
public state_m: any = [];
|
|
||||||
selectGeoRegionChanges(reg){
|
|
||||||
this._addQuesFrom.controls.fk_state.reset();
|
|
||||||
this._addQuesFrom.controls.fk_city.reset();
|
|
||||||
this._addQuesFrom.controls.fk_branch.reset();
|
|
||||||
this.state_m = [];
|
|
||||||
this.city_m = [];
|
|
||||||
this.branch_m = [];
|
|
||||||
if(reg){
|
|
||||||
this.state_m = reg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public city_m: any = []
|
|
||||||
selectGeoStateChanges(city) {
|
|
||||||
this._addQuesFrom.controls.fk_city.reset();
|
|
||||||
this._addQuesFrom.controls.fk_branch.reset();
|
|
||||||
this.city_m = [];
|
|
||||||
this.branch_m = [];
|
|
||||||
if(city){
|
|
||||||
this.city_m = city;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public branch_m: any = [];
|
|
||||||
selectGeoCityChanges(brn){
|
|
||||||
this._addQuesFrom.controls.fk_branch.reset();
|
|
||||||
this.branch_m = [];
|
|
||||||
if(brn){
|
|
||||||
this.branch_m = brn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getGeoLocationMaster() {
|
|
||||||
this.entityService.getGeoLocationMasterDetails().subscribe(
|
|
||||||
data => {
|
|
||||||
this.geoRecords = data.records;
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
this.notifier.notify('warning', 'No Geo Location Records Found.!');
|
|
||||||
this.errorMessage = "No Category Records Found.";
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
getEntityOptionsMaster() {
|
getEntityOptionsMaster() {
|
||||||
this.masterService.getAllMasterData('ENTITYTYPE').subscribe(
|
this.masterService.getAllMasterData('ENTITYTYPE').subscribe(
|
||||||
data => {
|
data => {
|
||||||
@ -169,8 +92,8 @@ export class EntityAddComponent implements OnInit {
|
|||||||
|
|
||||||
/** For Popup Close Button */
|
/** For Popup Close Button */
|
||||||
onNoClick(): void {
|
onNoClick(): void {
|
||||||
// this.dialogRef.close();
|
this.dialogRef.close(null);
|
||||||
this.router.navigate(['/setting/entity/list']);
|
// this.router.navigate(['/setting/entity/list']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** To Save/Edited Popup Data */
|
/** To Save/Edited Popup Data */
|
||||||
@ -192,16 +115,16 @@ export class EntityAddComponent implements OnInit {
|
|||||||
if (dataresult.status == 200) {
|
if (dataresult.status == 200) {
|
||||||
console.log(dataresult);
|
console.log(dataresult);
|
||||||
this.notifier.notify('success', 'Record Saved Successfully.!');
|
this.notifier.notify('success', 'Record Saved Successfully.!');
|
||||||
this.router.navigate(['/setting/entity/list']);
|
this.dialogRef.close(dataresult);
|
||||||
this._addQuesFrom.reset();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
|
this.dialogRef.close(null);
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
this.errorMessage = "Something Wents Wrong Try Again !";
|
// this.errorMessage = "Something Wents Wrong Try Again !";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,103 @@
|
|||||||
|
<div style="max-height: 480px;">
|
||||||
|
<div fxLayout="row wrap" fxLayoutAlign="end">
|
||||||
|
<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>
|
||||||
|
<mat-card>
|
||||||
|
<h4>{{editAddType}} - Billing Information Details</h4>
|
||||||
|
<hr>
|
||||||
|
<!--{{data | json}}-->
|
||||||
|
<form [formGroup]="_editEntityBillingInfoFrom" (submit)="onSubmit()">
|
||||||
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="start center">
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="Billing Name" formControlName="billing_name">
|
||||||
|
<mat-error *ngIf="submitted && f.billing_name.hasError('required')" class="mat-text-warn">You must Include Billing Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="start center">
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="Door No./ Street No." formControlName="addressline1">
|
||||||
|
<mat-error *ngIf="submitted && f.addressline1.hasError('required')" class="mat-text-warn">You must Include Door No./ Street No.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="Street Name" formControlName="addressline2">
|
||||||
|
<mat-error *ngIf="submitted && f.addressline2.hasError('required')" class="mat-text-warn">You must Include Street Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="City, State" formControlName="addressline3">
|
||||||
|
<mat-error *ngIf="submitted && f.addressline3.hasError('required')" class="mat-text-warn">You must Include City, State.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<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-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="start center">
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="Email" formControlName="email">
|
||||||
|
<mat-error *ngIf="submitted && f.email.hasError('required')" class="mat-text-warn">You must Include Email.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="Mobile" formControlName="mobileno">
|
||||||
|
<mat-error *ngIf="submitted && f.mobileno.hasError('required')" class="mat-text-warn">You must Include Mobile.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="start center">
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="GST" formControlName="gstno">
|
||||||
|
<mat-error *ngIf="submitted && f.gstno.hasError('required')" class="mat-text-warn">You must Include GST.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="PAN" formControlName="pan">
|
||||||
|
<mat-error *ngIf="submitted && f.pan.hasError('required')" class="mat-text-warn">You must Include PAN.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div formArrayName="contacts" class="example-full-width">
|
||||||
|
<div *ngFor="let conts of f_contacts.controls; let i=index">
|
||||||
|
<div [formGroupName]="i">
|
||||||
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="Contact Person Name" formControlName="contact_person">
|
||||||
|
<mat-error *ngIf="submitted && conts['controls'].contact_person.hasError('required')" class="mat-text-warn">You must Include Person Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="Contact Person Mobile" formControlName="contact_mobile_no">
|
||||||
|
<mat-error *ngIf="submitted && conts['controls'].contact_mobile_no.hasError('required')" class="mat-text-warn">You must Include Contact Person Mobile.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||||
|
<input matInput placeholder="Contact Person Email" formControlName="contact_email">
|
||||||
|
<mat-error *ngIf="submitted && conts['controls'].contact_email.hasError('required')" class="mat-text-warn">You must Include Contact Person Email.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button mat-button color="primary" matTooltip="Add More Answer" matTooltipPosition="above" (click)="addContacts(null); false">Add More</button>
|
||||||
|
<!--<a (click)="addLanguage()" style="cursor: default">Add another Answer </a>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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"(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>
|
||||||
|
</form>
|
||||||
|
</mat-card>
|
||||||
|
<!--<div *ngIf="noRecordFound">
|
||||||
|
<mat-card class="listHover" style="width: 580px; padding: 6px;" *ngFor="let question of m_questions">
|
||||||
|
<span (click)="onNoClick()">{{question.question}}</span>
|
||||||
|
</mat-card>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="!noRecordFound" style="width: 320px;">
|
||||||
|
<h5 style="color: red;">No Records Found.!</h5>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
@ -1,6 +1,24 @@
|
|||||||
<p>
|
<div fxLayout="row wrap" fxLayoutAlign="end">
|
||||||
entity-edit-billing-info works!
|
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="editDetails(null); false"><mat-icon>add</mat-icon></button>
|
||||||
|
</div>
|
||||||
</p>
|
<mat-card *ngFor="let data of entityBillingInfoRecord">
|
||||||
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
|
||||||
<h1>{{ entityId }}</h1>
|
<div fxFlex="20%">
|
||||||
|
{{data.billing_name}}
|
||||||
|
</div>
|
||||||
|
<div fxFlex="50%">
|
||||||
|
<div>
|
||||||
|
{{data.addressline2}}, {{data.addressline3}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Pan: {{data.pan}}, Gst: {{data.gstno}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Contact Person Info, Contact Person Info, Contact Person Info
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div fxFlex="20%">
|
||||||
|
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="editDetails(data)"><mat-icon>edit</mat-icon></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mat-card>
|
||||||
@ -1,4 +1,14 @@
|
|||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, ViewChild, OnInit, OnDestroy, Input, Inject } from '@angular/core';
|
||||||
|
import { MatPaginator, MatSort, MatTableDataSource, MatDialog, MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material';
|
||||||
|
import { FormGroup, FormControl, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { DataSource } from '@angular/cdk/table';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
import { NotifierService } from 'angular-notifier';
|
||||||
|
|
||||||
|
import { MastersService } from './../../../service/masters/masters.service';
|
||||||
|
import { EntityService } from './../../../service/entity/entity.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-entity-edit-billing-info',
|
selector: 'app-entity-edit-billing-info',
|
||||||
@ -7,10 +17,224 @@ import { Component, OnInit, Input } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class EntityEditBillingInfoComponent implements OnInit {
|
export class EntityEditBillingInfoComponent implements OnInit {
|
||||||
|
|
||||||
@Input() entityId: number;
|
@Input() public entityId: number;
|
||||||
constructor() { }
|
|
||||||
|
public entityBillingInfoRecord: any;
|
||||||
|
public noRecordFound: boolean;
|
||||||
|
constructor(private dialog: MatDialog,
|
||||||
|
private entityService: EntityService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.getEntityIDBillingInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
getEntityIDBillingInfo() {
|
||||||
|
this.entityService.getEntityIdBillingInfoDetails(this.entityId).subscribe(
|
||||||
|
data => {
|
||||||
|
if (data) {
|
||||||
|
if (data.records) {
|
||||||
|
this.noRecordFound = false;
|
||||||
|
this.entityBillingInfoRecord = data.records;
|
||||||
|
} else {
|
||||||
|
this.noRecordFound = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noRecordFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
editDetails(rowDetails: any) {
|
||||||
|
const dialogRef = this.dialog.open(DialogAddEditBillingInfo, {
|
||||||
|
data: {'details':rowDetails, entity_id: this.entityId},
|
||||||
|
disableClose: true
|
||||||
|
});
|
||||||
|
dialogRef.afterClosed()
|
||||||
|
.subscribe(dataresult => {
|
||||||
|
this.getEntityIDBillingInfo();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'dialog-add-edd-billing-info',
|
||||||
|
styles: [``
|
||||||
|
],
|
||||||
|
templateUrl: './dialog-add-edit-billing-info.component.html'
|
||||||
|
})
|
||||||
|
export class DialogAddEditBillingInfo implements OnInit {
|
||||||
|
|
||||||
|
public m_questions: any;
|
||||||
|
public editAddType = 'Edit';
|
||||||
|
public _editEntityBillingInfoFrom: FormGroup;
|
||||||
|
errorRecord: string;
|
||||||
|
noRecordFound: boolean;
|
||||||
|
public submitted: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifier service
|
||||||
|
*/
|
||||||
|
private notifier: NotifierService;
|
||||||
|
constructor(
|
||||||
|
notifier: NotifierService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
public dialogRef: MatDialogRef<DialogAddEditBillingInfo>,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
|
private entityService: EntityService,
|
||||||
|
private mastersService: MastersService,
|
||||||
|
private _formBuilder: FormBuilder) {
|
||||||
|
// this.entity_id = this.route.snapshot.params['entity-id'];
|
||||||
|
// this.entity_id = this.parent.entityId;
|
||||||
|
this.notifier = notifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.loadFormData();
|
||||||
|
this.loadContactsDetails(this.data.details.contacts);
|
||||||
|
}
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// load form data form the master
|
||||||
|
loadFormData() {
|
||||||
|
/** Questions Form Datas*/
|
||||||
|
if(this.data.details == null) {
|
||||||
|
this._editEntityBillingInfoFrom = this._formBuilder.group({
|
||||||
|
entity_billing_id: [''],
|
||||||
|
fk_entity_id: [this.data.entity_id],
|
||||||
|
billing_name: ['', Validators.compose([Validators.required])],
|
||||||
|
addressline1: ['', Validators.compose([Validators.required])],
|
||||||
|
addressline2: ['', Validators.compose([Validators.required])],
|
||||||
|
addressline3: ['', Validators.compose([Validators.required])],
|
||||||
|
pincode: ['', Validators.compose([Validators.required])],
|
||||||
|
email: ['', Validators.compose([Validators.required])],
|
||||||
|
mobileno: ['', Validators.compose([Validators.required])],
|
||||||
|
gstno: ['', Validators.compose([Validators.required])],
|
||||||
|
gststatecode: [''],
|
||||||
|
pan: ['', Validators.compose([Validators.required])],
|
||||||
|
contacts: this._formBuilder.array([
|
||||||
|
this.initContacts(null)
|
||||||
|
])
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let data = this.data.details;
|
||||||
|
this._editEntityBillingInfoFrom = this._formBuilder.group({
|
||||||
|
entity_billing_id: [data.entity_billing_id],
|
||||||
|
fk_entity_id: [data.fk_entity_id],
|
||||||
|
billing_name: [data.billing_name, Validators.compose([Validators.required])],
|
||||||
|
addressline1: [data.addressline1, Validators.compose([Validators.required])],
|
||||||
|
addressline2: [data.addressline2, Validators.compose([Validators.required])],
|
||||||
|
addressline3: [data.addressline3, Validators.compose([Validators.required])],
|
||||||
|
pincode: [data.pincode, Validators.compose([Validators.required])],
|
||||||
|
email: [data.email, Validators.compose([Validators.required])],
|
||||||
|
mobileno: [data.mobileno, Validators.compose([Validators.required])],
|
||||||
|
gstno: [data.gstno, Validators.compose([Validators.required])],
|
||||||
|
gststatecode: [data.gststatecode],
|
||||||
|
pan: [data.pan, Validators.compose([Validators.required])],
|
||||||
|
contacts: this._formBuilder.array([
|
||||||
|
])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
loadContactsDetails(record: any) {
|
||||||
|
if(record == null || record == undefined){
|
||||||
|
this.addContacts(null);
|
||||||
|
} else {
|
||||||
|
if(record.length > 0) {
|
||||||
|
for (let val of record) {
|
||||||
|
let vals = val;
|
||||||
|
this.addContacts(vals);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// convenience getter for easy access to form fields
|
||||||
|
get f() { return this._editEntityBillingInfoFrom.controls; }
|
||||||
|
|
||||||
|
// form contacts details access
|
||||||
|
get f_contacts() { return <FormArray>this._editEntityBillingInfoFrom.get('contacts'); }
|
||||||
|
|
||||||
|
|
||||||
|
// Dynamic Form field creation Functionality : START ===>
|
||||||
|
initContacts(conts) {
|
||||||
|
if(conts == null){
|
||||||
|
return this._formBuilder.group({
|
||||||
|
entity_billing_contact_id: [null],
|
||||||
|
fk_entity_billing_id: [null],
|
||||||
|
contact_person: ['', Validators.compose([Validators.required])],
|
||||||
|
contact_email: ['', Validators.compose([Validators.required])],
|
||||||
|
contact_mobile_no: ['', Validators.compose([Validators.required])],
|
||||||
|
isactive: [1]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
entity_billing_contact_id: [conts.entity_billing_contact_id],
|
||||||
|
fk_entity_billing_id: [conts.fk_entity_billing_id],
|
||||||
|
contact_person: [conts.contact_person, Validators.compose([Validators.required])],
|
||||||
|
contact_email: [conts.contact_email, Validators.compose([Validators.required])],
|
||||||
|
contact_mobile_no: [conts.contact_mobile_no, Validators.compose([Validators.required])],
|
||||||
|
isactive: [conts.isactive]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addContacts(conts) {
|
||||||
|
const control = <FormArray>this._editEntityBillingInfoFrom.controls['contacts'];
|
||||||
|
control.push(this.initContacts(conts));
|
||||||
|
}
|
||||||
|
|
||||||
|
removeContacts(i: number) {
|
||||||
|
const control = <FormArray>this._editEntityBillingInfoFrom.controls['contacts'];
|
||||||
|
control.removeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// END ===>
|
||||||
|
|
||||||
|
|
||||||
|
/** To Save/Edited Popup Data */
|
||||||
|
onSubmit() {
|
||||||
|
this.submitted = true;
|
||||||
|
// stop here if form is invalid
|
||||||
|
if (this._editEntityBillingInfoFrom.invalid) {
|
||||||
|
// this.errorMessage = "Please Fill All Mandate Fields.";
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
var billingInfoFormValues = this._editEntityBillingInfoFrom.value;
|
||||||
|
|
||||||
|
//To Remove The "Null" With Key also
|
||||||
|
Object.keys(billingInfoFormValues).forEach((key) => (billingInfoFormValues[key] == null) && delete billingInfoFormValues[key]);
|
||||||
|
alert(billingInfoFormValues);
|
||||||
|
this.entityService.updateEntityIdBillingInfoDetails(billingInfoFormValues).subscribe(
|
||||||
|
dataresult => {
|
||||||
|
if (dataresult.status == 200) {
|
||||||
|
console.log(dataresult);
|
||||||
|
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
this.dialogRef.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** To Reset Popup Data */
|
||||||
|
onReset() {
|
||||||
|
this.loadFormData();
|
||||||
|
this.loadContactsDetails(this.data.details.contacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,51 @@
|
|||||||
<p>
|
<form [formGroup]="_editEntityRegionFrom" (submit)="onSubmit()">
|
||||||
entity-edit-region works!
|
<div formArrayName="region_lender" class="example-full-width">
|
||||||
</p>
|
<mat-card *ngFor="let region of _editEntityRegionFrom.controls.region_lender['controls']; let i=index">
|
||||||
|
<div [formGroupName]="i">
|
||||||
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
|
||||||
|
<mat-form-field fxFlex="30%">
|
||||||
|
<mat-select placeholder="Region *" formControlName="fk_region_id">
|
||||||
|
<mat-option *ngFor="let reg of m_region" [value]="reg.region_id">{{ reg.name }}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="submitted && region['controls'].fk_region_id.hasError('required')" class="mat-text-warn">Region Required.!</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="30%">
|
||||||
|
<mat-select placeholder="City *" formControlName="fk_city_id">
|
||||||
|
<mat-option *ngFor="let city of m_city" [value]="city.city_id">{{ city.city_name }}({{city.state_name}})</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="submitted && region['controls'].fk_city_id.hasError('required')" class="mat-text-warn">City Required.!</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<!--<mat-form-field fxFlex="18%">
|
||||||
|
<mat-select placeholder="State *" formControlName="fk_state_id">
|
||||||
|
<mat-option *ngFor="let state of m_state" [value]="state.state_id">{{ state.name }}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="submitted && region['controls'].fk_state_id.hasError('required')" class="mat-text-warn">State Required.!</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="18%">
|
||||||
|
<mat-select placeholder="Branch *" formControlName="fk_branch_id">
|
||||||
|
<mat-option *ngFor="let branch of m_branch" [value]="branch.branch_id">{{ branch.name }}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="submitted && region['controls'].fk_branch_id.hasError('required')" class="mat-text-warn">Branch Required.!</mat-error>
|
||||||
|
</mat-form-field>-->
|
||||||
|
|
||||||
|
<div fxFlex="30%">
|
||||||
|
<mat-checkbox *ngIf="region.get('entity_region_map_id').value != null" formControlName="isactive" [ngModel]="region.get('isactive').value == 1 ? true : region.get('isactive').value == 0 ? false : null"
|
||||||
|
(ngModelChange)="region.get('isactive').value = $event ? 1 : 0"></mat-checkbox>
|
||||||
|
|
||||||
|
<span *ngIf="_editEntityRegionFrom.controls.region_lender.controls.length > 1" (click)="removeLanguage(i)">
|
||||||
|
<button *ngIf="region.get('entity_region_map_id').value == null" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mat-card>
|
||||||
|
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="addRegionFormData(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||||
|
</div>
|
||||||
|
<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"><mat-icon>save</mat-icon></button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|||||||
@ -1,4 +1,14 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, ViewChild, OnInit, OnDestroy, Input, Inject } from '@angular/core';
|
||||||
|
import { MatPaginator, MatSort, MatTableDataSource, MatDialog, MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material';
|
||||||
|
import { FormGroup, FormControl, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { DataSource } from '@angular/cdk/table';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
import { NotifierService } from 'angular-notifier';
|
||||||
|
|
||||||
|
import { MastersService } from './../../../service/masters/masters.service';
|
||||||
|
import { EntityService } from './../../../service/entity/entity.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-entity-edit-region',
|
selector: 'app-entity-edit-region',
|
||||||
@ -7,9 +17,213 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class EntityEditRegionComponent implements OnInit {
|
export class EntityEditRegionComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
@Input() public entityId: number;
|
||||||
|
|
||||||
|
public noRocordsFound: boolean;
|
||||||
|
public entityRegionRecord: any;
|
||||||
|
public errorMessage;
|
||||||
|
|
||||||
|
public m_region: any = [];
|
||||||
|
public m_city: any = [];
|
||||||
|
public m_state: any = [];
|
||||||
|
public m_branch: any = [];
|
||||||
|
|
||||||
|
public _editEntityRegionFrom: FormGroup;
|
||||||
|
public submitted = false;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifier service
|
||||||
|
*/
|
||||||
|
private notifier: NotifierService;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
notifier: NotifierService,
|
||||||
|
private entityService: EntityService,
|
||||||
|
private mastersService: MastersService,
|
||||||
|
private _formBuilder: FormBuilder) {
|
||||||
|
this.notifier = notifier;
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.getEntityIDRegionInfoDetails();
|
||||||
|
this.getCityHierarchyMaster();
|
||||||
|
this.getRegionMasters();
|
||||||
|
// this.getCustomerSegmentMasters();
|
||||||
|
|
||||||
|
this._editEntityRegionFrom = this._formBuilder.group({
|
||||||
|
region_lender: this._formBuilder.array([
|
||||||
|
// this.addRegionFormData(null, null),
|
||||||
|
])
|
||||||
|
})
|
||||||
|
// this.addRegionFormData(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
setFormDatas(record) {
|
||||||
|
if (record.length > 0) {
|
||||||
|
for (let val of record) {
|
||||||
|
let vals = {
|
||||||
|
entity_region_map_id: val.entity_region_map_id,
|
||||||
|
fk_entity_id: val.fk_entity_id,
|
||||||
|
fk_region_id: val.fk_region_id,
|
||||||
|
fk_city_id: val.fk_city_id,
|
||||||
|
// fk_state_id: null,
|
||||||
|
// fk_branch_id: null,
|
||||||
|
isactive: val.isactive,
|
||||||
|
};
|
||||||
|
this.addRegionFormData(vals, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getEntityIDRegionInfoDetails() {
|
||||||
|
this.entityService.getEntityIdRegionInfoDetails(this.entityId).subscribe(
|
||||||
|
data => {
|
||||||
|
if (data) {
|
||||||
|
if (data.records) {
|
||||||
|
this.noRocordsFound = false;
|
||||||
|
this.entityRegionRecord = data.records;
|
||||||
|
this.setFormDatas(this.entityRegionRecord);
|
||||||
|
} else {
|
||||||
|
this.noRocordsFound = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noRocordsFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCityHierarchyMaster() {
|
||||||
|
this.entityService.getCityHierarchyMaster().subscribe(
|
||||||
|
data => {
|
||||||
|
this.m_city = data.records;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
this.notifier.notify('warning', 'No City Master Records Found.!');
|
||||||
|
// this.errorMessage = "No Lender Master Record Found.";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRegionMasters() {
|
||||||
|
this.mastersService.getAllMasterData('REGIONS').subscribe(
|
||||||
|
data => {
|
||||||
|
this.m_region = data.records;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
this.notifier.notify('warning', 'No Region Master Records Found.!');
|
||||||
|
// this.errorMessage = "No Region Master Record Found.";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// getCustomerSegmentMasters() {
|
||||||
|
// this.templatesService.getCustomerSegmentsMasterListDetails().subscribe(
|
||||||
|
// data => {
|
||||||
|
// this.m_customerSegment = data.records;
|
||||||
|
// },
|
||||||
|
// error => {
|
||||||
|
// this.notifier.notify('warning', 'No Customer Segment Master Records Found.!');
|
||||||
|
// this.errorMessage = "No Customer Segment Master Record Found.";
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// convenience getter for easy access to form fields
|
||||||
|
get f() { return this._editEntityRegionFrom.controls; }
|
||||||
|
|
||||||
|
// Dynamic Form field creation Functionality : START ===>
|
||||||
|
initRegionFormLoad(data) {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
entity_region_map_id: [data.entity_region_map_id],
|
||||||
|
fk_entity_id: [data.fk_entity_id],
|
||||||
|
fk_region_id: [data.fk_region_id, Validators.compose([Validators.required])],
|
||||||
|
fk_city_id: [data.fk_city_id, Validators.compose([Validators.required])],
|
||||||
|
// fk_state_id: [data.fk_state_id, Validators.compose([Validators.required])],
|
||||||
|
// fk_branch_id: [data.fk_branch_id, Validators.compose([Validators.required])],
|
||||||
|
isactive: [data.isactive],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
addRegionFormData(data, e) {
|
||||||
|
if (data == null) {
|
||||||
|
let newDate = {
|
||||||
|
entity_region_map_id: null,
|
||||||
|
fk_entity_id: this.entityId,
|
||||||
|
fk_region_id: null,
|
||||||
|
fk_city_id: null,
|
||||||
|
// fk_state_id: null,
|
||||||
|
// fk_branch_id: null,
|
||||||
|
isactive: 1,
|
||||||
|
}
|
||||||
|
const control = <FormArray>this._editEntityRegionFrom.controls['region_lender'];
|
||||||
|
control.push(this.initRegionFormLoad(newDate));
|
||||||
|
} else {
|
||||||
|
const control = <FormArray>this._editEntityRegionFrom.controls['region_lender'];
|
||||||
|
control.push(this.initRegionFormLoad(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
removeLanguage(i: number) {
|
||||||
|
const control = <FormArray>this._editEntityRegionFrom.controls['region_lender'];
|
||||||
|
control.removeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// END ===>
|
||||||
|
|
||||||
|
/** To Save/Edited Popup Data */
|
||||||
|
onSubmit() {
|
||||||
|
this.submitted = true;
|
||||||
|
// stop here if form is invalid
|
||||||
|
if (this._editEntityRegionFrom.invalid) {
|
||||||
|
this.errorMessage = "Please Fill All Mandate Fields.";
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
var formValues = this._editEntityRegionFrom.value;
|
||||||
|
//To Remove The "Null" With Key also
|
||||||
|
Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
|
||||||
|
// alert(JSON.stringify(formValues.temp_lender));
|
||||||
|
if (!this.checkDuplicateInObject(formValues.region_lender)) {
|
||||||
|
this.entityService.updateEntityIdRegionInfoDetails(formValues.region_lender).subscribe(
|
||||||
|
dataresult => {
|
||||||
|
if (dataresult.status == 200) {
|
||||||
|
console.log(dataresult);
|
||||||
|
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||||
|
const arr = <FormArray>this._editEntityRegionFrom.controls.region_lender;
|
||||||
|
arr.controls.splice(0);
|
||||||
|
this.getEntityIDRegionInfoDetails();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
this.errorMessage = "Something Wents Wrong Try Again.!";
|
||||||
|
}
|
||||||
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.notifier.notify('warning', 'duplication records occured.!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
checkDuplicateInObject(inputArray) {
|
||||||
|
let seenDuplicate = false;
|
||||||
|
inputArray.map(function (item, index) {
|
||||||
|
let currentVal = inputArray[index];
|
||||||
|
for (let i = index + 1; i < inputArray.length; i++) {
|
||||||
|
if (currentVal.fk_region_id === inputArray[i].fk_region_id
|
||||||
|
&& currentVal.fk_city_id === inputArray[i].fk_city_id) {
|
||||||
|
console.log('duplication: ' + i);
|
||||||
|
seenDuplicate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(index);
|
||||||
|
});
|
||||||
|
return seenDuplicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1 @@
|
|||||||
<p>
|
<h1>Tat info</h1>
|
||||||
entity-edit-tat works!
|
|
||||||
</p>
|
|
||||||
@ -1,4 +1,14 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, ViewChild, OnInit, OnDestroy, Input, Inject } from '@angular/core';
|
||||||
|
import { MatPaginator, MatSort, MatTableDataSource, MatDialog, MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material';
|
||||||
|
import { FormGroup, FormControl, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { DataSource } from '@angular/cdk/table';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
import { NotifierService } from 'angular-notifier';
|
||||||
|
|
||||||
|
import { MastersService } from './../../../service/masters/masters.service';
|
||||||
|
import { EntityService } from './../../../service/entity/entity.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-entity-edit-tat',
|
selector: 'app-entity-edit-tat',
|
||||||
@ -7,9 +17,71 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class EntityEditTatComponent implements OnInit {
|
export class EntityEditTatComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
public noRocordsFound: boolean;
|
||||||
|
public entityVendorCityRecord: any;
|
||||||
|
public errorMessage;
|
||||||
|
|
||||||
|
@Input() public entityId: number;
|
||||||
|
public m_city: any = [];
|
||||||
|
public selectedArr: any = [];
|
||||||
|
|
||||||
|
|
||||||
|
toppings1 = new FormControl();
|
||||||
|
|
||||||
|
toppingList1: any[] = [{'id': 1,'name':'Extra cheese'}, {'id': 2, 'name':'Mushroom'}, { 'id': 3, 'name':'Onion'}];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifier service
|
||||||
|
*/
|
||||||
|
private notifier: NotifierService;
|
||||||
|
|
||||||
|
constructor(notifier: NotifierService,
|
||||||
|
private entityService: EntityService,
|
||||||
|
private mastersService: MastersService,
|
||||||
|
private _formBuilder: FormBuilder) {
|
||||||
|
this.notifier = notifier;
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.getEntityIdCityDetails();
|
||||||
|
this.getCityMasters();
|
||||||
|
this.toppings1.setValue([3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedItem: any;
|
||||||
|
|
||||||
|
selected(e){
|
||||||
|
this.selectedArr = [...e.value];
|
||||||
|
this.selectedItem = this.m_city.filter(val => this.selectedArr.indexOf(val.city_id) > -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
getEntityIdCityDetails(){
|
||||||
|
this.entityService.getEntityIdCityInfoDetails(this.entityId).subscribe(
|
||||||
|
data => {
|
||||||
|
if (data) {
|
||||||
|
if (data.records) {
|
||||||
|
this.noRocordsFound = false;
|
||||||
|
this.entityVendorCityRecord = data.records;
|
||||||
|
} else {
|
||||||
|
this.noRocordsFound = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noRocordsFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCityMasters() {
|
||||||
|
this.mastersService.getAllMasterData('CITY').subscribe(
|
||||||
|
data => {
|
||||||
|
this.m_city = data.records;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
this.notifier.notify('warning', 'No City Master Records Found.!');
|
||||||
|
// this.errorMessage = "No Region Master Record Found.";
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
<mat-form-field>
|
||||||
|
<mat-select (selectionChange)="selected($event)" placeholder="Toppings" [formControl]="toppings1" multiple>
|
||||||
|
<mat-option *ngFor="let city of m_city" [value]="city.city_id">{{city.name}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
{{ selectedCityName | json }}-->
|
||||||
|
|
||||||
|
<mat-chip-list>
|
||||||
|
<mat-chip *ngFor="let cit of selectedCityName" >{{cit.name}}</mat-chip>
|
||||||
|
</mat-chip-list>
|
||||||
|
|
||||||
|
<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" (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="button" (click)="onSubmit()"><mat-icon>save</mat-icon></button>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { EntityEditVendorCityInfoComponent } from './entity-edit-vendor-city-info.component';
|
||||||
|
|
||||||
|
describe('EntityEditVendorCityInfoComponent', () => {
|
||||||
|
let component: EntityEditVendorCityInfoComponent;
|
||||||
|
let fixture: ComponentFixture<EntityEditVendorCityInfoComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ EntityEditVendorCityInfoComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(EntityEditVendorCityInfoComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,149 @@
|
|||||||
|
import { Component, ViewChild, OnInit, OnDestroy, Input, Inject } from '@angular/core';
|
||||||
|
import { MatPaginator, MatSort, MatTableDataSource, MatDialog, MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material';
|
||||||
|
import { FormGroup, FormControl, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { DataSource } from '@angular/cdk/table';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
import { NotifierService } from 'angular-notifier';
|
||||||
|
|
||||||
|
import { MastersService } from './../../../service/masters/masters.service';
|
||||||
|
import { EntityService } from './../../../service/entity/entity.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-entity-edit-vendor-city-info',
|
||||||
|
templateUrl: './entity-edit-vendor-city-info.component.html',
|
||||||
|
styleUrls: ['./entity-edit-vendor-city-info.component.scss']
|
||||||
|
})
|
||||||
|
export class EntityEditVendorCityInfoComponent implements OnInit {
|
||||||
|
|
||||||
|
public noRocordsFound: boolean;
|
||||||
|
public entityVendorCityRecord: any;
|
||||||
|
public errorMessage;
|
||||||
|
|
||||||
|
@Input() public entityId: number;
|
||||||
|
public m_city: any = [];
|
||||||
|
public selectedArr: any = [];
|
||||||
|
|
||||||
|
|
||||||
|
toppings1 = new FormControl();
|
||||||
|
|
||||||
|
toppingList1: any[] = [{'id': 1,'name':'Extra cheese'}, {'id': 2, 'name':'Mushroom'}, { 'id': 3, 'name':'Onion'}];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifier service
|
||||||
|
*/
|
||||||
|
private notifier: NotifierService;
|
||||||
|
|
||||||
|
constructor(notifier: NotifierService,
|
||||||
|
private entityService: EntityService,
|
||||||
|
private mastersService: MastersService,
|
||||||
|
private _formBuilder: FormBuilder) {
|
||||||
|
this.notifier = notifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.getEntityIdCityDetails();
|
||||||
|
this.getCityMasters();
|
||||||
|
// this.toppings1.setValue(['1']);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedItem: any;
|
||||||
|
|
||||||
|
selected(e){
|
||||||
|
this.selectedArr = [...e.value];
|
||||||
|
this.getNameofCityId(e.value);
|
||||||
|
// this.selectedItem = this.m_city.filter(val => this.selectedArr.indexOf(val.city_id) > -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
getEntityIdCityDetails(){
|
||||||
|
this.entityService.getEntityIdCityInfoDetails(this.entityId).subscribe(
|
||||||
|
data => {
|
||||||
|
if (data) {
|
||||||
|
if (data.records) {
|
||||||
|
this.noRocordsFound = false;
|
||||||
|
if(data.records[0]){
|
||||||
|
this.entityVendorCityRecord = data.records[0];
|
||||||
|
let arr: string[] = this.entityVendorCityRecord.fk_city_id.split(',');
|
||||||
|
let arrVal = arr.map(val => val);
|
||||||
|
this.getNameofCityId(arrVal);
|
||||||
|
this.toppings1.setValue(arrVal);
|
||||||
|
} else {
|
||||||
|
this.toppings1.setValue(null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noRocordsFound = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noRocordsFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedCityName:any;
|
||||||
|
|
||||||
|
getNameofCityId(arg) {
|
||||||
|
let arrs = [...arg];
|
||||||
|
this.selectedCityName = this.m_city.filter(val => arrs.indexOf(val.city_id) > -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
getCityMasters() {
|
||||||
|
this.mastersService.getAllMasterData('CITY').subscribe(
|
||||||
|
data => {
|
||||||
|
this.m_city = data.records;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
this.notifier.notify('warning', 'No City Master Records Found.!');
|
||||||
|
// this.errorMessage = "No Region Master Record Found.";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
|
||||||
|
let cityArr: any[] = this.toppings1.value;
|
||||||
|
|
||||||
|
if(cityArr.length > 0) {
|
||||||
|
let Records:any;
|
||||||
|
if(this.entityVendorCityRecord){
|
||||||
|
Records = {
|
||||||
|
"vendor_city_map_id": this.entityVendorCityRecord.vendor_city_map_id || '',
|
||||||
|
"fk_vendor_id": this.entityVendorCityRecord.fk_vendor_id || this.entityId,
|
||||||
|
"fk_city_id": cityArr.toString(),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Records = {
|
||||||
|
"vendor_city_map_id": '',
|
||||||
|
"fk_vendor_id": this.entityId,
|
||||||
|
"fk_city_id": cityArr.toString(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.entityService.updateEntityIdCityInfoDetails(Records).subscribe(
|
||||||
|
dataresult => {
|
||||||
|
if (dataresult.status == 200) {
|
||||||
|
console.log(dataresult);
|
||||||
|
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||||
|
// const arr = <FormArray>this._editEntityRegionFrom.controls.region_lender;
|
||||||
|
// arr.controls.splice(0);
|
||||||
|
// this.getEntityIDRegionInfoDetails();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
this.errorMessage = "Something Wents Wrong Try Again.!";
|
||||||
|
}
|
||||||
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
||||||
|
});
|
||||||
|
|
||||||
|
}else {
|
||||||
|
this.notifier.notify('warning', 'City Should Selected.!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onReset() {
|
||||||
|
this.getEntityIdCityDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -178,41 +178,63 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>-->
|
</div>-->
|
||||||
|
|
||||||
|
<!--{{ _editEntityNameFrom | json}}-->
|
||||||
|
|
||||||
<!--<mat-card style="padding: 6px;">
|
<mat-card style="padding: 6px;">
|
||||||
<div fxLayout="row" fxLayoutAlign="end start">
|
<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"
|
<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>
|
(click)="backToList()"><mat-icon>close</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
<mat-card style="padding: 6px;">
|
<mat-card style="padding: 6px;" *ngIf="entityNameRecord">
|
||||||
<h6>Template Name</h6>
|
<h6>Entity Details ({{this.entityNameRecord.entity_name}})</h6>
|
||||||
|
|
||||||
|
<form [formGroup]="_editEntityNameFrom" (submit)="onSubmit()">
|
||||||
<hr>
|
<hr>
|
||||||
<div>
|
<div>
|
||||||
<form [formGroup]="_editTempNameFrom" (submit)="onSubmit()">
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
|
||||||
<div fxLayout="row" fxLayoutWrap fxLayoutGap="0.5%" fxLayoutAlign="start center">
|
<div fxFlex="30%">
|
||||||
<mat-form-field class="ml-xs">
|
<mat-form-field class="ml-xs">
|
||||||
<input matInput placeholder="Template Name" formControlName="template_name">
|
<input matInput placeholder="Entity Full Name" formControlName="full_name">
|
||||||
<mat-error *ngIf="submitted && f.template_name.hasError('required')" class="mat-text-warn">You must Include Template Name.</mat-error>
|
<mat-error *ngIf="submitted && f.full_name.hasError('required')" class="mat-text-warn">You must Include Entity Full Name.</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div>
|
</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>
|
<div fxFlex="30%">
|
||||||
|
<mat-form-field class="ml-xs">
|
||||||
|
<input matInput placeholder="Entity Short Name" formControlName="short_name">
|
||||||
|
<mat-error *ngIf="submitted && f.short_name.hasError('required')" class="mat-text-warn">You must Include Entity Short Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div fxFlex="30%">
|
||||||
|
<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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<div> No Template Name Found.</div>
|
<div *ngIf="noEntityNameFound"> No Template Name Found.</div>
|
||||||
|
</form>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-tab-group>
|
<mat-tab-group *ngIf="entityNameRecord && !noEntityNameFound">
|
||||||
<mat-tab label="Lender Details">
|
<mat-tab label="Billing Information">
|
||||||
<ng-template matTabContent>
|
<ng-template matTabContent>
|
||||||
<app-entity-edit-billing-info [entityId]="entity_id">
|
<app-entity-edit-billing-info [entityId]="entity_id">
|
||||||
</app-entity-edit-billing-info>
|
</app-entity-edit-billing-info>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Category">
|
<mat-tab *ngIf="localEntityType == 2" label="Region Information">
|
||||||
|
<ng-template matTabContent>
|
||||||
|
<app-entity-edit-region [entityId]="entity_id">
|
||||||
|
</app-entity-edit-region>
|
||||||
|
</ng-template>
|
||||||
|
</mat-tab>
|
||||||
|
<mat-tab *ngIf="localEntityType == 3" label="Cities Information">
|
||||||
|
<ng-template matTabContent>
|
||||||
|
<app-entity-edit-vendor-city-info [entityId]="entity_id">
|
||||||
|
</app-entity-edit-vendor-city-info>
|
||||||
|
</ng-template>
|
||||||
|
</mat-tab>
|
||||||
|
<!--<mat-tab label="Category">
|
||||||
<ng-template matTabContent>
|
<ng-template matTabContent>
|
||||||
<app-template-edit-category [questionId]="question_id">
|
<app-template-edit-category [questionId]="question_id">
|
||||||
</app-template-edit-category>
|
</app-template-edit-category>
|
||||||
@ -223,8 +245,10 @@
|
|||||||
<app-template-edit-question-answer [questionId]="question_id">
|
<app-template-edit-question-answer [questionId]="question_id">
|
||||||
</app-template-edit-question-answer>
|
</app-template-edit-question-answer>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>-->
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</mat-card>-->
|
</mat-card>
|
||||||
|
|
||||||
|
<!--https://stackoverflow.com/questions/51233913/how-to-save-selected-object-using-mat-chip-and-autocomplete-in-angular-material/51239619-->
|
||||||
|
<!--https://stackblitz.com/angular/yjpbqxmqvppe?file=app%2Fchips-autocomplete-example.html-->
|
||||||
@ -21,6 +21,7 @@ import { NotifierService } from 'angular-notifier';
|
|||||||
/** Service */
|
/** Service */
|
||||||
import { MastersService } from './../../service/masters/masters.service';
|
import { MastersService } from './../../service/masters/masters.service';
|
||||||
import { EntityService } from './../../service/entity/entity.service';
|
import { EntityService } from './../../service/entity/entity.service';
|
||||||
|
|
||||||
import { EntityListComponent } from './../entity-list/entity.list.component';
|
import { EntityListComponent } from './../entity-list/entity.list.component';
|
||||||
/*
|
/*
|
||||||
* Question master details edit component
|
* Question master details edit component
|
||||||
@ -36,16 +37,12 @@ export class EntityEditComponent implements OnInit, OnDestroy{
|
|||||||
@Input() public childMessage: any;
|
@Input() public childMessage: any;
|
||||||
|
|
||||||
public entity_id: number;
|
public entity_id: number;
|
||||||
public pageTitle: string = "Entity";
|
public _editEntityNameFrom: FormGroup;
|
||||||
public subTitle1: string = "Tax Info";
|
|
||||||
public subTitle2: string = "Contacts";
|
|
||||||
public _addQuesFrom: FormGroup;
|
|
||||||
public submitted = false;
|
public submitted = false;
|
||||||
public categories: any = [];
|
|
||||||
public geoRecords: any = [];
|
|
||||||
public entityOptions: any = [];
|
|
||||||
public questionsOptions: any = [];
|
|
||||||
errorMessage: string;
|
errorMessage: string;
|
||||||
|
public noEntityNameFound: boolean;
|
||||||
|
public entityNameRecord: any;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifier service
|
* Notifier service
|
||||||
@ -62,161 +59,54 @@ public pageTitle: string = "Entity";
|
|||||||
private entityListComponent: EntityListComponent) {
|
private entityListComponent: EntityListComponent) {
|
||||||
this.notifier = notifier;
|
this.notifier = notifier;
|
||||||
this.entity_id = this.route.snapshot.params['entity-id'];
|
this.entity_id = this.route.snapshot.params['entity-id'];
|
||||||
|
this.getEntityIdDetails();
|
||||||
|
// this._editEntityNameFrom = this._formBuilder.group({
|
||||||
|
// full_name: ['', Validators.compose([Validators.required]) ]
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.loadFormData();
|
this.entityListComponent.showListView(false);
|
||||||
/** Questions Form Datas*/
|
|
||||||
if (this.childMessage["0"].length > 0) {
|
|
||||||
for (let val of this.childMessage["0"]) {
|
|
||||||
// alert(JSON.stringify(val));
|
|
||||||
let vals = val;
|
|
||||||
this.addLanguage(vals['contact_person'], vals['contact_email'], vals['contact_mobile_no'], vals['entity_child_id'], vals['isactive'], null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnInit Load Geo Details and Question Type Masters
|
public localEntityType: number;
|
||||||
this.getGeoLocationMaster();
|
|
||||||
this.getEntityOptionsMaster();
|
getEntityIdDetails() {
|
||||||
|
this.entityService.getEntityIdNameDetails(this.entity_id).subscribe(
|
||||||
|
data => {
|
||||||
|
if (data) {
|
||||||
|
if (data.records) {
|
||||||
|
this.noEntityNameFound = false;
|
||||||
|
this.entityNameRecord = data.records.data[0];
|
||||||
|
this.localEntityType = this.entityNameRecord.fk_entity_type_id;
|
||||||
|
this.setFormDatas();
|
||||||
|
} else {
|
||||||
|
this.noEntityNameFound = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noEntityNameFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// load answer details list
|
setFormDatas(){
|
||||||
loadAnsData() {
|
// alert(this.templateNameDetails.template_name);
|
||||||
if (this.childMessage["0"].length > 0) {
|
this._editEntityNameFrom = this._formBuilder.group({
|
||||||
for (let val of this.childMessage["0"]) {
|
entity_id: [this.entityNameRecord.entity_id],
|
||||||
// alert(JSON.stringify(val));
|
full_name: [this.entityNameRecord.full_name, Validators.compose([Validators.required]) ],
|
||||||
let vals = val;
|
short_name: [this.entityNameRecord.short_name, Validators.compose([Validators.required]) ],
|
||||||
this.addLanguage(vals['contact_person'], vals['contact_email'], vals['contact_mobile_no'], vals['entity_child_id'], vals['isactive'], null);
|
// entity_name: [this.entityNameRecord.entity_name],
|
||||||
}
|
fk_entity_type_id: [this.entityNameRecord.fk_entity_type_id],
|
||||||
}
|
isactive: [this.entityNameRecord.isactive]
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
loadFormData() {
|
|
||||||
this._addQuesFrom = this._formBuilder.group({
|
|
||||||
entity_id: [this.childMessage.entity_id],
|
|
||||||
fk_entity_type_id: [this.childMessage.fk_entity_type_id, Validators.compose([Validators.required])],
|
|
||||||
full_name: [this.childMessage.full_name, Validators.compose([Validators.required])],
|
|
||||||
short_name: [this.childMessage.short_name, Validators.compose([Validators.required])],
|
|
||||||
fk_region: [this.childMessage.fk_region, Validators.compose([Validators.required])],
|
|
||||||
fk_state: [this.childMessage.fk_state, Validators.compose([Validators.required])],
|
|
||||||
fk_city: [this.childMessage.fk_city, Validators.compose([Validators.required])],
|
|
||||||
fk_branch: [this.childMessage.fk_branch, Validators.compose([Validators.required])],
|
|
||||||
addressline1: [this.childMessage.addressline1, Validators.compose([Validators.required])],
|
|
||||||
pincode: [this.childMessage.pincode, Validators.compose([Validators.required])],
|
|
||||||
official_email: [this.childMessage.official_email, Validators.compose([Validators.required, Validators.email])],
|
|
||||||
phone_number: [this.childMessage.phone_number, Validators.compose([Validators.required])],
|
|
||||||
remarks: [this.childMessage.remarks, Validators.compose([Validators.required])],
|
|
||||||
pan: [this.childMessage.pan, Validators.compose([Validators.required])],
|
|
||||||
gst_no: [this.childMessage.gst_no, Validators.compose([Validators.required])],
|
|
||||||
gst_state_code: [this.childMessage.gst_state_code, Validators.compose([Validators.required])],
|
|
||||||
tat: [this.childMessage.tat, Validators.compose([Validators.required])],
|
|
||||||
entity_child: this._formBuilder.array([
|
|
||||||
// this.initAnswers(),
|
|
||||||
])
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// convenience getter for easy access to form fields
|
// convenience getter for easy access to form fields
|
||||||
get f() { return this._addQuesFrom.controls; }
|
get f() { return this._editEntityNameFrom.controls; }
|
||||||
|
|
||||||
// form entity_child details access
|
|
||||||
get f_ans() { return <FormArray>this._addQuesFrom.get('entity_child'); }
|
|
||||||
|
|
||||||
// Dynamic Form field creation Functionality : START ===>
|
|
||||||
initAnswers(c_person, c_email, e_phn, fk_id, isAct, e) {
|
|
||||||
isAct = isAct == null ? 1 : isAct;
|
|
||||||
return this._formBuilder.group({
|
|
||||||
contact_person: [c_person, Validators.compose([Validators.required])],
|
|
||||||
contact_email: [c_email, Validators.compose([Validators.required, Validators.email])],
|
|
||||||
contact_mobile_no: [e_phn, Validators.compose([Validators.required])],
|
|
||||||
entity_child_id: [fk_id],
|
|
||||||
isactive: [isAct]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
addLanguage(c_person, c_email, e_phn, fk_id, isAct, e) {
|
|
||||||
const control = <FormArray>this._addQuesFrom.controls['entity_child'];
|
|
||||||
control.push(this.initAnswers(c_person, c_email, e_phn, fk_id, isAct, e));
|
|
||||||
}
|
|
||||||
removeLanguage(i: number) {
|
|
||||||
const control = <FormArray>this._addQuesFrom.controls['entity_child'];
|
|
||||||
control.removeAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// END ===>
|
|
||||||
|
|
||||||
public state_m: any = [];
|
|
||||||
selectGeoRegionChanges(reg){
|
|
||||||
this._addQuesFrom.controls.fk_state.reset();
|
|
||||||
this._addQuesFrom.controls.fk_city.reset();
|
|
||||||
this._addQuesFrom.controls.fk_branch.reset();
|
|
||||||
this.state_m = [];
|
|
||||||
this.city_m = [];
|
|
||||||
this.branch_m = [];
|
|
||||||
if(reg){
|
|
||||||
this.state_m = reg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public city_m: any = []
|
|
||||||
selectGeoStateChanges(city) {
|
|
||||||
this._addQuesFrom.controls.fk_city.reset();
|
|
||||||
this._addQuesFrom.controls.fk_branch.reset();
|
|
||||||
this.city_m = [];
|
|
||||||
this.branch_m = [];
|
|
||||||
if(city){
|
|
||||||
this.city_m = city;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public branch_m: any = [];
|
|
||||||
selectGeoCityChanges(brn){
|
|
||||||
this._addQuesFrom.controls.fk_branch.reset();
|
|
||||||
this.branch_m = [];
|
|
||||||
if(brn){
|
|
||||||
this.branch_m = brn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getGeoLocationMaster() {
|
|
||||||
this.entityService.getGeoLocationMasterDetails().subscribe(
|
|
||||||
data => {
|
|
||||||
this.geoRecords = data.records;
|
|
||||||
this.setGeoEditSelectDetails();
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
this.notifier.notify('warning', 'No Geo Location Records Found.!');
|
|
||||||
this.errorMessage = "No Category Records Found.";
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
setGeoEditSelectDetails() {
|
|
||||||
let state = this.geoRecords.filter(data=>{if(data.region_id === this.childMessage.fk_region){ return data.state_data;}});
|
|
||||||
this.state_m = state[0].state_data;
|
|
||||||
let city = this.state_m.filter(data=>{if(data.state_id === this.childMessage.fk_state){ return data.city_data;}});
|
|
||||||
this.city_m = city[0].city_data;
|
|
||||||
let branch = this.city_m.filter(data=>{if(data.city_id === this.childMessage.fk_city){ return data.branch_data;}});
|
|
||||||
// alert(JSON.stringify(branch));
|
|
||||||
this.branch_m = branch[0].branch_data;
|
|
||||||
}
|
|
||||||
getEntityOptionsMaster() {
|
|
||||||
this.masterService.getAllMasterData('ENTITYTYPE').subscribe(
|
|
||||||
data => {
|
|
||||||
this.entityOptions = data.records.filter(data => data.entity_type_id != 1);
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
this.notifier.notify('warning', 'No Answer Type Records Found.!');
|
|
||||||
this.errorMessage = "No Answer Type Record Found.";
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** For Popup Close Button */
|
|
||||||
onNoClick(): void {
|
|
||||||
this.entityListComponent.changeListView();
|
|
||||||
// this.dialogRef.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
backToList() {
|
backToList() {
|
||||||
this.entityListComponent.showListView(true);
|
this.entityListComponent.showListView(true);
|
||||||
@ -227,23 +117,20 @@ public pageTitle: string = "Entity";
|
|||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.submitted = true;
|
this.submitted = true;
|
||||||
// stop here if form is invalid
|
// stop here if form is invalid
|
||||||
if (this._addQuesFrom.invalid) {
|
if (this._editEntityNameFrom.invalid) {
|
||||||
this.errorMessage = "Please Fill All Mandate Fields.";
|
this.errorMessage = "Please Fill All Mandate Fields.";
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var entityFormValues = this._addQuesFrom.value;
|
var entityFormValues = this._editEntityNameFrom.value;
|
||||||
|
|
||||||
//To Remove The "Null" With Key also
|
|
||||||
Object.keys(entityFormValues).forEach((key) => (entityFormValues[key] == null) && delete entityFormValues[key]);
|
Object.keys(entityFormValues).forEach((key) => (entityFormValues[key] == null) && delete entityFormValues[key]);
|
||||||
|
|
||||||
//Add BRANCH data with help Service File
|
|
||||||
this.entityService.updateEntityMasterDetails(entityFormValues).subscribe(
|
this.entityService.updateEntityMasterDetails(entityFormValues).subscribe(
|
||||||
dataresult => {
|
dataresult => {
|
||||||
if (dataresult.status == 200) {
|
if (dataresult.status == 200) {
|
||||||
console.log(dataresult);
|
console.log(dataresult);
|
||||||
this.notifier.notify('success', 'Record Updated Successfully.!');
|
this.notifier.notify('success', 'Record Updated Successfully.!');
|
||||||
this._addQuesFrom.reset();
|
this.getEntityIdDetails();
|
||||||
this.entityListComponent.changeListView();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
@ -258,8 +145,7 @@ public pageTitle: string = "Entity";
|
|||||||
|
|
||||||
/** To Reset Popup Data */
|
/** To Reset Popup Data */
|
||||||
onReset() {
|
onReset() {
|
||||||
this.loadFormData();
|
this.getEntityIdDetails();
|
||||||
this.loadAnsData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<div fxFlex="80%">
|
<div fxFlex="80%">
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="20%">
|
<div fxFlex="20%">
|
||||||
<button mat-fab class="mr-1 mb-1" color="primary" (click)="addNewQuestion()"><mat-icon>add</mat-icon></button>
|
<button mat-fab class="mr-1 mb-1" color="primary" (click)="addNewEntity()"><mat-icon>add</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="enityList.length > 0">
|
<ng-container *ngIf="enityList.length > 0">
|
||||||
@ -50,14 +50,9 @@
|
|||||||
</mat-paginator>
|
</mat-paginator>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!listView">
|
|
||||||
<app-entity-edit [childMessage]="parentMessage"></app-entity-edit>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button (click)="goToEdit(1)">Go To Edit</button>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<app-entity-edit ></app-entity-edit>
|
<router-outlet></router-outlet>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<notifier-container></notifier-container>
|
<notifier-container></notifier-container>
|
||||||
@ -133,13 +133,14 @@ export class EntityListComponent implements OnInit {
|
|||||||
public parentMessage: any = [];
|
public parentMessage: any = [];
|
||||||
editEntity(detail){
|
editEntity(detail){
|
||||||
this.parentMessage = detail;
|
this.parentMessage = detail;
|
||||||
|
this.router.navigate([ '../list/edit', detail.entity_id ], { relativeTo: this.route });
|
||||||
this.listView = false;
|
this.listView = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
goToEdit(template_id : number){
|
// goToEdit(template_id : number){
|
||||||
this.router.navigate([ '../list/edit', template_id ], { relativeTo: this.route });
|
// this.router.navigate([ '../list/edit', template_id ], { relativeTo: this.route });
|
||||||
this.listView = false;
|
// this.listView = false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
showListView(status: boolean){
|
showListView(status: boolean){
|
||||||
// alert(2);
|
// alert(2);
|
||||||
@ -147,6 +148,7 @@ export class EntityListComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeListView(){
|
changeListView(){
|
||||||
|
|
||||||
this.getEntityListMasters();
|
this.getEntityListMasters();
|
||||||
this.listView = true;
|
this.listView = true;
|
||||||
}
|
}
|
||||||
@ -170,6 +172,25 @@ export class EntityListComponent implements OnInit {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addNewEntity(): void {
|
||||||
|
const dialogRef = this.dialog.open(EntityAddComponent, {
|
||||||
|
disableClose: true,
|
||||||
|
data: { }
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
if(result != null) {
|
||||||
|
this.getEntityListMasters();
|
||||||
|
this.editEntity({'entity_id':result.record});
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
console.log('The dialog was closed');
|
||||||
|
// alert(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// {"dataStatus":true,"status":200,"records":
|
// {"dataStatus":true,"status":200,"records":
|
||||||
|
|||||||
@ -13,7 +13,8 @@ import {
|
|||||||
MatToolbarModule,MatSelectModule,
|
MatToolbarModule,MatSelectModule,
|
||||||
MatListModule, MatMenuModule,
|
MatListModule, MatMenuModule,
|
||||||
MatCheckboxModule,MatTabsModule,
|
MatCheckboxModule,MatTabsModule,
|
||||||
MatExpansionModule
|
MatExpansionModule,
|
||||||
|
MatChipsModule
|
||||||
} 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';
|
||||||
@ -31,6 +32,10 @@ import { EntityEditRegionComponent } from './entity-edit/entity-edit-region/enti
|
|||||||
import { EntityEditTatComponent } from './entity-edit/entity-edit-tat/entity-edit-tat.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 { 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';
|
import { EntityEditBillingInfoComponent } from './entity-edit/entity-edit-billing-info/entity-edit-billing-info.component';
|
||||||
|
|
||||||
|
import { DialogAddEditBillingInfo } from './entity-edit/entity-edit-billing-info/entity-edit-billing-info.component';
|
||||||
|
import { EntityEditVendorCityInfoComponent } from './entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom angular notifier options
|
* Custom angular notifier options
|
||||||
*/
|
*/
|
||||||
@ -89,6 +94,7 @@ const customNotifierOptions: NotifierOptions = {
|
|||||||
MatToolbarModule,MatSelectModule,MatListModule, MatMenuModule,
|
MatToolbarModule,MatSelectModule,MatListModule, MatMenuModule,
|
||||||
MatCheckboxModule,
|
MatCheckboxModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
|
MatChipsModule,
|
||||||
MatExpansionModule,
|
MatExpansionModule,
|
||||||
MatSlideToggleModule,
|
MatSlideToggleModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
@ -102,10 +108,14 @@ const customNotifierOptions: NotifierOptions = {
|
|||||||
EntityEditRegionComponent,
|
EntityEditRegionComponent,
|
||||||
EntityEditTatComponent,
|
EntityEditTatComponent,
|
||||||
EntityEditPriceComponent,
|
EntityEditPriceComponent,
|
||||||
EntityEditBillingInfoComponent
|
EntityEditBillingInfoComponent,
|
||||||
|
DialogAddEditBillingInfo,
|
||||||
|
EntityEditVendorCityInfoComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
// EntityEditComponent
|
// EntityEditComponent
|
||||||
|
DialogAddEditBillingInfo,
|
||||||
|
EntityAddComponent
|
||||||
],
|
],
|
||||||
providers : [
|
providers : [
|
||||||
EntityService
|
EntityService
|
||||||
|
|||||||
@ -73,7 +73,7 @@ export class EntityService {
|
|||||||
updateEntityMasterDetails(Records: any): Observable<any> {
|
updateEntityMasterDetails(Records: any): Observable<any> {
|
||||||
Records.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
Records.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
Records.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
Records.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
||||||
return this._http.post<any>(this.apiUrl + "saveExistEntity", { 'records': Records})
|
return this._http.post<any>(this.apiUrl + "saveNewEntity", { 'records': Records})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(this.handleError('role', []))
|
catchError(this.handleError('role', []))
|
||||||
)
|
)
|
||||||
@ -88,6 +88,84 @@ export class EntityService {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =========================================== Entity New Details
|
||||||
|
|
||||||
|
getEntityIdNameDetails(entity_id: any): Observable<any>{
|
||||||
|
// Add safe, URL encoded search parameter if there is a search term
|
||||||
|
const options = entity_id ?
|
||||||
|
{ params: new HttpParams().set('eid', entity_id) } : {};
|
||||||
|
|
||||||
|
return this._http.get<any[]>(this.apiUrl + "getEntityMasterInfo", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateEntityIdNameDetails(Records: any): Observable<any>{
|
||||||
|
|
||||||
|
let records = Records.map(item=>{
|
||||||
|
item.updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
|
item.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
return this._http.post<any[]>(this.apiUrl + "saveTemplateLenderDetails", {'records': records });
|
||||||
|
}
|
||||||
|
|
||||||
|
getEntityIdBillingInfoDetails(entity_id: any): Observable<any>{
|
||||||
|
// Add safe, URL encoded search parameter if there is a search term
|
||||||
|
const options = entity_id ?
|
||||||
|
{ params: new HttpParams().set('eid', entity_id) } : {};
|
||||||
|
|
||||||
|
return this._http.get<any[]>(this.apiUrl + "getEntityBillingInfo", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateEntityIdBillingInfoDetails(Records: any): Observable<any>{
|
||||||
|
|
||||||
|
Records.updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
|
Records.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
||||||
|
|
||||||
|
return this._http.post<any[]>(this.apiUrl + "saveEntityBillingInfo", {'records': Records });
|
||||||
|
}
|
||||||
|
|
||||||
|
getEntityIdRegionInfoDetails(entity_id: any): Observable<any>{
|
||||||
|
// Add safe, URL encoded search parameter if there is a search term
|
||||||
|
const options = entity_id ?
|
||||||
|
{ params: new HttpParams().set('entityid', entity_id) } : {};
|
||||||
|
|
||||||
|
return this._http.get<any[]>(this.apiUrl + "getEntityRegionCityMap", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateEntityIdRegionInfoDetails(Records: any): Observable<any>{
|
||||||
|
let records = Records.map(item=>{
|
||||||
|
item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
|
item.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
||||||
|
item.createdon = item.createdon == null ? currentdate : item.createdon;
|
||||||
|
item.fk_createdby = item.fk_createdby == null ? this._aws.getlocale() : item.fk_createdby;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
return this._http.post<any[]>(this.apiUrl + "saveEntityRegionMapping", {'records': records });
|
||||||
|
}
|
||||||
|
|
||||||
|
getCityHierarchyMaster() : Observable<any>{
|
||||||
|
return this._http.get<any[]>(this.apiUrl + "getCityHierarchy");
|
||||||
|
}
|
||||||
|
|
||||||
|
getEntityIdCityInfoDetails(entity_id: any): Observable<any>{
|
||||||
|
// Add safe, URL encoded search parameter if there is a search term
|
||||||
|
const options = entity_id ?
|
||||||
|
{ params: new HttpParams().set('entityid', entity_id) } : {};
|
||||||
|
|
||||||
|
return this._http.get<any[]>(this.apiUrl + "getVendorCityMap", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateEntityIdCityInfoDetails(Records: any): Observable<any>{
|
||||||
|
|
||||||
|
Records.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
|
Records.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
||||||
|
|
||||||
|
return this._http.post<any[]>(this.apiUrl + "saveVendorCityMapping", {'records': Records });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TO Handle The Error
|
* TO Handle The Error
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user