diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index f1dd890d8..25d14d8da 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -210,8 +210,9 @@ export class AddPdComponent implements OnInit, OnDestroy { data => { if (data.status == 200) { this.titleList=data.records.filter(val=>val.isactive==1); - let index1 = this.titleList.map(data => data.name).indexOf("Master"); - this.titleList.splice(index1, 1); + // console.log(this.titleList); + // let index1 = this.titleList.map(data => data.name).indexOf("Master"); + // this.titleList.splice(index1, 1); } }, error => this.errorMessage = error); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.html new file mode 100644 index 000000000..d24d79dd8 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.html @@ -0,0 +1,55 @@ +
+ +

+
+ {{pageTitle}} +
+
+ +
+

+ + + +
+
+ + + {{expense.expense_item}} + + + +
+
+ + + + + + {{frq.name}} + + + + + +
+ +
+
+
+ +
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.scss new file mode 100644 index 000000000..3f33ba147 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.scss @@ -0,0 +1,21 @@ +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + } + mat-form-field { + margin: 0 2%; + } + .example-section { + height: 120px; + } + + .example-margin { + margin: 0 10px; + } + ::ng-deep .cdk-global-overlay-wrapper{ + justify-content: center !important; +} + +.item-margin { + margin-left: 2%; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.spec.ts new file mode 100644 index 000000000..d55a1db2c --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageBusinesExpenseComponent } from './manage-busines-expense.component'; + +describe('ManageBusinesExpenseComponent', () => { + let component: ManageBusinesExpenseComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ManageBusinesExpenseComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageBusinesExpenseComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.ts new file mode 100644 index 000000000..85e9d8501 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.ts @@ -0,0 +1,125 @@ +import { Component, OnInit, Input, Output, Inject } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; +import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-manage-busines-expense', + templateUrl: './manage-busines-expense.component.html', + styleUrls: ['./manage-busines-expense.component.scss'] +}) +export class ManageBusinesExpenseComponent implements OnInit { + + pageTitle:string; + businessItemForm:FormGroup; + frequencyData: any[]=[]; + businessExpenseData: any[]=[]; + private notifier: NotifierService; + constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { + this.frequencyData=this.data.masterData.frequencyList; + this.businessExpenseData = this.data.masterData.businessExpenseList; + this.pageTitle = this.data.manage_status==1 ? 'Add Business Expense Item' : 'Update Business Expense Item'; + this.notifier = notifier; + } + + ngOnInit() { + if(this.data.manage_status==2){ + this.businessItemForm = this._fb.group({ + busExpense: this._fb.array([this.createBusinessItemWithData(this.data.editData)]), + }); + } + else{ + this.businessItemForm = this._fb.group({ + busExpense: this._fb.array([this.createBusinessItem()]), + }); + + } + + } + + // add business item details + createBusinessItem():FormGroup { + return this._fb.group({ + pd_expense_id:[''], + fk_pd_id:[this.data.masterData.pdid], + expense_item_id:['',Validators.compose([Validators.required])], + expense_value:['',Validators.compose([Validators.required])], + fk_frequency_id:['',Validators.compose([Validators.required])], + annual_expenses_value:['',Validators.compose([Validators.required])], + }); +} + +// create form with data +createBusinessItemWithData(values: any) { + return this._fb.group({ + pd_expense_id:[values.pd_expense_id], + fk_pd_id:[this.data.masterData.pdid], + expense_item_id:[values.expense_item_id,Validators.compose([Validators.required])], + expense_value:[values.expense_value,Validators.compose([Validators.required])], + fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])], + annual_expenses_value:[values.annual_expenses_value,Validators.compose([Validators.required])], + }); +} + +// add more item +addMore(): void{ + let control = this.businessItemForm.controls['busExpense']; + control.push(this.createBusinessItem()); +} + +// close dialogue manually +closeDialogue(){ + this.dialogRef.close({update_status:false}); +} + +businessCalculation(indexVal: number,values: any): void { + let control:any = this.businessItemForm.controls['busExpense']; + if(values.expense_value!='' && values.fk_frequency_id!='') { + let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); + control.controls[indexVal].controls['annual_expenses_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor)); + + } + else { + control.controls[indexVal].controls['annual_expenses_value'].setValue(''); + } +} + +removeItem(indexVal: number) : void { + let control = this.businessItemForm.controls['busExpense']; + control.removeAt(indexVal); + +} + +// save purchase details +submitDetails(records) { + if (this.businessItemForm.invalid) { + this.validateAllFormFields(this.businessItemForm); + this.notifier.notify('warning',"Please Check All Manatory Fields.."); + return; + } + this._pd.saveAssessedDetails('saveAssessedIncomeBusinessExpenses',records.busExpense).subscribe(data => { + this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.'); + setTimeout(() =>{ + this.dialogRef.close({update_status:true}); + },3000); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); +} + + // validate all form group and form array fields + validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html new file mode 100644 index 000000000..e75308643 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html @@ -0,0 +1,72 @@ + + +

+
+ {{pageTitle}} +
+
+ +
+

+ + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + +
+
+
+
+ + + + +
+ +
+ + + +
+ +
+ + + + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.scss new file mode 100644 index 000000000..3f33ba147 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.scss @@ -0,0 +1,21 @@ +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + } + mat-form-field { + margin: 0 2%; + } + .example-section { + height: 120px; + } + + .example-margin { + margin: 0 10px; + } + ::ng-deep .cdk-global-overlay-wrapper{ + justify-content: center !important; +} + +.item-margin { + margin-left: 2%; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.spec.ts new file mode 100644 index 000000000..cc694278a --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageDailySalesComponent } from './manage-daily-sales.component'; + +describe('ManageDailySalesComponent', () => { + let component: ManageDailySalesComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ManageDailySalesComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageDailySalesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.ts new file mode 100644 index 000000000..f0a702803 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.ts @@ -0,0 +1,213 @@ +import { Component, OnInit, Input, Output, Inject } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; +import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service'; +import { NotifierService } from 'angular-notifier'; +import { DatePipe } from '@angular/common'; +import { DeleteRecordsCountPipe } from './../../../../../../../pd-pipes/delete-records-count.pipe'; + +@Component({ + selector: 'app-manage-daily-sales', + templateUrl: './manage-daily-sales.component.html', + styleUrls: ['./manage-daily-sales.component.scss'], + providers: [DeleteRecordsCountPipe], +}) +export class ManageDailySalesComponent implements OnInit { + pipe = new DatePipe('en-US'); + pageTitle:string; + salesItemForm:FormGroup; + UOMData: any[]=[]; + frequencyData: any[]=[]; + private notifier: NotifierService; + constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { + this.pageTitle = this.data.manage_status==1 ? 'Add Daily Sales Item' : 'Update Daily Sales Item'; + this.notifier = notifier; + } + + ngOnInit() { + if(this.data.manage_status==1){ + this.salesItemForm = this._fb.group({ + sales_product: this._fb.array([this.createSalesItem()]), + }); + let control: any = this.salesItemForm.controls['sales_product']; + control = control.controls[0].get('child') as FormArray; + control.push(this.createDailySalesData('')) + } + else if(this.data.manage_status==2){ + this.salesItemForm = this._fb.group({ + sales_product: this._fb.array([this.createSalesItemWithData(this.data.editData)]), + }); + let control: any = this.salesItemForm.controls['sales_product']; + control = control.controls[0].get('child') as FormArray; + this.data.editData.values.forEach(elementVal => { + control.push(this.createDailySalesWithData(elementVal,this.data.editData.sim_id)) + }); + } + else{ + this.salesItemForm = this._fb.group({ + sales_product: this._fb.array([]), + }); + + } + + } + + // add sales item details + createSalesItem():FormGroup { + return this._fb.group({ + fk_pd_id: [this.data.masterData.pdid], + sim_id: [''], + sales_item: ['', Validators.compose([Validators.required])], + child: this._fb.array([]), + margin_per: [''], + margin_value: [''], + isactive:[true] + }); +} +// create daily list empty +createDailySalesData(sim_id: string) { + return this._fb.group({ + simc_id: [''], + fk_sim_id: [sim_id], + sales_date: [''], + sales_value: ['', Validators.compose([Validators.required])], + isactive:[true] + }) +} + +// create form with data +createSalesItemWithData(values: any) { + return this._fb.group({ + fk_pd_id: [this.data.masterData.pdid], + sim_id: [values.sim_id], + sales_item: [values.salesItem, Validators.compose([Validators.required])], + child: this._fb.array([]), + margin_per: [this.data.margin_calculation_status===true ? values.margin_per: ''], + margin_value: [this.data.margin_calculation_status===true ? values.margin_value: ''], + isactive:[true] + }); +} +// create daily list +createDailySalesWithData(values: any, sim_id: string) { + return this._fb.group({ + simc_id: [values.simc_id], + fk_sim_id: [sim_id], + sales_date: [new Date(this.pipe.transform(values.sales_date, 'yyyy-MM-dd')), Validators.compose([Validators.required])], + sales_value: [values.sales_value, Validators.compose([Validators.required])], + isactive:[true] + }) +} + +// add more item +addMore(parentIndex: number): void{ + let control = this.salesItemForm.controls['sales_product']; + control.push(this.createSalesItem()); + control = control.controls[parentIndex].get('child') as FormArray; + control.push(this.createDailySalesData('')) +} + +// add more daily items +addMoreDailySales(parentIndex: number,values: any): void{ + let control: any = this.salesItemForm.controls['sales_product']; + control=control.controls[parentIndex].get('child') as FormArray; + control.push(this.createDailySalesData(values.sim_id)); +} + +// remove daily items +removeDailyItems(parentIndex: number,childIndex:number, childValue:any): void { + let control: any = this.salesItemForm.controls['sales_product']; + control=control.controls[parentIndex].get('child') as FormArray; + if(childValue.simc_id=='' || childValue.simc_id==null){ + control.removeAt(childIndex); + let calculatControlValues: any = this.salesItemForm.controls['sales_product']; + calculatControlValues = calculatControlValues.controls[parentIndex]; + this.salesCalculation(parentIndex,calculatControlValues.value); + } + else { + control.controls[childIndex].controls.isactive.setValue(false); + let calculatControlValues: any = this.salesItemForm.controls['sales_product']; + calculatControlValues = calculatControlValues.controls[parentIndex]; + this.salesCalculation(parentIndex,calculatControlValues.value); + } + +} + +removeProducts(parentIndex:number){ + let control: any = this.salesItemForm.controls['sales_product']; + control.removeAt(parentIndex); +} + +// close dialogue manually +closeDialogue(){ + this.dialogRef.close({update_status:false}); +} + +salesCalculation(indexVal: number,values: any): void { + if(this.data.margin_calculation_status===true){ + let control:any = this.salesItemForm.controls['sales_product']; + if(values.child.length>0 && values.margin_per!=''){ + let transformData = values.child.filter(val=>val.sales_date!='' && val.sales_date!=null && val.sales_date!=undefined && val.sales_value!='' && val.isactive===true).map(mval=>{ + mval.custum_date = this.pipe.transform(mval.sales_date, 'yyyy-MM'); + return mval; + }); + if(transformData.length>0) { + let getUniqueMonthCounts = transformData.map(val=>val.custum_date) + .filter((fVal,fIndex,fArray)=>{ + return fIndex === fArray.indexOf(fVal); + }); + let getTotalValueCounts = transformData.map(val=>val.sales_value) + .reduce((sum, curr) => parseInt(sum) + parseInt(curr)); + control.controls[indexVal].controls['margin_value'].setValue(parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length))); + } + else{ + control.controls[indexVal].controls['margin_value'].setValue(''); + } + + } + else { + control.controls[indexVal].controls['margin_value'].setValue(''); + + } + } + +} +// save sales details +submitDetails(records) { + if (this.salesItemForm.invalid) { + this.validateAllFormFields(this.salesItemForm); + this.notifier.notify('warning',"Please Check All Manatory Fields.."); + return; + } + // this is for remove custom date key from my array values + records.sales_product.forEach(parVal => { + parVal.child.forEach(childVal => { + if(childVal['custum_date']){ + delete childVal['custum_date'] ; + } + }); + }); + this._pd.saveAssessedDetails('saveAssessedIncomeMonthwiseItems',records.sales_product).subscribe(data => { + this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.'); + setTimeout(() =>{ + this.dialogRef.close({update_status:true}); + },3000); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); +} + + // validate all form group and form array fields + validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.html new file mode 100644 index 000000000..a0221e46f --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.html @@ -0,0 +1,53 @@ + + +

+
+ {{pageTitle}} +
+
+ +
+

+ + + +
+
+ + + + +
+
+ + + + + + {{frq.name}} + + + + + +
+ +
+
+
+ +
+
+
+
+ +
+ + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.scss new file mode 100644 index 000000000..3f33ba147 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.scss @@ -0,0 +1,21 @@ +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + } + mat-form-field { + margin: 0 2%; + } + .example-section { + height: 120px; + } + + .example-margin { + margin: 0 10px; + } + ::ng-deep .cdk-global-overlay-wrapper{ + justify-content: center !important; +} + +.item-margin { + margin-left: 2%; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.spec.ts new file mode 100644 index 000000000..293bd8847 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageHouseHoldComponent } from './manage-house-hold.component'; + +describe('ManageHouseHoldComponent', () => { + let component: ManageHouseHoldComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ManageHouseHoldComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageHouseHoldComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.ts new file mode 100644 index 000000000..09ca82366 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component.ts @@ -0,0 +1,122 @@ +import { Component, OnInit, Input, Output, Inject } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; +import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-manage-house-hold', + templateUrl: './manage-house-hold.component.html', + styleUrls: ['./manage-house-hold.component.scss'] +}) +export class ManageHouseHoldComponent implements OnInit { + pageTitle:string; + houseItemForm:FormGroup; + frequencyData: any[]=[]; + private notifier: NotifierService; + constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { + this.frequencyData=this.data.masterData.frequencyList; + this.pageTitle = this.data.manage_status==1 ? 'Add House Hold Item' : 'Update House Hold Item'; + this.notifier = notifier; + } + + ngOnInit() { + if(this.data.manage_status==2){ + this.houseItemForm = this._fb.group({ + houseExpense: this._fb.array([this.createHouseholdItemWithData(this.data.editData)]), + }); + } + else{ + this.houseItemForm = this._fb.group({ + houseExpense: this._fb.array([this.createHouseholdItem()]), + }); + + } + + } + + // add Household item details + createHouseholdItem():FormGroup { + return this._fb.group({ + household_expense_id:[''], + fk_pd_id:[this.data.masterData.pdid] , + expense_item: ['',Validators.compose([Validators.required])], + expense_value: ['',Validators.compose([Validators.required])], + fk_frequency_id: ['',Validators.compose([Validators.required])], + annual_expense_value: ['',Validators.compose([Validators.required])], + }); +} + +// create form with data +createHouseholdItemWithData(values: any) { + return this._fb.group({ + household_expense_id:[values.household_expense_id], + fk_pd_id:[this.data.masterData.pdid] , + expense_item: [values.expense_item,Validators.compose([Validators.required])], + expense_value: [values.expense_value,Validators.compose([Validators.required])], + fk_frequency_id: [values.fk_frequency_id,Validators.compose([Validators.required])], + annual_expense_value: [values.annual_expense_value,Validators.compose([Validators.required])], + }); +} + +// add more item +addMore(): void{ + let control = this.houseItemForm.controls['houseExpense']; + control.push(this.createHouseholdItem()); +} + +// close dialogue manually +closeDialogue(){ + this.dialogRef.close({update_status:false}); +} + +houseCalculation(indexVal: number,values: any): void { + let control:any = this.houseItemForm.controls['houseExpense']; + if(values.expense_value!='' && values.fk_frequency_id!='') { + let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); + control.controls[indexVal].controls['annual_expense_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor)); + + } + else { + control.controls[indexVal].controls['annual_expense_value'].setValue(''); + } +} + +removeItem(indexVal: number) : void { + let control = this.houseItemForm.controls['houseExpense']; + control.removeAt(indexVal); + +} + +// save house hold details +submitDetails(records) { + if (this.houseItemForm.invalid) { + this.validateAllFormFields(this.houseItemForm); + this.notifier.notify('warning',"Please Check All Manatory Fields.."); + return; + } + this._pd.saveAssessedDetails('saveAssessedIncomeHouseholdExpenses',records.houseExpense).subscribe(data => { + this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.'); + setTimeout(() =>{ + this.dialogRef.close({update_status:true}); + },3000); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); +} + + // validate all form group and form array fields + validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.html new file mode 100644 index 000000000..6f5c5e89b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.html @@ -0,0 +1,55 @@ + + +

+
+ {{pageTitle}} +
+
+ +
+

+ + + +
+
+ + + {{income.business_income_item}} + + + +
+
+ + + + + + {{frq.name}} + + + + + +
+ +
+
+
+ +
+
+
+
+ +
+ + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.scss new file mode 100644 index 000000000..3f33ba147 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.scss @@ -0,0 +1,21 @@ +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + } + mat-form-field { + margin: 0 2%; + } + .example-section { + height: 120px; + } + + .example-margin { + margin: 0 10px; + } + ::ng-deep .cdk-global-overlay-wrapper{ + justify-content: center !important; +} + +.item-margin { + margin-left: 2%; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.spec.ts new file mode 100644 index 000000000..d8a661b5d --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageOtherBusinessIncomeComponent } from './manage-other-business-income.component'; + +describe('ManageOtherBusinessIncomeComponent', () => { + let component: ManageOtherBusinessIncomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ManageOtherBusinessIncomeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageOtherBusinessIncomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.ts new file mode 100644 index 000000000..d3eb35298 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component.ts @@ -0,0 +1,125 @@ +import { Component, OnInit, Input, Output, Inject } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; +import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-manage-other-business-income', + templateUrl: './manage-other-business-income.component.html', + styleUrls: ['./manage-other-business-income.component.scss'] +}) +export class ManageOtherBusinessIncomeComponent implements OnInit { + + pageTitle:string; + businessIncomeItemForm:FormGroup; + frequencyData: any[]=[]; + businessIncomeData: any[]=[]; + private notifier: NotifierService; + constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { + this.frequencyData=this.data.masterData.frequencyList; + this.businessIncomeData = this.data.masterData.businessIncomeList; + this.pageTitle = this.data.manage_status==1 ? 'Add Business Income Item' : 'Update Business Income Item'; + this.notifier = notifier; + } + + ngOnInit() { + if(this.data.manage_status==2){ + this.businessIncomeItemForm = this._fb.group({ + busIncome: this._fb.array([this.createBusinessIncomeItemWithData(this.data.editData)]), + }); + } + else{ + this.businessIncomeItemForm = this._fb.group({ + busIncome: this._fb.array([this.createBusinessIncomeItem()]), + }); + + } + + } + + // add business Income item details + createBusinessIncomeItem():FormGroup { + return this._fb.group({ + pd_business_income_id:[''], + fk_pd_id:[this.data.masterData.pdid], + business_income_id:['',Validators.compose([Validators.required])], + income_value:['',Validators.compose([Validators.required])], + fk_frequency_id:['',Validators.compose([Validators.required])], + annual_income_value:['',Validators.compose([Validators.required])], + }); +} + +// create form with data +createBusinessIncomeItemWithData(values: any) { + return this._fb.group({ + pd_business_income_id:[values.pd_business_income_id], + fk_pd_id:[this.data.masterData.pdid], + business_income_id:[values.business_income_id,Validators.compose([Validators.required])], + income_value:[values.income_value,Validators.compose([Validators.required])], + fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])], + annual_income_value:[values.annual_income_value,Validators.compose([Validators.required])], + }); +} + +// add more item +addMore(): void{ + let control = this.businessIncomeItemForm.controls['busIncome']; + control.push(this.createBusinessIncomeItem()); +} + +// close dialogue manually +closeDialogue(){ + this.dialogRef.close({update_status:false}); +} + +businessCalculation(indexVal: number,values: any): void { + let control:any = this.businessIncomeItemForm.controls['busIncome']; + if(values.income_value!='' && values.fk_frequency_id!='') { + let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); + control.controls[indexVal].controls['annual_income_value'].setValue(parseInt(values.income_value) * parseInt(filterFrequencyValue[0].mutiple_factor)); + + } + else { + control.controls[indexVal].controls['annual_income_value'].setValue(''); + } +} + +removeItem(indexVal: number) : void { + let control = this.businessIncomeItemForm.controls['busIncome']; + control.removeAt(indexVal); + +} + +// save purchase details +submitDetails(records) { + if (this.businessIncomeItemForm.invalid) { + this.validateAllFormFields(this.businessIncomeItemForm); + this.notifier.notify('warning',"Please Check All Manatory Fields.."); + return; + } + this._pd.saveAssessedDetails('saveOtherBusinessIncome',records.busIncome).subscribe(data => { + this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.'); + setTimeout(() =>{ + this.dialogRef.close({update_status:true}); + },3000); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); +} + + // validate all form group and form array fields + validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.html new file mode 100644 index 000000000..672c66b24 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.html @@ -0,0 +1,68 @@ + + +

+
+ {{pageTitle}} +
+
+ +
+

+ + + +
+
+ + + + +
+
+ + + + + + {{uom.name}} + + + + + +
+ +
+ + + {{frq.name}} + + + + + +
+ +
+
+
+ +
+
+
+
+ +
+ + + + + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.scss new file mode 100644 index 000000000..3f33ba147 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.scss @@ -0,0 +1,21 @@ +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + } + mat-form-field { + margin: 0 2%; + } + .example-section { + height: 120px; + } + + .example-margin { + margin: 0 10px; + } + ::ng-deep .cdk-global-overlay-wrapper{ + justify-content: center !important; +} + +.item-margin { + margin-left: 2%; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.spec.ts new file mode 100644 index 000000000..2b4112bda --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManagePurchaseComponent } from './manage-purchase.component'; + +describe('ManagePurchaseComponent', () => { + let component: ManagePurchaseComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ManagePurchaseComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ManagePurchaseComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.ts new file mode 100644 index 000000000..2ba3bfe63 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.ts @@ -0,0 +1,129 @@ +import { Component, OnInit, Input, Output, Inject } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; +import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-manage-purchase', + templateUrl: './manage-purchase.component.html', + styleUrls: ['./manage-purchase.component.scss'] +}) +export class ManagePurchaseComponent implements OnInit { + + pageTitle:string; + purchaseItemForm:FormGroup; + UOMData: any[]=[]; + frequencyData: any[]=[]; + private notifier: NotifierService; + constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { + this.UOMData=this.data.masterData.UOMList; + this.frequencyData=this.data.masterData.frequencyList; + this.pageTitle = this.data.manage_status==1 ? 'Add Purchase Item' : 'Update Purchase Item'; + this.notifier = notifier; + } + + ngOnInit() { + if(this.data.manage_status==2){ + this.purchaseItemForm = this._fb.group({ + purchase: this._fb.array([this.createPurchaseItemWithData(this.data.editData)]), + }); + } + else{ + this.purchaseItemForm = this._fb.group({ + purchase: this._fb.array([this.createPurchaseItem()]), + }); + + } + + } + + // add purchase item details + createPurchaseItem():FormGroup { + return this._fb.group({ + purchase_id:[''], + fk_pd_id:[this.data.masterData.pdid], + purchase_item:['',Validators.compose([Validators.required])], + purchase_qty:['',Validators.compose([Validators.required])], + fk_uom_id:['',Validators.compose([Validators.required])], + rate_per_unit:['',Validators.compose([Validators.required])], + fk_frequency_id:['',Validators.compose([Validators.required])], + annual_purchase_value:['',Validators.compose([Validators.required])], + }); +} + +// create form with data +createPurchaseItemWithData(values: any) { + return this._fb.group({ + purchase_id:[values.purchase_id], + fk_pd_id:[this.data.masterData.pdid], + purchase_item:[values.purchase_item,Validators.compose([Validators.required])], + purchase_qty:[values.purchase_qty,Validators.compose([Validators.required])], + fk_uom_id:[values.fk_uom_id,Validators.compose([Validators.required])], + rate_per_unit:[values.rate_per_unit,Validators.compose([Validators.required])], + fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])], + annual_purchase_value:[values.annual_purchase_value,Validators.compose([Validators.required])], + }); +} + +// add more item +addMore(): void{ + let control = this.purchaseItemForm.controls['purchase']; + control.push(this.createPurchaseItem()); +} + +// close dialogue manually +closeDialogue(){ + this.dialogRef.close({update_status:false}); +} + +purchaseCalculation(indexVal: number,values: any): void { + let control:any = this.purchaseItemForm.controls['purchase']; + if(values.purchase_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') { + let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); + control.controls[indexVal].controls['annual_purchase_value'].setValue(parseInt(values.purchase_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)); + + } + else { + control.controls[indexVal].controls['annual_purchase_value'].setValue(''); + } +} + +removeItem(indexVal: number) : void { + let control = this.purchaseItemForm.controls['purchase']; + control.removeAt(indexVal); + +} + +// save purchase details +submitDetails(records) { + if (this.purchaseItemForm.invalid) { + this.validateAllFormFields(this.purchaseItemForm); + this.notifier.notify('warning',"Please Check All Manatory Fields.."); + return; + } + this._pd.saveAssessedDetails('saveAssessedIncomePurchaseDetails',records.purchase).subscribe(data => { + this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.'); + setTimeout(() =>{ + this.dialogRef.close({update_status:true}); + },3000); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); +} + + // validate all form group and form array fields + validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html new file mode 100644 index 000000000..8511f63d1 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html @@ -0,0 +1,78 @@ + + +

+
+ {{pageTitle}} +
+
+ +
+

+ + + +
+
+ + + + +
+
+ + + + + + {{uom.name}} + + + + + +
+ +
+ + + {{frq.name}} + + + + + +
+
+ + + + + + + + + +
+ +
+
+
+ +
+
+
+
+ +
+ + + + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.scss new file mode 100644 index 000000000..5e737ca3c --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.scss @@ -0,0 +1,22 @@ +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + } + mat-form-field { + margin: 0 2%; + } + .example-section { + height: 120px; + } + + .example-margin { + margin: 0 10px; + } + ::ng-deep .cdk-global-overlay-wrapper{ + justify-content: center !important; +} + +.item-margin { + margin-left: 2%; +} + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.spec.ts new file mode 100644 index 000000000..05b03c31b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageSalesComponent } from './manage-sales.component'; + +describe('ManageSalesComponent', () => { + let component: ManageSalesComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ManageSalesComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageSalesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.ts new file mode 100644 index 000000000..384ee80a2 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.ts @@ -0,0 +1,157 @@ +import { Component, OnInit, Input, Output, Inject } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; +import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-manage-sales', + templateUrl: './manage-sales.component.html', + styleUrls: ['./manage-sales.component.scss'] +}) +export class ManageSalesComponent implements OnInit { + pageTitle:string; + salesItemForm:FormGroup; + UOMData: any[]=[]; + frequencyData: any[]=[]; + private notifier: NotifierService; + constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { + this.UOMData=this.data.masterData.UOMList; + this.frequencyData=this.data.masterData.frequencyList; + this.pageTitle = this.data.manage_status==1 ? 'Add Sales Item' : 'Update Sales Item'; + this.notifier = notifier; + } + + ngOnInit() { + if(this.data.manage_status==2){ + this.salesItemForm = this._fb.group({ + salesCalItemwise: this._fb.array([this.createSalesItemWithData(this.data.editData)]), + }); + } + else{ + this.salesItemForm = this._fb.group({ + salesCalItemwise: this._fb.array([this.createSalesItem()]), + }); + + } + + } + + // add sales item details + createSalesItem():FormGroup { + return this._fb.group({ + sci_id:[], + fk_pd_id:[this.data.masterData.pdid], + sales_item:['',Validators.compose([Validators.required])], + sales_qty:['',Validators.compose([Validators.required])], + fk_uom_id:['',Validators.compose([Validators.required])], + rate_per_unit:['',Validators.compose([Validators.required])], + fk_frequency_id:['',Validators.compose([Validators.required])], + annual_sale_value:[''], + margin_per:[''], + margin_per_uom:[''], + margin_final_value:[''], + }); +} + +// create form with data +createSalesItemWithData(values: any) { + return this._fb.group({ + sci_id:[values.sci_id], + fk_pd_id:[this.data.masterData.pdid], + sales_item:[values.sales_item,Validators.compose([Validators.required])], + sales_qty:[values.sales_qty,Validators.compose([Validators.required])], + fk_uom_id:[values.fk_uom_id,Validators.compose([Validators.required])], + rate_per_unit:[values.rate_per_unit,Validators.compose([Validators.required])], + fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])], + annual_sale_value:[values.annual_sale_value], + margin_per:[this.data.margin_calculation_status===true ? values.margin_per : ''], + margin_per_uom:[this.data.margin_calculation_status===true ? values.margin_per_uom :''], + margin_final_value:[this.data.margin_calculation_status===true ? values.margin_final_value: ''], + }); +} + +// add more item +addMore(): void{ + let control = this.salesItemForm.controls['salesCalItemwise']; + control.push(this.createSalesItem()); +} + +// close dialogue manually +closeDialogue(){ + this.dialogRef.close({update_status:false}); +} + +salesCalculation(indexVal: number,values: any): void { + let control:any = this.salesItemForm.controls['salesCalItemwise']; + if(values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') { + let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); + control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)); + + } + else { + control.controls[indexVal].controls['annual_sale_value'].setValue(''); + } + if(this.data.margin_calculation_status===true) { + values.margin_per_uom=='' && values.margin_per!='' ? this.salesMarginPerCalculation(indexVal,this.salesItemForm.value.salesCalItemwise[indexVal]): values.margin_per_uom!='' && values.margin_per=='' ? this.salesMarginAmtCalculation(indexVal,this.salesItemForm.value.salesCalItemwise[indexVal]) : values.margin_per_uom!='' && values.margin_per!='' ? this.salesMarginAmtCalculation(indexVal,this.salesItemForm.value.salesCalItemwise[indexVal]) :this.salesMarginAmtCalculation(indexVal,this.salesItemForm.value.salesCalItemwise[indexVal]); + } +} +salesMarginPerCalculation(indexVal: number,values: any): void { + let control:any = this.salesItemForm.controls['salesCalItemwise']; + control.controls[indexVal].controls['margin_per_uom'].setValue(''); + if(values.margin_per!='' && values.annual_sale_value!='') { + control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100)); + } + else { + control.controls[indexVal].controls['margin_final_value'].setValue(''); + } +} +salesMarginAmtCalculation(indexVal: number,values: any): void { + let control:any = this.salesItemForm.controls['salesCalItemwise']; + control.controls[indexVal].controls['margin_per'].setValue(''); + if(values.margin_per_uom!='' && values.sales_qty!='') { + control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.sales_qty) * parseInt(values.margin_per_uom)); + } + else { + control.controls[indexVal].controls['margin_final_value'].setValue(''); + } +} + +removeItem(indexVal: number) : void { + let control = this.salesItemForm.controls['salesCalItemwise']; + control.removeAt(indexVal); + +} + +// save sales details +submitDetails(records) { + if (this.salesItemForm.invalid) { + this.validateAllFormFields(this.salesItemForm); + this.notifier.notify('warning',"Please Check All Manatory Fields.."); + return; + } + this._pd.saveAssessedDetails('saveAssessedIncomeSalesCalculatedByItemwise',records.salesCalItemwise).subscribe(data => { + this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.'); + setTimeout(() =>{ + this.dialogRef.close({update_status:true}); + },3000); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); +} + + // validate all form group and form array fields + validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.html index 206bbfe1e..8ec856cb6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.html @@ -1,6 +1,4 @@ - - -

+

{{pageTitle}}
@@ -11,371 +9,228 @@

- - - - - -
-
- + + + + + + - - - - - - - - - Sales Calculate Item Wise - - - {{salesCaluatedItem.length}}  Items - - - -
- - - - - - - - - - - - - - - - - + + + + +
+

a) Cost of Goods Sold

+
+
+

{{sales_value}}

+
+ +
+ +
+

b) Purchases

+
+
+

{{purchase_value}}

+
+ +
+ +
+

c) Gross Profit (a-b)

+
+
+

{{gross_profit_value}}

+
+ +
+ +
+

d) Other Income

+
+
+

{{other_income_value}}

+
+ +
+ +
+

e) Other Expenses

+
+
+

{{other_expense_value}}

+
+ +
+ +
+

f) Net Profit (c+d-e)

- -
- - - - - - - - - - -
Item{{salesItem.sales_item}} Qty/UOM{{salesItem.sales_qty }}/{{salesItem.uom_name }} Rate/Unit {{salesItem.rate_per_unit }} Frequency {{salesItem.frequency_name}} Annual Sale Value {{salesItem.annual_sale_value}}
-
-
-
- - - - Sales Calculate Month Wise - - - {{salesMonthWiseExpandedItems.length}}  Items - - - - - - - {{expandDetails.salesItem}} - -
- {{footer.month_message}}   {{footer.year_message}} -
- -
-
- - - -
- -

{{eachItem.header}}

- - - - - - - - - - - - - - - - -
Date{{itemValue.sales_date | date: 'dd-MM-yyyy'}} Total Amount{{itemValue.sales_value}} {{getTotalCost(eachItem.value)}}
-
- -
+
+
+

{{net_profit_value}}

+
+ + + +
+

g) Household Expenses

+ +
+
+

{{house_hold_value}}

+
+ +
+ +
+

h) Net Disposable Income (f-g)

+ + +
+
+

{{net_disable_income_value}}

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - Purchase Details - - - {{purchaseDetails.length}}  Items - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Item{{purchaseItem.purchase_item}} Qty/UOM{{purchaseItem.purchase_qty }}/{{purchaseItem.uom_name }} Rate/Unit {{purchaseItem.rate_per_unit }} Frequency {{purchaseItem.frequency_name}} Annual Purchase Value {{purchaseItem.annual_purchase_value}}
-
-
-
- - - - Business Expenses - - - {{businessExpenses.length}}  Items - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
Item {{businessEx.expense_item}} Value {{businessEx.expense_value }} Frequency {{businessEx.frequency_name}} Annual Expenses Value {{businessEx.annual_expenses_value}}
-
-
-
- - - - House Hold Expenses - - - {{houseHoldExpenses.length}}  Items - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
Item{{householdItem.expense_item}} Value{{householdItem.expense_value }}Frequency {{householdItem.frequency_name}} Annual Expenses Value {{householdItem.annual_expense_value}}
-
-
-
- - - - - -
- -
-
- - -
-
-
-
-
-
-
Image 1
-
-
-
-
-
-
-
Image 2
-
-
-
-
-
-
-
Image 3
-
-
-
-
-
-
-
Image 2
-
-
-
-
-
-
-
Image 3
-
-
-
-
-
-
-
Image 1
-
-
-
-
-
- - - - - + +
+
+ + + + @@ -388,7 +243,7 @@
--> +
- - + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss index 294dc4fa9..71e617ab3 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss @@ -3,35 +3,11 @@ overflow: auto; } -table { - width: 100%; -} - -tr.mat-footer-row { - font-weight: bold; -} - -.mat-table-sticky { - border-top: 1px solid #e0e0e0; -} ::ng-deep .cdk-global-overlay-wrapper{ justify-content: center !important; } - .mat-form-field { - width: 100%; - } - .expan_footer{ - font-size: 18px; - direction: rtl; - } - .expan_table_header { - font-size: 18px; - text-align: center; - } - .h4_font { - font-size: 18px; - } + .subtitle_message { color:#e00201 !important; } @@ -144,4 +120,21 @@ tr.mat-footer-row { border:1px solid rgba(0, 0, 0, 0.12); } + mat-list-item:nth-child(3) { + background-color: #f5f5f5; + } + mat-list-item:nth-child(6) { + background-color: #f5f5f5; + } + mat-list-item:nth-child(8) { + background-color: #f5f5f5; + } + .mat_list_right_div { + text-align: left; + } + .mat_list_center_div { + text-align: center; + } + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts index f8a6e5b87..bdb939669 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts @@ -1,5 +1,4 @@ import {Component,OnInit,Inject,Input, ViewChild } from '@angular/core'; -import {FormBuilder,FormGroup,Validators,FormArray, FormControl,} from '@angular/forms'; import { NotifierService } from 'angular-notifier'; import { MatDialog, @@ -16,42 +15,65 @@ import { ActivatedRoute, Router } from "@angular/router"; styleUrls: ['./assessed-income.component.scss'] }) export class AssessedIncomeComponent implements OnInit { - public _assessedIncomeFormFrom: FormGroup; private notifier: NotifierService; pageTitle: string ="Assessed Income Details"; // @Input() pdid: number; // @Input() form_id: number; pdid: number; form_id: number; - salesCaluatedItemColumns: string[] = ['Item', 'Qty/UOM','Rate/Unit','Frequency','Annual Sale Value']; + displayedColumns = ['sno','list','amount']; + sales_value: number; + purchase_value: number; + gross_profit_value: number; + other_income_value: number; + other_expense_value: number; + net_profit_value: number; + house_hold_value: number; + net_disable_income_value: number; public salesCaluatedItem:any= []; - salesItemMonthWiseColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value']; public salesItemMonthWise:any= []; - purchaseDetailsColumns: string[] = ['Item', 'Qty/UOM','Rate/Unit','Frequency','Annual Purchase Value']; public purchaseDetails:any= []; - businessExpensesColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value']; public businessExpenses:any= []; - houseHoldExpensesColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value']; public houseHoldExpenses:any= []; - - public salesMonthItemColumns = ['Date','Amount']; + public otherBusinessIncome: any=[]; // Sales Item MonthWise declare table header,body andd footer elements salesMonthWiseTable:any=[]; salesItemMonthWiseBody: any[]; salesItemMonthWiseFooter: any[]; - salesMonthWiseExpandedItems: any=[] - - constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, +public UOMList: any=[]; +public frequencyList: any=[]; +public businessExpenseList: any=[]; +public businessIncomeList: any=[]; +public grossProfitTypeList: any=[]; +public salesDeclaredCustomer: any=[]; +public getCustomValues:any = { UOMList: this.UOMList,frequencyList: this.frequencyList,businessExpenseList: this.businessExpenseList,businessIncomeList:this.businessIncomeList,pdid:'',grossProfitTypeList:this.grossProfitTypeList}; +//public finalData: any; + constructor(notifier: NotifierService, private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.notifier = notifier; this.form_id = 16; + this.loadAIDetails(); + this.getAIMaster('UOM',1); + this.getAIMaster('FREQUENCY',2); + this.getAIMaster('BUSINESSEXPENSES',3); + this.getAIMaster('BUSINESSINCOME',4); + this.getCustomValues.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.sales_value=0; + this.purchase_value=0; + this.gross_profit_value=0; + this.other_income_value=0; + this.other_expense_value=0; + this.net_profit_value=0; + this.house_hold_value=0; + this.net_disable_income_value=0; + } public viewerOptions: any = { navbar: false, @@ -73,19 +95,22 @@ public viewerOptions: any = { } }; ngOnInit() { - - this.initAssessedIncomeForm(); + + } + // load ai details + loadAIDetails(): void{ + this.salesMonthWiseExpandedItems=[] let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; this._pd.getAssessedIncomeFormDetails(params).subscribe(value => { if (value.status == 200) { - if(value.records.sales_declared_by_customer){ - this._assessedIncomeFormFrom.controls['sales_declared_by_customer'].setValue(value.records.sales_declared_by_customer[0].sales_declared_by_customer); + if(value.records.gross_profit_calculation_type){ + this.grossProfitTypeList = value.records.gross_profit_calculation_type; + this.getCustomValues.grossProfitTypeList=this.grossProfitTypeList; } - else{ - this._assessedIncomeFormFrom.controls['sales_declared_by_customer'].setValue(''); - + if(value.records.sales_declared_by_customer){ + this.salesDeclaredCustomer = value.records.sales_declared_by_customer; } if(value.records.sales_calculated_by_itemwise){ this.salesCaluatedItem = value.records.sales_calculated_by_itemwise; @@ -142,10 +167,8 @@ public viewerOptions: any = { // message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived', // value: calculateAllItemsTotal * convertYear, // }) - this.salesMonthWiseExpandedItems.push({salesItem:itemElement.sales_item, expandElements:expandBodyContent, footerMessage: footerMessage}); + this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage}); }); - - } if(value.records.purchase_details){ this.purchaseDetails = value.records.purchase_details; @@ -156,6 +179,22 @@ public viewerOptions: any = { if(value.records.house_hold_expenses){ this.houseHoldExpenses = value.records.house_hold_expenses; } + if(value.records.othre_business_income){ + this.otherBusinessIncome = value.records.othre_business_income; + } + + if(value.records.final_data.length >0){ + // this.finalData = value.records.final_data[0]; + + this.sales_value = value.records.final_data[0].income.sales_revenue !='' && value.records.final_data[0].income.sales_revenue !=null ? value.records.final_data[0].income.sales_revenue : 0; + this.purchase_value = value.records.final_data[0].expense.purchase !='' && value.records.final_data[0].expense.purchase !=null ? value.records.final_data[0].expense.purchase : 0; + this.gross_profit_value = value.records.final_data[0].gross_profit !='' && value.records.final_data[0].gross_profit !=null ? value.records.final_data[0].gross_profit : 0; + this.other_income_value = value.records.final_data[0].income.other_business_income !='' && value.records.final_data[0].income.other_business_income !=null ? value.records.final_data[0].income.other_business_income : 0; + this.other_expense_value = value.records.final_data[0].expense.business_expense !='' && value.records.final_data[0].expense.business_expense !=null ? value.records.final_data[0].expense.business_expense : 0; + this.net_profit_value = value.records.final_data[0].expense.net_profit !='' && value.records.final_data[0].expense.net_profit !=null ? value.records.final_data[0].expense.net_profit : 0; + this.house_hold_value = 0; + this.net_disable_income_value = this.net_profit_value-this.house_hold_value; + } } }) @@ -166,14 +205,29 @@ public viewerOptions: any = { return getItems.map(t => t.sales_value).reduce((acc, value) => acc + Number(value), 0); } + // get common drop down list + getAIMaster(table:string, type:Number):void { + this._pd.getAllMasterDatas(table).subscribe( + data => { + if (data.dataStatus == true) { + if(type==1){ + this.UOMList = data.records.filter(uom=>uom.isactive==1); + this.getCustomValues.UOMList= this.UOMList; + } + if(type==2){ + this.frequencyList = data.records.filter(frq=>frq.isactive==1); + this.getCustomValues.frequencyList= this.frequencyList; + } + if(type==3) { + this.businessExpenseList = data.records.filter(val=>val.isactive==1); + this.getCustomValues.businessExpenseList= this.businessExpenseList; + } + if(type==4){ + this.businessIncomeList=data.records.filter(val=>val.isactive==1); + this.getCustomValues.businessIncomeList= this.businessIncomeList; - // Dynamic Form field creation - - public initAssessedIncomeForm(): void { - this._assessedIncomeFormFrom = this.fb.group({ - sales_declared_by_customer: ['', Validators.compose([Validators.required])], - // lender_representative_details: this.fb.array([]), + } + } }); -} - + } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.html new file mode 100644 index 000000000..4aa869563 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.html @@ -0,0 +1,56 @@ + + +
+
+ Business Expense Items +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Buiness Expense {{element.expense_item}} Amount (Rs) {{element.expense_value}} Frequency {{element.frequency_name}} + Annual Expenses {{element.annual_expenses_value}} + + + +
+
+
+
+ + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.scss new file mode 100644 index 000000000..a464130a1 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.scss @@ -0,0 +1,30 @@ +.example-container { + max-height: 280px; + width: 100%; + overflow: auto; + margin-top: 2%; + } + + table { + width: 100%; + } + + td{ + padding-right: 2%; + padding-left: 2%; + white-space: nowrap; + } + + th { + padding-left: 2%; + padding-right: 2%; + white-space: nowrap; + } + + .mat-table-sticky:first-child { + border-right: 1px solid #e0e0e0; + } + + .mat-table-sticky:last-child { + border-left: 1px solid #e0e0e0; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.spec.ts new file mode 100644 index 000000000..3687bddfc --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BusinessExpenseDetailsComponent } from './business-expense-details.component'; + +describe('BusinessExpenseDetailsComponent', () => { + let component: BusinessExpenseDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ BusinessExpenseDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BusinessExpenseDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.ts new file mode 100644 index 000000000..6b54e794f --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component.ts @@ -0,0 +1,88 @@ +import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter } from '@angular/core'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material'; +import { ManageBusinesExpenseComponent } from './../AI-diologue/manage-busines-expense/manage-busines-expense.component'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-business-expense-details', + templateUrl: './business-expense-details.component.html', + styleUrls: ['./business-expense-details.component.scss'] +}) +export class BusinessExpenseDetailsComponent implements OnInit { + + displayedColumns = ['buiness_expense','expense_value','frequency','annual_expenses','action']; + public businessItemSource= new MatTableDataSource(); + @Input() parentData: any; + @Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number}; + @Output() loadAssessedForms = new EventEmitter(); + private notifier: NotifierService; + constructor(notifier: NotifierService,private _pd: PdTrigerService, private dialog: MatDialog) { + this.notifier= notifier; + } + + ngOnInit() { + } + + // add more item details + addMoreItem():void { + let passValues: any = { + manage_status:1, + masterData: this.masterData + } + const dialogRef = this.dialog.open(ManageBusinesExpenseComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); + +} +editExpenseItem(value:any) { + let passValues: any = { + manage_status:2, + masterData: this.masterData, + editData:value + } + const dialogRef = this.dialog.open(ManageBusinesExpenseComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); +} + +// remove expense item +removeExpenseItem(value: any) : void{ + + let deleteRecords: any =[{ + "fk_pd_id":this.masterData.pdid, + "pd_expense_id":value.pd_expense_id, + "isactive":false, + }]; + this._pd.saveAssessedDetails('saveAssessedIncomeBusinessExpenses',deleteRecords).subscribe(data => { + this.notifier.notify('success','Removed Successfully'); + this.loadAssessedForms.next('1'); +}, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); +}); +} + +// detect chnges from parent +ngOnChanges(changes: SimpleChanges) { + this.businessItemSource.data = changes.parentData.currentValue; +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html new file mode 100644 index 000000000..f0951717b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html @@ -0,0 +1,69 @@ + + + +
+
+ Sales Calculate Daily Wise +
+
+ +
+
+ + + + {{expandDetails.salesItem}} + (Margin Percentage % : {{expandDetails.margin_per}}   Margin Value : {{expandDetails.margin_value}}) + + + +
+ {{footer.month_message}}   {{footer.year_message}} +
+
+
+ + + + +
+ +

{{eachItem.header}}

+ + + + + + + + + + + + + + + +
Date{{itemValue.sales_date | date: 'dd-MM-yyyy'}} Total Amount{{itemValue.sales_value}} {{getTotalCost(eachItem.value)}}
+
+ +
+ + + + + +
+
+
+ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.scss new file mode 100644 index 000000000..588f58a6b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.scss @@ -0,0 +1,33 @@ +.example-container { + max-height: 500px; + overflow: auto; +} + +table { + width: 100%; +} + +tr.mat-footer-row { + font-weight: bold; +} + +.mat-table-sticky { + border-top: 1px solid #e0e0e0; +} + .expan_footer{ + font-size: 18px; + direction: rtl; +} +.expan_table_header { + font-size: 18px; + //text-align: center; +} +.h4_font { + font-size: 18px; +} +.subtitle_message { + color:#e00201 !important; +} +.delete-margin { + margin-left: 3%; + } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.spec.ts new file mode 100644 index 000000000..b8081b9f6 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DailySalesDetailsComponent } from './daily-sales-details.component'; + +describe('DailySalesDetailsComponent', () => { + let component: DailySalesDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DailySalesDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DailySalesDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.ts new file mode 100644 index 000000000..a3aa5c5ba --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.ts @@ -0,0 +1,121 @@ +import { Component, OnInit, Input, Output, Inject, DoCheck, EventEmitter } from '@angular/core'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material'; +import { ManageDailySalesComponent } from './../AI-diologue/manage-daily-sales/manage-daily-sales.component'; +import { NotifierService } from 'angular-notifier'; +import { AnyAaaaRecord } from 'dns'; + +@Component({ + selector: 'app-daily-sales-details', + templateUrl: './daily-sales-details.component.html', + styleUrls: ['./daily-sales-details.component.scss'] +}) +export class DailySalesDetailsComponent implements OnInit, DoCheck { + public salesMonthItemColumns = ['Date','Amount']; + public salesMonthWiseExpandedItems: any[]=[]; + @Input() parentData: any; + @Input() masterData: { UOMList: any; frequencyList: any; pdid:number, grossProfitTypeList:any}; + @Output() loadAssessedForms = new EventEmitter(); + activateMariginCalculation: boolean; + private notifier:NotifierService; + constructor(notifier:NotifierService, private _pd: PdTrigerService, private dialog: MatDialog) { + this.activateMariginCalculation=false; + this.notifier = notifier; + } + + ngOnInit() { + } + + // get total cost + getTotalCost(getItems:any) { + return getItems.map(t => t.sales_value).reduce((acc, value) => acc + Number(value), 0); + } + +// add more item details +addMoreItem():void { + let passValues: any = { + manage_status:1, + masterData: this.masterData, + margin_calculation_status:this.activateMariginCalculation, + } + const dialogRef = this.dialog.open(ManageDailySalesComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); + +} +editSalesItem(value:any) { + let transformData: any = value.expandElements.map(val=>val.value); + transformData = [].concat.apply([], transformData); + let editValue: any = { + "fk_pd_id":this.masterData.pdid, + "sim_id":value.sim_id, + "salesItem":value.salesItem, + "margin_value":value.margin_value, + "margin_per":value.margin_per, + "values":transformData + } + let passValues: any = { + manage_status:2, + masterData: this.masterData, + editData:editValue, + margin_calculation_status:this.activateMariginCalculation, + } + const dialogRef = this.dialog.open(ManageDailySalesComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); +} + +// remove sales item +removeSalesItem(value: any) : void{ + // let transformData: any = value.expandElements.map(val=>val.value); + // transformData = [].concat.apply([], transformData); + let deleteRecords: any =[{ + "sim_id":value.sim_id, + "isactive":false, + "child":[] + }]; + this._pd.saveAssessedDetails('saveAssessedIncomeMonthwiseItems',deleteRecords).subscribe(data => { + this.notifier.notify('success','Removed Successfully'); + this.loadAssessedForms.next('1'); +}, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); +}); +} + +// do check component bases +ngDoCheck() { + this.salesMonthWiseExpandedItems = this.parentData; + + if(this.masterData.grossProfitTypeList.length>0){ + this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin==2 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==2 ? true : false; + }} + + // detect chnges from parent +// ngOnChanges(changes: SimpleChanges) { +// this.salesMonthWiseExpandedItems = changes.parentData.currentValue; +// if(changes.masterData){ +// if(changes.masterData.currentValue.grossProfitTypeList.length>0){ +// this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==2 ? true : false; +// } +// } +// } + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.html new file mode 100644 index 000000000..42dd4466c --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.html @@ -0,0 +1,26 @@ +
+ + + + + + + + + {{getData.name}} + + + + + {{getSale.name}} + + + + + + + +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.scss new file mode 100644 index 000000000..b559b3c47 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.scss @@ -0,0 +1,3 @@ +mat-form-field { + margin: 0 2%; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.spec.ts new file mode 100644 index 000000000..d9b770dc8 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { GrossProfitCalculationComponent } from './gross-profit-calculation.component'; + +describe('GrossProfitCalculationComponent', () => { + let component: GrossProfitCalculationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ GrossProfitCalculationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(GrossProfitCalculationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts new file mode 100644 index 000000000..b9f81139f --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts @@ -0,0 +1,79 @@ +import { Component, OnInit, Input, Output, Inject,EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-gross-profit-calculation', + templateUrl: './gross-profit-calculation.component.html', + styleUrls: ['./gross-profit-calculation.component.scss'] +}) +export class GrossProfitCalculationComponent implements OnInit, OnChanges { + @Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number}; + @Input() parentData: any; + @Output() loadAssessedForms = new EventEmitter(); + public grossProfitForm: FormGroup; + check__purchse_type:any=[{'id':'1','name':'Yes'},{'id':'2','name':'No'}] + check_sales_type:any=[{'id':'1','name':'Gross Margin'},{'id':'2','name':'Net Margin'}] + private notifier: NotifierService; + constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) { + this.notifier = notifier; + } + + ngOnInit() { + + } + changeOptions(values: any){ + this.grossProfitForm.controls['margin'].setValue(''); + } + submitDetails(records: any){ + if (this.grossProfitForm.invalid) { + this.validateAllFormFields(this.grossProfitForm); + this.notifier.notify('warning',"Please Check All Manatory Fields.."); + return; + } + this._pd.saveAssessedDetails('saveAssessedIncomeCalculateMode',records).subscribe(data => { + this.notifier.notify('success','Saved Successfully.'); + this.loadAssessedForms.next('1'); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.loadAssessedForms.next('1'); + }); + } + + // detect chnges from parent +ngOnChanges(changes: SimpleChanges) { + if(changes.parentData.currentValue.length>0){ + this.grossProfitForm = this._fb.group( + { + calc_type_id:[changes.parentData.currentValue[0].calc_type_id], + fk_pd_id:[this.masterData.pdid], + mode:[changes.parentData.currentValue[0].mode,Validators.compose([Validators.required])], + margin:[changes.parentData.currentValue[0].margin], + }) + } + else { + this.grossProfitForm = this._fb.group( + { + calc_type_id:[''], + fk_pd_id:[this.masterData.pdid], + mode:['',Validators.compose([Validators.required])], + margin:[''], + }) + } +} + +// validate all form group and form array fields +validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.html new file mode 100644 index 000000000..031f03552 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.html @@ -0,0 +1,57 @@ + + +
+
+ House Hold Items +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Expense Particulars {{element.expense_item}} Amount (Rs) {{element.expense_value}} Frequency {{element.frequency_name}} + Annual Expenses {{element.annual_expense_value}} + + + +
+
+
+
+ + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.scss new file mode 100644 index 000000000..a464130a1 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.scss @@ -0,0 +1,30 @@ +.example-container { + max-height: 280px; + width: 100%; + overflow: auto; + margin-top: 2%; + } + + table { + width: 100%; + } + + td{ + padding-right: 2%; + padding-left: 2%; + white-space: nowrap; + } + + th { + padding-left: 2%; + padding-right: 2%; + white-space: nowrap; + } + + .mat-table-sticky:first-child { + border-right: 1px solid #e0e0e0; + } + + .mat-table-sticky:last-child { + border-left: 1px solid #e0e0e0; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.spec.ts new file mode 100644 index 000000000..a2d07f83b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HouseHoldDetailsComponent } from './house-hold-details.component'; + +describe('HouseHoldDetailsComponent', () => { + let component: HouseHoldDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HouseHoldDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HouseHoldDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.ts new file mode 100644 index 000000000..1a168c080 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component.ts @@ -0,0 +1,90 @@ +import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter } from '@angular/core'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material'; +import { ManageHouseHoldComponent } from './../AI-diologue/manage-house-hold/manage-house-hold.component'; +import { NotifierService } from 'angular-notifier'; + + +@Component({ + selector: 'app-house-hold-details', + templateUrl: './house-hold-details.component.html', + styleUrls: ['./house-hold-details.component.scss'] +}) +export class HouseHoldDetailsComponent implements OnInit { + + displayedColumns = ['buiness_particulars','expense_value','frequency','annual_expenses','action']; + public houseItemSource= new MatTableDataSource(); + @Input() parentData: any; + @Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number}; + @Output() loadAssessedForms = new EventEmitter(); + private notifier: NotifierService; + constructor(notifier: NotifierService,private _pd: PdTrigerService, private dialog: MatDialog) { + this.notifier= notifier; + } + + ngOnInit() { + } + + // add more item details + addMoreItem():void { + let passValues: any = { + manage_status:1, + masterData: this.masterData + } + const dialogRef = this.dialog.open(ManageHouseHoldComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); + +} +editHouseItem(value:any) { + let passValues: any = { + manage_status:2, + masterData: this.masterData, + editData:value + } + const dialogRef = this.dialog.open(ManageHouseHoldComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); +} + +// remove house item +removeHouseItem(value: any) : void{ + + let deleteRecords: any =[{ + "fk_pd_id":this.masterData.pdid, + "household_expense_id":value.household_expense_id, + "isactive":false, + }]; + this._pd.saveAssessedDetails('saveAssessedIncomeHouseholdExpenses',deleteRecords).subscribe(data => { + this.notifier.notify('success','Removed Successfully'); + this.loadAssessedForms.next('1'); +}, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); +}); +} + + +// detect chnges from parent +ngOnChanges(changes: SimpleChanges) { + this.houseItemSource.data = changes.parentData.currentValue; +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.html new file mode 100644 index 000000000..49e26601d --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.html @@ -0,0 +1,55 @@ + + +
+
+ Other Business Income Items +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Buiness Income {{element.business_income_item}} Amount (Rs) {{element.income_value}} Frequency {{element.frequency_name}} + Annual Income {{element.annual_income_value}} + + + +
+
+
+
+ + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.scss new file mode 100644 index 000000000..a464130a1 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.scss @@ -0,0 +1,30 @@ +.example-container { + max-height: 280px; + width: 100%; + overflow: auto; + margin-top: 2%; + } + + table { + width: 100%; + } + + td{ + padding-right: 2%; + padding-left: 2%; + white-space: nowrap; + } + + th { + padding-left: 2%; + padding-right: 2%; + white-space: nowrap; + } + + .mat-table-sticky:first-child { + border-right: 1px solid #e0e0e0; + } + + .mat-table-sticky:last-child { + border-left: 1px solid #e0e0e0; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.spec.ts new file mode 100644 index 000000000..dc12132a1 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OtherBusinessIncomeDetailsComponent } from './other-business-income-details.component'; + +describe('OtherBusinessIncomeDetailsComponent', () => { + let component: OtherBusinessIncomeDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OtherBusinessIncomeDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OtherBusinessIncomeDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.ts new file mode 100644 index 000000000..f7dd09c2a --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.ts @@ -0,0 +1,87 @@ +import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter } from '@angular/core'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material'; +import { ManageOtherBusinessIncomeComponent } from './../AI-diologue/manage-other-business-income/manage-other-business-income.component'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-other-business-income-details', + templateUrl: './other-business-income-details.component.html', + styleUrls: ['./other-business-income-details.component.scss'] +}) +export class OtherBusinessIncomeDetailsComponent implements OnInit { + + displayedColumns = ['buiness_income','income_value','frequency','annual_income','action']; + public businessIncomeItemSource= new MatTableDataSource(); + @Input() parentData: any; + @Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number}; + @Output() loadAssessedForms = new EventEmitter(); + private notifier: NotifierService; + constructor(notifier: NotifierService, private _pd: PdTrigerService, private dialog: MatDialog) { + this.notifier=notifier; + } + + ngOnInit() { + } + + // add more item details + addMoreItem():void { + let passValues: any = { + manage_status:1, + masterData: this.masterData + } + const dialogRef = this.dialog.open(ManageOtherBusinessIncomeComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); + +} +editIncomeItem(value:any) { + let passValues: any = { + manage_status:2, + masterData: this.masterData, + editData:value + } + const dialogRef = this.dialog.open(ManageOtherBusinessIncomeComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); +} +// remove income item +removeIncomeItem(value: any) : void{ + + let deleteRecords: any =[{ + "fk_pd_id":this.masterData.pdid, + "pd_business_income_id":value.pd_business_income_id, + "isactive":false, + }]; + this._pd.saveAssessedDetails('saveOtherBusinessIncome',deleteRecords).subscribe(data => { + this.notifier.notify('success','Removed Successfully'); + this.loadAssessedForms.next('1'); +}, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); +}); +} + +// detect chnges from parent +ngOnChanges(changes: SimpleChanges) { + this.businessIncomeItemSource.data = changes.parentData.currentValue; +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.html new file mode 100644 index 000000000..766e42c2d --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.html @@ -0,0 +1,68 @@ + + +
+
+ Purchase Item +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Raw Material/Trading Item {{element.purchase_item}} Purchase Quantity {{element.purchase_qty}} UOM {{element.uom_name}} Rate/Unit of Purchase {{element.rate_per_unit}} Frequency {{element.frequency_name}} + Annual Purchase {{element.annual_purchase_value}} + + + +
+
+
+ + Purchase Item is Not Available.. + +
+ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.scss new file mode 100644 index 000000000..a464130a1 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.scss @@ -0,0 +1,30 @@ +.example-container { + max-height: 280px; + width: 100%; + overflow: auto; + margin-top: 2%; + } + + table { + width: 100%; + } + + td{ + padding-right: 2%; + padding-left: 2%; + white-space: nowrap; + } + + th { + padding-left: 2%; + padding-right: 2%; + white-space: nowrap; + } + + .mat-table-sticky:first-child { + border-right: 1px solid #e0e0e0; + } + + .mat-table-sticky:last-child { + border-left: 1px solid #e0e0e0; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.spec.ts new file mode 100644 index 000000000..cf25e93a8 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PurchaseDetailsComponent } from './purchase-details.component'; + +describe('PurchaseDetailsComponent', () => { + let component: PurchaseDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PurchaseDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PurchaseDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.ts new file mode 100644 index 000000000..bb5475978 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.ts @@ -0,0 +1,100 @@ +import { Component, OnInit, Input, Output, Inject, DoCheck, EventEmitter } from '@angular/core'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material'; +import { ManagePurchaseComponent } from './../AI-diologue/manage-purchase/manage-purchase.component'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-purchase-details', + templateUrl: './purchase-details.component.html', + styleUrls: ['./purchase-details.component.scss'] +}) +export class PurchaseDetailsComponent implements OnInit, DoCheck { + displayedColumns = ['raw_material','purchase_quantity','UOM','rate_per_unit_purchase','frequency','annual_purchase','action']; + public purchaseItemSource= new MatTableDataSource(); + activateMariginCalculation:boolean; + private notifier: NotifierService; + @Input() parentData: any; + @Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any,businessIncomeList: any, pdid:number, grossProfitTypeList:any}; + @Output() loadAssessedForms = new EventEmitter(); + constructor(notifier: NotifierService,private _pd: PdTrigerService, private dialog: MatDialog) { + this.activateMariginCalculation=false; + this.notifier = notifier; + } + + ngOnInit() { + } + + // add more item details + addMoreItem():void { + let passValues: any = { + manage_status:1, + masterData: this.masterData + } + const dialogRef = this.dialog.open(ManagePurchaseComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); + +} +editPurchaseItem(value:any) { + let passValues: any = { + manage_status:2, + masterData: this.masterData, + editData:value + } + const dialogRef = this.dialog.open(ManagePurchaseComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); +} +// remove purchase item +removePurchaseItem(value: any) : void{ + + let deleteRecords: any =[{ + "fk_pd_id":this.masterData.pdid, + "purchase_id":value.purchase_id, + "isactive":false, + }]; + this._pd.saveAssessedDetails('saveAssessedIncomePurchaseDetails',deleteRecords).subscribe(data => { + this.notifier.notify('success','Removed Successfully'); + this.loadAssessedForms.next('1'); +}, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); +}); +} + +// do check component bases +ngDoCheck() { + if(this.masterData.grossProfitTypeList.length>0){ + this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==1 ? true : false; + } + this.purchaseItemSource.data = this.parentData; +} + +// detect chnges from parent +// ngOnChanges(changes: SimpleChanges) { +// if(changes.masterData){ +// if(changes.masterData.currentValue.grossProfitTypeList.length>0){ +// this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==1 ? true : false; +// } +// } +// this.purchaseItemSource.data = changes.parentData.currentValue; +// } +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html new file mode 100644 index 000000000..9d54b4f61 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html @@ -0,0 +1,21 @@ +
+ + + + Sales Calculation + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.scss new file mode 100644 index 000000000..b559b3c47 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.scss @@ -0,0 +1,3 @@ +mat-form-field { + margin: 0 2%; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.spec.ts new file mode 100644 index 000000000..cdc8420d0 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SalesCalculationComponent } from './sales-calculation.component'; + +describe('SalesCalculationComponent', () => { + let component: SalesCalculationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SalesCalculationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SalesCalculationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts new file mode 100644 index 000000000..05e271ac8 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts @@ -0,0 +1,102 @@ +import { Component, OnInit, Input, Output, Inject, EventEmitter, DoCheck, OnChanges, SimpleChanges } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-sales-calculation', + templateUrl: './sales-calculation.component.html', + styleUrls: ['./sales-calculation.component.scss'] +}) +export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck { + @Input() parentData: any; + @Input() masterData: { pdid:number,grossProfitTypeList:any}; + @Output() loadAssessedForms = new EventEmitter(); + salesCalculationForm:FormGroup; + activateMariginCalculation: boolean; + private notifier: NotifierService; + constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) { + this.activateMariginCalculation=false; + this.notifier = notifier; + } + + ngOnInit() { + } + salesCalculation(values): void { + if(values.margin_per !='' && values.sales_declared_by_customer !='') + { + this.salesCalculationForm.controls['margin_value'].setValue(values.sales_declared_by_customer * (values.margin_per/100)); + } + } + // save sales calculations details +submitDetails(records) { + if (this.salesCalculationForm.invalid) { + this.validateAllFormFields(this.salesCalculationForm); + this.notifier.notify('warning',"Please Check All Manatory Fields.."); + return; + } + this._pd.saveAssessedDetails('saveAssessedIncomeSalesDeclaredByCustomer',records).subscribe(data => { + this.notifier.notify('success', 'Saved Successfully.'); + this.loadAssessedForms.next('1'); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.loadAssessedForms.next('1'); + }); +} + +// validate all form group and form array fields +validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + +// do check component bases +ngDoCheck() { + + if(this.masterData.grossProfitTypeList.length>0){ + this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin==2 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==2 ? true : false; + } + this.activateMariginCalculation===true ? this.salesCalculationForm.controls['margin_per'].setValidators([Validators.required]) : this.salesCalculationForm.controls['margin_per'].clearValidators(); + this.salesCalculationForm.controls['margin_per'].updateValueAndValidity(); + +} + + //detect chnges from parent +ngOnChanges(changes: SimpleChanges) { + if(changes.masterData){ + if(changes.masterData.currentValue.grossProfitTypeList.length>0){ + this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==2 ? true : false; + } + } + if(changes.parentData){ + if(changes.parentData.currentValue.length>0){ + this.salesCalculationForm = this._fb.group({ + sdc_id:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sdc_id], + sales_declared_by_customer:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sales_declared_by_customer, Validators.compose([Validators.required])], + fk_pd_id:[this.masterData.pdid], + margin_per:[this.activateMariginCalculation===false ? '' : changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_per,this.activateMariginCalculation===true ? Validators.required: Validators.nullValidator], + margin_value:[this.activateMariginCalculation==false ? '' : changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_value], + }); + } + else { + this.salesCalculationForm = this._fb.group({ + sdc_id:[''], + sales_declared_by_customer:['', Validators.required], + fk_pd_id:[this.masterData.pdid], + margin_per:['',this.activateMariginCalculation===true ? Validators.required: Validators.nullValidator], + margin_value:[''], + }); + } + } + + } + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.html new file mode 100644 index 000000000..bc1f00af6 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.html @@ -0,0 +1,86 @@ + + + +
+
+ Sales Calculate Item Wise +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Product/Services {{element.sales_item}} Sale Quantity {{element.sales_qty}} UOM {{element.uom_name}} Rate/Unit of Sale {{element.rate_per_unit}} Frequency {{element.frequency_name}} + Annual Sales {{element.annual_sale_value}} + Margin Percentage % {{element.margin_per}} + Margin Amount {{element.margin_per_uom}} + Final Value {{element.margin_final_value}} + + + +
+
+
+ +
+ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.scss new file mode 100644 index 000000000..f78501e65 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.scss @@ -0,0 +1,30 @@ +.example-container { + max-height: 300px; + width: 100%; + overflow: auto; + margin-top: 2%; + } + + table { + width: 100%; + } + + td{ + padding-right: 2%; + padding-left: 2%; + white-space: nowrap; + } + + th { + padding-left: 2%; + padding-right: 2%; + white-space: nowrap; + } + + .mat-table-sticky:first-child { + border-right: 1px solid #e0e0e0; + } + + .mat-table-sticky:last-child { + border-left: 1px solid #e0e0e0; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.spec.ts new file mode 100644 index 000000000..00a6abb8a --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SalesDetailsComponent } from './sales-details.component'; + +describe('SalesDetailsComponent', () => { + let component: SalesDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SalesDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SalesDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.ts new file mode 100644 index 000000000..79171bfa0 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.ts @@ -0,0 +1,119 @@ +import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter, DoCheck } from '@angular/core'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material'; +import { ManageSalesComponent } from './../AI-diologue/manage-sales/manage-sales.component'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-sales-details', + templateUrl: './sales-details.component.html', + styleUrls: ['./sales-details.component.scss'] +}) +export class SalesDetailsComponent implements OnInit, DoCheck { + displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','action']; + public salesItemSource= new MatTableDataSource(); + @Input() parentData: any; + @Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any,businessIncomeList: any, pdid:number, grossProfitTypeList:any}; + @Output() loadAssessedForms = new EventEmitter(); + activateMariginCalculation: boolean; + private notifier :NotifierService + constructor(notifier:NotifierService, private _pd: PdTrigerService, private dialog: MatDialog) { + this.activateMariginCalculation=false; + this.notifier = notifier; + } + + ngOnInit() { + } + +// add more item details +addMoreItem():void { + let passValues: any = { + manage_status:1, + masterData: this.masterData, + margin_calculation_status:this.activateMariginCalculation, + } + const dialogRef = this.dialog.open(ManageSalesComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); + +} +editSalesItem(value:any) { + let passValues: any = { + manage_status:2, + masterData: this.masterData, + editData:value, + margin_calculation_status:this.activateMariginCalculation, + + } + const dialogRef = this.dialog.open(ManageSalesComponent, { + data: passValues, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult.update_status==true){ + this.loadAssessedForms.next('1'); + } + }); +} + +// remove sales item +removeSalesItem(value: any) : void{ + + let deleteRecords: any =[{ + "fk_pd_id":this.masterData.pdid, + "sci_id":value.sci_id, + "isactive":false, + }]; + this._pd.saveAssessedDetails('saveAssessedIncomeSalesCalculatedByItemwise',deleteRecords).subscribe(data => { + this.notifier.notify('success','Removed Successfully'); + this.loadAssessedForms.next('1'); +}, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); +}); +} + +// do check component bases +ngDoCheck() { + this.salesItemSource.data = this.parentData; + + if(this.masterData.grossProfitTypeList.length>0){ + this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin==2 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==2 ? true : false; + if(this.activateMariginCalculation===true){ + this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','margin_percentage','margin_amount','final_value','action']; + } + else { + this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','action']; + + } + }} + +// detect chnges from parent +// ngOnChanges(changes: SimpleChanges) { +// this.salesItemSource.data = changes.parentData.currentValue; +// if(changes.masterData){ +// if(changes.masterData.currentValue.grossProfitTypeList.length>0){ +// this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==2 ? true : false; +// if(this.activateMariginCalculation===true){ +// this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','margin_percentage','margin_amount','final_value','action']; +// } +// else { +// this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','action']; + +// } +// } +// } +// } + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html index 055075397..bbf1a9622 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html @@ -123,13 +123,13 @@ - +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts index 81cfbb247..3ffe3e868 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts @@ -200,7 +200,7 @@ export class BankingDetailsComponent implements OnInit { //is_main: [''], //is_main: [this.pd_cus_segment == 'SAL' ? '' : ''], //is_main:[''], - is_main: this.pd_cus_segment == 'SAL' ? [''] : [''], + // is_main: this.pd_cus_segment == 'SAL' ? [''] : [''], vintage_year: [''], vintage_month: [''], }); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts index 101636fbf..5fa3a6b26 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts @@ -27,7 +27,7 @@ export class BusinessAssetsInfoComponent implements OnInit { // businessEmiAmtFlag : boolean = false; public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"}, {'value': "no",'viewValue': "No"}, - {'value': "nan",'viewValue': "NA"}] + ] appxMarketAmtInwords : any = []; // emiAmtInwords : any = []; // PremiumPaidInwords : any = []; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html index 92808407e..77c53f89d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html @@ -103,7 +103,7 @@
-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html index dcf7ee39d..4603d85f1 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html @@ -34,6 +34,27 @@
+ + + + + Positive + Negative + Refer to Credit + Others + + + + + + + + + + + + +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts index 6d22cd494..c3c8a61e8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts @@ -58,6 +58,10 @@ export class FinalRemarksComponent implements OnInit { final_custormer_remark_type : [], final_other_customer_behaviour:[], is_service_provided: ['', Validators.required], + pd_officers_recommendation:['', Validators.required], + others_pd_officers_recommendation:[''], + enter_reason_for_negative:[''], + enter_reason_for_refer_to_credit:[''], final_form_remarks: ['',Validators.required] }); this.getM_Type(); @@ -88,6 +92,10 @@ export class FinalRemarksComponent implements OnInit { if(data.dataStatus){ this._finalRemarkForm.controls.final_custormer_remark_type.setValue(data.records.final_custormer_remark_type); this._finalRemarkForm.controls.final_other_customer_behaviour.setValue(data.records.final_other_customer_behaviour); + this._finalRemarkForm.controls.pd_officers_recommendation.setValue(data.records.pd_officers_recommendation); + this._finalRemarkForm.controls.others_pd_officers_recommendation.setValue(data.records.others_pd_officers_recommendation); + this._finalRemarkForm.controls.enter_reason_for_negative.setValue(data.records.enter_reason_for_negative); + this._finalRemarkForm.controls.enter_reason_for_refer_to_credit.setValue(data.records.enter_reason_for_refer_to_credit); this._finalRemarkForm.controls.is_service_provided.setValue(data.records.is_service_provided); this._finalRemarkForm.controls.final_form_remarks.setValue(data.records.final_form_remarks); this.noRecordsFound = true; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index b84c413de..0d4c8b595 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -91,9 +91,23 @@ import { QcReviewComponent } from './list-pd/pd-report/qc-review/qc-review.compo import { SharedModule } from "app/shared/shared.module"; import { BusinessInfoGroupComponent } from './list-pd/start-pd/forms/business-info-group/business-info-group.component'; import { SearchRelationPipe } from './../pd-pipes/search-relation.pipe'; +import { DeleteRecordsCountPipe } from './../pd-pipes/delete-records-count.pipe'; import { BusinessAssetsInfoComponent } from './list-pd/start-pd/forms/business-assets-info/business-assets-info.component'; import { BusinessBankingDetailsComponent } from './list-pd/start-pd/forms/business-banking-details/business-banking-details.component'; - +import { SalesDetailsComponent } from './list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component'; +import { DailySalesDetailsComponent } from './list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component'; +import { SalesCalculationComponent } from './list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component'; +import { ManageSalesComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component'; +import { PurchaseDetailsComponent } from './list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component'; +import { BusinessExpenseDetailsComponent } from './list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component'; +import { HouseHoldDetailsComponent } from './list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component'; +import { OtherBusinessIncomeDetailsComponent } from './list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component'; +import { ManagePurchaseComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component'; +import { ManageBusinesExpenseComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component'; +import { ManageHouseHoldComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component'; +import { ManageOtherBusinessIncomeComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component'; +import { GrossProfitCalculationComponent } from './list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component'; +import { ManageDailySalesComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component'; /** * Custom angular notifier options */ @@ -270,7 +284,7 @@ const pdCustomNotifierOptions: NotifierOptions = { // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule, // OwlNativeDateTimeModule, // ], - declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent], + declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent], // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent], // providers: [PdTrigerService, GetGeometricLocationService], @@ -308,13 +322,13 @@ const pdCustomNotifierOptions: NotifierOptions = { OwlNativeDateTimeModule, ], // declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, AssetsInfoComponent], - exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent], + exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent], providers: [PdTrigerService, GetGeometricLocationService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'}, {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}], entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,BusinessAssetsInfoComponent, - ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent], + ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent], }) export class ManagePdModule { diff --git a/ng6-seed/src/app/personal-discussion/pd-pipes/delete-records-count.pipe.spec.ts b/ng6-seed/src/app/personal-discussion/pd-pipes/delete-records-count.pipe.spec.ts new file mode 100644 index 000000000..c729fa4fe --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/pd-pipes/delete-records-count.pipe.spec.ts @@ -0,0 +1,8 @@ +import { DeleteRecordsCountPipe } from './delete-records-count.pipe'; + +describe('DeleteRecordsCountPipe', () => { + it('create an instance', () => { + const pipe = new DeleteRecordsCountPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/pd-pipes/delete-records-count.pipe.ts b/ng6-seed/src/app/personal-discussion/pd-pipes/delete-records-count.pipe.ts new file mode 100644 index 000000000..c41f3c7ee --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/pd-pipes/delete-records-count.pipe.ts @@ -0,0 +1,18 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'deleteRecordsCount' +}) +export class DeleteRecordsCountPipe implements PipeTransform { + + transform(value: any): any { + if(value.length>0){ + let filterData = value.filter(val=>val.isactive===true); + return filterData.length; + } + else { + return 0; + } + } + +} diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 6ac7bb7ef..057387d01 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -557,6 +557,15 @@ export class PdTrigerService { catchError(this.handleError('role', [])) ) } + + // save assessed sales item wise + saveAssessedDetails(methodURl: string,saveData:any){ + //saveData.createdby = this._aws.getlocale(); + return this._http.post(this.apiUrl + methodURl, { "records": saveData }) + .pipe( + catchError(this.handleError('operation', [])) + ) + } } diff --git a/ng6-seed/src/app/personal-discussion/personal-discussion.module.ts b/ng6-seed/src/app/personal-discussion/personal-discussion.module.ts index 41ecee292..8149f4af5 100755 --- a/ng6-seed/src/app/personal-discussion/personal-discussion.module.ts +++ b/ng6-seed/src/app/personal-discussion/personal-discussion.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; - import { CKEditorModule } from 'ng2-ckeditor'; import { PdfViewerModule } from 'ng2-pdf-viewer'; import { diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html index 17b31563b..690e32c5d 100755 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html @@ -205,7 +205,7 @@
-
diff --git a/ng6-seed/src/app/settings/masters/component/branch/branch-dialog/branch-dialog.component.html b/ng6-seed/src/app/settings/masters/component/branch/branch-dialog/branch-dialog.component.html index da96ed323..1949a2962 100755 --- a/ng6-seed/src/app/settings/masters/component/branch/branch-dialog/branch-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/branch/branch-dialog/branch-dialog.component.html @@ -38,7 +38,7 @@ fxLayoutAlign="center">
- + diff --git a/ng6-seed/src/app/settings/masters/component/city/city-dialog/city-dialog.component.html b/ng6-seed/src/app/settings/masters/component/city/city-dialog/city-dialog.component.html index c18a1fa26..fcc9bfcc9 100755 --- a/ng6-seed/src/app/settings/masters/component/city/city-dialog/city-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/city/city-dialog/city-dialog.component.html @@ -56,7 +56,7 @@ fxLayoutAlign="center">
- + diff --git a/ng6-seed/src/app/settings/masters/component/comments-on-locality/comments-on-locality-dialog/comments-on-locality-dialog.component.html b/ng6-seed/src/app/settings/masters/component/comments-on-locality/comments-on-locality-dialog/comments-on-locality-dialog.component.html index da88ac6b3..ebe8fc363 100755 --- a/ng6-seed/src/app/settings/masters/component/comments-on-locality/comments-on-locality-dialog/comments-on-locality-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/comments-on-locality/comments-on-locality-dialog/comments-on-locality-dialog.component.html @@ -41,7 +41,7 @@ fxLayoutAlign="center">
- + diff --git a/ng6-seed/src/app/settings/masters/component/company/company-dialog/company-dialog.component.html b/ng6-seed/src/app/settings/masters/component/company/company-dialog/company-dialog.component.html index f0df83f71..e4ddc2e72 100755 --- a/ng6-seed/src/app/settings/masters/component/company/company-dialog/company-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/company/company-dialog/company-dialog.component.html @@ -82,7 +82,7 @@
- + diff --git a/ng6-seed/src/app/settings/masters/component/customer-behaviour/customer-behaviour-dialog/customer-behaviour-dialog.component.html b/ng6-seed/src/app/settings/masters/component/customer-behaviour/customer-behaviour-dialog/customer-behaviour-dialog.component.html index c445f8fe6..976374cd3 100755 --- a/ng6-seed/src/app/settings/masters/component/customer-behaviour/customer-behaviour-dialog/customer-behaviour-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/customer-behaviour/customer-behaviour-dialog/customer-behaviour-dialog.component.html @@ -45,7 +45,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/customer-segment/customer-segment-dialog/customer-segment-dialog.component.html b/ng6-seed/src/app/settings/masters/component/customer-segment/customer-segment-dialog/customer-segment-dialog.component.html index 98f96e5e6..b456efca9 100755 --- a/ng6-seed/src/app/settings/masters/component/customer-segment/customer-segment-dialog/customer-segment-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/customer-segment/customer-segment-dialog/customer-segment-dialog.component.html @@ -51,7 +51,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/designation/designation-dialog/designation-dialog.component.html b/ng6-seed/src/app/settings/masters/component/designation/designation-dialog/designation-dialog.component.html index c50de886e..4dab2576c 100755 --- a/ng6-seed/src/app/settings/masters/component/designation/designation-dialog/designation-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/designation/designation-dialog/designation-dialog.component.html @@ -51,7 +51,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/frequency/frequency-dialog/frequency-dialog.component.html b/ng6-seed/src/app/settings/masters/component/frequency/frequency-dialog/frequency-dialog.component.html index 706429f5d..044195d58 100755 --- a/ng6-seed/src/app/settings/masters/component/frequency/frequency-dialog/frequency-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/frequency/frequency-dialog/frequency-dialog.component.html @@ -43,7 +43,7 @@ fxLayoutAlign="center"> - +
diff --git a/ng6-seed/src/app/settings/masters/component/industry_classification/industry_classification-dialog/industry_classification-dialog.component.html b/ng6-seed/src/app/settings/masters/component/industry_classification/industry_classification-dialog/industry_classification-dialog.component.html index 5cae4c53a..d7866a7b6 100755 --- a/ng6-seed/src/app/settings/masters/component/industry_classification/industry_classification-dialog/industry_classification-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/industry_classification/industry_classification-dialog/industry_classification-dialog.component.html @@ -42,7 +42,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/lender-hierarchy/lender-hierarchy-dialog/lender-hierarchy-dialog.component.html b/ng6-seed/src/app/settings/masters/component/lender-hierarchy/lender-hierarchy-dialog/lender-hierarchy-dialog.component.html index 3fba64166..d4ec82904 100755 --- a/ng6-seed/src/app/settings/masters/component/lender-hierarchy/lender-hierarchy-dialog/lender-hierarchy-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/lender-hierarchy/lender-hierarchy-dialog/lender-hierarchy-dialog.component.html @@ -41,7 +41,7 @@ fxLayoutAlign="center"> - +
diff --git a/ng6-seed/src/app/settings/masters/component/members-occupation/members-occupation-dialog/members-occupation-dialog.component.html b/ng6-seed/src/app/settings/masters/component/members-occupation/members-occupation-dialog/members-occupation-dialog.component.html index c6ca49362..1fa866f5d 100755 --- a/ng6-seed/src/app/settings/masters/component/members-occupation/members-occupation-dialog/members-occupation-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/members-occupation/members-occupation-dialog/members-occupation-dialog.component.html @@ -41,7 +41,7 @@ fxLayout="row"> - + diff --git a/ng6-seed/src/app/settings/masters/component/pd-location-approach/pd-location-approach-dialog/pd-location-approach-dialog.component.html b/ng6-seed/src/app/settings/masters/component/pd-location-approach/pd-location-approach-dialog/pd-location-approach-dialog.component.html index d65b8cde4..01325aed2 100755 --- a/ng6-seed/src/app/settings/masters/component/pd-location-approach/pd-location-approach-dialog/pd-location-approach-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/pd-location-approach/pd-location-approach-dialog/pd-location-approach-dialog.component.html @@ -44,7 +44,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/pd-type/pd-type-dialog/pd-type-dialog.component.html b/ng6-seed/src/app/settings/masters/component/pd-type/pd-type-dialog/pd-type-dialog.component.html index 643c7122a..6d848af09 100755 --- a/ng6-seed/src/app/settings/masters/component/pd-type/pd-type-dialog/pd-type-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/pd-type/pd-type-dialog/pd-type-dialog.component.html @@ -44,7 +44,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/product/product-dialog/product-dialog.component.html b/ng6-seed/src/app/settings/masters/component/product/product-dialog/product-dialog.component.html index bd8c0551a..25533d8e0 100755 --- a/ng6-seed/src/app/settings/masters/component/product/product-dialog/product-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/product/product-dialog/product-dialog.component.html @@ -48,7 +48,7 @@ fxLayoutAlign="center"> - +
diff --git a/ng6-seed/src/app/settings/masters/component/question-category/question-category-dialog/question-category-dialog.component.html b/ng6-seed/src/app/settings/masters/component/question-category/question-category-dialog/question-category-dialog.component.html index 770a4570f..baf7c2c7e 100755 --- a/ng6-seed/src/app/settings/masters/component/question-category/question-category-dialog/question-category-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/question-category/question-category-dialog/question-category-dialog.component.html @@ -24,7 +24,7 @@ fxLayoutAlign="center"> - +
diff --git a/ng6-seed/src/app/settings/masters/component/regions/regions-dialog/regions-dialog.component.html b/ng6-seed/src/app/settings/masters/component/regions/regions-dialog/regions-dialog.component.html index f652efa2a..75f365b69 100755 --- a/ng6-seed/src/app/settings/masters/component/regions/regions-dialog/regions-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/regions/regions-dialog/regions-dialog.component.html @@ -44,7 +44,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/relation-ship/relation-ship-dialog/relation-ship-dialog.component.html b/ng6-seed/src/app/settings/masters/component/relation-ship/relation-ship-dialog/relation-ship-dialog.component.html index 3cce82541..bce2dfe82 100755 --- a/ng6-seed/src/app/settings/masters/component/relation-ship/relation-ship-dialog/relation-ship-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/relation-ship/relation-ship-dialog/relation-ship-dialog.component.html @@ -43,7 +43,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/states/states-dialog/states-dialog.component.html b/ng6-seed/src/app/settings/masters/component/states/states-dialog/states-dialog.component.html index fe54686e3..3f9d97b0c 100755 --- a/ng6-seed/src/app/settings/masters/component/states/states-dialog/states-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/states/states-dialog/states-dialog.component.html @@ -68,7 +68,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/sub-product/sub-product-dialog/sub-product-dialog.component.html b/ng6-seed/src/app/settings/masters/component/sub-product/sub-product-dialog/sub-product-dialog.component.html index 387c6daae..41254f91f 100755 --- a/ng6-seed/src/app/settings/masters/component/sub-product/sub-product-dialog/sub-product-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/sub-product/sub-product-dialog/sub-product-dialog.component.html @@ -75,7 +75,7 @@ fxLayoutAlign="center"> - +
diff --git a/ng6-seed/src/app/settings/masters/component/title/title-dialog/title-dialog.component.html b/ng6-seed/src/app/settings/masters/component/title/title-dialog/title-dialog.component.html index f2bd7bf94..83443b57b 100755 --- a/ng6-seed/src/app/settings/masters/component/title/title-dialog/title-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/title/title-dialog/title-dialog.component.html @@ -42,7 +42,7 @@ fxLayoutAlign="center">
- + diff --git a/ng6-seed/src/app/settings/masters/component/type-of-activity/activity-dialog/activity-dialog.component.html b/ng6-seed/src/app/settings/masters/component/type-of-activity/activity-dialog/activity-dialog.component.html index 4a172f7d5..dd448c2ac 100755 --- a/ng6-seed/src/app/settings/masters/component/type-of-activity/activity-dialog/activity-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/type-of-activity/activity-dialog/activity-dialog.component.html @@ -43,7 +43,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/settings/masters/component/uom/uom-dialog/uom-dialog.component.html b/ng6-seed/src/app/settings/masters/component/uom/uom-dialog/uom-dialog.component.html index 1c1c11b7e..67567e5e8 100755 --- a/ng6-seed/src/app/settings/masters/component/uom/uom-dialog/uom-dialog.component.html +++ b/ng6-seed/src/app/settings/masters/component/uom/uom-dialog/uom-dialog.component.html @@ -41,7 +41,7 @@ fxLayoutAlign="center"> - + diff --git a/ng6-seed/src/app/shared/numbers-only/numbers-only.directive.ts b/ng6-seed/src/app/shared/numbers-only/numbers-only.directive.ts new file mode 100644 index 000000000..cc1db71f5 --- /dev/null +++ b/ng6-seed/src/app/shared/numbers-only/numbers-only.directive.ts @@ -0,0 +1,31 @@ +import { Directive, ElementRef, HostListener, Input } from '@angular/core'; + +@Directive({ + selector: '[OnlyNumber]' +}) +export class NumbersOnlyDirective { + + // Allow decimal numbers. The \. is only allowed once to occur + private regex: RegExp = new RegExp(/^[0-9]+(\.[0-9]*){0,1}$/g); + + // Allow key codes for special events. Reflect : + // Backspace, tab, end, home + private specialKeys: Array = [ 'Backspace', 'Tab', 'End', 'Home' ]; + + constructor(private el: ElementRef) { + } + + @HostListener('keydown', [ '$event' ]) + onKeyDown(event: KeyboardEvent) { + // Allow Backspace, tab, end, and home keys + if (this.specialKeys.indexOf(event.key) !== -1) { + return; + } + + let current: string = this.el.nativeElement.value; + let next: string = current.concat(event.key); + if (next && !String(next).match(this.regex)) { + event.preventDefault(); + } + } +} \ No newline at end of file diff --git a/ng6-seed/src/app/shared/shared.module.ts b/ng6-seed/src/app/shared/shared.module.ts index cc6a4cb68..7ec2767bd 100755 --- a/ng6-seed/src/app/shared/shared.module.ts +++ b/ng6-seed/src/app/shared/shared.module.ts @@ -5,6 +5,7 @@ import { HorizontalMenuItems } from './menu-items/horizontal-menu-items'; import { AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective } from './accordion'; import { ToggleFullscreenDirective } from './fullscreen/toggle-fullscreen.directive'; import { RatingComponent} from './rating/rating.component'; +import { NumbersOnlyDirective } from './numbers-only/numbers-only.directive'; @NgModule({ declarations: [ @@ -12,14 +13,16 @@ import { RatingComponent} from './rating/rating.component'; AccordionLinkDirective, AccordionDirective, ToggleFullscreenDirective, - RatingComponent + RatingComponent, + NumbersOnlyDirective ], exports: [ AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective, ToggleFullscreenDirective, - RatingComponent + RatingComponent, + NumbersOnlyDirective ], providers: [ MenuItems, HorizontalMenuItems ] }) diff --git a/ng6-seed/src/app/template/templates/templates-list/edit/edit-category/edit-category.component.html b/ng6-seed/src/app/template/templates/templates-list/edit/edit-category/edit-category.component.html index ffcd6bdd7..fd4d127fb 100755 --- a/ng6-seed/src/app/template/templates/templates-list/edit/edit-category/edit-category.component.html +++ b/ng6-seed/src/app/template/templates/templates-list/edit/edit-category/edit-category.component.html @@ -30,7 +30,7 @@
- +
\ No newline at end of file diff --git a/ng6-seed/src/app/template/templates/templates-list/edit/edit-lender/edit-lender.component.html b/ng6-seed/src/app/template/templates/templates-list/edit/edit-lender/edit-lender.component.html index 23a15f950..35eeeff6b 100755 --- a/ng6-seed/src/app/template/templates/templates-list/edit/edit-lender/edit-lender.component.html +++ b/ng6-seed/src/app/template/templates/templates-list/edit/edit-lender/edit-lender.component.html @@ -48,7 +48,7 @@
- +
\ No newline at end of file