This commit is contained in:
Surendiran 2023-05-15 16:57:46 +05:30
parent a02b15812e
commit df1a32a4a7
9 changed files with 78 additions and 38 deletions

View File

@ -89,8 +89,7 @@ export class AddBusinessComponent implements OnInit {
ngOnInit() { ngOnInit() {
let userrole = localStorage.getItem('user_role') let userrole = localStorage.getItem('user_role')
this.form = new FormGroup({ this.form = new FormGroup({
admin_checked: new FormControl('',null), admin_checked: new FormControl('',null),
logo: new FormControl('', null), logo: new FormControl('', null),
busName: new FormControl('', [Validators.required]), busName: new FormControl('', [Validators.required]),
address: new FormControl('', [Validators.required, Validators.maxLength(100)]), address: new FormControl('', [Validators.required, Validators.maxLength(100)]),
@ -111,8 +110,7 @@ export class AddBusinessComponent implements OnInit {
return this.form.controls[controlName].hasError(errorName); return this.form.controls[controlName].hasError(errorName);
} }
validateUsernameAvailability(control: FormControl) { validateUsernameAvailability(control: FormControl) {
return this.http.get<any[]>(this.apiUrl + "businessDetailList") return this.http.get<any[]>(this.apiUrl + "businessDetailList")
.pipe( .pipe(
map((response:any) => { map((response:any) => {
@ -124,7 +122,7 @@ export class AddBusinessComponent implements OnInit {
tmp.push(element.email) tmp.push(element.email)
}); });
console.log(tmp,`${control.value}`); console.log(tmp,`${control.value}`);
return !tmp.includes(`${control.value}`) ? null : { usernameTaken: true }; return !tmp.includes(`${control.value}` && this.action == 'add') ? null : { usernameTaken: true };
}) })
); );
} }
@ -134,10 +132,11 @@ export class AddBusinessComponent implements OnInit {
let tmp = this.form.value let tmp = this.form.value
tmp.id = this.local_data.id tmp.id = this.local_data.id
console.log(tmp,this.form) console.log(tmp,this.form)
if (!this.form.valid) { if (!this.form.valid) {
console.log("check") console.log("check")
return; return;
} }
// this.formData.append('image', this.currentFileUpload); // this.formData.append('image', this.currentFileUpload);
// console.log(this.formData.getAll('image')); // console.log(this.formData.getAll('image'));
if(this.action == 'Update'){ if(this.action == 'Update'){

View File

@ -34,6 +34,13 @@ export class BusinessService {
// ) // )
} }
getMailLogDetails(params:any): Observable<any> {
return this._http.post(this.apiUrl + 'getMailDetails', params)
// .pipe(
// catchError(this.handleError('role', []))
// )
}
private handleError<T>(operation = 'operation', result?: T) { private handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => { return (error: any): Observable<T> => {
return of(result as T); return of(result as T);

View File

@ -9,11 +9,11 @@
<div class="main-content" fxLayout="row" fxLayoutAlign="center start"> <div class="main-content" fxLayout="row" fxLayoutAlign="center start">
<div fxFlex.gt-sm="90" fxFlex.gt-xs="95" fxFlex="100"> <div fxFlex.gt-sm="90" fxFlex.gt-xs="95" fxFlex="100">
<div class="messages-list material fullscreen"> <div class="messages-list material fullscreen">
<table mat-table [dataSource]="dataSource" #mytable class="my-table mat-elevation-z8 len-table"> <table mat-table [dataSource]="mailLogListSource" #mytable class="my-table mat-elevation-z8 len-table">
<ng-container matColumnDef="report"> <ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef class="font-color mat-no">Report </th> <th mat-header-cell *matHeaderCellDef class="font-color mat-no">S.No </th>
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.report}} </td> <td mat-cell *matCellDef="let element" class="element-spc"> {{element.id}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="subject"> <ng-container matColumnDef="subject">
@ -26,9 +26,9 @@
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.recipients}} </td> <td mat-cell *matCellDef="let element" class="element-spc"> {{element.recipients}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="content"> <ng-container matColumnDef="contentPage">
<th mat-header-cell *matHeaderCellDef class="font-color mat-no"> Content Page </th> <th mat-header-cell *matHeaderCellDef class="font-color mat-no"> Content Page </th>
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.content}} </td> <td mat-cell *matCellDef="let element" class="element-spc"> {{element.contentPage}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="status"> <ng-container matColumnDef="status">
@ -36,9 +36,9 @@
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.status}} </td> <td mat-cell *matCellDef="let element" class="element-spc"> {{element.status}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="time"> <ng-container matColumnDef="createdAt">
<th mat-header-cell *matHeaderCellDef class="font-color mat-no"> Time Sent</th> <th mat-header-cell *matHeaderCellDef class="font-color mat-no"> Time Sent</th>
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.time}} </td> <td mat-cell *matCellDef="let element" class="element-spc"> {{element.createdAt | date:'short'}} </td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
@ -51,9 +51,9 @@
</mat-progress-spinner> </mat-progress-spinner>
</mat-card> --> </mat-card> -->
<div [hidden]="recordStatus"> <div [hidden]="recordStatus">
<mat-paginator #paginator class="mat-elevation-z1" [length]="" [pageIndex]="pageIndex" [pageSize]="pageSize" <mat-paginator #paginator class="mat-elevation-z1" [length]="mailLogListLength" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons> [pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator> </mat-paginator>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,7 +1,8 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { MatTable } from '@angular/material/table'; import { MatTable, MatTableDataSource } from '@angular/material/table';
import { BusinessService } from 'app/appoinment/business/business-service/business.service';
export interface PeriodicElement { export interface PeriodicElement {
report: string; report: string;
@ -26,7 +27,7 @@ const ELEMENT_DATA: PeriodicElement[] = [
}) })
export class MailLogComponent implements OnInit { export class MailLogComponent implements OnInit {
displayedColumns: string[] = ['report', 'subject', 'recipients', 'content', 'status', 'time']; displayedColumns: string[] = ['id', 'subject', 'recipients', 'contentPage','status', 'createdAt'];
dataSource = ELEMENT_DATA; dataSource = ELEMENT_DATA;
length = 5; length = 5;
pageIndex = 0; pageIndex = 0;
@ -38,18 +39,46 @@ export class MailLogComponent implements OnInit {
@ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
@ViewChild(MatTable,{static:true}) table: MatTable<any> @ViewChild(MatTable,{static:true}) table: MatTable<any>
constructor() { } mailLogList: any[] = [];
public mailLogListLength: number;
public mailLogListSource = new MatTableDataSource();
constructor(public _mail:BusinessService) { }
pageChange(e) { pageChange(e) {
console.log(e); console.log(e);
} }
ngOnInit(): void { ngOnInit(): void {
this.getMailLogList()
this.recordStatus=false; this.recordStatus=false;
} }
applyFilter(filterValue: string) { applyFilter(filterValue: string) {
filterValue = filterValue.trim(); filterValue = filterValue.trim(); // Remove whitespace
filterValue = filterValue.toLowerCase(); filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
// this.customersListSource.filter = filterValue; this.mailLogListSource.filter = filterValue;
}
getMailLogList() {
let busId = localStorage.getItem('busId')
// let user_id = localStorage.getItem('user_id')
// let param = {}
let param = {"busId":busId}
this._mail.getMailLogDetails(param).subscribe(res => {
if (res.status == 200) {
this.isLoading = false
this.mailLogList = res.data;
console.log(this.mailLogList)
this.mailLogListLength = res.data.length;
this.mailLogListSource['data'] = this.mailLogList;
console.log(this.mailLogListSource)
this.recordStatus=false;
}
else{
this.isLoading = false
this.mailLogListSource['data'] = []
this.mailLogList=[];
this.mailLogListLength= null;
this.recordStatus=true;
}
}, error => this.isLoading = false);
} }
} }

View File

@ -22,9 +22,12 @@
<mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane"> <mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
<mat-label>Fees</mat-label> <mat-label>Fees</mat-label>
<input appMobileNumberPattern placeholder="Fees" matInput formControlName="fees"> <input appMobileNumberPattern placeholder="Fees" matInput formControlName="fees">
<div matSuffix>
<span><b>{{currencySymbol}}</b></span>
</div>
<mat-error *ngIf="myError('fees', 'required')">Fees is required</mat-error> <mat-error *ngIf="myError('fees', 'required')">Fees is required</mat-error>
<!-- <mat-error *ngIf="myError('fees', 'maxlength')">Limit exceed</mat-error> --> <!-- <mat-error *ngIf="myError('fees', 'maxlength')">Limit exceed</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane"> <mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
<mat-label>Description</mat-label> <mat-label>Description</mat-label>
<textarea row="5" cols="7" matInput placeholder="Description" formControlName="description"></textarea> <textarea row="5" cols="7" matInput placeholder="Description" formControlName="description"></textarea>

View File

@ -18,12 +18,15 @@ export class AddServiceComponent implements OnInit {
local_data:any; local_data:any;
action:string; action:string;
public durationTime = [{'time':'15'},{'time':'30'},{'time':'45'},{'time':'60'},{'time':'75'},{'time':'90'},{'time':'105'},{'time':'120'},{'time':'135'},{'time':'150'},{'time':'165'},{'time':'180'}] public durationTime = [{'time':'15'},{'time':'30'},{'time':'45'},{'time':'60'},{'time':'75'},{'time':'90'},{'time':'105'},{'time':'120'},{'time':'135'},{'time':'150'},{'time':'165'},{'time':'180'}]
currencySymbol: any;
constructor(private router: Router,private formBuilder: FormBuilder, constructor(private router: Router,private formBuilder: FormBuilder,
public dialogRef: MatDialogRef<AddServiceComponent>, public dialogRef: MatDialogRef<AddServiceComponent>,
@Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData) { @Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData) {
console.log(data); console.log(data);
this.local_data = {...data}; this.local_data = {...data};
this.action = this.local_data.action; this.action = this.local_data.action;
this.currencySymbol = localStorage.getItem('currency')
} }
get f(){ get f(){
return this.form.controls; return this.form.controls;

View File

@ -102,6 +102,9 @@ users() {
this.getUserData = res.data[0] this.getUserData = res.data[0]
// this.usersLogo = res.data[0].logo; // this.usersLogo = res.data[0].logo;
console.log(this.getUserData) console.log(this.getUserData)
let currency = this.getUserData.BusinessDetails[0].currency
console.log(currency)
localStorage.setItem('currency',currency)
} }
}) })
} }

View File

@ -39,4 +39,5 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<notifier-container></notifier-container>

View File

@ -1,6 +1,7 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { NotifierService } from 'angular-notifier';
import { SessionService } from 'app/session-services/session.service'; import { SessionService } from 'app/session-services/session.service';
@Component({ @Component({
@ -12,31 +13,21 @@ import { SessionService } from 'app/session-services/session.service';
export class ResetPasswordComponent implements OnInit { export class ResetPasswordComponent implements OnInit {
form: FormGroup; form: FormGroup;
forgotApiDetails: string; forgotApiDetails: string;
<<<<<<< HEAD email:any=[];
token:any = [];
hide: boolean; hide: boolean;
hide2:boolean; hide2:boolean;
constructor(private router: Router,public _ser:SessionService) { } constructor(private notifierService: NotifierService,private router: Router,public _ser:SessionService,private route: ActivatedRoute) { }
ngOnInit(): void { ngOnInit(): void {
this.hide = true; this.hide = true;
this.hide2 =true this.hide2 =true
this._ser.name.subscribe(data=>{
this.forgotApiDetails = data;
console.log(this.forgotApiDetails)
});
=======
email:any=[];
token:any = [];
constructor(private router: Router,public _ser:SessionService,private route: ActivatedRoute) { }
ngOnInit(): void {
// this._ser.name.subscribe(data=>{ // this._ser.name.subscribe(data=>{
// this.forgotApiDetails = data; // this.forgotApiDetails = data;
// console.log(this.forgotApiDetails) // console.log(this.forgotApiDetails)
// }); // });
this.email = this.route.snapshot.paramMap.get('email'); this.email = this.route.snapshot.paramMap.get('email');
this.token = this.route.snapshot.paramMap.get('token'); this.token = this.route.snapshot.paramMap.get('token');
>>>>>>> d71932e5e29ec8a54c96b8028b0207cb563576b2
this.form = new FormGroup({ this.form = new FormGroup({
password: new FormControl('', [Validators.required,Validators.pattern( password: new FormControl('', [Validators.required,Validators.pattern(
@ -56,7 +47,11 @@ export class ResetPasswordComponent implements OnInit {
this._ser.resetPasswordApi(this.email, this.token ,this.form.value).subscribe(res => { this._ser.resetPasswordApi(this.email, this.token ,this.form.value).subscribe(res => {
console.log(res) console.log(res)
if(res.status == 200){ if(res.status == 200){
this.router.navigate(['authentication/login']) this.notifierService.notify('success', res.message);
setTimeout(() => {
this.router.navigate(['authentication/login']);
return false;
},1000);
} }
// this.forgotTokenEmail = res // this.forgotTokenEmail = res