Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import {
Component,
OnInit,
Input,
AfterContentInit,
OnChanges,
SimpleChanges
} from '@angular/core';
import {
FormBuilder,
Validators,
FormGroup,
FormControl,
FormArray,
ReactiveFormsModule
} from '@angular/forms';
import { CodeModel } from '../../rfai-admin/rfai-admin.model';
import { CodeAndLevelModel } from '../rfai-submission.model';
import { isZeroValidator } from '../../../shared/validators';
@Component({
selector: 'app-request-codes',
templateUrl: './request-codes.component.html',
styleUrls: ['./request-codes.component.scss']
})
export class RequestCodesComponent implements OnInit, OnChanges {
constructor(private fb: FormBuilder) {}
codeList: FormArray;
form: FormGroup;
@Input() loincCodesLineLevel: CodeModel[] = [];
@Input() loincCodesClaimLevel: CodeModel[] = [];
@Input() loincCodeModifiers: CodeModel[] = [];
@Input() healthCareClaimStatusCodes: CodeModel[] = [];
@Input() resetForm = false;
@Input() totalLines = 0;
@Input() levelCode = 'C';
@Input() lineIdArray: number[] = [];
@Input() tabbable = true;
loinCodeArrayForEachRow: Array<CodeModel[]>;
loincCodes: CodeModel[] = [];
totalLinesArray = Array.apply(null, { length: 10 });
ngOnInit() {
this.formInit();
}
// ngAfterContentInit() {
// console.log('loincCodesClaimLevel gfjgfjgf', this.loincCodesClaimLevel);
// this.loincCodes = this.loincCodesClaimLevel;
// }
ngOnChanges(changes: SimpleChanges) {
if (!!this.loincCodes) {
this.loincCodes = this.loincCodesClaimLevel;
}
}
formInit() {
this.form = this.fb.group({
// healthCareClaimStatusCode: '',
// loincCode: '',
// loincCodeModifier1: '',
// loincCodeModifier2: '',
// lineNumber: '',
codeList: this.fb.array([
this.fb.group({
healthCareClaimStatusCode: [
'0',
[Validators.required, isZeroValidator]
],
loincCode0: ['0', [Validators.required, isZeroValidator]],
loincCodeModifier1: '0',
loincCodeModifier2: '0',
// lineNumber0: '',
levelDropDown: '0'
})
])
});
this.codeList = this.form.get('codeList') as FormArray;
}
addRow(): void {
const loincCodeName = 'loincCode' + this.codeList.length.toString();
if (this.codeList.length < 6) {
this.codeList.push(
this.fb.group({
healthCareClaimStatusCode: [
'0',
[Validators.required, isZeroValidator]
],
[loincCodeName]: ['0', [Validators.required, isZeroValidator]],
loincCodeModifier1: '0',
loincCodeModifier2: '0',
// [lineNumberName]: '',
levelDropDown: '0'
})
);
}
}
removeRow(index: number) {
this.codeList.removeAt(index);
}
onResetForm(): void {
this.formInit();
}
onChangeDropdown(event) {
if (event.target.value === '0') {
this.loincCodes = this.loincCodesClaimLevel;
} else {
this.loincCodes = this.loincCodesLineLevel;
}
}
}