import {Component, ChangeDetectionStrategy} from '@angular/core'; import {BasicMasterView, EnumFormView, BasicMasterListColumn, EnumColumnDataTypes} from '../../../form-builder/Basic-Master-View'; import {basicformbuilderService} from '../../../form-builder/basic-form-builder.service'; import {EnumDynamicControlType, EnumDefaultValidatorType} from '../../../form-builder/Basic-Entry-form'; import {Router} from '@angular/router'; import {EnumAllowOrDeduct} from '../../../_models/enums'; import { BasicMasterViewComponent } from 'src/app/form-builder/Basic-Master-View.component'; @Component({ selector: 'app-allowance-deduction-basic-entry', template: '
', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, }) /** allergy component*/ export class AllowanceAndDeductionComponent { ListviewData: any; msv: BasicMasterView = new BasicMasterView(); thebaseurl: string; public _allowDeductType: EnumAllowOrDeduct = EnumAllowOrDeduct.Allowance; public config = { animated: true, keyboard: true, backdrop: true, ignoreBackdropClick: true }; /** user ctor */ constructor(public msvs: basicformbuilderService, public router: Router) { this.msvs.setMasterView(this.msv); const value = this.router.url.split('/').pop(); if (value.trim().toLowerCase() == 'deduction') { this._allowDeductType = EnumAllowOrDeduct.Deduction; } } ngOnInit() { this.msv.entryFrom.formHeight = 316; this.msv.entryFrom.formWidth = 550; if (this._allowDeductType == EnumAllowOrDeduct.Deduction) { this.msv.caption = 'Deduction'; } else { this.msv.caption = 'Allowance'; } this.msv.fromViewType = EnumFormView.ListView; this.msv.listViewColumn.push(new BasicMasterListColumn('Code', 'Code', EnumColumnDataTypes.String)); this.msv.listViewColumn.push(new BasicMasterListColumn('Name', 'Name', EnumColumnDataTypes.String)); this.msv.listViewColumn.push(new BasicMasterListColumn('Name in Bangla', 'NameInBangla', EnumColumnDataTypes.String)); this.msv.searchPayrolltype = true; if (this._allowDeductType == EnumAllowOrDeduct.Deduction) { this.msv.dataGetFunctionName = 'GetDeduction'; this.msv.caption = 'Deduction'; this.msv.entryFrom.caption = 'Deduction'; } else { this.msv.caption = 'Allowance'; this.msv.dataGetFunctionName = 'GetAllowance'; this.msv.entryFrom.caption = 'Allowance '; } this.msv.entryFrom.iDColumnName = 'id'; this.msv.entryFrom.sourceObject = 'AllowanceDeduction'; this.msv.entryFrom.AddControl('Code', 'Code', EnumDynamicControlType.TextBox, '', true, EnumDefaultValidatorType.Custom, 100, 2); this.msv.entryFrom.AddControl('Name', 'Name', EnumDynamicControlType.TextBox, '', true, EnumDefaultValidatorType.Custom, 200, 2); this.msv.entryFrom.AddControl('Name in Bangla', 'NameInBangla', EnumDynamicControlType.TextBox, '', false, EnumDefaultValidatorType.Custom, 200, 2); if (this._allowDeductType == EnumAllowOrDeduct.Deduction) { this.msv.entryFrom.AddControl('Deduction Type', 'allowOrDeductType', EnumDynamicControlType.DropDownEnumData, 'Deduction:2', true, EnumDefaultValidatorType.Custom, 256, 5); } else { this.msv.entryFrom.AddControl('Allowance Type', 'allowOrDeductType', EnumDynamicControlType.DropDownEnumData, 'Allowance:1', true, EnumDefaultValidatorType.Custom, 256, 5); } } }