working hours changes

This commit is contained in:
bitbucket 2023-03-29 16:37:49 +05:30
parent ccadab7bc9
commit 70fc993883
9 changed files with 735 additions and 572 deletions

View File

@ -37,7 +37,7 @@
</ng-container> </ng-container>
<ng-container matColumnDef="time"> <ng-container matColumnDef="time">
<th mat-header-cell *matHeaderCellDef class="font-color">Appointment Time </th> <th mat-header-cell *matHeaderCellDef class="font-color">Appointment Time </th>
<td mat-cell *matCellDef="let element"> <div class="label">{{element.appoinmentSlots }}</div> </td> <td mat-cell *matCellDef="let element"><br> <div class="label">{{element.appoinmentSlots }}</div> </td>
</ng-container> </ng-container>

View File

@ -63,8 +63,18 @@ export class AppoinmentsListComponent implements OnInit {
this._app.getAppoinmentsListDetails().subscribe(res => { this._app.getAppoinmentsListDetails().subscribe(res => {
if (res.status == 200) { if (res.status == 200) {
this.appoinmentsList = res.data; this.appoinmentsList = res.data;
let user_role = localStorage.getItem('user_role');
if(user_role == 'PRACTITIONER'){
let id = localStorage.getItem('user_id')
console.log(id)
this.appoinmentsList
console.log(this.appoinmentsList) console.log(this.appoinmentsList)
let filter = this.appoinmentsList.filter(arr=>{return arr["ServicesMapDetail.userId"]
== id})
console.log(filter)
this.appoinmentsList = filter
}
} }
else{ else{

View File

@ -160,7 +160,19 @@ export class BusinessListComponent implements OnInit {
// var d = this.customersList.length+1 // var d = this.customersList.length+1
console.log(formValue[0]) console.log(formValue[0])
this._bus.addFormDetails(formValue[0]).subscribe(res => {
const formData:FormData = new FormData();
formData.append('image', formValue[0].logo);
// formData.append('busId', JSON.stringify(formValue[0].busName));
// formData.append('busName', JSON.stringify(formValue[0].busName));
// formData.append('address', JSON.stringify(formValue[0].address));
// formData.append('state', JSON.stringify(formValue[0].state));
// formData.append('city', JSON.stringify(formValue[0].city));
// formData.append('email', JSON.stringify(formValue[0].email));
// formData.append('contactNo', JSON.stringify(formValue[0].contactNo));
console.log(formData)
this._bus.addFormDetails(formData).subscribe(res => {
if (res.status == 200) { if (res.status == 200) {
// this.customersList = res.data; // this.customersList = res.data;
this.getBusinessList() this.getBusinessList()

View File

@ -19,7 +19,7 @@ export class BusinessService {
) )
} }
addFormDetails(addParams): Observable<any> { addFormDetails(addParams:any): Observable<any> {
return this._http.post(this.apiUrl + 'createBusinessDetails', addParams) return this._http.post(this.apiUrl + 'createBusinessDetails', addParams)
// .pipe( // .pipe(
// catchError(this.handleError('role', [])) // catchError(this.handleError('role', []))

View File

@ -19,6 +19,10 @@
<span class="staff-title"> <span class="staff-title">
Profile Profile
</span> </span>
<button mat-icon-button matTooltip="Edit" *ngIf="isEditable == false" (click)="edit_table(isEditable)" fileName="customers"><mat-icon >edit</mat-icon></button>
<!-- <button mat-icon-button *ngIf="table[0].statement == statement_item && table[0].statement != 'Cash Flow Statement'" color="accent" matTooltip="Edit" matTooltipPosition="right" (click)="editandcancel(true,table[0].section)" ><mat-icon>edit</mat-icon></button> -->
<button mat-icon-button color="accent" *ngIf="isEditable == true" (click)="edit_table(isEditable)" matTooltip="Cancel" matTooltipPosition="right" ><mat-icon>cancel_presentation</mat-icon></button>
<button mat-icon-button color="accent" *ngIf="isEditable == true" matTooltip="Submit" matTooltipPosition="right" ><mat-icon>done</mat-icon></button>
</div> </div>
<ng-scrollbar class="scrollHV"> <ng-scrollbar class="scrollHV">
<div mat-dialog-content class="my-table" > <div mat-dialog-content class="my-table" >
@ -26,6 +30,7 @@
<div class="form-group label-container"> <div class="form-group label-container">
<label>Name <span class="line">-</span></label> <label>Name <span class="line">-</span></label>
<a style="padding: 10px;">{{usersList.userName}}</a> <a style="padding: 10px;">{{usersList.userName}}</a>
</div> </div>
<div class="form-group label-container"> <div class="form-group label-container">
<label>Email Address <span style="margin-left: 2.7rem;">-</span></label> <label>Email Address <span style="margin-left: 2.7rem;">-</span></label>
@ -41,32 +46,67 @@
</div> </div>
<div class="form-group label-container"> <div class="form-group label-container">
<label>Gender <span style="margin-left: 5.5rem;">-</span></label> <label>Gender <span style="margin-left: 5.5rem;">-</span></label>
<a style="padding: 10px;">{{practitionerdetails.gender}}</a> <a *ngIf="isEditable == false" style="padding: 10px;">{{practitionerdetails.gender}}</a>
<mat-form-field class="example-full-width" *ngIf="isEditable == true">
<mat-label>Gender</mat-label>
<input type="text" matInput placeholder="Gender">
</mat-form-field>
</div> </div>
<div class="form-group label-container"> <div class="form-group label-container">
<label>Date of Birth <span style="margin-left: 3.5rem;">-</span></label> <label>Date of Birth <span style="margin-left: 3.5rem;">-</span></label>
<a style="padding: 10px;">{{practitionerdetails.dob}}</a> <a style="padding: 10px;" *ngIf="isEditable == false">{{practitionerdetails.dob}}</a>
<mat-form-field class="example-full-width" *ngIf="isEditable == true">
<mat-label>Date of Birth</mat-label>
<input type="text" matInput placeholder="Date of Birth">
</mat-form-field>
</div> </div>
<div class="form-group label-container"> <div class="form-group label-container">
<label>Languages <span style="margin-left: 4rem;">-</span></label> <label>Languages <span style="margin-left: 4rem;">-</span></label>
<a style="padding: 10px;">{{practitionerdetails.languages}}</a> <a style="padding: 10px;" *ngIf="isEditable == false">{{practitionerdetails.languages}}</a>
<mat-form-field class="example-full-width" *ngIf="isEditable == true">
<mat-label>Languages</mat-label>
<input type="text" matInput placeholder="Languages">
</mat-form-field>
</div> </div>
<div class="form-group label-container"> <div class="form-group label-container">
<label>Qualification <span style="margin-left: 4rem;">-</span></label> <label>Qualification <span style="margin-left: 4rem;">-</span></label>
<a style="padding: 10px;">{{practitionerdetails.qualification}}</a> <a style="padding: 10px;" *ngIf="isEditable == false">{{practitionerdetails.qualification}}</a>
<mat-form-field class="example-full-width" *ngIf="isEditable == true">
<mat-label>Qualification</mat-label>
<input type="text" matInput placeholder="Qualification">
</mat-form-field>
</div> </div>
<div class="form-group label-container"> <div class="form-group label-container">
<label>Designation <span style="margin-left: 3.7rem;">-</span></label> <label>Designation <span style="margin-left: 3.7rem;">-</span></label>
<a style="padding: 10px;">{{practitionerdetails.designtion}}</a> <a style="padding: 10px;" *ngIf="isEditable == false">{{practitionerdetails.designtion}}</a>
<mat-form-field class="example-full-width" *ngIf="isEditable == true">
<mat-label>Designation</mat-label>
<input type="text" matInput placeholder="Designation">
</mat-form-field>
</div> </div>
<div class="form-group label-container"> <div class="form-group label-container">
<label>Experience <span style="margin-left: 4rem;">-</span></label> <label>Experience <span style="margin-left: 4rem;">-</span></label>
<a style="padding: 10px;">{{practitionerdetails.exp}}</a> <a style="padding: 10px;" *ngIf="isEditable == false">{{practitionerdetails.exp}}</a>
<mat-form-field class="example-full-width" *ngIf="isEditable == true">
<mat-label>Experience</mat-label>
<input type="text" matInput placeholder="Experience">
</mat-form-field>
</div> </div>
<div class="form-group label-container"> <!-- <div class="form-group label-container">
<label>Fees <span style="margin-left: 6.7rem;">-</span></label> <label>Fees <span style="margin-left: 6.7rem;">-</span></label>
<a style="padding: 10px;">{{practitionerdetails.fees}}</a> <a style="padding: 10px;">{{practitionerdetails.fees}}</a>
</div> <mat-form-field class="example-full-width">
<mat-label>Email</mat-label>
<input type="email" matInput placeholder="Ex. pat@example.com">
</mat-form-field>
</div> -->
<!-- <div class="form-group label-container"> <!-- <div class="form-group label-container">
<label>WorkingHours <span style="margin-left: 6.7rem;">-</span></label> <label>WorkingHours <span style="margin-left: 6.7rem;">-</span></label>
<a style="padding: 10px;">{{practitionerdetails.workingHours}}</a> <a style="padding: 10px;">{{practitionerdetails.workingHours}}</a>

View File

@ -27,7 +27,7 @@ export class ConsultantSettingComponent implements OnInit {
status: 'Active', status: 'Active',
}, },
]; ];
isEditable:any = false;
public usersList:any = new MatTableDataSource(); public usersList:any = new MatTableDataSource();
public servicesList:any = new MatTableDataSource(); public servicesList:any = new MatTableDataSource();
practitionerdetails: any; practitionerdetails: any;
@ -141,6 +141,22 @@ openDialog(action,obj) {
// }); // });
} }
edit_table(param){
if (param == true) {
this.isEditable = false;
} else {
console.log('status', );
this.isEditable = true
// localStorage.setItem('row_item',JSON.stringify(tableArr))
console.log( this.isEditable);
// this.isEditable = status;
// this.isEditable_month = tableArr.months;
}
}
workingDialog(action,obj) { workingDialog(action,obj) {
obj.action = action; obj.action = action;
const dialogRef = this.dialog.open(ExtraWorkingHoursComponent, { const dialogRef = this.dialog.open(ExtraWorkingHoursComponent, {

View File

@ -22,6 +22,12 @@ export class EditWorkingHoursComponent implements OnInit {
]; ];
dynamicForm: FormGroup; dynamicForm: FormGroup;
dynamicForm2: FormGroup;
dynamicForm3: FormGroup;
dynamicForm4: FormGroup;
dynamicForm5: FormGroup;
dynamicForm6: FormGroup;
dynamicForm7: FormGroup;
// rows = [{noQuestion : 0}]; // rows = [{noQuestion : 0}];
datainputForm: FormGroup; datainputForm: FormGroup;
// timing: any[] = ['09:00am','09:30am','10:00am','10:30am','11:00am','11:30am','12:00am','12:30am','01:00pm','01:00pm','01:30pm', '02:00pm', '02:30pm', '03:00pm', '03:30pm', '04:00pm', '04:30pm', '05:00pm', '05:30pm', '06:00pm', '06:30pm', '07:00pm', '07:30pm', '08:00pm','08:30pm', '09:00pm',] // timing: any[] = ['09:00am','09:30am','10:00am','10:30am','11:00am','11:30am','12:00am','12:30am','01:00pm','01:00pm','01:30pm', '02:00pm', '02:30pm', '03:00pm', '03:30pm', '04:00pm', '04:30pm', '05:00pm', '05:30pm', '06:00pm', '06:30pm', '07:00pm', '07:30pm', '08:00pm','08:30pm', '09:00pm',]
@ -50,20 +56,129 @@ ngOnInit(): void {
this.dynamicForm = this.fb.group({ this.dynamicForm = this.fb.group({
filters: this.fb.array([]) filters: this.fb.array([])
}); });
this.dynamicForm2 = this.fb.group({
filters2: this.fb.array([])
});
this.dynamicForm3 = this.fb.group({
filters3: this.fb.array([])
});
this.dynamicForm4 = this.fb.group({
filters4: this.fb.array([])
});
this.dynamicForm5 = this.fb.group({
filters5: this.fb.array([])
});
this.dynamicForm6 = this.fb.group({
filters6: this.fb.array([])
});
this.dynamicForm7 = this.fb.group({
filters7: this.fb.array([])
});
this.seedFiltersFormArray(); this.seedFiltersFormArray();
this.seedFiltersFormArray2();
this.seedFiltersFormArray3();
this.seedFiltersFormArray4();
this.seedFiltersFormArray5();
this.seedFiltersFormArray6();
this.seedFiltersFormArray7();
} }
seedFiltersFormArray() { seedFiltersFormArray() {
this.seedData.forEach(seedDatum => { this.seedData.forEach(seedDatum => {
console.log(seedDatum)
const formGroup = this.createFilterGroup(); const formGroup = this.createFilterGroup();
if (seedDatum.apiType) { if (seedDatum.apiType) {
formGroup.addControl('value', this.getFormControl()); formGroup.addControl('value', this.getFormControl());
} }
seedDatum.day = 'sunday'
formGroup.patchValue(seedDatum); formGroup.patchValue(seedDatum);
this.filtersFormArray.push(formGroup); this.filtersFormArray.push(formGroup);
}); });
} }
seedFiltersFormArray2() {
this.seedData.forEach(seedDatum => {
const formGroup = this.createFilterGroup();
if (seedDatum.apiType) {
formGroup.addControl('value', this.getFormControl());
}
seedDatum.day = 'monday'
formGroup.patchValue(seedDatum);
this.filtersFormArray2.push(formGroup);
});
}
seedFiltersFormArray3() {
this.seedData.forEach(seedDatum => {
const formGroup = this.createFilterGroup();
if (seedDatum.apiType) {
formGroup.addControl('value', this.getFormControl());
}
seedDatum.day = 'tuesday'
formGroup.patchValue(seedDatum);
this.filtersFormArray3.push(formGroup);
});
}
seedFiltersFormArray4() {
this.seedData.forEach(seedDatum => {
const formGroup = this.createFilterGroup();
if (seedDatum.apiType) {
formGroup.addControl('value', this.getFormControl());
}
seedDatum.day = 'wednesday'
formGroup.patchValue(seedDatum);
this.filtersFormArray4.push(formGroup);
});
}
seedFiltersFormArray5() {
this.seedData.forEach(seedDatum => {
const formGroup = this.createFilterGroup();
if (seedDatum.apiType) {
formGroup.addControl('value', this.getFormControl());
}
seedDatum.day = 'thursday'
formGroup.patchValue(seedDatum);
this.filtersFormArray5.push(formGroup);
});
}
seedFiltersFormArray6() {
this.seedData.forEach(seedDatum => {
const formGroup = this.createFilterGroup();
if (seedDatum.apiType) {
formGroup.addControl('value', this.getFormControl());
}
seedDatum.day = 'friday'
formGroup.patchValue(seedDatum);
this.filtersFormArray6.push(formGroup);
});
}
seedFiltersFormArray7() {
this.seedData.forEach(seedDatum => {
const formGroup = this.createFilterGroup();
if (seedDatum.apiType) {
formGroup.addControl('value', this.getFormControl());
}
seedDatum.day = 'saturday'
formGroup.patchValue(seedDatum);
this.filtersFormArray7.push(formGroup);
});
}
createFilterGroup() { createFilterGroup() {
return this.fb.group({ return this.fb.group({
@ -72,15 +187,58 @@ createFilterGroup() {
day: [] day: []
}); });
} }
createFilterGroup2() {
return this.fb.group({
filterType: [],
apiType: [],
day: []
});
}
addFilterToFiltersFormArray() { addFilterToFiltersFormArray() {
this.filtersFormArray.push(this.createFilterGroup()); this.filtersFormArray.push(this.createFilterGroup());
} }
addFilterToFiltersFormArray2() {
this.filtersFormArray2.push(this.createFilterGroup2());
}
addFilterToFiltersFormArray3() {
this.filtersFormArray3.push(this.createFilterGroup());
}
addFilterToFiltersFormArray4() {
this.filtersFormArray4.push(this.createFilterGroup());
}
addFilterToFiltersFormArray5() {
this.filtersFormArray5.push(this.createFilterGroup());
}
addFilterToFiltersFormArray6() {
this.filtersFormArray6.push(this.createFilterGroup());
}
addFilterToFiltersFormArray7() {
this.filtersFormArray7.push(this.createFilterGroup());
}
removeFilterFromFiltersFormArray(index) { removeFilterFromFiltersFormArray(index) {
this.filtersFormArray.removeAt(index); this.filtersFormArray.removeAt(index);
} }
removeFilterFromFiltersFormArray2(index) {
this.filtersFormArray2.removeAt(index);
}
removeFilterFromFiltersFormArray3(index) {
this.filtersFormArray3.removeAt(index);
}
removeFilterFromFiltersFormArray4(index) {
this.filtersFormArray4.removeAt(index);
}
removeFilterFromFiltersFormArray5(index) {
this.filtersFormArray5.removeAt(index);
}
removeFilterFromFiltersFormArray6(index) {
this.filtersFormArray6.removeAt(index);
}
removeFilterFromFiltersFormArray7(index) {
this.filtersFormArray7.removeAt(index);
}
selectedAPIChanged(i) { selectedAPIChanged(i) {
this.getFilterGroupAtIndex(i).addControl('value', this.getFormControl()); this.getFilterGroupAtIndex(i).addControl('value', this.getFormControl());
} }
@ -90,12 +248,34 @@ getFormControl() {
} }
save() { save() {
console.log(this.dynamicForm.value);
let tmp = [this.dynamicForm.value,this.dynamicForm2.value,this.dynamicForm3.value,this.dynamicForm4.value,this.dynamicForm5.value,this.dynamicForm6.value,this.dynamicForm7.value]
console.log(tmp);
} }
get filtersFormArray() { get filtersFormArray() {
return (<FormArray>this.dynamicForm.get('filters')); return (<FormArray>this.dynamicForm.get('filters'));
} }
get filtersFormArray2() {
return (<FormArray>this.dynamicForm2.get('filters2'));
}
get filtersFormArray3() {
return (<FormArray>this.dynamicForm3.get('filters3'));
}
get filtersFormArray4() {
return (<FormArray>this.dynamicForm4.get('filters4'));
}
get filtersFormArray5() {
return (<FormArray>this.dynamicForm5.get('filters5'));
}
get filtersFormArray6() {
return (<FormArray>this.dynamicForm6.get('filters6'));
}
get filtersFormArray7() {
return (<FormArray>this.dynamicForm7.get('filters7'));
}
getFilterGroupAtIndex(index) { getFilterGroupAtIndex(index) {
return (<FormGroup>this.filtersFormArray.at(index)); return (<FormGroup>this.filtersFormArray.at(index));
@ -121,4 +301,6 @@ getFilterGroupAtIndex(index) {
onSubmit() { onSubmit() {
console.log(this.datainputForm.value); console.log(this.datainputForm.value);
} }
showOptions(event:any): void {
console.log(event.checked);}
} }

View File

@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatTable, MatTableDataSource } from '@angular/material/table'; import { MatTable, MatTableDataSource } from '@angular/material/table';
import { AppointmentsService } from 'app/appoinment/appoinments/appointments-service/appointments.service';
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
import { AddCustomersComponent } from '../add-customers/add-customers.component'; import { AddCustomersComponent } from '../add-customers/add-customers.component';
import { CustomersService } from '../customers-service/customers.service'; import { CustomersService } from '../customers-service/customers.service';
@ -50,8 +51,9 @@ export class CustomersListComponent implements OnInit {
// pageSize = 10; // pageSize = 10;
// pageEvent: PageEvent; // pageEvent: PageEvent;
addFormData: any; addFormData: any;
appoinmentsList:any =[];
constructor(public dialog: MatDialog,public _cus:CustomersService) { } appoinmentsIds:any = [];
constructor(public dialog: MatDialog,public _cus:CustomersService,public _app:AppointmentsService) { }
ngOnInit(): void { ngOnInit(): void {
// console.log('IN') // console.log('IN')
@ -61,10 +63,47 @@ export class CustomersListComponent implements OnInit {
getCustomersList() { getCustomersList() {
//this._pd.getTabStatusPdDetails(this.tabStatus) //this._pd.getTabStatusPdDetails(this.tabStatus)
let user_role = localStorage.getItem('user_role');
if(user_role == 'PRACTITIONER'){
this._app.getAppoinmentsListDetails().subscribe(res => {
if (res.status == 200) {
this.appoinmentsList = res.data;
let id = localStorage.getItem('user_id')
console.log(id)
console.log(this.appoinmentsList)
let filter = this.appoinmentsList.filter(arr=>{return arr["ServicesMapDetail.userId"]
== id})
console.log(filter)
filter.forEach(element => {
this.appoinmentsIds.push( element.customer[0].id)
});
}
else{
}
})
}
this._cus.getCustomersListDetails().subscribe(res => { this._cus.getCustomersListDetails().subscribe(res => {
if (res.status == 200) { if (res.status == 200) {
this.customersList = res.data; this.customersList = res.data;
// console.log(this.customersList) console.log(this.customersList,this.appoinmentsIds)
let user_role = localStorage.getItem('user_role');
if(user_role == 'PRACTITIONER'){
const activeIds = this.appoinmentsIds
const serviceList = this.customersList
const result = serviceList.filter(({id}) => activeIds.includes(id));
console.log(result)
this.customersList = result
}
// this.dataSource = res.data.length; // this.dataSource = res.data.length;
// console.log(this.dataSource) // console.log(this.dataSource)
// this.dataSource.data = this.customersList; // this.dataSource.data = this.customersList;