question master changes : kdk
This commit is contained in:
parent
7400b4f216
commit
3bdd446b07
@ -12,6 +12,8 @@ import {
|
|||||||
FormArray,
|
FormArray,
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
|
|
||||||
|
import { NotifierService } from 'angular-notifier';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MatDialog,
|
MatDialog,
|
||||||
MatDialogRef,
|
MatDialogRef,
|
||||||
@ -21,6 +23,10 @@ import {
|
|||||||
import { MastersService } from './../../service/masters/masters.service';
|
import { MastersService } from './../../service/masters/masters.service';
|
||||||
import { QuestionsService } from './../../service/questions/questions.service';
|
import { QuestionsService } from './../../service/questions/questions.service';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Question master add details
|
||||||
|
* : kdk
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-add',
|
selector: 'app-add',
|
||||||
templateUrl: './add.component.html',
|
templateUrl: './add.component.html',
|
||||||
@ -35,10 +41,19 @@ export class AddComponent implements OnInit {
|
|||||||
public questionsOptions: any = [];
|
public questionsOptions: any = [];
|
||||||
errorMessage: string;
|
errorMessage: string;
|
||||||
|
|
||||||
constructor(private _formBuilder: FormBuilder,
|
/**
|
||||||
|
* Notifier service
|
||||||
|
*/
|
||||||
|
private notifier: NotifierService;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
notifier: NotifierService,
|
||||||
|
private _formBuilder: FormBuilder,
|
||||||
private dialogRef: MatDialogRef<AddComponent>,
|
private dialogRef: MatDialogRef<AddComponent>,
|
||||||
private masterService: MastersService,
|
private masterService: MastersService,
|
||||||
private questionsService: QuestionsService) { }
|
private questionsService: QuestionsService) {
|
||||||
|
this.notifier = notifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -55,19 +70,6 @@ export class AddComponent implements OnInit {
|
|||||||
// OnInit Load Category and Question Type Masters
|
// OnInit Load Category and Question Type Masters
|
||||||
this.getCategoryListMaster();
|
this.getCategoryListMaster();
|
||||||
this.getQuestionOptionsMaster();
|
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 = <any> error);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// convenience getter for easy access to form fields
|
// 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);
|
this.categories = data.records.filter(category => category.isactive == 1);
|
||||||
},
|
},
|
||||||
error => {
|
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;
|
this.questionsOptions = data.records;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
this.notifier.notify('warning', 'No Answer Type Records Found.!');
|
||||||
this.errorMessage = "No Answer Type Record Found.";
|
this.errorMessage = "No Answer Type Record Found.";
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -134,13 +138,17 @@ export class AddComponent implements OnInit {
|
|||||||
dataresult => {
|
dataresult => {
|
||||||
if (dataresult.status == 200) {
|
if (dataresult.status == 200) {
|
||||||
console.log(dataresult);
|
console.log(dataresult);
|
||||||
alert("sample alert for Saving");
|
this.notifier.notify('success', 'Record Saved Successfully.!');
|
||||||
|
this.dialogRef.close();
|
||||||
|
// alert("sample alert for Saving");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
||||||
}
|
}
|
||||||
}, error => {
|
}, 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 !";
|
||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
});
|
});
|
||||||
//After Saving the BRANCH data then popup close
|
//After Saving the BRANCH data then popup close
|
||||||
|
|||||||
@ -75,7 +75,8 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>-->
|
</ul>-->
|
||||||
<div class="row" style="text-align:right;">
|
<div class="row" style="text-align:right;">
|
||||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button"
|
||||||
|
(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
<!--</div>-->
|
<!--</div>-->
|
||||||
|
|||||||
@ -23,6 +23,10 @@ import {
|
|||||||
import { MastersService } from './../../service/masters/masters.service';
|
import { MastersService } from './../../service/masters/masters.service';
|
||||||
import { QuestionsService } from './../../service/questions/questions.service';
|
import { QuestionsService } from './../../service/questions/questions.service';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Question master details edit component
|
||||||
|
* : kdk
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-edit',
|
selector: 'app-edit',
|
||||||
templateUrl: './edit.component.html',
|
templateUrl: './edit.component.html',
|
||||||
@ -63,12 +67,12 @@ export class EditComponent implements OnInit {
|
|||||||
this.addLanguage(vals['answer'], vals['question_answer_id'], vals['isactive'], null);
|
this.addLanguage(vals['answer'], vals['question_answer_id'], vals['isactive'], null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnInit Load Category and Question Type Masters
|
// OnInit Load Category and Question Type Masters
|
||||||
this.getCategoryListMaster();
|
this.getCategoryListMaster();
|
||||||
this.getQuestionOptionsMaster();
|
this.getQuestionOptionsMaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load answer details list
|
||||||
loadAnsData() {
|
loadAnsData() {
|
||||||
if (this.data["0"].length > 0) {
|
if (this.data["0"].length > 0) {
|
||||||
for (let val of this.data["0"]) {
|
for (let val of this.data["0"]) {
|
||||||
@ -79,6 +83,7 @@ export class EditComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load form data form the master
|
||||||
loadFormData() {
|
loadFormData() {
|
||||||
/** Questions Form Datas*/
|
/** Questions Form Datas*/
|
||||||
this._addQuesFrom = this._formBuilder.group({
|
this._addQuesFrom = this._formBuilder.group({
|
||||||
@ -94,11 +99,13 @@ export class EditComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get f_ans() { return <FormArray>this._addQuesFrom.get('answers'); }
|
|
||||||
|
|
||||||
// convenience getter for easy access to form fields
|
// convenience getter for easy access to form fields
|
||||||
get f() { return this._addQuesFrom.controls; }
|
get f() { return this._addQuesFrom.controls; }
|
||||||
|
|
||||||
|
// form answer details access
|
||||||
|
get f_ans() { return <FormArray>this._addQuesFrom.get('answers'); }
|
||||||
|
|
||||||
|
|
||||||
// Dynamic Form field creation Functionality : START ===>
|
// Dynamic Form field creation Functionality : START ===>
|
||||||
initAnswers(ans, fk_id, isAct) {
|
initAnswers(ans, fk_id, isAct) {
|
||||||
isAct = isAct == null ? 1 : isAct;
|
isAct = isAct == null ? 1 : isAct;
|
||||||
@ -125,6 +132,7 @@ export class EditComponent implements OnInit {
|
|||||||
this.categories = data.records.filter(category => category.isactive == 1);
|
this.categories = data.records.filter(category => category.isactive == 1);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
this.notifier.notify('warning', 'No Category Records Found.!');
|
||||||
this.errorMessage = "No Category Record Found.";
|
this.errorMessage = "No Category Record Found.";
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -135,6 +143,7 @@ export class EditComponent implements OnInit {
|
|||||||
this.questionsOptions = data.records;
|
this.questionsOptions = data.records;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
this.notifier.notify('warning', 'No Answer Type Records Found.!');
|
||||||
this.errorMessage = "No Answer Type Record Found.";
|
this.errorMessage = "No Answer Type Record Found.";
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -163,17 +172,18 @@ export class EditComponent implements OnInit {
|
|||||||
dataresult => {
|
dataresult => {
|
||||||
if (dataresult.status == 200) {
|
if (dataresult.status == 200) {
|
||||||
console.log(dataresult);
|
console.log(dataresult);
|
||||||
this.notifier.notify( 'success', 'Your Changes Updated!' );
|
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
// this.notifierService('success', 'You are awesome! I mean it!');
|
// this.notifierService('success', 'You are awesome! I mean it!');
|
||||||
// alert("sample alert for Saving");
|
// alert("sample alert for Saving");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify( 'warning', 'Something Wents Wrong Try Again !' );
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
this.errorMessage = "Something Wents Wrong Try Again !";
|
this.errorMessage = "Something Wents Wrong Try Again.!";
|
||||||
}
|
}
|
||||||
}, error => {
|
}, 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();
|
this.dialogRef.close();
|
||||||
});
|
});
|
||||||
//After Saving the BRANCH data then popup close
|
//After Saving the BRANCH data then popup close
|
||||||
|
|||||||
@ -1,29 +1,23 @@
|
|||||||
<div>
|
<div>
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card class="mat-elevation-z1">
|
<mat-card class="mat-elevation-z1">
|
||||||
<!--<mat-card-title><span> Questions Master </span></mat-card-title>
|
|
||||||
<mat-card-subtitle> List of Questions</mat-card-subtitle>
|
|
||||||
<mat-card-content>-->
|
|
||||||
<div style="margin: 6px; padding: 4px;">
|
<div style="margin: 6px; padding: 4px;">
|
||||||
<div class="p_title" style="font-size: 16px; font-style: bold;">Questions Master</div>
|
<div class="p_title" style="font-size: 16px; font-style: bold;">Questions Master</div>
|
||||||
<div class="sub_title" style="font-size: 11px;">List of Questions</div>
|
<div class="sub_title" style="font-size: 11px;">List of Questions</div>
|
||||||
</div>
|
</div>
|
||||||
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="center none">
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="center none">
|
||||||
<div fxFlex="80%">
|
<div fxFlex="80%">
|
||||||
|
<form [formGroup]="filterFormGroupCtrl">
|
||||||
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="0.5px" fxLayoutAlign="start none" style="padding: 6px;">
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="0.5px" fxLayoutAlign="start none" style="padding: 6px;">
|
||||||
<!--<mat-form-field class="example-full-width">
|
|
||||||
<input matInput placeholder="Category" value="">
|
<mat-select placeholder="Category" formControlName="category">
|
||||||
</mat-form-field>-->
|
|
||||||
<!--<mat-form-field>-->
|
|
||||||
<mat-select placeholder="Category" formControlName="filterFormCtrl">
|
|
||||||
<!--<ngx-mat-select-search [formControl]="masterFilterCtrl" ></ngx-mat-select-search>-->
|
<!--<ngx-mat-select-search [formControl]="masterFilterCtrl" ></ngx-mat-select-search>-->
|
||||||
<mat-option *ngFor="let cat of categories" [value]="cat.question_categroy_id" (click)="getQuestionsMasters()">
|
<mat-option *ngFor="let cat of categories" [value]="cat.question_categroy_id" (click)="getQuestionsMasters()">
|
||||||
{{cat.categroy_name}}
|
{{cat.categroy_name}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|
||||||
<!--</mat-form-field>-->
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="20%">
|
<div fxFlex="20%">
|
||||||
<button mat-stroked-button color="primary" (click)="addNewQuestion()">Add Questions</button>
|
<button mat-stroked-button color="primary" (click)="addNewQuestion()">Add Questions</button>
|
||||||
@ -35,7 +29,7 @@
|
|||||||
<ng-container *ngIf="productList.length > 0">
|
<ng-container *ngIf="productList.length > 0">
|
||||||
<div style="padding: 0 12px;">
|
<div style="padding: 0 12px;">
|
||||||
<mat-card class="product-card" *ngFor="let product of dataSource.connect() | async">
|
<mat-card class="product-card" *ngFor="let product of dataSource.connect() | async">
|
||||||
<div fxLayout="row" fxLayoutAlign="start start">
|
<div fxLayout="row" fxLayoutAlign="start start" style="padding: 6px 2px;">
|
||||||
|
|
||||||
<div fxFlex="90%" style="padding: 12px 8px;">
|
<div fxFlex="90%" style="padding: 12px 8px;">
|
||||||
<!--<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="start none">
|
<!--<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="start none">
|
||||||
@ -52,7 +46,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="10%">
|
<div fxFlex="10%">
|
||||||
<button mat-icon-button [matMenuTriggerFor]="menu">
|
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="editQuestion(product)"><mat-icon>edit</mat-icon></button>
|
||||||
|
<!--<button mat-icon-button [matMenuTriggerFor]="menu">
|
||||||
<mat-icon>more_vert</mat-icon>
|
<mat-icon>more_vert</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-menu #menu="matMenu">
|
<mat-menu #menu="matMenu">
|
||||||
@ -60,7 +55,7 @@
|
|||||||
<mat-icon>create</mat-icon>
|
<mat-icon>create</mat-icon>
|
||||||
<span>Edit</span>
|
<span>Edit</span>
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<mat-card-header>
|
<!--<mat-card-header>
|
||||||
@ -78,23 +73,13 @@
|
|||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<mat-card *ngIf="noQuesMasterRecrdFound">
|
||||||
|
<div class="no-record-found">No Record Found ... </div>
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
<!--<mat-paginator
|
<mat-paginator #paginator class="mat-elevation-z1" [length]="productList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
|
||||||
#paginator
|
[pageSizeOptions]="[5, 10, 25, 100]" (page)="pageEvent = $event; pageChange($event)">
|
||||||
[length]="productList.length"
|
|
||||||
[pageSize]="5"
|
|
||||||
[pageSizeOptions]="[5, 10, 25, 100]"
|
|
||||||
[showFirstLastButtons]="true">
|
|
||||||
</mat-paginator>-->
|
|
||||||
|
|
||||||
<mat-paginator #paginator class="mat-elevation-z1"
|
|
||||||
[length]="productList.length"
|
|
||||||
[pageIndex]="pageIndex"
|
|
||||||
[pageSize]="pageSize"
|
|
||||||
[pageSizeOptions]="[5, 10, 25, 100]"
|
|
||||||
(page)="pageEvent = $event; pageChange($event)">
|
|
||||||
</mat-paginator>
|
</mat-paginator>
|
||||||
|
|
||||||
<!--<mat-card>
|
<!--<mat-card>
|
||||||
<div class="example-container mat-elevation-z8">
|
<div class="example-container mat-elevation-z8">
|
||||||
<mat-table [dataSource]="dataSource" matSort>
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
|||||||
@ -44,3 +44,9 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
box-shadow: 0 2px 3px #c8bbbb;
|
box-shadow: 0 2px 3px #c8bbbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-record-found {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #03a9f4;
|
||||||
|
padding : 12px 8px;
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatTableDataSource, MatDialog, PageEvent } from '@angular/material';
|
import { MatPaginator, MatSort, MatTableDataSource, MatDialog, PageEvent } from '@angular/material';
|
||||||
import { FormGroup, FormControl } from '@angular/forms';
|
import { FormGroup, FormControl, FormBuilder } from '@angular/forms';
|
||||||
import { DataSource } from '@angular/cdk/table';
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { QuestionsService } from './../../service/questions/questions.service';
|
import { QuestionsService } from './../../service/questions/questions.service';
|
||||||
@ -9,6 +9,10 @@ import { MastersService } from './../../service/masters/masters.service';
|
|||||||
import { AddComponent } from './../add/add.component';
|
import { AddComponent } from './../add/add.component';
|
||||||
import { EditComponent } from './../edit/edit.component';
|
import { EditComponent } from './../edit/edit.component';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Questions master List component
|
||||||
|
* : kdk
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list',
|
selector: 'app-list',
|
||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
@ -20,17 +24,17 @@ export class ListComponent implements OnInit {
|
|||||||
public paginationList: any[] = [];
|
public paginationList: any[] = [];
|
||||||
public categories: any = [];
|
public categories: any = [];
|
||||||
public search_cid: any = null;
|
public search_cid: any = null;
|
||||||
|
public noQuesMasterRecrdFound: boolean = false;
|
||||||
|
|
||||||
public filterFormCtrl : FormControl = new FormControl();
|
public filterFormGroupCtrl: FormGroup;
|
||||||
/** control for the MatSelect filter keyword */
|
|
||||||
// public masterFilterCtrl: FormControl = new FormControl();
|
|
||||||
|
|
||||||
|
// pagination variable details
|
||||||
length = 50;
|
length = 50;
|
||||||
pageIndex = 0;
|
pageIndex = 0;
|
||||||
pageSize = 10;
|
pageSize = 10;
|
||||||
|
|
||||||
pageEvent: PageEvent;
|
pageEvent: PageEvent;
|
||||||
|
|
||||||
|
// data source variable details
|
||||||
questionListData = null;
|
questionListData = null;
|
||||||
public dataLength: number;
|
public dataLength: number;
|
||||||
public dataSource = new MatTableDataSource();
|
public dataSource = new MatTableDataSource();
|
||||||
@ -41,28 +45,46 @@ export class ListComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private dialog: MatDialog,
|
constructor(private dialog: MatDialog,
|
||||||
private questionsService: QuestionsService,
|
private questionsService: QuestionsService,
|
||||||
private masterService: MastersService) {
|
private masterService: MastersService,
|
||||||
this.getQuestionsMasters();
|
private _formBuilder: FormBuilder) {
|
||||||
}
|
this.filterFormGroupCtrl = this._formBuilder.group({
|
||||||
|
category: [null, '']
|
||||||
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;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getCategorMaster();
|
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() {
|
getCategorMaster() {
|
||||||
this.masterService.getAllMasterData('QUESTIONCATEGORY').subscribe(
|
this.masterService.getAllMasterData('QUESTIONCATEGORY').subscribe(
|
||||||
data => {
|
data => {
|
||||||
@ -88,9 +110,9 @@ export class ListComponent implements OnInit {
|
|||||||
// add questions popup model call
|
// add questions popup model call
|
||||||
addNewQuestion() {
|
addNewQuestion() {
|
||||||
const dialogRef = this.dialog.open(AddComponent, {
|
const dialogRef = this.dialog.open(AddComponent, {
|
||||||
data: {}
|
data: {},
|
||||||
|
disableClose: true
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed()
|
dialogRef.afterClosed()
|
||||||
.subscribe(dataresult => {
|
.subscribe(dataresult => {
|
||||||
this.getQuestionsMasters();
|
this.getQuestionsMasters();
|
||||||
@ -99,11 +121,12 @@ export class ListComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// edit questions master details popup model
|
||||||
editQuestion(rowDetails: any) {
|
editQuestion(rowDetails: any) {
|
||||||
const dialogRef = this.dialog.open(EditComponent, {
|
const dialogRef = this.dialog.open(EditComponent, {
|
||||||
data: rowDetails
|
data: rowDetails,
|
||||||
|
disableClose: true
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed()
|
dialogRef.afterClosed()
|
||||||
.subscribe(dataresult => {
|
.subscribe(dataresult => {
|
||||||
this.getQuestionsMasters();
|
this.getQuestionsMasters();
|
||||||
@ -111,7 +134,7 @@ export class ListComponent implements OnInit {
|
|||||||
// this.isPopupOpened = false;
|
// this.isPopupOpened = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// padination page event call
|
||||||
pageChange(e) {
|
pageChange(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,9 +28,8 @@ import { AddComponent } from './add/add.component';
|
|||||||
import { EditComponent } from './edit/edit.component';
|
import { EditComponent } from './edit/edit.component';
|
||||||
/*
|
/*
|
||||||
* Question Master Module details
|
* Question Master Module details
|
||||||
|
* : kdk
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom angular notifier options
|
* Custom angular notifier options
|
||||||
*/
|
*/
|
||||||
@ -42,7 +41,7 @@ const customNotifierOptions: NotifierOptions = {
|
|||||||
},
|
},
|
||||||
vertical: {
|
vertical: {
|
||||||
position: 'top',
|
position: 'top',
|
||||||
distance: 12,
|
distance: 32,
|
||||||
gap: 10
|
gap: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user