Fairoj : Notification and some other issues fixed
This commit is contained in:
parent
ee773f92a1
commit
3755bb5ae8
3937
ng6-seed/package-lock.json
generated
3937
ng6-seed/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -145,10 +145,12 @@ export class AwsService {
|
||||
var newPassword = prompt('Enter New Password ', '');
|
||||
cognitoUser.confirmPassword(verificationCode, newPassword, {
|
||||
onSuccess() {
|
||||
//('Password confirmed!');
|
||||
alert('Password Changed Successfully!');
|
||||
},
|
||||
onFailure(err) {
|
||||
//('Password not confirmed!');
|
||||
// let msg=err.message.split(',')
|
||||
// msg[0]== 'Invalid verification code provided' ?
|
||||
alert(err.message)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -52,7 +52,10 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
|
||||
</mat-form-field>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 30%">
|
||||
<input matInput type="text" formControlName="pd_officer" placeholder="PD Officer Name" >
|
||||
</mat-form-field>
|
||||
<div align="right">
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
|
||||
|
||||
@ -60,6 +60,7 @@ export class AllPdComponent implements OnInit, OnChanges {
|
||||
pd_lender:[null],
|
||||
pd_name:[null],
|
||||
pd_applicant_id:[null],
|
||||
pd_officer:[null]
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
}
|
||||
|
||||
@ -54,6 +54,9 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 30%">
|
||||
<input matInput type="text" formControlName="pd_officer" placeholder="PD Officer Name" >
|
||||
</mat-form-field>
|
||||
<div align="right">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
|
||||
|
||||
@ -62,6 +62,7 @@ export class CompletedPdComponent implements OnInit, OnChanges {
|
||||
pd_lender:[null],
|
||||
pd_name:[null],
|
||||
pd_applicant_id:[null],
|
||||
pd_officer:['']
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
}
|
||||
|
||||
@ -53,6 +53,9 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 30%">
|
||||
<input matInput type="text" formControlName="pd_officer" placeholder="PD Officer Name" >
|
||||
</mat-form-field>
|
||||
<div align="right">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
|
||||
|
||||
@ -58,6 +58,7 @@ export class InprogressPdComponent implements OnInit, OnChanges {
|
||||
pd_lender:[null],
|
||||
pd_name:[null],
|
||||
pd_applicant_id:[null],
|
||||
pd_officer:[null]
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
}
|
||||
|
||||
@ -53,6 +53,9 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 30%">
|
||||
<input matInput type="text" formControlName="pd_officer" placeholder="PD Officer Name" >
|
||||
</mat-form-field>
|
||||
<div align="right">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
|
||||
|
||||
@ -60,6 +60,7 @@ export class QcCompletedPdComponent implements OnInit, OnChanges {
|
||||
pd_lender: [null],
|
||||
pd_name: [null],
|
||||
pd_applicant_id: [null],
|
||||
pd_officer:[null]
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
}
|
||||
|
||||
@ -53,6 +53,9 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput type="text" formControlName="pd_applicant_id" placeholder="Applicant Id">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 30%">
|
||||
<input matInput type="text" formControlName="pd_officer" placeholder="PD Officer Name" >
|
||||
</mat-form-field>
|
||||
<div align="right">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
|
||||
|
||||
@ -59,6 +59,7 @@ export class ScheduledPdComponent implements OnInit, OnChanges {
|
||||
pd_lender:[null],
|
||||
pd_name:[null],
|
||||
pd_applicant_id:[null],
|
||||
pd_officer:[null]
|
||||
});
|
||||
this.getcommonDropDown();
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ export class QcListComponent implements OnInit {
|
||||
this.viewPdList = true;
|
||||
this.recordStatus=false;
|
||||
this.allTab=true;
|
||||
console.log("qc list Entered")
|
||||
|
||||
}
|
||||
// after view call all tabs component
|
||||
|
||||
@ -13,6 +13,7 @@ import { EditPdApplicantComponent } from './../../../personal-discussion/manage-
|
||||
import { EditPdMasterComponent } from './../../../personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component';
|
||||
import { PdRequirementComponent } from './../../../personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component';
|
||||
import { InitiateAdditionalPdComponent } from './../../../personal-discussion/manage-pd/list-pd/initiate-additional-pd/initiate-additional-pd.component';
|
||||
import {QcStartComponent} from '../qc-start/qc-start.component'
|
||||
|
||||
import {DatePipe } from '@angular/common';
|
||||
@Component({
|
||||
@ -250,7 +251,7 @@ export class QcViewComponent implements OnInit, OnDestroy {
|
||||
// console.log('childData',childData);
|
||||
// return;
|
||||
this.destroyType=3;
|
||||
this.router.navigate([ '../../startpd',pdID,this.masterRandomString], { relativeTo: this.route });
|
||||
this.router.navigate([ '../../../startpd',pdID,this.masterRandomString], { relativeTo: this.route });
|
||||
}
|
||||
// pd report
|
||||
getPDIDReport(pdID:any) {
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="filter-header">
|
||||
<div class="ml-xs mr-xs" style="width: 100%;">
|
||||
<form [formGroup]="reportform">
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel [(expanded)]="expandStatus">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title class="text-xs-left">
|
||||
<h6 class="mt-0">
|
||||
@ -42,7 +42,7 @@
|
||||
</mat-expansion-panel-header>
|
||||
<div>
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||
<input matInput type="text" placeholder="Application ID" formControlName="applicant_id">
|
||||
<input matInput type="text" placeholder="Applicant ID" formControlName="applicant_id">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="ml-xs mr-xs" style="width:30%">
|
||||
@ -65,8 +65,13 @@
|
||||
</mat-form-field>
|
||||
|
||||
<div align="right">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
|
||||
matTooltip="Reset" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary">
|
||||
<mat-icon>settings_backup_restore</mat-icon>
|
||||
</button>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button
|
||||
matTooltip="Search" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button" (click)="searchform(reportform.value)">
|
||||
matTooltip="Search" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button" (click)="searchPanel()">
|
||||
<mat-icon>search</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
@ -82,7 +87,7 @@
|
||||
|
||||
<ng-container matColumnDef="serialno" sticky>
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Sl </th>
|
||||
<td mat-cell *matCellDef="let row; let i = index;"> {{row.serialno}} </td>
|
||||
<td mat-cell *matCellDef="let row; let i = index;"> {{i+1}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="applicant" sticky>
|
||||
@ -223,7 +228,7 @@
|
||||
</div>
|
||||
<div *ngIf="dataLength == 0" class="nocontent ml-xs mr-xs" style="padding: 1rem !important;">No records found</div>
|
||||
</div>
|
||||
<mat-paginator [length]="pageSize" [pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25, 50, 100,dataLength]" showFirstLastButtons></mat-paginator>
|
||||
<!-- <mat-paginator [length]="pageSize" [pageIndex]="pageIndex" [pageSize]="pageNumber" [pageSizeOptions]="[5, 10, 25, 50, 100,dataLength]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons></mat-paginator> -->
|
||||
</ng-template>
|
||||
</div>
|
||||
<div *ngIf="Loading">
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
/** Report Table Common Css (Overall)*/
|
||||
.report-table-container {
|
||||
max-height: 600px;
|
||||
max-height:600px;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
margin-top: 2%;
|
||||
|
||||
@ -4,7 +4,8 @@ import { ReportsService } from '../reports.service';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { FormGroup, FormControl,FormBuilder } from '@angular/forms';
|
||||
import * as XLSX from 'xlsx';
|
||||
import { MatSort,MatPaginator, MatTableDataSource } from '@angular/material';
|
||||
import { MatSort,MatPaginator, MatTableDataSource,PageEvent } from '@angular/material';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pd-mis',
|
||||
@ -12,7 +13,7 @@ import { MatSort,MatPaginator, MatTableDataSource } from '@angular/material';
|
||||
styleUrls: ['./pd-mis.component.scss']
|
||||
})
|
||||
export class PdMisComponent implements OnInit {
|
||||
|
||||
pageEvent:PageEvent;
|
||||
pipe = new DatePipe('en-US');
|
||||
maxDate: any;
|
||||
minDate: any;
|
||||
@ -28,6 +29,8 @@ export class PdMisComponent implements OnInit {
|
||||
public pageSize : number;
|
||||
public dataSource = new MatTableDataSource();
|
||||
error:any=[];
|
||||
pageNumber:number=10;
|
||||
pageIndex:number=0
|
||||
|
||||
displayedColumns = ['serialno',
|
||||
'applicant',
|
||||
@ -47,10 +50,11 @@ export class PdMisComponent implements OnInit {
|
||||
'agency_name',
|
||||
'officer_name',
|
||||
'pd_status'];
|
||||
expandStatus: boolean;
|
||||
|
||||
|
||||
|
||||
constructor(private reportsService:ReportsService,private route:ActivatedRoute,private router:Router,private form_builder:FormBuilder) {
|
||||
constructor(private reportsService:ReportsService,private route:ActivatedRoute,private router:Router,private form_builder:FormBuilder,private notifier:NotifierService) {
|
||||
this.reportform = this.form_builder.group({ from_date:[null],to_date:[null],city:[null],branch:[null],applicant_id:[null] });
|
||||
}
|
||||
|
||||
@ -60,8 +64,8 @@ export class PdMisComponent implements OnInit {
|
||||
}
|
||||
|
||||
getMISDailyReport() {
|
||||
|
||||
this.reportsService.retirveDataForMISDailyReport().subscribe(
|
||||
let array=[]
|
||||
this.reportsService.retirveDataForMISDailyReport(array).subscribe(
|
||||
data => {
|
||||
if(data.dataStatus == true){
|
||||
this.api_data = data.records;
|
||||
@ -114,59 +118,98 @@ export class PdMisComponent implements OnInit {
|
||||
filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
|
||||
this.dataSource.filter = filterValue;
|
||||
}
|
||||
|
||||
searchform(value:any){
|
||||
|
||||
this.reportsService.retirveDataForMISDailyReport().subscribe(
|
||||
|
||||
data => {
|
||||
if(data['dataStatus']==true)
|
||||
{
|
||||
this.filtered_data = data.records;
|
||||
|
||||
if(value.applicant_id !== null && value.applicant_id != ''){
|
||||
this.filtered_data = this.filterForApplicantID(this.filtered_data,value.applicant_id);
|
||||
}
|
||||
if(value.city !== null && value.city != ''){
|
||||
this.filtered_data = this.filterForCity(this.filtered_data,value.city);
|
||||
}
|
||||
if(value.branch !== null && value.branch != ''){
|
||||
// this.filtered_data = this.filtered_data.filter(val => val.branch == value.branch );
|
||||
// this.filtered_data = this.filtered_data.filter(val => this.customFilter(val,value.brach,3));
|
||||
this.filtered_data = this.filterForBranch(this.filtered_data,value.branch);
|
||||
}
|
||||
if(value.from_date !== null && value.to_date !== null){
|
||||
// console.log('value',value.from_date);
|
||||
// console.log('value',value.to_date);
|
||||
let from_Date = this.pipe.transform(value.from_date,'yyyy-MM-dd HH:mm:ss');
|
||||
let to_Date = this.pipe.transform(value.to_date,'yyyy-MM-dd HH:mm:ss');
|
||||
this.filtered_data = this.filtered_data.filter(val => val.created_on >= from_Date && val.created_on <= to_Date );
|
||||
// console.log('this.filtered_data',this.filtered_data);
|
||||
}
|
||||
this.Loading = false;
|
||||
this.dataLength = this.filtered_data.length;
|
||||
this.pageSize = this.filtered_data.length;
|
||||
if(this.filtered_data.length >= 1){
|
||||
this.api_data = this.filtered_data.map((val, i)=>{
|
||||
val['serialno'] = i + 1;
|
||||
return val;
|
||||
})
|
||||
}
|
||||
this.dataSource.data = this.filtered_data;
|
||||
}
|
||||
else{
|
||||
this.dataSource.data = this.filtered_data;
|
||||
this.dataLength = this.filtered_data.length;
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.error.push(error);
|
||||
this.dataLength = 0;
|
||||
this.Loading = false;
|
||||
}
|
||||
);
|
||||
pageChange(e) {
|
||||
console.log(e);
|
||||
}
|
||||
// searchform(value:any){
|
||||
|
||||
// this.reportsService.retirveDataForMISDailyReport(this.reportform.value).subscribe(
|
||||
|
||||
// data => {
|
||||
// if(data['dataStatus']==true)
|
||||
// {
|
||||
// this.filtered_data = data.records;
|
||||
|
||||
// if(value.applicant_id !== null && value.applicant_id != ''){
|
||||
// this.filtered_data = this.filterForApplicantID(this.filtered_data,value.applicant_id);
|
||||
// }
|
||||
// if(value.city !== null && value.city != ''){
|
||||
// this.filtered_data = this.filterForCity(this.filtered_data,value.city);
|
||||
// }
|
||||
// if(value.branch !== null && value.branch != ''){
|
||||
// // this.filtered_data = this.filtered_data.filter(val => val.branch == value.branch );
|
||||
// // this.filtered_data = this.filtered_data.filter(val => this.customFilter(val,value.brach,3));
|
||||
// this.filtered_data = this.filterForBranch(this.filtered_data,value.branch);
|
||||
// }
|
||||
// if(value.from_date !== null && value.to_date !== null){
|
||||
// // console.log('value',value.from_date);
|
||||
// // console.log('value',value.to_date);
|
||||
// let from_Date = this.pipe.transform(value.from_date,'yyyy-MM-dd HH:mm:ss');
|
||||
// let to_Date = this.pipe.transform(value.to_date,'yyyy-MM-dd HH:mm:ss');
|
||||
// this.filtered_data = this.filtered_data.filter(val => val.created_on >= from_Date && val.created_on <= to_Date );
|
||||
// // console.log('this.filtered_data',this.filtered_data);
|
||||
// }
|
||||
// this.Loading = false;
|
||||
// this.dataLength = this.filtered_data.length;
|
||||
// this.pageSize = this.filtered_data.length;
|
||||
// if(this.filtered_data.length >= 1){
|
||||
// this.api_data = this.filtered_data.map((val, i)=>{
|
||||
// val['serialno'] = i + 1;
|
||||
// return val;
|
||||
// })
|
||||
// }
|
||||
// this.dataSource.data = this.filtered_data;
|
||||
// }
|
||||
// else{
|
||||
// this.dataSource.data = this.filtered_data;
|
||||
// this.dataLength = this.filtered_data.length;
|
||||
// }
|
||||
// },
|
||||
// error => {
|
||||
// this.error.push(error);
|
||||
// this.dataLength = 0;
|
||||
// this.Loading = false;
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
searchPanel(){
|
||||
this.reportform.value.from_date=this.pipe.transform(this.reportform.value.from_date,'yyyy-MM-dd')
|
||||
this.reportform.value.to_date=this.pipe.transform(this.reportform.value.to_date,'yyyy-MM-dd')
|
||||
this.reportsService.retirveDataForMISDailyReport(this.reportform.value).subscribe(res=>{
|
||||
if(res['dataStatus'] == true){
|
||||
|
||||
this.dataSource.data=res['records'];
|
||||
this.dataLength=res['records'].length;
|
||||
this.expandStatus=false
|
||||
if(this.dataLength == 0){
|
||||
console.log("data length",this.dataLength)
|
||||
this.notifier.notify('warning', 'No Records Found !');
|
||||
this.dataSource.data = [];
|
||||
this.dataLength=0
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.notifier.notify('Warning', 'Something Went Wrong');
|
||||
this.dataSource.data = [];
|
||||
this.dataLength=0
|
||||
}
|
||||
},error => {
|
||||
//this.errorMessage.push(error);
|
||||
this.error.push(error)
|
||||
this.dataLength=0
|
||||
this.Loading = false;
|
||||
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
alert(error.html_format);
|
||||
});
|
||||
|
||||
}
|
||||
onReset(){
|
||||
// if(this.reportform.value.filter(val=>val.))
|
||||
this.Loading=true
|
||||
this.reportform.reset();
|
||||
this.getMISDailyReport()
|
||||
this.expandStatus=false
|
||||
}
|
||||
filterForApplicantID(arrayData: any, Values: any) {
|
||||
Values = Values.toLowerCase();
|
||||
if (Values) {
|
||||
@ -193,12 +236,14 @@ export class PdMisComponent implements OnInit {
|
||||
Values = Values.toLowerCase();
|
||||
if (Values) {
|
||||
let Filter: any = [];
|
||||
|
||||
let getAllCityOnly = arrayData.map(v => v.city.replace(/[^A-Za-z0-9]/ig, "").toLowerCase());
|
||||
// console.log("arra",JSON.parse(arrayData),Values);
|
||||
let getAllCityOnly = arrayData.map(v => v.city.replace(/[^A-Za-z0-9]/ig, "").toLowerCase());
|
||||
console.log("getall ",getAllCityOnly)
|
||||
|
||||
let searched_filter_array = getAllCityOnly.filter(val => val.includes(Values));
|
||||
|
||||
Filter = searched_filter_array.map(x => {
|
||||
console.log("x",x);
|
||||
let findIndex = getAllCityOnly.indexOf(x);
|
||||
return arrayData[findIndex];
|
||||
});
|
||||
|
||||
@ -25,10 +25,53 @@ import { NgxDatatableModule } from '@swimlane/ngx-datatable';
|
||||
import { ReportsService } from '../reports/reports.service';
|
||||
import { ReportsRoutingModule } from './reports-routing.module';
|
||||
import { PdMisComponent } from './pd-mis/pd-mis.component';
|
||||
import {NotifierModule,NotifierOptions} from 'angular-notifier'
|
||||
|
||||
|
||||
const pdCustomNotifierOptions: NotifierOptions = {
|
||||
position: {
|
||||
horizontal: {
|
||||
position: 'right',
|
||||
distance: 12
|
||||
},
|
||||
vertical: {
|
||||
position: 'top',
|
||||
distance: 32,
|
||||
gap: 10
|
||||
}
|
||||
},
|
||||
theme: 'material',
|
||||
behaviour: {
|
||||
autoHide: 2000,
|
||||
onClick: 'hide',
|
||||
onMouseover: 'pauseAutoHide',
|
||||
showDismissButton: true,
|
||||
stacking: 4
|
||||
},
|
||||
animations: {
|
||||
enabled: true,
|
||||
show: {
|
||||
preset: 'slide',
|
||||
speed: 300,
|
||||
easing: 'ease'
|
||||
},
|
||||
hide: {
|
||||
preset: 'fade',
|
||||
speed: 300,
|
||||
easing: 'ease',
|
||||
offset: 50
|
||||
},
|
||||
shift: {
|
||||
speed: 300,
|
||||
easing: 'ease'
|
||||
},
|
||||
overlap: 150
|
||||
}
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
NotifierModule.withConfig(pdCustomNotifierOptions),
|
||||
MatExpansionModule,
|
||||
CommonModule,
|
||||
MatFormFieldModule,
|
||||
|
||||
@ -22,7 +22,7 @@ export class ReportsService {
|
||||
// }
|
||||
|
||||
// get Details
|
||||
retirveDataForMISDailyReport(): Observable<any> {
|
||||
return this._http.get(this.apiUrl + 'PD_MIS_report');
|
||||
retirveDataForMISDailyReport(value): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'PD_MIS_report',value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,9 +81,10 @@ export class LoginComponent implements OnInit{
|
||||
if (result !== undefined) {
|
||||
let auth = { 'Username': this.email, 'Password': this.password, 'newpassword': result };
|
||||
this.aws.dologin(auth).subscribe(res => {
|
||||
localStorage.setItem('user_role',res.idToken.payload["custom:role_id"]);
|
||||
this.router.navigate(['/home']);
|
||||
}, err => {
|
||||
// alert(err.message);
|
||||
alert(err.message);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
@ -73,7 +73,7 @@ export class RegisterComponent implements OnInit {
|
||||
this.regForm = this.fb.group({
|
||||
userid: [null],
|
||||
firstName: [null, Validators.compose([Validators.required, Validators.minLength(2)])],
|
||||
lastName: [null, Validators.compose([Validators.required])],
|
||||
lastName: ['', Validators.compose([Validators.required])],
|
||||
phone: [null, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(12)])],
|
||||
email: [null, Validators.compose([Validators.required, CustomValidators.email])],
|
||||
role: [null, Validators.compose([Validators.required])],
|
||||
|
||||
@ -9,6 +9,7 @@ import { HttpClient } from '@angular/common/http';
|
||||
|
||||
/** Environment */
|
||||
import { environment } from 'environments/environment'
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Injectable()
|
||||
export class MessagingService {
|
||||
@ -19,7 +20,8 @@ export class MessagingService {
|
||||
private angularFireDB: AngularFireDatabase,
|
||||
private angularFireAuth: AngularFireAuth,
|
||||
private angularFireMessaging: AngularFireMessaging,
|
||||
private http: HttpClient) {
|
||||
private http: HttpClient,
|
||||
private router:Router) {
|
||||
this.angularFireMessaging.messaging.subscribe(
|
||||
(_messaging) => {
|
||||
_messaging.onMessage = _messaging.onMessage.bind(_messaging);
|
||||
@ -43,11 +45,11 @@ export class MessagingService {
|
||||
this.angularFireDB.object('fcmTokens/').update(data)
|
||||
|
||||
})
|
||||
// let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}};
|
||||
// this.updateNotificationToken(params).subscribe(
|
||||
// (data) => { console.log('success',data);},
|
||||
// (err) => { console.error('Something Went wrong on update notify.', err);
|
||||
// });
|
||||
let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}};
|
||||
this.updateNotificationToken(params).subscribe(
|
||||
(data) => { console.log('success',data);},
|
||||
(err) => { console.error('Something Went wrong on update notify.', err);
|
||||
});
|
||||
}
|
||||
|
||||
updateNotificationToken(params): Observable<any> {
|
||||
@ -61,9 +63,11 @@ export class MessagingService {
|
||||
* @param userId userId
|
||||
*/
|
||||
requestPermission(userId) {
|
||||
// console.log("user id in request permission method",userId)
|
||||
this.angularFireMessaging.requestToken.subscribe(
|
||||
(token) => {
|
||||
// console.log(token);
|
||||
console.log(token);
|
||||
// this.router.navigate(['./personal_discussion'])
|
||||
this.updateToken(userId, token);
|
||||
},
|
||||
(err) => {
|
||||
@ -78,8 +82,9 @@ export class MessagingService {
|
||||
receiveMessage() {
|
||||
this.angularFireMessaging.messages.subscribe(
|
||||
(payload) => {
|
||||
// console.log("new message received. ", payload);
|
||||
console.log("new message received. ", payload);
|
||||
this.currentMessage.next(payload);
|
||||
//this.router.navigate([''])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,8 @@ export const environment = {
|
||||
|
||||
environmentName: 'Development Environment',//Localhost Environment.
|
||||
|
||||
apiEndpoint: 'https://ssa.sineedge.com/sparqtest/api/',
|
||||
// apiEndpoint: 'https://ssa.sineedge.com/sparqtest/api/',
|
||||
apiEndpoint: 'https://demo.pdgenie.com/sparqtest/api/',
|
||||
|
||||
authorization: 'sparqvenba2018',
|
||||
|
||||
|
||||
@ -7,7 +7,8 @@ importScripts('https://www.gstatic.com/firebasejs/5.5.0/firebase-messaging.js');
|
||||
// Initialize the Firebase app in the service worker by passing in the
|
||||
// messagingSenderId.
|
||||
firebase.initializeApp({
|
||||
'messagingSenderId': '627754063571'
|
||||
// 'messagingSenderId': '627754063571'
|
||||
'messagingSenderId': '906855209078'
|
||||
});
|
||||
|
||||
// Retrieve an instance of Firebase Messaging so that it can handle background
|
||||
|
||||
Loading…
Reference in New Issue
Block a user