This commit is contained in:
venbatechnologies@gmail.com 2019-09-03 18:04:00 +05:30
commit 5da22e1c8f
3 changed files with 50 additions and 3 deletions

View File

@ -28,6 +28,23 @@
<input matInput placeholder="Short Name" formControlName="short_name"> <input matInput placeholder="Short Name" formControlName="short_name">
<mat-error *ngIf="submitted && f.short_name.hasError('required')" class="mat-text-warn">You must Include Short Name.</mat-error> <mat-error *ngIf="submitted && f.short_name.hasError('required')" class="mat-text-warn">You must Include Short Name.</mat-error>
</mat-form-field> </mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
<mat-form-field fxFlex="1 1 auto" class="ml-xs">
<mat-select placeholder="Score Card (Yes/No)" formControlName="is_score_card_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_score_card_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="1 1 auto" class="ml-xs">
<mat-select placeholder="OTP (Yes/No)" formControlName="is_otp_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_otp_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div> </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>

View File

@ -43,6 +43,8 @@ export class EntityAddComponent implements OnInit {
public _addQuesFrom: FormGroup; public _addQuesFrom: FormGroup;
public submitted = false; public submitted = false;
public entityOptions: any = []; public entityOptions: any = [];
public scoreCardOptions: any = [{'score_option_name':'Yes','score_option_value':'1'},{'score_option_name':'No','score_option_value':'0'}];
errorMessage: string; errorMessage: string;
error : any = []; error : any = [];
@ -69,6 +71,8 @@ export class EntityAddComponent implements OnInit {
fk_entity_type_id: [null, Validators.compose([Validators.required])], fk_entity_type_id: [null, Validators.compose([Validators.required])],
full_name: [null, Validators.compose([Validators.required])], full_name: [null, Validators.compose([Validators.required])],
short_name: [null, Validators.compose([Validators.required])], short_name: [null, Validators.compose([Validators.required])],
is_score_card_enabled: [null, Validators.compose([Validators.required])],
is_otp_enabled: [null, Validators.compose([Validators.required])],
remarks: [null], remarks: [null],
isactive: [1] isactive: [1]
}); });
@ -109,6 +113,8 @@ export class EntityAddComponent implements OnInit {
} else { } else {
var entityFormValues = this._addQuesFrom.value; var entityFormValues = this._addQuesFrom.value;
//To Remove The "Null" With Key also //To Remove The "Null" With Key also
Object.keys(entityFormValues).forEach((key) => (entityFormValues[key] == null) && delete entityFormValues[key]); Object.keys(entityFormValues).forEach((key) => (entityFormValues[key] == null) && delete entityFormValues[key]);

View File

@ -198,18 +198,42 @@
<mat-error *ngIf="submitted && f.full_name.hasError('required')" class="mat-text-warn">You must Include Entity Full Name.</mat-error> <mat-error *ngIf="submitted && f.full_name.hasError('required')" class="mat-text-warn">You must Include Entity Full Name.</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="30%"> <div fxFlex="20%">
<mat-form-field class="ml-xs" style="width:100%"> <mat-form-field class="ml-xs" style="width:100%">
<input matInput placeholder="Entity Short Name" formControlName="short_name"> <input matInput placeholder="Entity Short Name" formControlName="short_name">
<mat-error *ngIf="submitted && f.short_name.hasError('required')" class="mat-text-warn">You must Include Entity Short Name.</mat-error> <mat-error *ngIf="submitted && f.short_name.hasError('required')" class="mat-text-warn">You must Include Entity Short Name.</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="30%">
<div fxFlex="20%">
<mat-form-field class="ml-xs" style="width:100%">
<mat-select placeholder="Score Card (Yes/No)" formControlName="is_score_card_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_score_card_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div>
<div fxFlex="20%">
<mat-form-field class="ml-xs" style="width:100%">
<mat-select placeholder="OTP (Yes/No)" formControlName="is_otp_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_otp_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div>
</div>
<div></div>
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="100%" fxLayoutAlign="flex-end">
<div fxFlex="20%">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" <button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button"
(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button> (click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-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-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>
</div> </div>
<div *ngIf="noEntityNameFound"> No Template Name Found.</div> <div *ngIf="noEntityNameFound"> No Template Name Found.</div>
</form> </form>