template creation edit screen changes : kdk
This commit is contained in:
parent
6154d876e4
commit
50b94aeb23
@ -28,6 +28,12 @@ export class TemplatesService {
|
|||||||
return this._http.get<any[]>(this.apiUrl + "listAllTemplates/any", options);
|
return this._http.get<any[]>(this.apiUrl + "listAllTemplates/any", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addNewTemplate(Records: any): Observable<any>{
|
||||||
|
Records.fk_createdby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
|
Records.createdon = currentdate;//to get Current date and Time for when the Record is created
|
||||||
|
return this._http.post<any[]>(this.apiUrl + "saveNewTemplateName", {'records': Records });
|
||||||
|
}
|
||||||
|
|
||||||
getTemplateIDNameDetails(temp_id: number): Observable<any>{
|
getTemplateIDNameDetails(temp_id: number): Observable<any>{
|
||||||
// Add safe, URL encoded search parameter if there is a search term
|
// Add safe, URL encoded search parameter if there is a search term
|
||||||
return this._http.post<any[]>(this.apiUrl + "getTemplateMaster", {'template_id': temp_id });
|
return this._http.post<any[]>(this.apiUrl + "getTemplateMaster", {'template_id': temp_id });
|
||||||
@ -49,6 +55,8 @@ export class TemplatesService {
|
|||||||
let records = Records.map(item=>{
|
let records = Records.map(item=>{
|
||||||
item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
item.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
item.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
||||||
|
item.createdon = item.createdon == null ? currentdate : item.createdon;
|
||||||
|
item.fk_createdby = item.fk_createdby == null ? this._aws.getlocale() : item.fk_createdby;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
return this._http.post<any[]>(this.apiUrl + "saveTemplateLenderDetails", {'records': records });
|
return this._http.post<any[]>(this.apiUrl + "saveTemplateLenderDetails", {'records': records });
|
||||||
@ -65,6 +73,8 @@ export class TemplatesService {
|
|||||||
let records = Records.map(item=>{
|
let records = Records.map(item=>{
|
||||||
item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
item.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
item.updatedon = currentdate;//to get Current date and Time for when the Record is created
|
||||||
|
item.createdon = item.createdon == null ? currentdate : item.createdon;
|
||||||
|
item.fk_createdby = item.fk_createdby == null ? this._aws.getlocale() : item.fk_createdby;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
return this._http.post<any[]>(this.apiUrl + "saveTemplateCategoryDetails", {'records': records });
|
return this._http.post<any[]>(this.apiUrl + "saveTemplateCategoryDetails", {'records': records });
|
||||||
@ -81,6 +91,9 @@ export class TemplatesService {
|
|||||||
let records = Records.map(item=>{
|
let records = Records.map(item=>{
|
||||||
item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
item.updatedon = currentdate;
|
item.updatedon = currentdate;
|
||||||
|
item.createdon = item.createdon == null ? currentdate : item.createdon;
|
||||||
|
item.fk_createdby = item.fk_createdby == null ? this._aws.getlocale() : item.fk_createdby;
|
||||||
|
|
||||||
// item.answers = item.answers.map(subItem=>{
|
// item.answers = item.answers.map(subItem=>{
|
||||||
// subItem.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
// subItem.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
|
||||||
// subItem.updatedon = currentdate;
|
// subItem.updatedon = currentdate;
|
||||||
|
|||||||
@ -4,38 +4,35 @@
|
|||||||
|
|
||||||
<form [formGroup]="_editTempCategoryFrom" (submit)="onSubmit()">
|
<form [formGroup]="_editTempCategoryFrom" (submit)="onSubmit()">
|
||||||
<div formArrayName="temp_category" class="example-full-width">
|
<div formArrayName="temp_category" class="example-full-width">
|
||||||
<table>
|
<mat-card *ngFor="let answ of _editTempCategoryFrom.controls.temp_category['controls']; let i=index ; let last = last;">
|
||||||
<tr *ngFor="let answ of _editTempCategoryFrom.controls.temp_category['controls']; let i=index ; let last = last;">
|
|
||||||
<td>
|
<div [formGroupName]="i">
|
||||||
<div [formGroupName]="i">
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
|
||||||
<div fxLayout="row" fxLayoutWrap fxLayoutGap="5%" fxLayoutAlign="start center">
|
<div fxFlex="30%">
|
||||||
<div fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Category" formControlName="fk_question_category_id">
|
<mat-select placeholder="Category *" formControlName="fk_question_category_id">
|
||||||
<mat-option *ngFor="let category of m_category" [value]="category.question_category_id">{{ category.category_name }}</mat-option>
|
<mat-option *ngFor="let category of m_category" [value]="category.question_category_id">{{ category.category_name }}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
<mat-error *ngIf="submitted && answ['controls'].fk_question_category_id.hasError('required')" class="mat-text-warn">Category Required.!</mat-error>
|
||||||
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Category Already Exist.!</mat-error>
|
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Category Already Exist.!</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="0 1 auto" class="ml-xs">
|
<div fxFlex="30%">
|
||||||
<mat-form-field style="width: 25%; text-align: center" appearance="outline">
|
<mat-form-field style="width: 80px; text-align: center" appearance="outline">
|
||||||
<input matInput formControlName="weightage">
|
<input matInput placeholder="Weightage *" formControlName="weightage">
|
||||||
</mat-form-field> <span>%</span>
|
</mat-form-field> <span>%</span>
|
||||||
|
<mat-error *ngIf="submitted && answ['controls'].weightage.hasError('required')" class="mat-text-warn">Weightage Required.!</mat-error>
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="0 1 auto" class="ml-xs">
|
<div fxFlex="30%">
|
||||||
<button *ngIf="_editTempCategoryFrom.controls.temp_category.controls.length > 1" (click)="removeLanguage(i)" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
<button (click)="removeLanguage(i)" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
||||||
|
</div>
|
||||||
</div>
|
<!--<div fxFlex="0 1 auto" class="ml-xs">
|
||||||
<div fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<button *ngIf="last" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Add More" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
<button *ngIf="last" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Add More" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||||
|
</div>-->
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Category Already Exist.!</mat-error>
|
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Category Already Exist.!</mat-error>
|
||||||
</td>
|
</mat-card>
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<!--<mat-card role="list">-->
|
<!--<mat-card role="list">-->
|
||||||
<!--<mat-card style="width: 70%;" *ngFor="let answ of _editTempCategoryFrom.controls.temp_category['controls']; let i=index ; let last = last;"
|
<!--<mat-card style="width: 70%;" *ngFor="let answ of _editTempCategoryFrom.controls.temp_category['controls']; let i=index ; let last = last;"
|
||||||
role="listitem">
|
role="listitem">
|
||||||
@ -68,6 +65,9 @@
|
|||||||
</mat-card>-->
|
</mat-card>-->
|
||||||
<!--</mat-card>-->
|
<!--</mat-card>-->
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||||
|
</div>
|
||||||
<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>
|
||||||
|
|||||||
@ -7,42 +7,42 @@
|
|||||||
|
|
||||||
<form [formGroup]="_editTempLenderFrom" (submit)="onSubmit()">
|
<form [formGroup]="_editTempLenderFrom" (submit)="onSubmit()">
|
||||||
<div formArrayName="temp_lender" class="example-full-width">
|
<div formArrayName="temp_lender" class="example-full-width">
|
||||||
<div *ngFor="let answ of _editTempLenderFrom.controls.temp_lender['controls']; let i=index">
|
<mat-card *ngFor="let answ of _editTempLenderFrom.controls.temp_lender['controls']; let i=index">
|
||||||
<div [formGroupName]="i">
|
<div [formGroupName]="i">
|
||||||
<div fxLayout="row" fxLayoutWrap fxLayoutGap="0.5%" fxLayoutAlign="start center">
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
<mat-form-field fxFlex="20%">
|
||||||
<mat-select placeholder="Lender" formControlName="fk_lender_id">
|
<mat-select placeholder="Lender *" formControlName="fk_lender_id">
|
||||||
<mat-option *ngFor="let lend of m_lender" [value]="lend.entity_id">{{ lend.full_name }}</mat-option>
|
<mat-option *ngFor="let lend of m_lender" [value]="lend.entity_id">{{ lend.full_name }}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<!--<mat-error *ngIf="submitted && fk_lender_id.hasError('required')" class="mat-text-warn">You must Select Lender Type.</mat-error>-->
|
<mat-error *ngIf="submitted && answ['controls'].fk_lender_id.hasError('required')" class="mat-text-warn">Lender Type Required.!</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
<mat-form-field fxFlex="20%">
|
||||||
<mat-select placeholder="Product" formControlName="fk_product_id">
|
<mat-select placeholder="Product *" formControlName="fk_product_id">
|
||||||
<mat-option *ngFor="let prcd of m_product" [value]="prcd.product_id">{{ prcd.product_name }}</mat-option>
|
<mat-option *ngFor="let prcd of m_product" [value]="prcd.product_id">{{ prcd.product_name }}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<!--<mat-error *ngIf="submitted && fk_product_id.hasError('required')" class="mat-text-warn">You must Select Product.</mat-error>-->
|
<mat-error *ngIf="submitted && answ['controls'].fk_product_id.hasError('required')" class="mat-text-warn">Product Required.!</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
<mat-form-field fxFlex="20%">
|
||||||
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
|
<mat-select placeholder="Customer Segment *" formControlName="fk_customer_segment">
|
||||||
<mat-option *ngFor="let cusSeg of m_customerSegment" [value]="cusSeg.customer_segment_id">{{ cusSeg.customer_segment }}</mat-option>
|
<mat-option *ngFor="let cusSeg of m_customerSegment" [value]="cusSeg.customer_segment_id">{{ cusSeg.customer_segment }}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<!--<mat-error *ngIf="submitted && fk_customer_segment.hasError('required')" class="mat-text-warn">You must Select Customer Segment.</mat-error>-->
|
<mat-error *ngIf="submitted && answ['controls'].fk_customer_segment.hasError('required')" class="mat-text-warn">Customer Segment Required.!</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<div>
|
<div fxFlex="20%">
|
||||||
<mat-checkbox *ngIf="answ.get('template_lender_map_id').value != null" formControlName="isactive" [ngModel]="answ.get('isactive').value == 1 ? true : answ.get('isactive').value == 0 ? false : null"
|
<mat-checkbox *ngIf="answ.get('template_lender_map_id').value != null" formControlName="isactive" [ngModel]="answ.get('isactive').value == 1 ? true : answ.get('isactive').value == 0 ? false : null"
|
||||||
(ngModelChange)="answ.get('isactive').value = $event ? 1 : 0"></mat-checkbox>
|
(ngModelChange)="answ.get('isactive').value = $event ? 1 : 0"></mat-checkbox>
|
||||||
|
|
||||||
<span *ngIf="_editTempLenderFrom.controls.temp_lender.controls.length > 1" (click)="removeLanguage(i)">
|
<span *ngIf="_editTempLenderFrom.controls.temp_lender.controls.length > 1" (click)="removeLanguage(i)">
|
||||||
<button *ngIf="answ.get('template_lender_map_id').value == null" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
<button *ngIf="answ.get('template_lender_map_id').value == null" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</mat-card>
|
||||||
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" style="text-align:right;">
|
<div class="row" style="text-align:right;">
|
||||||
|
|||||||
@ -1,102 +1,71 @@
|
|||||||
<!--<mat-card>
|
|
||||||
|
|
||||||
<form [formGroup]="_editquestionAnswerForm" (submit)="onSubmit()">
|
<form [formGroup]="_editquestionAnswerForm" (submit)="onSubmit()">
|
||||||
<div formArrayName="temp_category" class="example-full-width">
|
<div formArrayName="temp_questions" class="example-full-width">
|
||||||
<mat-accordion>
|
<table>
|
||||||
<mat-expansion-panel *ngFor="let data of CaterogyQuesAns">
|
<tr *ngFor="let ques of _editquestionAnswerForm.controls.temp_questions['controls']; let i=index ; let last = last;">
|
||||||
<mat-expansion-panel-header>
|
<td>
|
||||||
<mat-panel-title>
|
<mat-card>
|
||||||
{{ data.category_name }}
|
|
||||||
</mat-panel-title>
|
|
||||||
<mat-panel-description>
|
|
||||||
{{ data.weightage }}
|
|
||||||
</mat-panel-description>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-category-question-answer [CaterogyQuesAns]="data">
|
|
||||||
</app-category-question-answer>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
</mat-accordion>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</mat-card>-->
|
|
||||||
|
|
||||||
|
|
||||||
<!--<pre>{{ templateCategoryRecord | json }}</pre>-->
|
|
||||||
<!--<pre> {{ CaterogyQuesAns | json}}</pre>-->
|
|
||||||
<div fxLayout="row" fxLayoutAlign="end">
|
|
||||||
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="openDialog(); false"><mat-icon>add</mat-icon></button>
|
|
||||||
</div>
|
|
||||||
<form [formGroup]="_editquestionAnswerForm" (submit)="onSubmit()">
|
|
||||||
<div formArrayName="temp_questions" class="example-full-width">
|
|
||||||
<table>
|
|
||||||
<tr *ngFor="let ques of _editquestionAnswerForm.controls.temp_questions['controls']; let i=index ; let last = last;">
|
|
||||||
<td>
|
|
||||||
<div [formGroupName]="i">
|
<div [formGroupName]="i">
|
||||||
<mat-card>
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="5%" fxLayoutAlign="start center">
|
||||||
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="5%" fxLayoutAlign="start center">
|
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="60%">
|
||||||
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="60%">
|
<span>{{i+1}}</span> ) <label>{{ques.get('question').value}}</label>
|
||||||
<label>{{ques.get('question').value}}</label>
|
</div>
|
||||||
|
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="20%">
|
||||||
|
<mat-form-field style="width: 45px; text-align: center" appearance="outline">
|
||||||
|
<input matInput formControlName="question_weightage">
|
||||||
|
</mat-form-field> <span> % </span>
|
||||||
|
<mat-error *ngIf="submitted && ques['controls'].question_weightage.hasError('required')" class="mat-text-warn">Ques. WT is Required.!</mat-error>
|
||||||
|
</div>
|
||||||
|
<div fxFlex="0 1 auto" class="ml-xs" fxFlex="20%">
|
||||||
|
<button (click)="removeLanguage(i)" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"
|
||||||
|
type="button"><mat-icon>delete</mat-icon></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="20%">
|
|
||||||
<mat-form-field style="width: 25%; text-align: center" appearance="outline">
|
|
||||||
<input matInput formControlName="question_weightage">
|
|
||||||
</mat-form-field> <span>%</span>
|
|
||||||
</div>
|
|
||||||
<div fxFlex="0 1 auto" class="ml-xs" fxFlex="20%">
|
|
||||||
<button (click)="removeLanguage(i)" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" type="button"><mat-icon>delete</mat-icon></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card>
|
|
||||||
<div formArrayName="answers" class="example-full-width">
|
<div formArrayName="answers" class="example-full-width">
|
||||||
|
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="0.5%" fxLayoutAlign="center">
|
||||||
<!--<div class="container" fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="0.5%" fxLayoutAlign="center">-->
|
<div fxFlex.gt-xs="50%" [fxFlex.gt-md]="regularDistribution" *ngFor="let answ of ques['controls'].answers['controls']; let i_ans = index ; let Ans_last = last;">
|
||||||
<div fxLayout="row" fxLayoutWrap fxLayoutGap="0.5%" fxLayoutAlign="center"
|
|
||||||
*ngFor="let answ of ques['controls'].answers['controls']; let i_ans = index ; let Ans_last = last;">
|
|
||||||
<div [formGroupName]="i_ans">
|
<div [formGroupName]="i_ans">
|
||||||
<div fxLayout="row" fxLayoutWrap fxLayoutGap="5%" fxLayoutAlign="start center">
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap="0.5%" fxLayoutAlign="start center">
|
||||||
<div fxFlex="0 1 auto" class="ml-xs">
|
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="70%">
|
||||||
<mat-form-field>
|
<div>
|
||||||
<!--<label>{{answ.get('answer').value}}</label>-->
|
<span>{{i_ans+1}}.</span> {{answ.get('answer').value}}
|
||||||
<input matInput formControlName="answer">
|
</div>
|
||||||
</mat-form-field>
|
<!--<mat-form-field>
|
||||||
|
<input matInput formControlName="answer">
|
||||||
|
</mat-form-field>-->
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="0 1 auto" class="ml-xs">
|
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="30%">
|
||||||
<mat-form-field style="width: 25%; text-align: center" appearance="outline">
|
<mat-form-field style="padding: 0 !important; margin: 0 !important; width: 45px !important; text-align: center;">
|
||||||
<input matInput formControlName="template_answer_weightage">
|
<input matInput formControlName="template_answer_weightage">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div fxLayout="row" fxLayoutAlign="end">
|
||||||
</div>
|
<mat-error *ngIf="submitted && answ['controls'].template_answer_weightage.hasError('required')" class="mat-text-warn">Score Required.!</mat-error>
|
||||||
<!--</div>-->
|
|
||||||
|
|
||||||
<!--<div class="container" fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutGap="0.5%" fxLayoutAlign="center"
|
|
||||||
*ngFor="let answ of ques['controls'].answers['controls']; let i_ans = index ; let Ans_last = last;">
|
|
||||||
<div [formGroupName]="i_ans">
|
|
||||||
<div fxLayout="row" fxLayoutWrap fxLayoutGap="5%" fxLayoutAlign="start center">
|
|
||||||
<div fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<mat-form-field>
|
|
||||||
<input matInput formControlName="answer">
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div fxFlex="0 1 auto" class="ml-xs">
|
|
||||||
<mat-form-field style="width: 25%; text-align: center" appearance="outline">
|
|
||||||
<input matInput formControlName="template_answer_weightage">
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Category Already Exist.!</mat-error>
|
<div fxLayout="row" fxLayoutAlign="start">
|
||||||
</td>
|
<mat-error *ngIf="submitted && i == dublicateRerdIndex "> This Question Answer Already Exist.!</mat-error>
|
||||||
</tr>
|
</div>
|
||||||
|
</mat-card>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" style="text-align:right;">
|
<div fxLayout="row" fxLayoutAlign="start">
|
||||||
<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-fab class="mr-1 mb-1" color="primary" matTooltip="Add More Contact Person" matTooltipPosition="above" (click)="openDialog(); false"><mat-icon>add</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<div class="row" style="text-align:right;">
|
||||||
|
<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>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<!--<div [fxLayout]="'row wrap'" fxLayout.xs="column" fxLayoutWrap="wrap">
|
||||||
|
<div fxFlex.gt-xs="50%" [fxFlex.gt-md]="regularDistribution" *ngFor="let country of countries">
|
||||||
|
{{country}}
|
||||||
|
</div>
|
||||||
|
</div>-->
|
||||||
@ -14,6 +14,9 @@ export interface DialogData {
|
|||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**sweet alert */
|
||||||
|
// import Swal from 'sweetalert2';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-category-question-answer',
|
selector: 'app-category-question-answer',
|
||||||
templateUrl: './category-question-answer.component.html',
|
templateUrl: './category-question-answer.component.html',
|
||||||
@ -21,6 +24,9 @@ export interface DialogData {
|
|||||||
})
|
})
|
||||||
export class CategoryQuestionAnswerComponent implements OnInit {
|
export class CategoryQuestionAnswerComponent implements OnInit {
|
||||||
|
|
||||||
|
countries = ['d', 'd', 'd', 'd', 'd' ,'d'];
|
||||||
|
regularDistribution = 100 / 3;
|
||||||
|
|
||||||
@Input() CaterogyQuesAns: any;
|
@Input() CaterogyQuesAns: any;
|
||||||
|
|
||||||
_editquestionAnswerForm: FormGroup;
|
_editquestionAnswerForm: FormGroup;
|
||||||
@ -246,7 +252,8 @@ alert();
|
|||||||
alert("duplication records occured.!");
|
alert("duplication records occured.!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert("value should equal to 100")
|
// Swal('value should equal to 100.!','error');
|
||||||
|
alert("value should equal to 100");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -276,6 +283,11 @@ alert();
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dialog-overview-example-dialog',
|
selector: 'dialog-overview-example-dialog',
|
||||||
|
styles:[`
|
||||||
|
.listHover: hover {
|
||||||
|
background: yellow;
|
||||||
|
}`
|
||||||
|
],
|
||||||
templateUrl: './dialog-category-question-list.html'
|
templateUrl: './dialog-category-question-list.html'
|
||||||
})
|
})
|
||||||
export class DialogOverviewExampleDialog {
|
export class DialogOverviewExampleDialog {
|
||||||
@ -301,12 +313,21 @@ export class DialogOverviewExampleDialog {
|
|||||||
this.dialogRef.close(ques);
|
this.dialogRef.close(ques);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errorRecord : string;
|
||||||
|
noRecordFound: boolean;
|
||||||
|
|
||||||
getCategoryRemainingQuesMasters() {
|
getCategoryRemainingQuesMasters() {
|
||||||
this.templatesService.getRemaningQuestionCategory(this.data).subscribe(
|
this.templatesService.getRemaningQuestionCategory(this.data).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.m_questions = data.records;
|
if(data.status === 200 && data.dataStatus){
|
||||||
|
this.noRecordFound = true;
|
||||||
|
this.m_questions = data.records;
|
||||||
|
} else {
|
||||||
|
this.noRecordFound = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
this.noRecordFound = true;
|
||||||
// this.notifier.notify('warning', 'No Category Master Records Found.!');
|
// this.notifier.notify('warning', 'No Category Master Records Found.!');
|
||||||
// this.m_category = "No Category Master Records Found.";
|
// this.m_category = "No Category Master Records Found.";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
<div style="max-height: 480px;">
|
<div style="max-height: 480px;">
|
||||||
<mat-card style="width: 580px; padding: 6px;" *ngFor="let question of m_questions">
|
<div *ngIf="noRecordFound">
|
||||||
|
<mat-card class="listHover" style="width: 580px; padding: 6px;" *ngFor="let question of m_questions">
|
||||||
<span (click)="onNoClick(question)">{{question.question}}</span>
|
<span (click)="onNoClick(question)">{{question.question}}</span>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="!noRecordFound" style="width: 320px;">
|
||||||
|
<h5 style="color: red;">No Records Found.!</h5>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<div style="width: 320px;">
|
||||||
|
<div fxLayout="row" fxLayoutAlign="end start">
|
||||||
|
<button mat-raised-button mat-icon-button color="primary" class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above"
|
||||||
|
(click)="onClose()"><mat-icon>close</mat-icon></button>
|
||||||
|
</div>
|
||||||
|
<mat-card style="padding: 4px;">
|
||||||
|
<h5>Add New Template</h5>
|
||||||
|
<hr>
|
||||||
|
<form [formGroup]="_addTemplateFrom" (submit)="onSubmit()">
|
||||||
|
<div fxLayout="row" fxLayoutAlign="center">
|
||||||
|
<mat-form-field class="ml-xs example-full-width">
|
||||||
|
<textarea matInput placeholder="Template Name" formControlName="template_name"></textarea>
|
||||||
|
<mat-error *ngIf="submitted && f.template_name.hasError('required')" class="mat-text-warn">You must Include Template Name.</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<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>
|
||||||
|
</form>
|
||||||
|
</mat-card>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { TemplatesAddComponent } from './templates-add.component';
|
||||||
|
|
||||||
|
describe('TemplatesAddComponent', () => {
|
||||||
|
let component: TemplatesAddComponent;
|
||||||
|
let fixture: ComponentFixture<TemplatesAddComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ TemplatesAddComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(TemplatesAddComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
/** Common Imports */
|
||||||
|
import {
|
||||||
|
Component,
|
||||||
|
OnInit,
|
||||||
|
Inject
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
FormBuilder,
|
||||||
|
FormGroup,
|
||||||
|
Validators,
|
||||||
|
FormArray,
|
||||||
|
} from '@angular/forms';
|
||||||
|
|
||||||
|
import {
|
||||||
|
MatDialog,
|
||||||
|
MatDialogRef,
|
||||||
|
MAT_DIALOG_DATA
|
||||||
|
} from '@angular/material';
|
||||||
|
|
||||||
|
/** Service */
|
||||||
|
import { TemplatesService } from './../../../service/templates/templates.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-templates-add',
|
||||||
|
templateUrl: './templates-add.component.html',
|
||||||
|
styleUrls: ['./templates-add.component.scss']
|
||||||
|
})
|
||||||
|
export class TemplatesAddComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
public _addTemplateFrom: FormGroup;
|
||||||
|
public submitted = false;
|
||||||
|
|
||||||
|
constructor(private _formBuilder: FormBuilder,
|
||||||
|
private templatesService: TemplatesService,
|
||||||
|
private dialogRef: MatDialogRef<TemplatesAddComponent>) {
|
||||||
|
/** Add New Template Name Form Datas*/
|
||||||
|
this._addTemplateFrom = this._formBuilder.group({
|
||||||
|
template_id: [''],
|
||||||
|
template_name: [null, Validators.compose([Validators.required])],
|
||||||
|
isactive: [1]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// convenience getter for easy access to form fields
|
||||||
|
get f() { return this._addTemplateFrom.controls; }
|
||||||
|
|
||||||
|
/** To Save/Edited Popup Data */
|
||||||
|
onSubmit() {
|
||||||
|
this.submitted = true;
|
||||||
|
// stop here if form is invalid
|
||||||
|
if (this._addTemplateFrom.invalid) {
|
||||||
|
// this.errorMessage = "Please Fill All Mandate Fields.";
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
var answerFormValues = this._addTemplateFrom.value;
|
||||||
|
|
||||||
|
//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.templatesService.addNewTemplate(answerFormValues).subscribe(
|
||||||
|
dataresult => {
|
||||||
|
if (dataresult.status == 200) {
|
||||||
|
// {"dataStatus":true,"status":200,"records":4}
|
||||||
|
this.dialogRef.close(dataresult);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}, error => {
|
||||||
|
this.dialogRef.close(null);
|
||||||
|
});
|
||||||
|
//After Saving the BRANCH data then popup close
|
||||||
|
// this.dialogRef.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
this.dialogRef.close(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -21,7 +21,7 @@
|
|||||||
</form>-->
|
</form>-->
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="20%">
|
<div fxFlex="20%">
|
||||||
<button mat-stroked-button color="primary">Add New Template</button>
|
<button mat-stroked-button color="primary" (click)="addNewTemplate()">Add New Template</button>
|
||||||
<!--<button mat-stroked-button color="primary" (click)="addNewQuestion()">Add Questions</button>-->
|
<!--<button mat-stroked-button color="primary" (click)="addNewQuestion()">Add Questions</button>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import { Observable } from 'rxjs/Observable';
|
|||||||
|
|
||||||
import { TemplatesService } from './../../service/templates/templates.service';
|
import { TemplatesService } from './../../service/templates/templates.service';
|
||||||
|
|
||||||
|
import { TemplatesAddComponent } from './templates-add/templates-add.component';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Template List component
|
* Template List component
|
||||||
* : kdk
|
* : kdk
|
||||||
@ -42,7 +44,8 @@ export class TemplateListComponent implements OnInit, OnDestroy {
|
|||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private templatesService: TemplatesService) {
|
private templatesService: TemplatesService,
|
||||||
|
public dialog: MatDialog) {
|
||||||
this.listView = true;
|
this.listView = true;
|
||||||
// this.names = 'dinesh';
|
// this.names = 'dinesh';
|
||||||
}
|
}
|
||||||
@ -85,6 +88,24 @@ export class TemplateListComponent implements OnInit, OnDestroy {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addNewTemplate(): void {
|
||||||
|
const dialogRef = this.dialog.open(TemplatesAddComponent, {
|
||||||
|
disableClose: true,
|
||||||
|
data: { }
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
if(result != null) {
|
||||||
|
this.goToEdit(result.records);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
console.log('The dialog was closed');
|
||||||
|
// alert(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import { EditQuestionAnswerComponent } from './templates-list/edit/edit-question
|
|||||||
import { TemplatesService } from './../service/templates/templates.service';
|
import { TemplatesService } from './../service/templates/templates.service';
|
||||||
import { CategoryQuestionAnswerComponent } from './templates-list/edit/edit-question-answer/category-question-answer/category-question-answer.component';
|
import { CategoryQuestionAnswerComponent } from './templates-list/edit/edit-question-answer/category-question-answer/category-question-answer.component';
|
||||||
import { DialogOverviewExampleDialog } from './templates-list/edit/edit-question-answer/category-question-answer/category-question-answer.component';
|
import { DialogOverviewExampleDialog } from './templates-list/edit/edit-question-answer/category-question-answer/category-question-answer.component';
|
||||||
|
import { TemplatesAddComponent } from './templates-list/templates-add/templates-add.component';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Question Master Module details
|
* Question Master Module details
|
||||||
@ -111,10 +112,12 @@ const customNotifierOptions: NotifierOptions = {
|
|||||||
EditLenderComponent,
|
EditLenderComponent,
|
||||||
EditQuestionAnswerComponent,
|
EditQuestionAnswerComponent,
|
||||||
CategoryQuestionAnswerComponent,
|
CategoryQuestionAnswerComponent,
|
||||||
DialogOverviewExampleDialog
|
DialogOverviewExampleDialog,
|
||||||
|
TemplatesAddComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
DialogOverviewExampleDialog
|
DialogOverviewExampleDialog,
|
||||||
|
TemplatesAddComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
TemplatesService
|
TemplatesService
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user