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 { DynamicNotifyComponent } from './layouts/dynamic-notify/dynamic-notify.component';
// import { SelectAllComponent } from './select-all/select-all.component'; // import { SelectAllComponent } from './select-all/select-all.component';
// import { CustomNotificationComponent } from './layouts/custom-notification/custom-notification.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'; //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 { PushNotifyService } from 'app/shared/push-notify.service';
import { DynamicNotifyComponent } from '../dynamic-notify/dynamic-notify.component'; 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> <mat-option #allSelected (click)="toggleAllSelection()" [value]="0">Select All</mat-option>
<span *ngFor="let option of pdofficerlist; let p_i=index"> <span *ngFor="let option of pdofficerlist; let p_i=index">
<mat-option [value]="option.fk_user_id">{{option.first_name}}</mat-option> <mat-option [value]="option.fk_user_id">{{option.first_name}}</mat-option>
</span> </span>
</mat-select> </mat-select>
<div *ngIf="hasError('pdofficer', 'required')">
</div>
</mat-form-field> </mat-form-field>
</div> </div>
<div <div
fxLayoutWrap fxLayoutWrap
fxLayoutGap="3.5%" fxLayoutGap="3.5%"
@ -58,13 +61,16 @@
<mat-form-field fxFlex="100%" appearance="outline"> <mat-form-field fxFlex="100%" appearance="outline">
<mat-label>Enter Text</mat-label> <mat-label>Enter Text</mat-label>
<textarea matInput type="text" formControlName="msg" ></textarea> <textarea matInput type="text" formControlName="msg" ></textarea>
<div *ngIf="hasError('msg', 'required')">
</div>
</mat-form-field> </mat-form-field>
</div> </div>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions align="end" > <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> </mat-dialog-actions>
</form> </form>

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core'; 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 { MatOption } from '@angular/material';
import { UserService } from 'app/settings/service/user.service'; 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 { export class DynamicNotifyComponent implements OnInit {
selectedAll:any={pdofficer:false} selectedAll:any={pdofficer:false}
pdofficer: any; // pdofficer: any;
msg: any; // msg: any;
pdofficerlist: any = []; pdofficerlist: any = [];
selectedItems:any=[]; selectedItems:any=[];
dropdownSettings:any={}; dropdownSettings:any={};
@ -21,6 +21,9 @@ export class DynamicNotifyComponent implements OnInit {
customnotifyform: FormGroup; customnotifyform: FormGroup;
@ViewChild('allSelected') private allSelected: MatOption; @ViewChild('allSelected') private allSelected: MatOption;
pdofficer = new FormControl("", [Validators.required]);
msg = new FormControl("", [Validators.required]);
constructor( public users:UserService,private _fb:FormBuilder) { constructor( public users:UserService,private _fb:FormBuilder) {
@ -29,8 +32,11 @@ export class DynamicNotifyComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.customnotifyform = this._fb.group({ this.customnotifyform = this._fb.group({
pdofficer:[''], // pdofficer:[''],
msg:[''], // msg:[''],
pdofficer: this.pdofficer,
msg: this.msg
}) })
this.getPdofficersList() this.getPdofficersList()
@ -103,10 +109,10 @@ toggleAllSelection() {
onSubmitUserDetails(param) { onSubmitUserDetails(param) {
console.log(param) console.log(param)
let configdata; let configdata;
param.pdofficer.shift() // param.pdofficer.shift()
console.log(param.pdofficer.length -1 + ' '+ this.pdofficerlist.length) console.log(param.pdofficer.length -1 + ' '+ this.pdofficerlist.length)
if ((param.pdofficer.length) == this.pdofficerlist.length){ if ((param.pdofficer.length - 1) == this.pdofficerlist.length){
configdata = { "records":{ "user_id":0,"msg":param.msg} } configdata = { "records":{ "user_id":[0],"msg":param.msg} }
} }
else{ else{
configdata = { "records":{ "user_id":param.pdofficer,"msg":param.msg} } 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);
};
} }