template edit screen , extra code clean up with component comment msg : kdk
This commit is contained in:
parent
407f45eada
commit
1fd7ae16c2
@ -1,7 +1,3 @@
|
||||
|
||||
<!--<pre>{{ templateCategoryRecord | json }}</pre>
|
||||
<pre> {{ m_category | json}}</pre>-->
|
||||
|
||||
<form [formGroup]="_editTempCategoryFrom" (submit)="onSubmit()">
|
||||
<div formArrayName="temp_category" class="example-full-width">
|
||||
<mat-card *ngFor="let answ of _editTempCategoryFrom.controls.temp_category['controls']; let i=index ; let last = last;">
|
||||
@ -24,46 +20,12 @@
|
||||
<mat-error *ngIf="submitted && answ['controls'].weightage.hasError('required')" class="mat-text-warn">Weightage Required.!</mat-error>
|
||||
</div>
|
||||
<div fxFlex="30%">
|
||||
<button (click)="removeLanguage(i)" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
||||
<button (click)="removeLanguage(i)" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" type="button"><mat-icon>delete</mat-icon></button>
|
||||
</div>
|
||||
<!--<div fxFlex="0 1 auto" class="ml-xs">
|
||||
<button *ngIf="last" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Add More" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Category Already Exist.!</mat-error>
|
||||
</mat-card>
|
||||
<!--<mat-card role="list">-->
|
||||
<!--<mat-card style="width: 70%;" *ngFor="let answ of _editTempCategoryFrom.controls.temp_category['controls']; let i=index ; let last = last;"
|
||||
role="listitem">
|
||||
<div [formGroupName]="i">
|
||||
<div fxLayout="row" fxLayoutWrap fxLayoutGap="5%" fxLayoutAlign="start center">
|
||||
<div fxFlex="0 1 auto" class="ml-xs">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Category" formControlName="fk_question_category_id">
|
||||
<mat-option *ngFor="let category of m_category" [value]="category.question_category_id">{{ category.category_name }}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Category Already Exist.!</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="0 1 auto" class="ml-xs">
|
||||
<mat-form-field style="width: 25%; text-align: center" appearance="outline">
|
||||
<input matInput formControlName="weightage">
|
||||
</mat-form-field> <span>%</span>
|
||||
</div>
|
||||
<div fxFlex="0 1 auto" class="ml-xs">
|
||||
<button *ngIf="_editTempCategoryFrom.controls.temp_category.controls.length > 1" (click)="removeLanguage(i)" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
||||
|
||||
</div>
|
||||
<div fxFlex="0 1 auto" class="ml-xs">
|
||||
<button *ngIf="last" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Add More" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Category Already Exist.!</mat-error>
|
||||
</mat-card>-->
|
||||
<!--</mat-card>-->
|
||||
</div>
|
||||
<div>
|
||||
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||
|
||||
@ -9,6 +9,11 @@ import { NotifierService } from 'angular-notifier';
|
||||
import { TemplatesService } from './../../../../service/templates/templates.service';
|
||||
import { MastersService } from './../../../../service/masters/masters.service';
|
||||
|
||||
/*
|
||||
* Question Cagegory add and edit functionality with dynamic form creation with validation
|
||||
* : kdk
|
||||
*/
|
||||
|
||||
@Component({
|
||||
selector: 'app-template-edit-category',
|
||||
templateUrl: './edit-category.component.html',
|
||||
@ -48,14 +53,6 @@ export class EditCategoryComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
// this.initAnswers(),
|
||||
])
|
||||
})
|
||||
|
||||
// if(this.categoryList.length > 0){
|
||||
// for (let val of this.categoryList) {
|
||||
// // alert(JSON.stringify(val));
|
||||
// let vals = val;
|
||||
// this.addLanguage(vals['fk_category_id'], vals['name'], vals['weightage'], null);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@ -77,7 +74,6 @@ export class EditCategoryComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Dynamic Form field creation Functionality : START ===>
|
||||
initAnswers(data) {
|
||||
return this._formBuilder.group({
|
||||
@ -112,9 +108,6 @@ export class EditCategoryComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
if (data.records) {
|
||||
this.templateCategoryRecord = data.records;
|
||||
this.setFormDatas(this.templateCategoryRecord);
|
||||
// this.templateListData = data.records;
|
||||
// this.dataLength = data.records.length;
|
||||
// this.dataSource.data = this.templateListData;
|
||||
} else {
|
||||
// this.noTemplateLendersFound = true;
|
||||
}
|
||||
@ -150,30 +143,6 @@ export class EditCategoryComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
// convenience getter for easy access to form fields
|
||||
get f() { return this._editTempCategoryFrom.controls; }
|
||||
|
||||
public m_categoryList = [{
|
||||
fk_category_id: 1,
|
||||
name: 'Category List 1',
|
||||
weightage: 2,
|
||||
}, {
|
||||
fk_category_id: 2,
|
||||
name: 'Category List 2',
|
||||
weightage: 5,
|
||||
}, {
|
||||
fk_category_id: 3,
|
||||
name: 'Category List 2',
|
||||
weightage: 5,
|
||||
}];
|
||||
|
||||
public categoryList = [{
|
||||
fk_category_id: 1,
|
||||
name: 'Category List 1',
|
||||
weightage: 2,
|
||||
}, {
|
||||
fk_category_id: 2,
|
||||
name: 'Category List 2',
|
||||
weightage: 5,
|
||||
}];
|
||||
|
||||
// Dynamic Form field creation Functionality : START ===>
|
||||
// initAnswers(fk_cat_id, name, weightage) {
|
||||
// return this._formBuilder.group({
|
||||
@ -186,9 +155,16 @@ export class EditCategoryComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
// const control = <FormArray>this._editTempCategoryFrom.controls['temp_category'];
|
||||
// control.push(this.initAnswers(fk_cat_id, name, weightage));
|
||||
// }
|
||||
|
||||
removeLanguage(i: number) {
|
||||
let value = (<FormArray>this._editTempCategoryFrom.controls['temp_category']).at(i).get('template_category_weightage_id').value;
|
||||
if (value == null) {
|
||||
const control = <FormArray>this._editTempCategoryFrom.controls['temp_category'];
|
||||
control.removeAt(i);
|
||||
} else {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// END ===>
|
||||
@ -200,17 +176,14 @@ export class EditCategoryComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
this.submitted = true;
|
||||
// stop here if form is invalid
|
||||
if (this._editTempCategoryFrom.invalid) {
|
||||
alert('no');
|
||||
this.notifier.notify('warning', 'Should Fill Required Fields.!');
|
||||
return;
|
||||
} else {
|
||||
var formValues = this._editTempCategoryFrom.value;
|
||||
//To Remove The "Null" With Key also
|
||||
Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
|
||||
|
||||
let val = formValues.temp_category;
|
||||
|
||||
let totalScore = val.map(value => { return Number(value.weightage); }).reduce((acc, value) => { return acc + value; }, 0);
|
||||
|
||||
if (totalScore == 100) {
|
||||
if (!this.checkDuplicateInObject(formValues.temp_category)) {
|
||||
this.templatesService.updateTempateIDCategoryDetails(formValues.temp_category).subscribe(
|
||||
@ -231,10 +204,10 @@ export class EditCategoryComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
||||
});
|
||||
} else {
|
||||
alert("duplication records occured.!");
|
||||
this.notifier.notify('warning', 'duplication records occured.!');
|
||||
}
|
||||
} else {
|
||||
alert("value should equal to 100")
|
||||
this.notifier.notify('warning', 'value should equal to 100.!');
|
||||
}
|
||||
|
||||
}
|
||||
@ -264,6 +237,4 @@ export class EditCategoryComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
//Called once, before the instance is destroyed.
|
||||
//Add 'implements OnDestroy' to the class.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
<!--<pre>{{ templateLenderRecord | json}}</pre>
|
||||
|
||||
<pre> {{ m_lender | json}} </pre>
|
||||
<pre> {{ m_product | json}} </pre>
|
||||
<pre> {{ m_customerSegment | json}} </pre>-->
|
||||
|
||||
|
||||
<form [formGroup]="_editTempLenderFrom" (submit)="onSubmit()">
|
||||
<div formArrayName="temp_lender" class="example-full-width">
|
||||
<mat-card *ngFor="let answ of _editTempLenderFrom.controls.temp_lender['controls']; let i=index">
|
||||
|
||||
@ -9,6 +9,10 @@ import { NotifierService } from 'angular-notifier';
|
||||
import { TemplatesService } from './../../../../service/templates/templates.service';
|
||||
import { MastersService } from './../../../../service/masters/masters.service';
|
||||
|
||||
/*
|
||||
* Question Lender Details Get Multi drop-down and dynamic form with validation
|
||||
* : kdk
|
||||
*/
|
||||
|
||||
@Component({
|
||||
selector: 'app-template-edit-lender',
|
||||
@ -132,15 +136,6 @@ export class EditLenderComponent implements OnInit {
|
||||
// convenience getter for easy access to form fields
|
||||
get f() { return this._editTempLenderFrom.controls; }
|
||||
|
||||
|
||||
public entityOptions = [{
|
||||
fk_lender_id: 1,
|
||||
name: 'Lender1'
|
||||
},{
|
||||
fk_lender_id: 2,
|
||||
name: 'Lender2'
|
||||
}];
|
||||
|
||||
// Dynamic Form field creation Functionality : START ===>
|
||||
initAnswers(data) {
|
||||
return this._formBuilder.group({
|
||||
@ -176,7 +171,6 @@ export class EditLenderComponent implements OnInit {
|
||||
|
||||
// END ===>
|
||||
|
||||
|
||||
/** To Save/Edited Popup Data */
|
||||
onSubmit() {
|
||||
this.submitted = true;
|
||||
@ -189,7 +183,6 @@ export class EditLenderComponent implements OnInit {
|
||||
//To Remove The "Null" With Key also
|
||||
Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
|
||||
// alert(JSON.stringify(formValues.temp_lender));
|
||||
|
||||
if (!this.checkDuplicateInObject(formValues.temp_lender)) {
|
||||
this.templatesService.updateTempateIDLenderDetails(formValues.temp_lender).subscribe(
|
||||
dataresult => {
|
||||
@ -209,16 +202,14 @@ export class EditLenderComponent implements OnInit {
|
||||
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
||||
});
|
||||
} else {
|
||||
alert("duplication records occured.!");
|
||||
this.notifier.notify('warning', 'duplication records occured.!');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkDuplicateInObject(inputArray) {
|
||||
let seenDuplicate = false;
|
||||
|
||||
inputArray.map(function (item, index) {
|
||||
let currentVal = inputArray[index];
|
||||
for (let i = index + 1; i < inputArray.length; i++) {
|
||||
|
||||
@ -17,6 +17,11 @@ export interface DialogData {
|
||||
/**sweet alert */
|
||||
// import Swal from 'sweetalert2';
|
||||
|
||||
/*
|
||||
* Templates Category Question list with answers , with multiple question with answer dynamic form validation
|
||||
* : kdk
|
||||
*/
|
||||
|
||||
@Component({
|
||||
selector: 'app-category-question-answer',
|
||||
templateUrl: './category-question-answer.component.html',
|
||||
@ -34,7 +39,6 @@ export class CategoryQuestionAnswerComponent implements OnInit {
|
||||
public panelOpenState: boolean;
|
||||
// secondFormGroup: FormGroup;
|
||||
|
||||
|
||||
/**
|
||||
* Notifier service
|
||||
*/
|
||||
@ -65,9 +69,6 @@ export class CategoryQuestionAnswerComponent implements OnInit {
|
||||
// alert(JSON.stringify(records));
|
||||
// }
|
||||
|
||||
animal: string;
|
||||
name: string;
|
||||
|
||||
|
||||
openDialog(): void {
|
||||
const dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
|
||||
@ -76,7 +77,6 @@ export class CategoryQuestionAnswerComponent implements OnInit {
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log('The dialog was closed');
|
||||
this.animal = result;
|
||||
this.setModelFirstFormDate(result);
|
||||
// alert(result);
|
||||
});
|
||||
@ -138,9 +138,6 @@ export class CategoryQuestionAnswerComponent implements OnInit {
|
||||
// ================== Dynamic Form set for Answers
|
||||
|
||||
addAnswerData(data, e, ix) {
|
||||
// const control = <FormArray>this._editquestionAnswerForm.controls['temp_questions'].get('answers');
|
||||
// let id = 0;
|
||||
|
||||
const control = (<FormArray>this._editquestionAnswerForm.controls['temp_questions']).at(ix).get('answers') as FormArray;
|
||||
// alert(control);
|
||||
control.push(this.initAnswerData(data));
|
||||
@ -160,7 +157,6 @@ export class CategoryQuestionAnswerComponent implements OnInit {
|
||||
|
||||
// =============================================
|
||||
|
||||
|
||||
// Dynamic Form field creation Functionality : START ===>
|
||||
initAnswers(data) {
|
||||
return this._formBuilder.group({
|
||||
@ -191,11 +187,8 @@ export class CategoryQuestionAnswerComponent implements OnInit {
|
||||
const control = <FormArray>this._editquestionAnswerForm.controls['temp_questions'];
|
||||
control.push(this.initAnswers(newDate));
|
||||
} else {
|
||||
// alert(JSON.stringify(data));
|
||||
const control = <FormArray>this._editquestionAnswerForm.controls['temp_questions'];
|
||||
control.push(this.initAnswers(data));
|
||||
// alert(control.length);
|
||||
// alert(JSON.stringify(this._editquestionAnswerForm.controls.temp_questions['controls']));
|
||||
this.setAnswers(data.answers, control.length - 1);
|
||||
}
|
||||
}
|
||||
@ -209,9 +202,8 @@ export class CategoryQuestionAnswerComponent implements OnInit {
|
||||
const control = <FormArray>this._editquestionAnswerForm.controls['temp_questions'];
|
||||
control.removeAt(inx);
|
||||
} else {
|
||||
alert();
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
}
|
||||
// alert(JSON.stringify(value));
|
||||
}
|
||||
|
||||
submitted: boolean;
|
||||
@ -219,7 +211,7 @@ alert();
|
||||
this.submitted = true;
|
||||
// stop here if form is invalid
|
||||
if (this._editquestionAnswerForm.invalid) {
|
||||
alert('no');
|
||||
this.notifier.notify('warning', 'Please Should Fill Required Fields.!');
|
||||
return;
|
||||
} else {
|
||||
var formValues = this._editquestionAnswerForm.value;
|
||||
@ -236,9 +228,6 @@ alert();
|
||||
if (dataresult.status == 200) {
|
||||
console.log(dataresult);
|
||||
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||
// const arr = <FormArray>this._editquestionAnswerForm.controls.temp_questions;
|
||||
// arr.controls.splice(0);
|
||||
// this.getTemplateCategoryDetails();
|
||||
}
|
||||
else {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
@ -249,13 +238,12 @@ alert();
|
||||
// this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
||||
});
|
||||
} else {
|
||||
alert("duplication records occured.!");
|
||||
this.notifier.notify('warning', 'duplication records occured.!');
|
||||
}
|
||||
} else {
|
||||
// Swal('value should equal to 100.!','error');
|
||||
alert("value should equal to 100");
|
||||
this.notifier.notify('warning', 'value should equal to 100.!');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,7 +252,6 @@ alert();
|
||||
checkDuplicateInObject(inputArray) {
|
||||
this.dublicateRerdIndex = -1;
|
||||
let seenDuplicate = false;
|
||||
|
||||
inputArray.map((item, index) => {
|
||||
let currentVal = inputArray[index];
|
||||
for (let i = index + 1; i < inputArray.length; i++) {
|
||||
@ -292,20 +279,12 @@ alert();
|
||||
})
|
||||
export class DialogOverviewExampleDialog {
|
||||
|
||||
// typesOfShoes: string[] = [
|
||||
// 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, ',
|
||||
// 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, ',
|
||||
// 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, ',
|
||||
// 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, ',
|
||||
// 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, '
|
||||
// ];
|
||||
|
||||
public m_questions: any;
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<DialogOverviewExampleDialog>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: DialogData,
|
||||
private templatesService: TemplatesService,
|
||||
private mastersService: MastersService,) {
|
||||
private mastersService: MastersService) {
|
||||
this.getCategoryRemainingQuesMasters();
|
||||
}
|
||||
|
||||
@ -328,8 +307,6 @@ export class DialogOverviewExampleDialog {
|
||||
},
|
||||
error => {
|
||||
this.noRecordFound = true;
|
||||
// this.notifier.notify('warning', 'No Category Master Records Found.!');
|
||||
// this.m_category = "No Category Master Records Found.";
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<mat-card>
|
||||
<!--<pre>{{ templateQuesAnsRecord | json}}</pre>-->
|
||||
<mat-accordion>
|
||||
<mat-expansion-panel *ngFor="let data of templateQuesAnsRecord">
|
||||
<mat-expansion-panel-header fxLayout="row" fxLayoutWrap fxLayoutGap="5%" fxLayoutAlign="start center">
|
||||
@ -14,16 +13,5 @@
|
||||
<app-category-question-answer [CaterogyQuesAns]="data">
|
||||
</app-category-question-answer>
|
||||
</mat-expansion-panel>
|
||||
<!--<mat-expansion-panel (opened)="panelOpenState = true" (closed)="panelOpenState = false">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
Category 2
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
50%
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<p>I'm visible because I am open</p>
|
||||
</mat-expansion-panel>-->
|
||||
</mat-accordion>
|
||||
</mat-card>
|
||||
@ -20,99 +20,20 @@ export class EditQuestionAnswerComponent implements OnInit {
|
||||
|
||||
@Input() questionId: number;
|
||||
|
||||
public _editTempCategoryFrom: FormGroup;
|
||||
public submitted = false;
|
||||
public panelOpenState : boolean;
|
||||
public templateQuesAnsRecord: any;
|
||||
|
||||
firstFormGroup: FormGroup;
|
||||
secondFormGroup: FormGroup;
|
||||
|
||||
constructor(
|
||||
notifier: NotifierService,
|
||||
private templatesService: TemplatesService,
|
||||
private mastersService: MastersService,
|
||||
private _formBuilder: FormBuilder,
|
||||
public dialog: MatDialog) {
|
||||
this.firstFormGroup = this._formBuilder.group({
|
||||
temp_questions: this._formBuilder.array([
|
||||
// this.initAnswers(),
|
||||
])
|
||||
});
|
||||
this.secondFormGroup = this._formBuilder.group({
|
||||
secondCtrl: ''
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getTemplateQuesAnsDetails();
|
||||
this.initalLoadFormData();
|
||||
if(this.categoryList.length > 0){
|
||||
for (let val of this.categoryList) {
|
||||
// alert(JSON.stringify(val));
|
||||
let vals = val;
|
||||
this.addLanguage(vals['fk_category_id'], vals['name'], vals['weightage'], null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setFormQuestionData(record) {
|
||||
// alert(JSON.stringify(record));
|
||||
}
|
||||
|
||||
initalLoadFormData(){
|
||||
this._editTempCategoryFrom = this._formBuilder.group({
|
||||
temp_category: this._formBuilder.array([
|
||||
// this.initAnswers(),
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
// convenience getter for easy access to form fields
|
||||
get f() { return this._editTempCategoryFrom.controls; }
|
||||
|
||||
public m_categoryList = [{
|
||||
fk_category_id: 1,
|
||||
name: 'Category List 1',
|
||||
weightage: 2,
|
||||
},{
|
||||
fk_category_id: 2,
|
||||
name: 'Category List 2',
|
||||
weightage: 5,
|
||||
},{
|
||||
fk_category_id: 3,
|
||||
name: 'Category List 2',
|
||||
weightage: 5,
|
||||
}];
|
||||
|
||||
public categoryList = [{
|
||||
fk_category_id: 1,
|
||||
name: 'Category List 1',
|
||||
weightage: 2,
|
||||
},{
|
||||
fk_category_id: 2,
|
||||
name: 'Category List 2',
|
||||
weightage: 5,
|
||||
}];
|
||||
|
||||
// Dynamic Form field creation Functionality : START ===>
|
||||
initAnswers(fk_cat_id, name, weightage) {
|
||||
return this._formBuilder.group({
|
||||
fk_category_id: [fk_cat_id, Validators.compose([Validators.required])],
|
||||
name: [name, Validators.compose([Validators.required])],
|
||||
weightage: [weightage, Validators.compose([Validators.required])],
|
||||
});
|
||||
}
|
||||
addLanguage(fk_cat_id, name, weightage, e) {
|
||||
const control = <FormArray>this._editTempCategoryFrom.controls['temp_category'];
|
||||
control.push(this.initAnswers(fk_cat_id, name, weightage));
|
||||
}
|
||||
removeLanguage(i: number) {
|
||||
const control = <FormArray>this._editTempCategoryFrom.controls['temp_category'];
|
||||
control.removeAt(i);
|
||||
}
|
||||
|
||||
// END ===>
|
||||
|
||||
getTemplateQuesAnsDetails() {
|
||||
this.templatesService.getTemplateIDQuesAnsDetails(this.questionId).subscribe(
|
||||
@ -120,10 +41,6 @@ export class EditQuestionAnswerComponent implements OnInit {
|
||||
if (data) {
|
||||
if (data.records) {
|
||||
this.templateQuesAnsRecord = data.records;
|
||||
this.setFormQuestionData(this.templateQuesAnsRecord);
|
||||
// this.templateListData = data.records;
|
||||
// this.dataLength = data.records.length;
|
||||
// this.dataSource.data = this.templateListData;
|
||||
} else {
|
||||
// this.noTemplateLendersFound = true;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user