diff --git a/ng6-seed/src/app/template/questions/add/add.component.html b/ng6-seed/src/app/template/questions/add/add.component.html index 48a04cea6..f9dc06f56 100644 --- a/ng6-seed/src/app/template/questions/add/add.component.html +++ b/ng6-seed/src/app/template/questions/add/add.component.html @@ -1,4 +1,5 @@
+<<<<<<< HEAD

{{pageTitle}}

@@ -63,10 +64,77 @@
+
+ + + {{ ct.categroy_name }} + + You must Select Category. + +
+
+ + + You must Include Question. + +
+
+ + + You must Include Description. + +
+
+ + + {{ ans.answer_type_name }} + + You must Select Answer Type. + +
+
+
+
+
+
+
+ + + + + +
+
+ + + +
+
+
+
+ + +
+
+ + +<<<<<<< HEAD
@@ -74,4 +142,13 @@ +======= +
+ + +
+ + + +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
\ 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..d904ca310 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,11 @@ import { FormArray, } from '@angular/forms'; +<<<<<<< HEAD +======= +import { NotifierService } from 'angular-notifier'; + +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe import { MatDialog, MatDialogRef, @@ -21,24 +26,52 @@ import { import { MastersService } from './../../service/masters/masters.service'; import { QuestionsService } from './../../service/questions/questions.service'; +<<<<<<< HEAD +======= +/* +* Question master add details +* : kdk +*/ +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe @Component({ selector: 'app-add', templateUrl: './add.component.html', styleUrls: ['./add.component.scss'] }) export class AddComponent implements OnInit { +<<<<<<< HEAD public pageTitle : string = "Add Question Details"; +======= + + public pageTitle: string = "Add Question Details"; +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe public _addQuesFrom: FormGroup; public submitted = false; public categories: any = []; public questionsOptions: any = []; errorMessage: string; +<<<<<<< HEAD constructor(private _formBuilder: FormBuilder, private dialogRef: MatDialogRef, private masterService: MastersService, private questionsService: QuestionsService) { } +======= + /** + * Notifier service + */ + private notifier: NotifierService; + + constructor( + notifier: NotifierService, + private _formBuilder: FormBuilder, + private dialogRef: MatDialogRef, + private masterService: MastersService, + private questionsService: QuestionsService) { + this.notifier = notifier; + } +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe ngOnInit() { @@ -55,6 +88,7 @@ export class AddComponent implements OnInit { // OnInit Load Category and Question Type Masters this.getCategoryListMaster(); this.getQuestionOptionsMaster(); +<<<<<<< HEAD // /** For SelectDrop Datas*/ // this._mastersService.getAllMasterData('CITY') @@ -68,6 +102,8 @@ export class AddComponent implements OnInit { // }, error => this.errorMessage = error); +======= +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe } // convenience getter for easy access to form fields @@ -96,7 +132,12 @@ export class AddComponent implements OnInit { this.categories = data.records.filter(category => category.isactive == 1); }, error => { +<<<<<<< HEAD this.errorMessage = "No Category Record Found."; +======= + this.notifier.notify('warning', 'No Category Records Found.!'); + this.errorMessage = "No Category Records Found."; +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe } ) } @@ -106,6 +147,10 @@ export class AddComponent implements OnInit { this.questionsOptions = data.records; }, error => { +<<<<<<< HEAD +======= + this.notifier.notify('warning', 'No Answer Type Records Found.!'); +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe this.errorMessage = "No Answer Type Record Found."; } ) @@ -126,6 +171,7 @@ export class AddComponent implements OnInit { } else { var answerFormValues = this._addQuesFrom.value; +<<<<<<< HEAD //To Remove The "Null" With Key also Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); @@ -145,6 +191,31 @@ export class AddComponent implements OnInit { }); //After Saving the BRANCH data then popup close // this.dialogRef.close(); +======= + //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); + 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(); +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe } } 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..0d2782356 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,13 @@
+<<<<<<< HEAD Active/InActive +======= + Active/InActive +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
+<<<<<<< HEAD +======= + +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
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..dfd3287c1 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,13 @@ import { import { MastersService } from './../../service/masters/masters.service'; import { QuestionsService } from './../../service/questions/questions.service'; +<<<<<<< HEAD +======= +/* +* Question master details edit component +* : kdk +*/ +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe @Component({ selector: 'app-edit', templateUrl: './edit.component.html', @@ -31,18 +38,30 @@ import { QuestionsService } from './../../service/questions/questions.service'; export class EditComponent implements OnInit { +<<<<<<< HEAD public pageTitle : string = "Edit Question Details"; +======= + public pageTitle: string = "Edit Question Details"; +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe public _addQuesFrom: FormGroup; public submitted = false; public categories: any = []; public questionsOptions: any = []; errorMessage: string; +<<<<<<< HEAD /** * Notifier service */ private notifier: NotifierService; +======= + + /** + * Notifier service + */ + private notifier: NotifierService; +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe constructor( notifier: NotifierService, @@ -51,8 +70,13 @@ export class EditComponent implements OnInit { private masterService: MastersService, private questionsService: QuestionsService, @Inject(MAT_DIALOG_DATA) public data: any) { +<<<<<<< HEAD this.notifier = notifier; } +======= + this.notifier = notifier; + } +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe ngOnInit() { this.loadFormData(); @@ -63,14 +87,23 @@ export class EditComponent implements OnInit { this.addLanguage(vals['answer'], vals['question_answer_id'], vals['isactive'], null); } } +<<<<<<< HEAD +======= +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe // OnInit Load Category and Question Type Masters this.getCategoryListMaster(); this.getQuestionOptionsMaster(); } +<<<<<<< HEAD loadAnsData(){ if (this.data["0"].length > 0) { +======= + // load answer details list + loadAnsData() { + if (this.data["0"].length > 0) { +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe for (let val of this.data["0"]) { // alert(JSON.stringify(val)); let vals = val; @@ -79,26 +112,46 @@ export class EditComponent implements OnInit { } } +<<<<<<< HEAD loadFormData() { /** Questions Form Datas*/ +======= + // load form data form the master + loadFormData() { + /** Questions Form Datas*/ +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe 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])], +<<<<<<< HEAD isactive:[this.data.isactive], +======= + isactive: [this.data.isactive], +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe answers: this._formBuilder.array([ // this.initAnswers(null, null), ]) }); } +<<<<<<< HEAD get f_ans() { return this._addQuesFrom.get('answers'); } // convenience getter for easy access to form fields get f() { return this._addQuesFrom.controls; } +======= + // 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'); } + + +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe // Dynamic Form field creation Functionality : START ===> initAnswers(ans, fk_id, isAct) { isAct = isAct == null ? 1 : isAct; @@ -125,6 +178,10 @@ export class EditComponent implements OnInit { this.categories = data.records.filter(category => category.isactive == 1); }, error => { +<<<<<<< HEAD +======= + this.notifier.notify('warning', 'No Category Records Found.!'); +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe this.errorMessage = "No Category Record Found."; } ) @@ -135,6 +192,10 @@ export class EditComponent implements OnInit { this.questionsOptions = data.records; }, error => { +<<<<<<< HEAD +======= + this.notifier.notify('warning', 'No Answer Type Records Found.!'); +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe this.errorMessage = "No Answer Type Record Found."; } ) @@ -163,17 +224,30 @@ export class EditComponent implements OnInit { dataresult => { if (dataresult.status == 200) { console.log(dataresult); +<<<<<<< HEAD this.notifier.notify( 'success', 'Your Changes Updated!' ); +======= + this.notifier.notify('success', 'Your Changes Updated.!'); +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe this.dialogRef.close(); // this.notifierService('success', 'You are awesome! I mean it!'); // alert("sample alert for Saving"); } else { +<<<<<<< HEAD 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 = "Something Wents Wrong Try Again.!"; + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.errorMessage = "Some Thing Wents Wrong Try Again.!"; +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe 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..7ca772592 100644 --- a/ng6-seed/src/app/template/questions/list/list.component.html +++ b/ng6-seed/src/app/template/questions/list/list.component.html @@ -1,5 +1,6 @@
+<<<<<<< HEAD + + {{cat.categroy_name}} + + +
+ + +
+ +
+ + + + + +
+ +
+ +
+ +
+
+ {{ product.categroy_name }} +
+
+
{{ product.question }} +
+
+
+
+
+ + +
+
+ +<<<<<<< HEAD
@@ -96,6 +155,19 @@ 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..7792de345 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,12 @@ color: #fff; box-shadow: 0 2px 3px #c8bbbb; } +<<<<<<< HEAD +======= + +.no-record-found { + font-size: 18px; + color: #03a9f4; + padding : 12px 8px; +} +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe 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..ea4e65f38 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,11 @@ import { Component, ViewChild, OnInit } from '@angular/core'; +<<<<<<< HEAD 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'; +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe import { DataSource } from '@angular/cdk/table'; import { Observable } from 'rxjs/Observable'; import { QuestionsService } from './../../service/questions/questions.service'; @@ -9,12 +14,20 @@ import { MastersService } from './../../service/masters/masters.service'; import { AddComponent } from './../add/add.component'; import { EditComponent } from './../edit/edit.component'; +<<<<<<< HEAD +======= +/* +* Questions master List component +* : kdk +*/ +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe @Component({ selector: 'app-list', templateUrl: './list.component.html', styleUrls: ['./list.component.scss'] }) export class ListComponent implements OnInit { +<<<<<<< HEAD public productList: any[] = []; public paginationList: any[] = []; @@ -31,15 +44,38 @@ export class ListComponent implements OnInit { pageEvent: PageEvent; +======= + + public productList: any[] = []; + public paginationList: any[] = []; + public categories: any = []; + public search_cid: any = null; + public noQuesMasterRecrdFound: boolean = false; + + public filterFormGroupCtrl: FormGroup; + + // pagination variable details + length = 50; + pageIndex = 0; + pageSize = 10; + pageEvent: PageEvent; + + // data source variable details +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe questionListData = null; public dataLength: number; public dataSource = new MatTableDataSource(); displayedColumns = ['categroy_name', 'question', 'actions']; +<<<<<<< HEAD +======= + +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; constructor(private dialog: MatDialog, +<<<<<<< HEAD private questionsService: QuestionsService, private masterService: MastersService) { this.getQuestionsMasters(); @@ -64,6 +100,50 @@ export class ListComponent implements OnInit { } getCategorMaster() { +======= + private questionsService: QuestionsService, + private masterService: MastersService, + private _formBuilder: FormBuilder) { + this.filterFormGroupCtrl = this._formBuilder.group({ + category: [null, ''] + }); + } + + ngOnInit() { + this.getCategorMaster(); + this.getQuestionsMasters(); + } + + // 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() { +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe this.masterService.getAllMasterData('QUESTIONCATEGORY').subscribe( data => { this.categories = data.records.filter(category => category.isactive == 1); @@ -74,7 +154,11 @@ export class ListComponent implements OnInit { ) } +<<<<<<< HEAD ngAfterViewInit() { +======= + ngAfterViewInit() { +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort; } @@ -88,6 +172,7 @@ export class ListComponent implements OnInit { // add questions popup model call addNewQuestion() { const dialogRef = this.dialog.open(AddComponent, { +<<<<<<< HEAD data: {} }); @@ -112,6 +197,33 @@ export class ListComponent implements OnInit { }); } +======= + data: {}, + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + this.getQuestionsMasters(); + // this.getBranch(); + // this.isPopupOpened = false; + }); + } + + // 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; + }); + } + // padination page event call +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe 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..872db1b18 100644 --- a/ng6-seed/src/app/template/questions/questions.module.ts +++ b/ng6-seed/src/app/template/questions/questions.module.ts @@ -28,9 +28,14 @@ import { AddComponent } from './add/add.component'; import { EditComponent } from './edit/edit.component'; /* * Question Master Module details +<<<<<<< HEAD */ +======= +* : kdk +*/ +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe /** * Custom angular notifier options */ @@ -42,7 +47,11 @@ const customNotifierOptions: NotifierOptions = { }, vertical: { position: 'top', +<<<<<<< HEAD distance: 12, +======= + distance: 32, +>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe gap: 10 } },