merge changes

This commit is contained in:
gandhimathi 2018-10-03 10:50:12 +05:30
commit 3af394783e
8 changed files with 438 additions and 0 deletions

View File

@ -1,4 +1,5 @@
<div style="max-height: 580px;"> <div style="max-height: 580px;">
<<<<<<< HEAD
<mat-card style="width: 580px; padding: 6px;"> <mat-card style="width: 580px; padding: 6px;">
<div class="ml-xs mr-xs" style="width: 100%;" fxLayout="row" fxLayoutAlign="center"> <div class="ml-xs mr-xs" style="width: 100%;" fxLayout="row" fxLayoutAlign="center">
<h2 mat-dialog-title style="width: 50%;">{{pageTitle}}</h2> <h2 mat-dialog-title style="width: 50%;">{{pageTitle}}</h2>
@ -63,10 +64,77 @@
</div> </div>
<!--Error List Shown Here--> <!--Error List Shown Here-->
<!--<ul> <!--<ul>
=======
<mat-card style="width: 580px; padding: 6px;">
<div class="ml-xs mr-xs" style="width: 100%;" fxLayout="row" fxLayoutAlign="center">
<h2 mat-dialog-title style="width: 50%;">{{pageTitle}}</h2>
<div style="width: 20%;"></div>
<div style="width: 30%;text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button>
</div>
</div>
<form [formGroup]="_addQuesFrom" (submit)="onSubmit()">
<!--<div class="form-group">-->
<div fxLayout="row" fxLayoutAlign="start none">
<mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Select Category" formControlName="fk_question_catagory">
<mat-option *ngFor="let ct of categories" [value]="ct.question_categroy_id">{{ ct.categroy_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.fk_question_catagory.hasError('required')" class="mat-text-warn">You must Select Category.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="start none">
<mat-form-field class="ml-xs example-full-width">
<textarea matInput placeholder="Question" formControlName="question"></textarea>
<mat-error *ngIf="submitted && f.question.hasError('required')" class="mat-text-warn">You must Include Question.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="start none">
<mat-form-field class="ml-xs example-full-width">
<textarea matInput placeholder="Description" formControlName="description"></textarea>
<mat-error *ngIf="submitted && f.description.hasError('required')" class="mat-text-warn">You must Include Description.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="start none">
<mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Select Answer Type" formControlName="fk_question_answertype">
<mat-option *ngFor="let ans of questionsOptions" [value]="ans.question_answer_type_id">{{ ans.answer_type_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.fk_question_answertype.hasError('required')" class="mat-text-warn">You must Select Answer Type.</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="answers" class="example-full-width">
<div *ngFor="let answ of _addQuesFrom.controls.answers['controls']; let i=index">
<div [formGroupName]="i">
<div fxLayout="row" style="width: 100%">
<div style="width: 80%">
<mat-form-field class="ml-xs example-full-width">
<!--<span>Answer {{i + 1}}</span>-->
<textarea matInput placeholder="Answer" formControlName="answer"></textarea>
<!--<mat-error *ngIf="submitted && answer.hasError('required')" class="mat-text-warn">You must Include Question.</mat-error>-->
</mat-form-field>
</div>
<div style="width:20%">
<span *ngIf="_addQuesFrom.controls.answers.controls.length > 1" (click)="removeLanguage(i)">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</div>
</div>
</div>
<button mat-button color="primary" matTooltip="Add More Answer" matTooltipPosition="above" (click)="addLanguage($event); false">Add More</button>
<!--<a (click)="addLanguage()" style="cursor: default">Add another Answer </a>-->
</div>
</div>
<!--Error List Shown Here-->
<!--<ul>
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
<li *ngFor="let err of errorMessage"> <li *ngFor="let err of errorMessage">
<mat-error>{{err.err}}</mat-error> <mat-error>{{err.err}}</mat-error>
</li> </li>
</ul>--> </ul>-->
<<<<<<< HEAD
<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="reset"><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="reset"><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>
@ -74,4 +142,13 @@
<!--</div>--> <!--</div>-->
</form> </form>
</mat-card> </mat-card>
=======
<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="reset"><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>
</div>
<!--</div>-->
</form>
</mat-card>
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
</div> </div>

View File

@ -12,6 +12,11 @@ import {
FormArray, FormArray,
} from '@angular/forms'; } from '@angular/forms';
<<<<<<< HEAD
=======
import { NotifierService } from 'angular-notifier';
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
import { import {
MatDialog, MatDialog,
MatDialogRef, MatDialogRef,
@ -21,24 +26,52 @@ 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';
<<<<<<< HEAD
=======
/*
* Question master add details
* : kdk
*/
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
@Component({ @Component({
selector: 'app-add', selector: 'app-add',
templateUrl: './add.component.html', templateUrl: './add.component.html',
styleUrls: ['./add.component.scss'] styleUrls: ['./add.component.scss']
}) })
export class AddComponent implements OnInit { export class AddComponent implements OnInit {
<<<<<<< HEAD
public pageTitle : string = "Add Question Details"; public pageTitle : string = "Add Question Details";
=======
public pageTitle: string = "Add Question Details";
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
public _addQuesFrom: FormGroup; public _addQuesFrom: FormGroup;
public submitted = false; public submitted = false;
public categories: any = []; public categories: any = [];
public questionsOptions: any = []; public questionsOptions: any = [];
errorMessage: string; errorMessage: string;
<<<<<<< HEAD
constructor(private _formBuilder: FormBuilder, constructor(private _formBuilder: FormBuilder,
private dialogRef: MatDialogRef<AddComponent>, private dialogRef: MatDialogRef<AddComponent>,
private masterService: MastersService, private masterService: MastersService,
private questionsService: QuestionsService) { } private questionsService: QuestionsService) { }
=======
/**
* Notifier service
*/
private notifier: NotifierService;
constructor(
notifier: NotifierService,
private _formBuilder: FormBuilder,
private dialogRef: MatDialogRef<AddComponent>,
private masterService: MastersService,
private questionsService: QuestionsService) {
this.notifier = notifier;
}
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
ngOnInit() { ngOnInit() {
@ -55,6 +88,7 @@ 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();
<<<<<<< HEAD
// /** For SelectDrop Datas*/ // /** For SelectDrop Datas*/
// this._mastersService.getAllMasterData('CITY') // this._mastersService.getAllMasterData('CITY')
@ -68,6 +102,8 @@ export class AddComponent implements OnInit {
// }, error => this.errorMessage = <any> error); // }, error => this.errorMessage = <any> error);
=======
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
} }
// convenience getter for easy access to form fields // 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); this.categories = data.records.filter(category => category.isactive == 1);
}, },
error => { error => {
<<<<<<< HEAD
this.errorMessage = "No Category Record Found."; 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; this.questionsOptions = data.records;
}, },
error => { error => {
<<<<<<< HEAD
=======
this.notifier.notify('warning', 'No Answer Type Records Found.!');
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
this.errorMessage = "No Answer Type Record Found."; this.errorMessage = "No Answer Type Record Found.";
} }
) )
@ -126,6 +171,7 @@ export class AddComponent implements OnInit {
} else { } else {
var answerFormValues = this._addQuesFrom.value; var answerFormValues = this._addQuesFrom.value;
<<<<<<< HEAD
//To Remove The "Null" With Key also //To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); 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 //After Saving the BRANCH data then popup close
// this.dialogRef.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
} }
} }

View File

@ -65,8 +65,13 @@
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutAlign="start none">
<<<<<<< HEAD
<mat-checkbox formControlName="isactive" [ngModel]="f.isactive.value == 1 ? true : f.isactive.value == 0 ? false : null" <mat-checkbox formControlName="isactive" [ngModel]="f.isactive.value == 1 ? true : f.isactive.value == 0 ? false : null"
(ngModelChange)="_addQuesFrom.controls['isactive'].setValue($event ? 1 : 0)">Active/InActive</mat-checkbox> (ngModelChange)="_addQuesFrom.controls['isactive'].setValue($event ? 1 : 0)">Active/InActive</mat-checkbox>
=======
<mat-checkbox formControlName="isactive" [ngModel]="f.isactive.value == 1 ? true : f.isactive.value == 0 ? false : null"
(ngModelChange)="_addQuesFrom.controls['isactive'].setValue($event ? 1 : 0)">Active/InActive</mat-checkbox>
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
</div> </div>
<!--Error List Shown Here--> <!--Error List Shown Here-->
<!--<ul> <!--<ul>
@ -75,7 +80,12 @@
</li> </li>
</ul>--> </ul>-->
<div class="row" style="text-align:right;"> <div class="row" style="text-align:right;">
<<<<<<< HEAD
<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="Reset" matTooltipPosition="above" type="button"
(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
<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>-->

View File

@ -23,6 +23,13 @@ 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';
<<<<<<< HEAD
=======
/*
* Question master details edit component
* : kdk
*/
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
@Component({ @Component({
selector: 'app-edit', selector: 'app-edit',
templateUrl: './edit.component.html', templateUrl: './edit.component.html',
@ -31,18 +38,30 @@ import { QuestionsService } from './../../service/questions/questions.service';
export class EditComponent implements OnInit { export class EditComponent implements OnInit {
<<<<<<< HEAD
public pageTitle : string = "Edit Question Details"; public pageTitle : string = "Edit Question Details";
=======
public pageTitle: string = "Edit Question Details";
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
public _addQuesFrom: FormGroup; public _addQuesFrom: FormGroup;
public submitted = false; public submitted = false;
public categories: any = []; public categories: any = [];
public questionsOptions: any = []; public questionsOptions: any = [];
errorMessage: string; errorMessage: string;
<<<<<<< HEAD
/** /**
* Notifier service * Notifier service
*/ */
private notifier: NotifierService; private notifier: NotifierService;
=======
/**
* Notifier service
*/
private notifier: NotifierService;
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
constructor( constructor(
notifier: NotifierService, notifier: NotifierService,
@ -51,8 +70,13 @@ export class EditComponent implements OnInit {
private masterService: MastersService, private masterService: MastersService,
private questionsService: QuestionsService, private questionsService: QuestionsService,
@Inject(MAT_DIALOG_DATA) public data: any) { @Inject(MAT_DIALOG_DATA) public data: any) {
<<<<<<< HEAD
this.notifier = notifier; this.notifier = notifier;
} }
=======
this.notifier = notifier;
}
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
ngOnInit() { ngOnInit() {
this.loadFormData(); this.loadFormData();
@ -63,14 +87,23 @@ 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);
} }
} }
<<<<<<< HEAD
=======
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
// OnInit Load Category and Question Type Masters // OnInit Load Category and Question Type Masters
this.getCategoryListMaster(); this.getCategoryListMaster();
this.getQuestionOptionsMaster(); this.getQuestionOptionsMaster();
} }
<<<<<<< HEAD
loadAnsData(){ loadAnsData(){
if (this.data["0"].length > 0) { 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"]) { for (let val of this.data["0"]) {
// alert(JSON.stringify(val)); // alert(JSON.stringify(val));
let vals = val; let vals = val;
@ -79,26 +112,46 @@ export class EditComponent implements OnInit {
} }
} }
<<<<<<< HEAD
loadFormData() { loadFormData() {
/** Questions Form Datas*/ /** Questions Form Datas*/
=======
// load form data form the master
loadFormData() {
/** Questions Form Datas*/
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
this._addQuesFrom = this._formBuilder.group({ this._addQuesFrom = this._formBuilder.group({
question_id: [this.data.question_id], question_id: [this.data.question_id],
question: [this.data.question, Validators.compose([Validators.required])], question: [this.data.question, Validators.compose([Validators.required])],
description: [this.data.description, 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_catagory: [this.data.fk_question_catagory, Validators.compose([Validators.required])],
fk_question_answertype: [this.data.fk_question_answertype, 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],
=======
isactive: [this.data.isactive],
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
answers: this._formBuilder.array([ answers: this._formBuilder.array([
// this.initAnswers(null, null), // this.initAnswers(null, null),
]) ])
}); });
} }
<<<<<<< HEAD
get f_ans() { return <FormArray>this._addQuesFrom.get('answers'); } 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; }
=======
// convenience getter for easy access to form fields
get f() { return this._addQuesFrom.controls; }
// form answer details access
get f_ans() { return <FormArray>this._addQuesFrom.get('answers'); }
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
// 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 +178,10 @@ 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 => {
<<<<<<< HEAD
=======
this.notifier.notify('warning', 'No Category Records Found.!');
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
this.errorMessage = "No Category Record Found."; this.errorMessage = "No Category Record Found.";
} }
) )
@ -135,6 +192,10 @@ export class EditComponent implements OnInit {
this.questionsOptions = data.records; this.questionsOptions = data.records;
}, },
error => { error => {
<<<<<<< HEAD
=======
this.notifier.notify('warning', 'No Answer Type Records Found.!');
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
this.errorMessage = "No Answer Type Record Found."; this.errorMessage = "No Answer Type Record Found.";
} }
) )
@ -163,17 +224,30 @@ export class EditComponent implements OnInit {
dataresult => { dataresult => {
if (dataresult.status == 200) { if (dataresult.status == 200) {
console.log(dataresult); console.log(dataresult);
<<<<<<< HEAD
this.notifier.notify( 'success', 'Your Changes Updated!' ); this.notifier.notify( 'success', 'Your Changes Updated!' );
=======
this.notifier.notify('success', 'Your Changes Updated.!');
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
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 {
<<<<<<< HEAD
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.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(); this.dialogRef.close();
}); });
//After Saving the BRANCH data then popup close //After Saving the BRANCH data then popup close

View File

@ -1,5 +1,6 @@
<div> <div>
<mat-card> <mat-card>
<<<<<<< HEAD
<mat-card class="mat-elevation-z1"> <mat-card class="mat-elevation-z1">
<!--<mat-card-title><span> Questions Master </span></mat-card-title> <!--<mat-card-title><span> Questions Master </span></mat-card-title>
<mat-card-subtitle> List of Questions</mat-card-subtitle> <mat-card-subtitle> List of Questions</mat-card-subtitle>
@ -53,6 +54,56 @@
</div> </div>
<div fxFlex="10%"> <div fxFlex="10%">
<button mat-icon-button [matMenuTriggerFor]="menu"> <button mat-icon-button [matMenuTriggerFor]="menu">
=======
<mat-card class="mat-elevation-z1">
<div style="margin: 6px; padding: 4px;">
<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>
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="center none">
<div fxFlex="80%">
<form [formGroup]="filterFormGroupCtrl">
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="0.5px" fxLayoutAlign="start none" style="padding: 6px;">
<mat-select placeholder="Category" formControlName="category">
<!--<ngx-mat-select-search [formControl]="masterFilterCtrl" ></ngx-mat-select-search>-->
<mat-option *ngFor="let cat of categories" [value]="cat.question_categroy_id" (click)="getQuestionsMasters()">
{{cat.categroy_name}}
</mat-option>
</mat-select>
</div>
</form>
</div>
<div fxFlex="20%">
<button mat-stroked-button color="primary" (click)="addNewQuestion()">Add Questions</button>
</div>
</div>
<!--</mat-card-content>-->
</mat-card>
<ng-container *ngIf="productList.length > 0">
<div style="padding: 0 12px;">
<mat-card class="product-card" *ngFor="let product of dataSource.connect() | async">
<div fxLayout="row" fxLayoutAlign="start start" style="padding: 6px 2px;">
<div fxFlex="90%" style="padding: 12px 8px;">
<!--<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="start none">
<div class="category-label"> {{ product.categroy_name }}</div>
</div>-->
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="none none">
<div class="ml-xs" fxFlex="20%">
{{ product.categroy_name }}
</div>
<div class="ml-xs" fxFlex="80%">
<div class="text-line-limit">{{ product.question }}
</div>
</div>
</div>
</div>
<div fxFlex="10%">
<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">
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>
<mat-menu #menu="matMenu"> <mat-menu #menu="matMenu">
@ -60,10 +111,17 @@
<mat-icon>create</mat-icon> <mat-icon>create</mat-icon>
<span>Edit</span> <span>Edit</span>
</button> </button>
<<<<<<< HEAD
</mat-menu> </mat-menu>
</div> </div>
</div> </div>
<!--<mat-card-header> <!--<mat-card-header>
=======
</mat-menu>-->
</div>
</div>
<!--<mat-card-header>
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
<mat-card-title> <mat-card-title>
<h4>{{ product.question }}</h4> <h4>{{ product.question }}</h4>
</mat-card-title> </mat-card-title>
@ -75,6 +133,7 @@
<mat-card-actions> <mat-card-actions>
<button mat-raised-button color="accent" (click)="addItemToCard(product)">Add to card</button> <button mat-raised-button color="accent" (click)="addItemToCard(product)">Add to card</button>
</mat-card-actions>--> </mat-card-actions>-->
<<<<<<< HEAD
</mat-card> </mat-card>
</div> </div>
</ng-container> </ng-container>
@ -96,6 +155,19 @@
</mat-paginator> </mat-paginator>
<!--<mat-card> <!--<mat-card>
=======
</mat-card>
</div>
</ng-container>
<mat-card *ngIf="noQuesMasterRecrdFound">
<div class="no-record-found">No Record Found ... </div>
</mat-card>
<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-card>
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
<div class="example-container mat-elevation-z8"> <div class="example-container mat-elevation-z8">
<mat-table [dataSource]="dataSource" matSort> <mat-table [dataSource]="dataSource" matSort>
@ -120,7 +192,11 @@
<mat-row *matRowDef="let row; columns: displayedColumns;"> <mat-row *matRowDef="let row; columns: displayedColumns;">
</mat-row> </mat-row>
</mat-table> </mat-table>
<<<<<<< HEAD
=======
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator> <mat-paginator [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator>
</div> </div>
</mat-card>--> </mat-card>-->

View File

@ -44,3 +44,12 @@
color: #fff; color: #fff;
box-shadow: 0 2px 3px #c8bbbb; box-shadow: 0 2px 3px #c8bbbb;
} }
<<<<<<< HEAD
=======
.no-record-found {
font-size: 18px;
color: #03a9f4;
padding : 12px 8px;
}
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe

View File

@ -1,6 +1,11 @@
import { Component, ViewChild, OnInit } from '@angular/core'; import { Component, ViewChild, OnInit } from '@angular/core';
<<<<<<< HEAD
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 } 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 { 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,12 +14,20 @@ 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';
<<<<<<< HEAD
=======
/*
* Questions master List component
* : kdk
*/
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
@Component({ @Component({
selector: 'app-list', selector: 'app-list',
templateUrl: './list.component.html', templateUrl: './list.component.html',
styleUrls: ['./list.component.scss'] styleUrls: ['./list.component.scss']
}) })
export class ListComponent implements OnInit { export class ListComponent implements OnInit {
<<<<<<< HEAD
public productList: any[] = []; public productList: any[] = [];
public paginationList: any[] = []; public paginationList: any[] = [];
@ -31,15 +44,38 @@ export class ListComponent implements OnInit {
pageEvent: PageEvent; 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; questionListData = null;
public dataLength: number; public dataLength: number;
public dataSource = new MatTableDataSource(); public dataSource = new MatTableDataSource();
displayedColumns = ['categroy_name', 'question', 'actions']; displayedColumns = ['categroy_name', 'question', 'actions'];
<<<<<<< HEAD
=======
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
@ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
constructor(private dialog: MatDialog, constructor(private dialog: MatDialog,
<<<<<<< HEAD
private questionsService: QuestionsService, private questionsService: QuestionsService,
private masterService: MastersService) { private masterService: MastersService) {
this.getQuestionsMasters(); this.getQuestionsMasters();
@ -64,6 +100,50 @@ export class ListComponent implements OnInit {
} }
getCategorMaster() { 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( this.masterService.getAllMasterData('QUESTIONCATEGORY').subscribe(
data => { data => {
this.categories = data.records.filter(category => category.isactive == 1); this.categories = data.records.filter(category => category.isactive == 1);
@ -74,7 +154,11 @@ export class ListComponent implements OnInit {
) )
} }
<<<<<<< HEAD
ngAfterViewInit() { ngAfterViewInit() {
=======
ngAfterViewInit() {
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
this.dataSource.paginator = this.paginator; this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
} }
@ -88,6 +172,7 @@ 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, {
<<<<<<< HEAD
data: {} 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) { pageChange(e) {
console.log(e); console.log(e);
} }

View File

@ -28,9 +28,14 @@ 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
<<<<<<< HEAD
*/ */
=======
* : kdk
*/
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
/** /**
* Custom angular notifier options * Custom angular notifier options
*/ */
@ -42,7 +47,11 @@ const customNotifierOptions: NotifierOptions = {
}, },
vertical: { vertical: {
position: 'top', position: 'top',
<<<<<<< HEAD
distance: 12, distance: 12,
=======
distance: 32,
>>>>>>> 3bdd446b0760f030c46f5bea12469a0a15829ebe
gap: 10 gap: 10
} }
}, },