From 262aa823ea44dfddf28ed9518198b7fc8b874bae Mon Sep 17 00:00:00 2001 From: surya Date: Wed, 27 Apr 2022 13:14:16 +0530 Subject: [PATCH 1/2] custom notification --- ng6-seed/src/app/app.module.ts | 6 +++--- ng6-seed/src/app/layouts/admin/admin-layout.component.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ng6-seed/src/app/app.module.ts b/ng6-seed/src/app/app.module.ts index a820fab66..03495251c 100755 --- a/ng6-seed/src/app/app.module.ts +++ b/ng6-seed/src/app/app.module.ts @@ -65,8 +65,8 @@ import { PushNotifyService } from './shared/push-notify.service'; import { MatVideoModule } from 'mat-video'; import { ReqTokenInterceptor } from './_guard/req-token.interceptor'; import { DynamicNotifyComponent } from './layouts/dynamic-notify/dynamic-notify.component'; -import { SelectAllComponent } from './select-all/select-all.component'; -import { CustomNotificationComponent } from './layouts/custom-notification/custom-notification.component'; +//import { SelectAllComponent } from './select-all/select-all.component'; +//import { CustomNotificationComponent } from './layouts/custom-notification/custom-notification.component'; //import { OtpComponent } from './session/otp/otp.component'; @@ -90,7 +90,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { AdminLayoutComponent, AuthLayoutComponent, NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, HttpLoaderComponent, - IncomingCallComponent, VideoChatComponent, DynamicNotifyComponent, SelectAllComponent, CustomNotificationComponent + IncomingCallComponent, VideoChatComponent, DynamicNotifyComponent, ], imports: [ ReactiveFormsModule, diff --git a/ng6-seed/src/app/layouts/admin/admin-layout.component.ts b/ng6-seed/src/app/layouts/admin/admin-layout.component.ts index 16910e7c1..802d5d56a 100755 --- a/ng6-seed/src/app/layouts/admin/admin-layout.component.ts +++ b/ng6-seed/src/app/layouts/admin/admin-layout.component.ts @@ -21,7 +21,7 @@ import { MatDialog } from '@angular/material'; // import { VideoChatComponent } from 'app/video-chat/video-chat.component'; import { PushNotifyService } from 'app/shared/push-notify.service'; import { DynamicNotifyComponent } from '../dynamic-notify/dynamic-notify.component'; -import { CustomNotificationComponent } from '../custom-notification/custom-notification.component'; +//import { CustomNotificationComponent } from '../custom-notification/custom-notification.component'; From 29926b94fe1c53a031d7fb1f236520e5367b6a0d Mon Sep 17 00:00:00 2001 From: surya Date: Thu, 28 Apr 2022 16:12:42 +0530 Subject: [PATCH 2/2] Custom Notification -single msg,validation --- .../dynamic-notify.component.html | 10 +++++-- .../dynamic-notify.component.ts | 26 ++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ng6-seed/src/app/layouts/dynamic-notify/dynamic-notify.component.html b/ng6-seed/src/app/layouts/dynamic-notify/dynamic-notify.component.html index 0d42a0c57..08c4cfd4a 100644 --- a/ng6-seed/src/app/layouts/dynamic-notify/dynamic-notify.component.html +++ b/ng6-seed/src/app/layouts/dynamic-notify/dynamic-notify.component.html @@ -43,13 +43,16 @@ Select All {{option.first_name}} + +
+ +
-
Enter Text +
+ +
- + diff --git a/ng6-seed/src/app/layouts/dynamic-notify/dynamic-notify.component.ts b/ng6-seed/src/app/layouts/dynamic-notify/dynamic-notify.component.ts index 665af8f6d..6231590b7 100644 --- a/ng6-seed/src/app/layouts/dynamic-notify/dynamic-notify.component.ts +++ b/ng6-seed/src/app/layouts/dynamic-notify/dynamic-notify.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { FormBuilder, FormGroup } from '@angular/forms'; +import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { MatOption } from '@angular/material'; import { UserService } from 'app/settings/service/user.service'; @@ -12,8 +12,8 @@ import { UserService } from 'app/settings/service/user.service'; }) export class DynamicNotifyComponent implements OnInit { selectedAll:any={pdofficer:false} - pdofficer: any; - msg: any; + // pdofficer: any; + // msg: any; pdofficerlist: any = []; selectedItems:any=[]; dropdownSettings:any={}; @@ -21,6 +21,9 @@ export class DynamicNotifyComponent implements OnInit { customnotifyform: FormGroup; @ViewChild('allSelected') private allSelected: MatOption; + pdofficer = new FormControl("", [Validators.required]); + msg = new FormControl("", [Validators.required]); + constructor( public users:UserService,private _fb:FormBuilder) { @@ -29,8 +32,11 @@ export class DynamicNotifyComponent implements OnInit { ngOnInit() { this.customnotifyform = this._fb.group({ - pdofficer:[''], - msg:[''], + // pdofficer:[''], + // msg:[''], + pdofficer: this.pdofficer, + msg: this.msg + }) this.getPdofficersList() @@ -103,10 +109,10 @@ toggleAllSelection() { onSubmitUserDetails(param) { console.log(param) let configdata; - param.pdofficer.shift() + // param.pdofficer.shift() console.log(param.pdofficer.length -1 + ' '+ this.pdofficerlist.length) - if ((param.pdofficer.length) == this.pdofficerlist.length){ - configdata = { "records":{ "user_id":0,"msg":param.msg} } + if ((param.pdofficer.length - 1) == this.pdofficerlist.length){ + configdata = { "records":{ "user_id":[0],"msg":param.msg} } } else{ configdata = { "records":{ "user_id":param.pdofficer,"msg":param.msg} } @@ -122,7 +128,9 @@ toggleAllSelection() { } - + public hasError = (controlName: string, errorName: string) => { + return this.customnotifyform.controls[controlName].hasError(errorName); + }; }