-
-
-
-
-
-
-
-
-
-
-
-
1" (click)="removeLanguage(i)">
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/template/questions/add/add.component.ts b/ng6-seed/src/app/template/questions/add/add.component.ts
index 60ccf36f4..c8824cd9e 100644
--- a/ng6-seed/src/app/template/questions/add/add.component.ts
+++ b/ng6-seed/src/app/template/questions/add/add.component.ts
@@ -12,6 +12,8 @@ import {
FormArray,
} from '@angular/forms';
+import { NotifierService } from 'angular-notifier';
+
import {
MatDialog,
MatDialogRef,
@@ -21,24 +23,37 @@ import {
import { MastersService } from './../../service/masters/masters.service';
import { QuestionsService } from './../../service/questions/questions.service';
+/*
+* Question master add details
+* : kdk
+*/
@Component({
selector: 'app-add',
templateUrl: './add.component.html',
styleUrls: ['./add.component.scss']
})
export class AddComponent implements OnInit {
-
- public pageTitle : string = "Add Question Details";
+
+ public pageTitle: string = "Add Question Details";
public _addQuesFrom: FormGroup;
public submitted = false;
public categories: any = [];
public questionsOptions: any = [];
errorMessage: string;
- constructor(private _formBuilder: FormBuilder,
+ /**
+ * Notifier service
+ */
+ private notifier: NotifierService;
+
+ constructor(
+ notifier: NotifierService,
+ private _formBuilder: FormBuilder,
private dialogRef: MatDialogRef
,
private masterService: MastersService,
- private questionsService: QuestionsService) { }
+ private questionsService: QuestionsService) {
+ this.notifier = notifier;
+ }
ngOnInit() {
@@ -55,19 +70,6 @@ export class AddComponent implements OnInit {
// OnInit Load Category and Question Type Masters
this.getCategoryListMaster();
this.getQuestionOptionsMaster();
-
- // /** For SelectDrop Datas*/
- // this._mastersService.getAllMasterData('CITY')
- // .subscribe(
- // data => {
-
- // if (data.status == 200) {
- // this.citydatas = data.records;
- // this.citydatas = this.citydatas.filter(city=>city.isactive == 1 );
- // }
-
- // }, error => this.errorMessage = error);
-
}
// convenience getter for easy access to form fields
@@ -96,7 +98,8 @@ export class AddComponent implements OnInit {
this.categories = data.records.filter(category => category.isactive == 1);
},
error => {
- this.errorMessage = "No Category Record Found.";
+ this.notifier.notify('warning', 'No Category Records Found.!');
+ this.errorMessage = "No Category Records Found.";
}
)
}
@@ -106,6 +109,7 @@ export class AddComponent implements OnInit {
this.questionsOptions = data.records;
},
error => {
+ this.notifier.notify('warning', 'No Answer Type Records Found.!');
this.errorMessage = "No Answer Type Record Found.";
}
)
@@ -126,25 +130,29 @@ export class AddComponent implements OnInit {
} else {
var answerFormValues = this._addQuesFrom.value;
- //To Remove The "Null" With Key also
- Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
+ //To Remove The "Null" With Key also
+ Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
- //Add BRANCH data with help Service File
- this.questionsService.addQuestionMasterDetails(answerFormValues).subscribe(
- dataresult => {
- if (dataresult.status == 200) {
- console.log(dataresult);
- alert("sample alert for Saving");
- }
- else {
- this.errorMessage = "Some Thing Wents Wrong Try Again !";
- }
- } , error => {
- this.errorMessage = "Some Thing Wents Wrong Try Again !";
- this.dialogRef.close();
- });
- //After Saving the BRANCH data then popup close
- // this.dialogRef.close();
+ //Add BRANCH data with help Service File
+ this.questionsService.addQuestionMasterDetails(answerFormValues).subscribe(
+ dataresult => {
+ if (dataresult.status == 200) {
+ console.log(dataresult);
+ this.notifier.notify('success', 'Record Saved Successfully.!');
+ this.dialogRef.close();
+ // alert("sample alert for Saving");
+ }
+ else {
+ this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ this.errorMessage = "Some Thing Wents Wrong Try Again !";
+ }
+ }, error => {
+ this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ this.errorMessage = "Something Wents Wrong Try Again !";
+ this.dialogRef.close();
+ });
+ //After Saving the BRANCH data then popup close
+ // this.dialogRef.close();
}
}
diff --git a/ng6-seed/src/app/template/questions/edit/edit.component.html b/ng6-seed/src/app/template/questions/edit/edit.component.html
index 6ee59cc58..a3804dcee 100644
--- a/ng6-seed/src/app/template/questions/edit/edit.component.html
+++ b/ng6-seed/src/app/template/questions/edit/edit.component.html
@@ -65,8 +65,8 @@
- Active/InActive
+ Active/InActive
-
+
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 726bb8e56..20dd63a40 100644
--- a/ng6-seed/src/app/template/questions/edit/edit.component.ts
+++ b/ng6-seed/src/app/template/questions/edit/edit.component.ts
@@ -23,6 +23,10 @@ import {
import { MastersService } from './../../service/masters/masters.service';
import { QuestionsService } from './../../service/questions/questions.service';
+/*
+* Question master details edit component
+* : kdk
+*/
@Component({
selector: 'app-edit',
templateUrl: './edit.component.html',
@@ -31,18 +35,18 @@ import { QuestionsService } from './../../service/questions/questions.service';
export class EditComponent implements OnInit {
- public pageTitle : string = "Edit Question Details";
+ public pageTitle: string = "Edit Question Details";
public _addQuesFrom: FormGroup;
public submitted = false;
public categories: any = [];
public questionsOptions: any = [];
errorMessage: string;
-
+
/**
* Notifier service
*/
- private notifier: NotifierService;
+ private notifier: NotifierService;
constructor(
notifier: NotifierService,
@@ -51,8 +55,8 @@ export class EditComponent implements OnInit {
private masterService: MastersService,
private questionsService: QuestionsService,
@Inject(MAT_DIALOG_DATA) public data: any) {
- this.notifier = notifier;
- }
+ this.notifier = notifier;
+ }
ngOnInit() {
this.loadFormData();
@@ -63,14 +67,14 @@ export class EditComponent implements OnInit {
this.addLanguage(vals['answer'], vals['question_answer_id'], vals['isactive'], null);
}
}
-
// OnInit Load Category and Question Type Masters
this.getCategoryListMaster();
this.getQuestionOptionsMaster();
}
- loadAnsData(){
- if (this.data["0"].length > 0) {
+ // load answer details list
+ loadAnsData() {
+ if (this.data["0"].length > 0) {
for (let val of this.data["0"]) {
// alert(JSON.stringify(val));
let vals = val;
@@ -79,26 +83,29 @@ export class EditComponent implements OnInit {
}
}
+ // load form data form the master
loadFormData() {
- /** Questions Form Datas*/
+ /** Questions Form Datas*/
this._addQuesFrom = this._formBuilder.group({
question_id: [this.data.question_id],
question: [this.data.question, Validators.compose([Validators.required])],
description: [this.data.description, Validators.compose([Validators.required])],
fk_question_catagory: [this.data.fk_question_catagory, Validators.compose([Validators.required])],
fk_question_answertype: [this.data.fk_question_answertype, Validators.compose([Validators.required])],
- isactive:[this.data.isactive],
+ isactive: [this.data.isactive],
answers: this._formBuilder.array([
// this.initAnswers(null, null),
])
});
}
- get f_ans() { return
this._addQuesFrom.get('answers'); }
-
// convenience getter for easy access to form fields
get f() { return this._addQuesFrom.controls; }
+ // form answer details access
+ get f_ans() { return this._addQuesFrom.get('answers'); }
+
+
// Dynamic Form field creation Functionality : START ===>
initAnswers(ans, fk_id, isAct) {
isAct = isAct == null ? 1 : isAct;
@@ -125,6 +132,7 @@ export class EditComponent implements OnInit {
this.categories = data.records.filter(category => category.isactive == 1);
},
error => {
+ this.notifier.notify('warning', 'No Category Records Found.!');
this.errorMessage = "No Category Record Found.";
}
)
@@ -135,6 +143,7 @@ export class EditComponent implements OnInit {
this.questionsOptions = data.records;
},
error => {
+ this.notifier.notify('warning', 'No Answer Type Records Found.!');
this.errorMessage = "No Answer Type Record Found.";
}
)
@@ -163,17 +172,18 @@ export class EditComponent implements OnInit {
dataresult => {
if (dataresult.status == 200) {
console.log(dataresult);
- this.notifier.notify( 'success', 'Your Changes Updated!' );
+ this.notifier.notify('success', 'Your Changes Updated.!');
this.dialogRef.close();
// this.notifierService('success', 'You are awesome! I mean it!');
// alert("sample alert for Saving");
}
else {
- this.notifier.notify( 'warning', 'Something Wents Wrong Try Again !' );
- this.errorMessage = "Something Wents Wrong Try Again !";
+ this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ this.errorMessage = "Something Wents Wrong Try Again.!";
}
}, error => {
- this.errorMessage = "Some Thing Wents Wrong Try Again !";
+ this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ this.errorMessage = "Some Thing Wents Wrong Try Again.!";
this.dialogRef.close();
});
//After Saving the BRANCH data then popup close
diff --git a/ng6-seed/src/app/template/questions/list/list.component.html b/ng6-seed/src/app/template/questions/list/list.component.html
index 0ee433bb7..5d45ad099 100644
--- a/ng6-seed/src/app/template/questions/list/list.component.html
+++ b/ng6-seed/src/app/template/questions/list/list.component.html
@@ -1,58 +1,53 @@
-
-
-
-
Questions Master
-
List of Questions
-
-
-
-
-
-
-
-
-
- {{cat.categroy_name}}
-
-
-
-
+
+
+
Questions Master
+
List of Questions
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
-
0">
-
-
-
-
-
-
-
-
- {{ product.categroy_name }}
+
+
+ {{ product.categroy_name }}
+
+
+
{{ product.question }}
+
+
-
-
{{ product.question }}
-
-
-
-
-
-
-
-
-
+
+
+
+
+ No Record Found ...
+
-
-
-
+
-
-
diff --git a/ng6-seed/src/app/template/questions/list/list.component.scss b/ng6-seed/src/app/template/questions/list/list.component.scss
index 67712370e..fa863a272 100644
--- a/ng6-seed/src/app/template/questions/list/list.component.scss
+++ b/ng6-seed/src/app/template/questions/list/list.component.scss
@@ -44,3 +44,9 @@
color: #fff;
box-shadow: 0 2px 3px #c8bbbb;
}
+
+.no-record-found {
+ font-size: 18px;
+ color: #03a9f4;
+ padding : 12px 8px;
+}
\ No newline at end of file
diff --git a/ng6-seed/src/app/template/questions/list/list.component.ts b/ng6-seed/src/app/template/questions/list/list.component.ts
index c670fd325..4ef7238db 100644
--- a/ng6-seed/src/app/template/questions/list/list.component.ts
+++ b/ng6-seed/src/app/template/questions/list/list.component.ts
@@ -1,6 +1,6 @@
import { Component, ViewChild, OnInit } from '@angular/core';
-import { MatPaginator, MatSort, MatTableDataSource, MatDialog, PageEvent} from '@angular/material';
-import { FormGroup, FormControl } from '@angular/forms';
+import { MatPaginator, MatSort, MatTableDataSource, MatDialog, PageEvent } from '@angular/material';
+import { FormGroup, FormControl, FormBuilder } from '@angular/forms';
import { DataSource } from '@angular/cdk/table';
import { Observable } from 'rxjs/Observable';
import { QuestionsService } from './../../service/questions/questions.service';
@@ -9,61 +9,83 @@ import { MastersService } from './../../service/masters/masters.service';
import { AddComponent } from './../add/add.component';
import { EditComponent } from './../edit/edit.component';
+/*
+* Questions master List component
+* : kdk
+*/
@Component({
selector: 'app-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.scss']
})
export class ListComponent implements OnInit {
-
+
public productList: any[] = [];
public paginationList: any[] = [];
public categories: any = [];
- public search_cid :any = null;
+ public search_cid: any = null;
+ public noQuesMasterRecrdFound: boolean = false;
- public filterFormCtrl : FormControl = new FormControl();
- /** control for the MatSelect filter keyword */
- // public masterFilterCtrl: FormControl = new FormControl();
+ public filterFormGroupCtrl: FormGroup;
+ // pagination variable details
length = 50;
pageIndex = 0;
pageSize = 10;
-
pageEvent: PageEvent;
+ // data source variable details
questionListData = null;
public dataLength: number;
public dataSource = new MatTableDataSource();
displayedColumns = ['categroy_name', 'question', 'actions'];
-
+
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
constructor(private dialog: MatDialog,
- private questionsService: QuestionsService,
- private masterService: MastersService) {
- this.getQuestionsMasters();
- }
-
- getQuestionsMasters(){
- this.search_cid = this.filterFormCtrl.value;
- console.log(this.filterFormCtrl);
- this.questionsService.getQuestionMasterDetails(this.search_cid).subscribe(
- data => {
- this.productList = data.records;
- this.questionListData = data.records;
- // alert(this.userData);
- this.dataLength = data.records.length;
- this.dataSource.data = this.questionListData;
- }
- )
- }
+ private questionsService: QuestionsService,
+ private masterService: MastersService,
+ private _formBuilder: FormBuilder) {
+ this.filterFormGroupCtrl = this._formBuilder.group({
+ category: [null, '']
+ });
+ }
ngOnInit() {
this.getCategorMaster();
+ this.getQuestionsMasters();
}
- getCategorMaster() {
+ // get question master list details
+ getQuestionsMasters() {
+ this.noQuesMasterRecrdFound = false;
+ this.search_cid = this.filterFormGroupCtrl.controls.category.value;
+ console.log(this.search_cid + ", " + this.filterFormGroupCtrl);
+ this.questionsService.getQuestionMasterDetails(this.search_cid).subscribe(
+ data => {
+ if (data) {
+ if (data.records) {
+ this.productList = data.records;
+ this.questionListData = data.records;
+ this.dataLength = data.records.length;
+ this.dataSource.data = this.questionListData;
+ } else {
+ this.productList = [];
+ this.dataLength = null;
+ this.noQuesMasterRecrdFound = true;
+ }
+ } else {
+ this.productList = [];
+ this.dataLength = null;
+ this.noQuesMasterRecrdFound = true;
+ }
+ }
+ )
+ }
+
+ // get category master details
+ getCategorMaster() {
this.masterService.getAllMasterData('QUESTIONCATEGORY').subscribe(
data => {
this.categories = data.records.filter(category => category.isactive == 1);
@@ -74,7 +96,7 @@ export class ListComponent implements OnInit {
)
}
- ngAfterViewInit() {
+ ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
@@ -88,30 +110,31 @@ export class ListComponent implements OnInit {
// add questions popup model call
addNewQuestion() {
const dialogRef = this.dialog.open(AddComponent, {
- data: {}
+ data: {},
+ disableClose: true
});
-
dialogRef.afterClosed()
- .subscribe(dataresult => {
- this.getQuestionsMasters();
- // this.getBranch();
- // this.isPopupOpened = false;
- });
+ .subscribe(dataresult => {
+ this.getQuestionsMasters();
+ // this.getBranch();
+ // this.isPopupOpened = false;
+ });
}
- editQuestion(rowDetails: any){
- const dialogRef = this.dialog.open(EditComponent, {
- data: rowDetails
+ // edit questions master details popup model
+ editQuestion(rowDetails: any) {
+ const dialogRef = this.dialog.open(EditComponent, {
+ data: rowDetails,
+ disableClose: true
});
-
dialogRef.afterClosed()
- .subscribe(dataresult => {
- this.getQuestionsMasters();
- // this.getBranch();
- // this.isPopupOpened = false;
- });
+ .subscribe(dataresult => {
+ this.getQuestionsMasters();
+ // this.getBranch();
+ // this.isPopupOpened = false;
+ });
}
-
+ // padination page event call
pageChange(e) {
console.log(e);
}
diff --git a/ng6-seed/src/app/template/questions/questions.module.ts b/ng6-seed/src/app/template/questions/questions.module.ts
index 0c8a20bd5..e5e6301fb 100644
--- a/ng6-seed/src/app/template/questions/questions.module.ts
+++ b/ng6-seed/src/app/template/questions/questions.module.ts
@@ -28,9 +28,8 @@ import { AddComponent } from './add/add.component';
import { EditComponent } from './edit/edit.component';
/*
* Question Master Module details
+* : kdk
*/
-
-
/**
* Custom angular notifier options
*/
@@ -42,7 +41,7 @@ const customNotifierOptions: NotifierOptions = {
},
vertical: {
position: 'top',
- distance: 12,
+ distance: 32,
gap: 10
}
},