-
-
-
-
-
-
-
-
-
-
- 1" (click)="removeLanguage(i)">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ gp.group_name }}
+
+
+
+
+
+ 1" (click)="removeLanguage(i)">
-
-
-
-
+
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/template/questions/edit/edit.component.ts b/ng6-seed/src/app/template/questions/edit/edit.component.ts
index 16268c336..4db0e5967 100644
--- a/ng6-seed/src/app/template/questions/edit/edit.component.ts
+++ b/ng6-seed/src/app/template/questions/edit/edit.component.ts
@@ -39,6 +39,7 @@ export class EditComponent implements OnInit {
public _addQuesFrom: FormGroup;
public submitted = false;
public categories: any = [];
+ public m_group: any = [];
public questionsOptions: any = [];
errorMessage: string;
@@ -60,15 +61,16 @@ export class EditComponent implements OnInit {
ngOnInit() {
this.loadFormData();
- if (this.data["0"].length > 0) {
- for (let val of this.data["0"]) {
- // alert(JSON.stringify(val));
- let vals = val;
- this.addLanguage(vals['answer'], vals['question_answer_id'], vals['isactive'], null);
- }
- }
+ // if (this.data["0"].length > 0) {
+ // for (let val of this.data["0"]) {
+ // // alert(JSON.stringify(val));
+ // let vals = val;
+ // this.addLanguage(vals['answer'], vals['question_answer_id'], vals['isactive'], null);
+ // }
+ // }
// OnInit Load Category and Question Type Masters
this.getCategoryListMaster();
+ this.getQuestionGroupMaster();
this.getQuestionOptionsMaster();
}
@@ -78,7 +80,7 @@ export class EditComponent implements OnInit {
for (let val of this.data["0"]) {
// alert(JSON.stringify(val));
let vals = val;
- this.addLanguage(vals['answer'], vals['question_answer_id'], vals['isactive'], null);
+ this.addLanguage(vals['answer'], vals['question_answer_id'], vals['fk_question_group_id'], vals['isactive'], null);
}
}
}
@@ -91,6 +93,7 @@ export class EditComponent implements OnInit {
question: [this.data.question, Validators.compose([Validators.required])],
description: [this.data.description, Validators.compose([Validators.required])],
fk_question_category: [this.data.fk_question_category, Validators.compose([Validators.required])],
+ fk_question_group_id: [this.data.fk_question_group_id, Validators.compose([Validators.required])],
fk_question_answertype: [this.data.fk_question_answertype, Validators.compose([Validators.required])],
isactive: [this.data.isactive],
answers: this._formBuilder.array([
@@ -107,17 +110,18 @@ export class EditComponent implements OnInit {
// Dynamic Form field creation Functionality : START ===>
- initAnswers(ans, fk_id, isAct) {
+ initAnswers(ans, fk_id, fk_question_group_id, isAct) {
isAct = isAct == null ? 1 : isAct;
return this._formBuilder.group({
answer: [ans, Validators.compose([Validators.required])],
question_answer_id: [fk_id],
+ fk_question_group_id: [fk_question_group_id],
isactive: [isAct]
});
}
- addLanguage(ans, fk_id, isAct, e) {
+ addLanguage(ans, fk_id, fk_question_group_id, isAct, e) {
const control =
this._addQuesFrom.controls['answers'];
- control.push(this.initAnswers(ans, fk_id, isAct));
+ control.push(this.initAnswers(ans, fk_id, fk_question_group_id, isAct));
}
removeLanguage(i: number) {
const control = this._addQuesFrom.controls['answers'];
@@ -137,6 +141,18 @@ export class EditComponent implements OnInit {
}
)
}
+
+ getQuestionGroupMaster() {
+ this.masterService.getAllMasterData('QUESTIONGROUP').subscribe(
+ data => {
+ this.m_group = data.records;
+ },
+ error => {
+ this.notifier.notify('warning', 'No Question Group Records Found.!');
+ this.errorMessage = "No Question Group Records Found.";
+ }
+ )
+ }
getQuestionOptionsMaster() {
this.masterService.getAllMasterData('QUESTIONANSWERTYPE').subscribe(
data => {