Merge branch 'master' of bitbucket.org:sriramv18/sparqsineedge

This commit is contained in:
bitbucket 2022-04-28 16:52:20 +05:30
commit 9e91e2fcc3
4 changed files with 28 additions and 11 deletions

View File

@ -67,6 +67,8 @@ 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';

View File

@ -22,6 +22,7 @@ import { MatDialog } from '@angular/material';
import { PushNotifyService } from 'app/shared/push-notify.service';
import { DynamicNotifyComponent } from '../dynamic-notify/dynamic-notify.component';
//import { CustomNotificationComponent } from '../custom-notification/custom-notification.component';

View File

@ -43,13 +43,16 @@
<mat-option #allSelected (click)="toggleAllSelection()" [value]="0">Select All</mat-option>
<span *ngFor="let option of pdofficerlist; let p_i=index">
<mat-option [value]="option.fk_user_id">{{option.first_name}}</mat-option>
</span>
</mat-select>
<div *ngIf="hasError('pdofficer', 'required')">
</div>
</mat-form-field>
</div>
<div
fxLayoutWrap
fxLayoutGap="3.5%"
@ -58,13 +61,16 @@
<mat-form-field fxFlex="100%" appearance="outline">
<mat-label>Enter Text</mat-label>
<textarea matInput type="text" formControlName="msg" ></textarea>
<div *ngIf="hasError('msg', 'required')">
</div>
</mat-form-field>
</div>
</mat-dialog-content>
<mat-dialog-actions align="end" >
<button mat-raised-button mat-dialog-close (click)="onSubmitUserDetails(customnotifyform.value)"><strong> Send</strong></button>
<button mat-raised-button mat-dialog-close (click)="onSubmitUserDetails(customnotifyform.value)" [disabled]="!customnotifyform.valid"><strong> Send</strong></button>
</mat-dialog-actions>
</form>

View File

@ -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);
};
}