diff --git a/ng-seed/Appointment_Frontend_Build.zip b/ng-seed/Appointment_Frontend_Build.zip index b031389..a6f6776 100644 Binary files a/ng-seed/Appointment_Frontend_Build.zip and b/ng-seed/Appointment_Frontend_Build.zip differ diff --git a/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.html b/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.html index 5b8b90c..1ee1321 100644 --- a/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.html +++ b/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.html @@ -41,7 +41,7 @@ Date and Time - {{row.appoinmentDate | date:'dd-MMM-YYYY'}}, {{row.appoinmentSlots[0] | date:'shortTime'}} + {{row.appoinmentDate | date:'dd-MMM-YYYY'}}
{{row.appoinmentSlots[0] | date:'shortTime'}}
@@ -54,10 +54,10 @@ {{row.customer[0].email}} - + Status diff --git a/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.ts b/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.ts index 6450ae4..74f4f28 100644 --- a/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.ts +++ b/ng-seed/src/app/appoinment/appoinments/appoinments-list/appoinments-list.component.ts @@ -33,7 +33,7 @@ export interface UsersData { export class AppoinmentsListComponent implements OnInit { push: any; - displayedColumns: string[] = ['id','ClientName','datetime','phoneNo','email','address','status', 'action']; + displayedColumns: string[] = ['id','ClientName','datetime','phoneNo','email','status', 'action']; public appointmentListLength: number; @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; diff --git a/ng-seed/src/app/appoinment/appoinments/appointment-addcustomer/appointment-addcustomer.component.html b/ng-seed/src/app/appoinment/appoinments/appointment-addcustomer/appointment-addcustomer.component.html index 092fd3c..8fae7eb 100644 --- a/ng-seed/src/app/appoinment/appoinments/appointment-addcustomer/appointment-addcustomer.component.html +++ b/ng-seed/src/app/appoinment/appoinments/appointment-addcustomer/appointment-addcustomer.component.html @@ -33,7 +33,7 @@ \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/appoinments/appointment-addcustomer/appointment-addcustomer.component.ts b/ng-seed/src/app/appoinment/appoinments/appointment-addcustomer/appointment-addcustomer.component.ts index 6edd6a4..4561ade 100644 --- a/ng-seed/src/app/appoinment/appoinments/appointment-addcustomer/appointment-addcustomer.component.ts +++ b/ng-seed/src/app/appoinment/appoinments/appointment-addcustomer/appointment-addcustomer.component.ts @@ -25,31 +25,25 @@ export class AppointmentAddcustomerComponent implements OnInit { public myError = (controlName: string, errorName: string) =>{ return this.form.controls[controlName].hasError(errorName); } - save(){ - } close(){ } - submit(){ - - console.log(this.form.value) + submit(){ + console.log(this.form.value) + let form ={ + "cusName":this.form.value.name, + "email":this.form.value.email, + "phoneNo":this.form.value.phoneNo, + "busId":localStorage.getItem('busId') - - - let form ={ - "cusName":this.form.value.name, - "email":this.form.value.email, - "phoneNo":this.form.value.phoneNo, - "busId":localStorage.getItem('busId') - - } - this._cus.addFormDetails(form).subscribe(res => { - if (res.status == 200) { - this.childButtonEvent.emit(res); - // this._app.customerlist.next(res) - } - }) + } + this._cus.addFormDetails(form).subscribe(res => { + if (res.status == 200) { + this.childButtonEvent.emit(res); + // this._app.customerlist.next(res) + } + }) } } diff --git a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.html b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.html index 0b266f6..bc832b4 100644 --- a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.html +++ b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.html @@ -62,7 +62,7 @@ --> - + - + -
- - - +
+ + + +
+
+
+
+
+
+
+
+

No Slots Available

+
+
+
@@ -135,10 +139,11 @@ Sure to delete {{local_data.cusName}}?
- +
- -
+ + + \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.scss b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.scss index e615dde..859803b 100644 --- a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.scss +++ b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.scss @@ -99,6 +99,9 @@ $tem-color : #217e69; .scrollHV { height: calc(100vh - 190px); } +.scrollHV2 { + height: calc(100vh - 462px); +} .notes{ margin-left: 7.5rem; margin-top: 2rem; @@ -249,4 +252,23 @@ $tem-color : #217e69; } .pad{ padding: 20px !important; -} \ No newline at end of file +} +.clickedSlot{ + color: white !important; + background-color: brown !important; + cursor: pointer !important; + width: auto; +} +.bookedSlot{ + background-color: darkgrey; + color: white; + width: 6rem; + cursor: no-drop !important; +} +.primary{ + background-color: #00866e00; + color: brown; + width: auto; + border: 1px solid brown; + cursor: pointer; +} \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.ts b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.ts index 9de78e2..ad3c09e 100644 --- a/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.ts +++ b/ng-seed/src/app/appoinment/appoinments/dialog-box/dialog-box.component.ts @@ -30,7 +30,7 @@ export interface UsersData { styleUrls: ['./dialog-box.component.scss'] }) export class DialogBoxComponent implements OnInit { - public show:boolean = false; + // public show:boolean = false; public buttonName:any = 'Show'; form: FormGroup; // fileToUpload: any; @@ -104,6 +104,9 @@ export class DialogBoxComponent implements OnInit { user_role: string; consultants: any = []; Status:any = [{id:1,value:"Consult"},{id:2,value:"Attend"},{id:1,value:"No Show"},{id:1,value:"Cancel"}] + advanced_slot_days: any; + slotIndex: any; + findSlotIndex: any; constructor(private notifierService: NotifierService,private router: Router,private formBuilder: FormBuilder, public _cus:CustomersService, public dialogRef: MatDialogRef,public _api:ConsultantService, public _con:ConsultantService, @Inject(MAT_DIALOG_DATA) public data: UsersData,public _app:AppointmentsService,public end_user:EndUserService) { @@ -111,18 +114,14 @@ export class DialogBoxComponent implements OnInit { this.local_data = {...data}; this.action = this.local_data.action; - + this.advanced_slot_days = parseInt(localStorage.getItem('advanced_slot_days'))-1 + console.log(this.advanced_slot_days) + } get f(){ return this.form.controls; } - doAction(){ - let tmp = this.form.value - tmp.id = this.local_data.id - this.dialogRef.close({event:this.action,data:tmp}); - console.log(this.form.value); - console.log(this.action,this.local_data) - } + closeDialog(){ this.dialogRef.close({event:'Cancel'}); } @@ -140,14 +139,14 @@ export class DialogBoxComponent implements OnInit { this.dialogRef.close(); } - toggle() { - this.show = !this.show; - // Change the name of the button. - if(this.show) - this.buttonName = "Hide"; - else - this.buttonName = "Show"; - } + // toggle() { + // this.show = !this.show; + // // Change the name of the button. + // if(this.show) + // this.buttonName = "Hide"; + // else + // this.buttonName = "Show"; + // } ngOnInit() { @@ -163,7 +162,7 @@ export class DialogBoxComponent implements OnInit { this.user_role = localStorage.getItem('user_role'); let tmp=[] - for(let i=0;i<=5;i++){ + for(let i=0;i<=this.advanced_slot_days;i++){ var someDate = new Date(); someDate.setDate(someDate.getDate() + i); //number of days to add, e.x. 15 days var dateFormated = someDate.toISOString().substr(0,10); @@ -171,7 +170,8 @@ export class DialogBoxComponent implements OnInit { tmp.push(dateFormated) } console.log(tmp) - this.days= tmp + this.days= tmp + // this.getslotData() this.getSlots() if(this.user_role != 'FRONTDESK'){ let userId = localStorage.getItem('user_id') @@ -197,7 +197,8 @@ export class DialogBoxComponent implements OnInit { appoinmentSlots: new FormControl('', [Validators.required]), }); - console.log(this.local_data, this.selects) + console.log(this.local_data, this.selects) + // this.findSlotIndex = this.local_data.appoinmentSlots // this.local_data.forEach(element => { if(this.local_data.hasOwnProperty('action')){ @@ -233,10 +234,51 @@ export class DialogBoxComponent implements OnInit { } }) } + + public myError = (controlName: string, errorName: string) =>{ return this.form.controls[controlName].hasError(errorName); } + // getslotData(){ + + // let findAppointmentDate = this.local_data.appoinmentDate + // this.days.forEach(element => { + // console.log(element) + // if(element == findAppointmentDate){ + // this.days.indexOf(element) + // console.log(this.days.indexOf(element)) + // this.clicks = this.days.indexOf(element) + // } + // }); + + // let options:any = { weekday: 'long'}; + // var prnDt = new Date(this.days[ this.clicks]).toLocaleTimeString('en-us', options); + // var formatDate = prnDt.split(" ") + // console.log(formatDate) + + // this.dayName = formatDate[0] + // let userId = localStorage.getItem('user_id') + // let params ={"id":userId , "day": this.dayName , "addcount": this.clicks} + + // this.end_user.getSlots(params).subscribe(res => { + // if (res.status == 200) { + // console.log(res) + // let data = res['data']; + // this.slots = data + // this.slots.forEach(element => { + // console.log(element) + // if(element == this.findSlotIndex[0]){ + // this.slots.indexOf(element) + // console.log(this.slots.indexOf(element)) + // this.slotIndex = this.slots.indexOf(element) + + // } + // }); + // } + // }) + // } + getCosultantList() { let param ={"busId": localStorage.getItem('busId')} console.log(param) @@ -258,7 +300,12 @@ export class DialogBoxComponent implements OnInit { } submit(){ - console.log(this.form.value); + + console.log(this.form.value,this.slotsResult,this.days[this.clicks]); + // if (!this.form.valid) { + // return; + // } + console.log(this.form.value,this.slotsResult,this.days[this.clicks]); let paramsmap= { "serviceId": ""+this.ServiceId+"", @@ -271,7 +318,7 @@ export class DialogBoxComponent implements OnInit { let paramsData:any= { "busId": localStorage.getItem('busId'), "cusId": this.customerId, - "appoinmentDate": this.form.value.appoinmentDate, + "appoinmentDate": this.days[this.clicks], "appoinmentTime": this.form.value.appoinmentTime, "serviceMap":serviceMap, "appoinmentSlots": this.slotsResult, @@ -304,9 +351,10 @@ export class DialogBoxComponent implements OnInit { } - goToSlotBooking(){ + goToSlotBooking(i){ + console.log(i) // this.days[] - if(this.clicks <5){ + if(this.clicks { + // console.log(element) + // if(element == this.findSlotIndex[0]){ + // this.slots.indexOf(element) + // console.log(this.slots.indexOf(element)) + // this.slotIndex = this.slots.indexOf(element) + + // } + // }); } }) } @@ -383,7 +440,7 @@ export class DialogBoxComponent implements OnInit { this.slot_array =[]; // debugger; // // event.preventDefault(); - // this.slotIndex = i + this.slotIndex = i // this.slotTime = param let resultDate = new DatePipe('en-US').transform(param, 'shortTime') this.form.controls['appoinmentTime'].setValue(resultDate) @@ -413,7 +470,7 @@ export class DialogBoxComponent implements OnInit { let result = filteredTimes.pop(); console.log(result); this.slotsResult = filteredTimes - this.show = false; + // this.show = false; // this.slots.forEach(element => { // if(element City is required Limit exceed
+ + Type Of Currency + + City is required + + + +
+ +
+ + Skills {{i}} + + + + +
+ +
+
+
+ + +
+
+ + \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.scss b/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.scss new file mode 100644 index 0000000..897869b --- /dev/null +++ b/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.scss @@ -0,0 +1,3 @@ +.scrollHV { + height: calc(100vh - 169px); +} \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.spec.ts b/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.spec.ts new file mode 100644 index 0000000..08a065f --- /dev/null +++ b/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddSkillsComponent } from './add-skills.component'; + +describe('AddSkillsComponent', () => { + let component: AddSkillsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AddSkillsComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(AddSkillsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.ts b/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.ts new file mode 100644 index 0000000..b3d113e --- /dev/null +++ b/ng-seed/src/app/appoinment/consultant-setting/add-skills/add-skills.component.ts @@ -0,0 +1,78 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { AbstractControl, FormArray, FormBuilder, FormGroup } from '@angular/forms'; +import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; + +@Component({ + selector: 'app-add-skills', + templateUrl: './add-skills.component.html', + styleUrls: ['./add-skills.component.scss'] +}) +export class AddSkillsComponent implements OnInit { + + userForm: FormGroup; + findSkillsIndex: any; + constructor(private formBuilder: FormBuilder, public dialog: MatDialog, private fb: FormBuilder,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { + console.log(data) + + + let test = { + "skills": data +} + + this.userForm = this.fb.group({ + skills: this.fb.array([ + this.fb.control(null) + ]) + }) + + if(data.length>1){ + + for(let i=1;i<=data.length-1;i++){ + //this.addFilterToFiltersFormArray2(i) + //this.Select2 = true; + this.addSkills() + } + + }else{ + + } + + this.userForm.patchValue(test) + + + } + + ngOnInit(): void { + + } + + + addSkills(): void { + (this.userForm.get('skills') as FormArray).push( + this.fb.control(null) + ); + } + + removeSkills(index) { + (this.userForm.get('skills') as FormArray).removeAt(index); + } + + getPhonesFormControls(): AbstractControl[] { + return ( this.userForm.get('skills')).controls + } + + send(values) { + console.log(values); + this.dialogRef.close(values); + } + + + closeDialog(){ + this.dialogRef.close(); + } + + close() { + this.dialogRef.close(); +} + +} diff --git a/ng-seed/src/app/appoinment/consultant-setting/consultant-setting.module.ts b/ng-seed/src/app/appoinment/consultant-setting/consultant-setting.module.ts index 2b40826..cc8fb34 100644 --- a/ng-seed/src/app/appoinment/consultant-setting/consultant-setting.module.ts +++ b/ng-seed/src/app/appoinment/consultant-setting/consultant-setting.module.ts @@ -14,6 +14,8 @@ import { ConsultantSettingComponent } from './consultant-setting/consultant-sett import { NotifierModule, NotifierOptions } from 'angular-notifier'; import { UnavailabilityComponent } from './unavailability/unavailability.component'; import { SharedModule } from 'app/shared/shared.module'; +import { AddSkillsComponent } from './add-skills/add-skills.component'; +import { MatInputModule } from '@angular/material/input'; const customNotifierOptions: NotifierOptions = { @@ -63,7 +65,8 @@ const customNotifierOptions: NotifierOptions = { EditWorkingHoursComponent, ExtraWorkingHoursComponent, AssignServiceComponent, - UnavailabilityComponent + UnavailabilityComponent, + AddSkillsComponent ], imports: [ CommonModule, @@ -73,7 +76,7 @@ const customNotifierOptions: NotifierOptions = { MatSidenavModule, SharedModule, MatFormFieldModule, - NotifierModule.withConfig(customNotifierOptions), + NotifierModule.withConfig(customNotifierOptions),MatInputModule ] }) diff --git a/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.html b/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.html index 158b2a6..a8f28b0 100644 --- a/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.html +++ b/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.html @@ -15,8 +15,11 @@ +
+
+
@@ -69,8 +72,10 @@
-->
+
+
{{practitionerdetails.exp}} @@ -195,22 +200,29 @@
- - {{practitionerdetails.slotDays}} + + {{practitionerdetails.days}} No of Slot Days - +
- {{practitionerdetails.skills}} - + + {{skill ? "* "+skill:"" }} + + + + +
diff --git a/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.scss b/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.scss index a307397..fc3a782 100644 --- a/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.scss +++ b/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.scss @@ -585,7 +585,7 @@ box-sizing: border-box; line-height: 15px; } .scrollHV { -height: calc(100vh - 200px); +height: calc(100vh - 240px); } ::ng-deep .mat-form-field-infix { height: 50px!important; @@ -638,3 +638,6 @@ content: "\20B9"; +.scrollHV2{ + height: calc(100vh - 305px); +} \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.ts b/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.ts index 210067a..41eff23 100644 --- a/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.ts +++ b/ng-seed/src/app/appoinment/consultant-setting/consultant-setting/consultant-setting.component.ts @@ -1,6 +1,6 @@ import { LocationStrategy } from '@angular/common'; import { Component, OnInit } from '@angular/core'; -import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { MatTableDataSource } from '@angular/material/table'; import { NotifierService } from 'angular-notifier'; @@ -11,6 +11,8 @@ import { ConsultantService } from '../consultant-service/consultant.service'; import { EditWorkingHoursComponent } from '../edit-working-hours/edit-working-hours.component'; import { ExtraWorkingHoursComponent } from '../extra-working-hours/extra-working-hours.component'; import { UnavailabilityComponent } from '../unavailability/unavailability.component'; +import { AddSkillsComponent } from '../add-skills/add-skills.component'; +import { json } from 'd3'; @Component({ selector: 'app-consultant-setting', @@ -43,11 +45,10 @@ export class ConsultantSettingComponent implements OnInit { "languages": null, "workingHours": JSON.stringify([{"sunday":{"hours":[{"startTime":"09:30 am","endTime":"06:00 pm","day":"sunday","value":null}],"breaks":[]}},{"monday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"monday","value":null}],"breaks":[]}},{"tuesday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"tuesday","value":null}],"breaks":[]}},{"wednesday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"wednesday","value":null}],"breaks":[]}},{"thursday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"thursday","value":null}],"breaks":[]}},{"friday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"friday","value":null}],"breaks":[]}},{"saturday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"saturday","value":null}],"breaks":[]}}]), // "dob": null, - "designtion": null, + // "designtion": null, "gender": null, "description":null, - "skills": [], - "slotDays":null, + "skills": [], "caption": null, "isActive": "1", @@ -66,12 +67,12 @@ export class ConsultantSettingComponent implements OnInit { caption:any = []; // dob: any=[]; languages: any=[]; - designtion: any=[]; - slotDays: any = []; + // designtion: any=[]; + days: any = []; exp: any=[]; qualification: any=[]; id: any; - public end_User_Url = environment.endUserUrl; + public end_User_Url = environment.endUserUrl; endUserURL: any; userRole:any=[]; genderOption:any = [{'name':'Male'},{'name':'Female'}] @@ -81,7 +82,9 @@ export class ConsultantSettingComponent implements OnInit { consultants: any = []; frontDeskHidden: any = 0; frontDeskPractdetails: any = []; - constructor(private notifierService: NotifierService,private formBuilder: FormBuilder, public dialog: MatDialog, public _con:ConsultantService, private fb: FormBuilder, public _api:ConsultantService,private locationStrategy: LocationStrategy) {} + constructor(private notifierService: NotifierService,private formBuilder: FormBuilder, public dialog: MatDialog, public _con:ConsultantService, private fb: FormBuilder, public _api:ConsultantService,private locationStrategy: LocationStrategy) { + + } ngOnInit() { @@ -119,7 +122,9 @@ getCosultantList() { this._con.getCosultantListDetails(param).subscribe(res => { if (res.status == 200) { console.log(res.data) - this.consultants = res.data; + this.consultants = res.data; + this.consultants = this.consultants.filter(val => val.role == 'PRACTITIONER') + console.log(this.consultants) } else{ this.consultants=[]; @@ -233,8 +238,7 @@ unavailability(action,obj) { "languages": null, "workingHours": JSON.stringify( [{"sunday":{"hours":[],"breaks":[]}},{"monday":{"hours":[{"startTime":"09:00 am","endTime":"06:00 pm","day":"monday","value":null}],"breaks":[]}},{"tuesday":{"hours":[],"breaks":[]}},{"wednesday":{"hours":[],"breaks":[]}},{"thursday":{"hours":[],"breaks":[]}},{"friday":{"hours":[],"breaks":[]}},{"saturday":{"hours":[],"breaks":[]}}]), // "dob": null, - "designtion": null, - "slotDays": null, + // "designtion": null, "gender": null, "description":null, "skills": [], @@ -287,8 +291,8 @@ unavailability(action,obj) { this.exp=this.practitionerdetails.exp this.languages=this.practitionerdetails.languages this.qualification=this.practitionerdetails.qualification - this.designtion=this.practitionerdetails.designtion - this.slotDays = this.practitionerdetails.slotDays + // this.designtion=this.practitionerdetails.designtion + this.days = this.practitionerdetails.days console.log(this.gender) // this.workinghours = this.practitionerdetails.workingHours @@ -478,12 +482,12 @@ unavailability(action,obj) { // "fees": "800", "languages": this.languages, // "dob": this.dob, - "designtion": this.qualification, - "slotDays": this.slotDays, + // "designtion": this.qualification, + "days": this.days, "gender": this.gender, - "workingHours": JSON.stringify( tmp), + "workingHours": JSON.stringify(tmp), "description": this.description, - "skills": JSON.stringify(this.skills), + "skills":this.skills, "caption": this.caption, "userName": this.userName, "practitionerId":userid @@ -510,6 +514,31 @@ unavailability(action,obj) { } + addSkills(){ + const dialogRef = this.dialog.open(AddSkillsComponent, { + width: '30%', + height: '100%', + // maxWidth: '38vw', + position: { right: '0' }, + // disableClose: true , + // panelClass: 'custom-dialog-container', + + data: this.skills + }); + dialogRef.afterClosed().subscribe(result => { + console.log(result) + + console.log(this.skills) + if(result != undefined){ + this.skills = result.skills + this.notifierService.notify('success', 'Skills Added Successfully'); + } + + + }); + } + + copyToClipBoard(message) { this.copiedKey = 1 console.log(message) diff --git a/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.html b/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.html index 5a203de..0b03043 100644 --- a/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.html +++ b/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.html @@ -10,8 +10,8 @@
-
-
+ +
@@ -29,8 +29,8 @@ - {{ startTime }} @@ -42,8 +42,8 @@ placeholder="Select Time" #apiField formControlName="endTime" [disabled]="Select1 !=true"> - {{ endTime }} @@ -57,14 +57,13 @@ formControlName="value" [placeholder]="apiField.value"> --> - - add - - - delete - + + +
@@ -101,9 +100,9 @@ + formControlName="startTime" [disabled]="Select2 !=true"> {{ startTime }} @@ -116,7 +115,7 @@ #apiField formControlName="endTime" [disabled]="Select2 !=true"> {{ endTime }} @@ -130,14 +129,13 @@ formControlName="value" [placeholder]="apiField.value"> --> - - add - - - delete - + + +
@@ -176,7 +174,7 @@ placeholder="Select Time" formControlName="startTime" [disabled]="Select3 !=true"> {{ startTime }} @@ -189,7 +187,7 @@ #apiField formControlName="endTime" [disabled]="Select3 !=true"> {{ endTime }} @@ -203,14 +201,13 @@ formControlName="value" [placeholder]="apiField.value"> --> - - add - - - delete - + + + @@ -249,7 +246,7 @@ placeholder="Select Time" formControlName="startTime" [disabled]="Select4 !=true"> {{ startTime }} @@ -262,7 +259,7 @@ #apiField formControlName="endTime" [disabled]="Select4 !=true"> {{ endTime }} @@ -276,14 +273,13 @@ formControlName="value" [placeholder]="apiField.value"> --> - - add - - - delete - + + + @@ -322,7 +318,7 @@ placeholder="Select Time" formControlName="startTime" [disabled]="Select5 !=true"> {{ startTime }} @@ -335,7 +331,7 @@ #apiField formControlName="endTime" [disabled]="Select5 !=true"> {{ endTime }} @@ -349,14 +345,13 @@ formControlName="value" [placeholder]="apiField.value"> --> - - add - - - delete - + + + @@ -395,7 +390,7 @@ placeholder="Select Time" formControlName="startTime" [disabled]="Select6 !=true"> {{ startTime }} @@ -408,7 +403,7 @@ #apiField formControlName="endTime" [disabled]="Select6 !=true"> {{ endTime }} @@ -422,14 +417,13 @@ formControlName="value" [placeholder]="apiField.value"> --> - - add - - - delete - + + + @@ -468,7 +462,7 @@ placeholder="Select Time" formControlName="startTime" [disabled]="Select7 !=true"> {{ startTime }} @@ -481,7 +475,7 @@ #apiField formControlName="endTime" [disabled]="Select7 !=true"> {{ endTime }} @@ -495,14 +489,13 @@ formControlName="value" [placeholder]="apiField.value"> --> - - add - - - delete - + + + diff --git a/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.scss b/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.scss index 9781bf7..6a30b91 100644 --- a/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.scss +++ b/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.scss @@ -75,7 +75,7 @@ margin-left: 1rem; margin-top: 1.5rem; // color: #FFF; - color: #111; + // color: #111; cursor: pointer; // &:hover { // cursor: pointer; @@ -143,3 +143,7 @@ mat-checkbox{ .mat-dialog-container{ padding: 24px 0px 0px 0px !important; } +.container{ a:hover { + display: block; +} +} diff --git a/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.ts b/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.ts index 56d323c..846eddc 100644 --- a/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.ts +++ b/ng-seed/src/app/appoinment/consultant-setting/edit-working-hours/edit-working-hours.component.ts @@ -11,7 +11,7 @@ import { ConsultantService } from "../consultant-service/consultant.service"; styleUrls: ["./edit-working-hours.component.scss"], }) export class EditWorkingHoursComponent implements OnInit { - startTimes = [ + startTimes:any = [ "09:00 am", "09:30 am", "10:00 am", @@ -19,8 +19,7 @@ export class EditWorkingHoursComponent implements OnInit { "11:00 am", "11:30 am", "12:00 pm", - "12:30 pm", - "01:00 pm", + "12:30 pm", "01:00 pm", "01:30 pm", "02:00 pm", @@ -48,8 +47,7 @@ export class EditWorkingHoursComponent implements OnInit { "11:30 am", "12:00 pm", "12:30 pm", - "01:00 pm", - "01:00 pm", + "01:00 pm", "01:30 pm", "02:00 pm", "02:30 pm", @@ -76,17 +74,17 @@ export class EditWorkingHoursComponent implements OnInit { "Friday", "Saturday", ]; - seedData = [{ day: "Sunday", startTime: "09:00 am", endTime: "09:30 am" }]; + seedData = [{ day: "Sunday", startTime: "09:00 am", endTime: "06:00 pm" }]; - Select1: any = true; - Select2: any = true; - Select3: any = true; - Select4: any = true; - Select5: any = true; - Select6: any = true; - Select7: any = true; + Select1: any = false; + Select2: any = false; + Select3: any = false; + Select4: any = false; + Select5: any = false; + Select6: any = false; + Select7: any = false; - dynamicForm: FormGroup; + dynamicForm1: FormGroup; dynamicForm2: FormGroup; dynamicForm3: FormGroup; dynamicForm4: FormGroup; @@ -99,6 +97,13 @@ export class EditWorkingHoursComponent implements OnInit { practitioner:any =[]; // 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',] doctor:any=[]; + selectFilterTimeDropdown: any=[]; + selectFilterTimeDropdown2: any=[]; + selectFilterTimeDropdown3: any=[]; + selectFilterTimeDropdown4: any=[]; + selectFilterTimeDropdown5: any=[]; + selectFilterTimeDropdown6: any=[]; + selectFilterTimeDropdown7: any=[]; constructor(private notifierService: NotifierService, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data, @@ -131,6 +136,14 @@ export class EditWorkingHoursComponent implements OnInit { // } ngOnInit() { + this.selectFilterTimeDropdown.push([[this.startTimes],[this.endTimes]]) + this.selectFilterTimeDropdown2.push([[this.startTimes],[this.endTimes]]) + this.selectFilterTimeDropdown3.push([[this.startTimes],[this.endTimes]]) + this.selectFilterTimeDropdown4.push([[this.startTimes],[this.endTimes]]) + this.selectFilterTimeDropdown5.push([[this.startTimes],[this.endTimes]]) + this.selectFilterTimeDropdown6.push([[this.startTimes],[this.endTimes]]) + this.selectFilterTimeDropdown7.push([[this.startTimes],[this.endTimes]]) + console.log(this.selectFilterTimeDropdown) this.doctor = JSON.parse(localStorage.getItem('practitioner')) console.log (this.doctor) this.datainputForm = this.fb.group({ @@ -139,8 +152,8 @@ export class EditWorkingHoursComponent implements OnInit { dropDownTest1: "", }); - this.dynamicForm = this.fb.group({ - filters: this.fb.array([]), + this.dynamicForm1 = this.fb.group({ + filters1: this.fb.array([]), }); this.dynamicForm2 = this.fb.group({ filters2: this.fb.array([]), @@ -169,28 +182,49 @@ export class EditWorkingHoursComponent implements OnInit { this.seedFiltersFormArray7(); //setInterval(() => { - - let sunday ={filters :this.data[0].sunday.hours } - for(let i=0;i<=this.data[0].sunday.hours.length-1;i++){ - this.addFilterToFiltersFormArray() - this.dynamicForm.patchValue(sunday) - } + console.log(this.data) + let sunday ={filters1 :this.data[0].sunday.hours } + if(this.data[0].sunday.hours.length>1){ + console.log('length') + for(let i=1;i<=this.data[0].sunday.hours.length-1;i++){ + this.addFilterToFiltersFormArray(i) + this.Select1 = true; + } + }else { + if(this.data[0].sunday.hours.length == 1){ + console.log('else length') + // this.addFilterToFiltersFormArray4() + this.Select1 = true; + } + } + this.dynamicForm1.patchValue(sunday) + // if(this.data[0].sunday.hours.length>1){ // } - this.dynamicForm.patchValue(sunday) + // this.dynamicForm.patchValue(sunday) // this.data[1].monday.hours.forEach(element => { // element.value = null // }); let monday ={filters2 :this.data[1].monday.hours } - for(let i=0;i<=this.data[1].monday.hours.length-2;i++){ - console.log(monday) - this.addFilterToFiltersFormArray2() - this.dynamicForm2.patchValue(monday) - } - this.dynamicForm2.patchValue(monday) + console.log(this.data[1].monday.hours.length) + if(this.data[1].monday.hours.length>1){ + console.log('length') + for(let i=1;i<=this.data[1].monday.hours.length-1;i++){ + this.addFilterToFiltersFormArray2(i) + this.Select2 = true; + } + }else { + if(this.data[1].monday.hours.length == 1){ + console.log('else length') + // this.addFilterToFiltersFormArray4() + this.Select2 = true; + } + } + this.dynamicForm2.patchValue(monday) + // this.dynamicForm2.patchValue(monday) // if(this.data[1].monday.hours.length>1){ // this.addFilterToFiltersFormArray2() // } @@ -200,61 +234,106 @@ export class EditWorkingHoursComponent implements OnInit { // if(this.data[2].tuesday.hours.length>1){ // this.addFilterToFiltersFormArray3() // } - for(let i=0;i<=this.data[2].tuesday.hours.length-2;i++){ - // console.log(monday) - this.addFilterToFiltersFormArray3() - this.dynamicForm3.patchValue(tuesday) - } + if(this.data[2].tuesday.hours.length>1){ + console.log('length') + for(let i=1;i<=this.data[2].tuesday.hours.length-1;i++){ + this.addFilterToFiltersFormArray3(i) + this.Select3 = true; + } + }else { + if(this.data[2].tuesday.hours.length == 1){ + console.log('else length') + // this.addFilterToFiltersFormArray4() + this.Select3 = true; + } + } this.dynamicForm3.patchValue(tuesday) + + // this.dynamicForm3.patchValue(tuesday) let wednesday ={filters4 :this.data[3].wednesday.hours } // if(this.data[3].wednesday.hours.length>1){ // this.addFilterToFiltersFormArray4() - // } - for(let i=0;i<=this.data[3].wednesday.hours.length-2;i++){ + // } // console.log(monday) - this.addFilterToFiltersFormArray4() - - this.dynamicForm4.patchValue(wednesday) - } - this.dynamicForm4.patchValue(wednesday) - let thursday ={filters5 :this.data[4].thursday.hours } + if(this.data[3].wednesday.hours.length>1){ + console.log('length') + for(let i=1;i<=this.data[3].wednesday.hours.length-1;i++){ + this.addFilterToFiltersFormArray4(i) + this.Select4 = true; + } + }else { + if(this.data[3].wednesday.hours.length == 1){ + console.log('else length') + // this.addFilterToFiltersFormArray4() + this.Select4 = true; + } + } + this.dynamicForm4.patchValue(wednesday) + + // this.dynamicForm4.patchValue(wednesday) + let thursday ={filters5 :this.data[4].thursday.hours } // if(this.data[4].thursday.hours.length>1){ // this.addFilterToFiltersFormArray5() // } - for(let i=0;i<=this.data[4].thursday.hours.length-2;i++){ - // console.log(monday) - this.addFilterToFiltersFormArray5() - - this.dynamicForm5.patchValue(thursday) + if(this.data[4].thursday.hours.length>1){ + console.log('length') + for(let i=1;i<=this.data[4].thursday.hours.length-1;i++){ + this.addFilterToFiltersFormArray5(i) + this.Select5 = true; } - this.dynamicForm5.patchValue(thursday) + }else { + if(this.data[4].thursday.hours.length == 1){ + console.log('else length') + // this.addFilterToFiltersFormArray4() + this.Select5 = true; + } + } + this.dynamicForm5.patchValue(thursday) + + // this.dynamicForm5.patchValue(thursday) // this.dynamicForm5.patchValue(thursday) let friday ={filters6 :this.data[5].friday.hours } // if(this.data[5].friday.hours.length>1){ // this.addFilterToFiltersFormArray6() // } - for(let i=0;i<=this.data[5].friday.hours.length-2;i++){ - // console.log(monday) - this.addFilterToFiltersFormArray6() - - - this.dynamicForm6.patchValue(friday) + if(this.data[5].friday.hours.length>1){ + console.log('length') + for(let i=1;i<=this.data[5].friday.hours.length-1;i++){ + this.addFilterToFiltersFormArray6(i) + this.Select6 = true; } - - this.dynamicForm6.patchValue(friday) + }else { + if(this.data[5].friday.hours.length == 1){ + console.log('else length') + // this.addFilterToFiltersFormArray4() + this.Select6 = true; + } + } + this.dynamicForm6.patchValue(friday) + + + // this.dynamicForm6.patchValue(friday) let saturday ={filters7 :this.data[6].saturday.hours } // if(this.data[6].saturday.hours.length>1){ // this.addFilterToFiltersFormArray7() // } - for(let i=0;i<=this.data[6].saturday.hours.length-2;i++){ - // console.log(monday) - this.addFilterToFiltersFormArray7() - - - this.dynamicForm7.patchValue(saturday) + if(this.data[6].saturday.hours.length>1){ + console.log('length') + for(let i=1;i<=this.data[6].saturday.hours.length-1;i++){ + this.addFilterToFiltersFormArray7(i) + this.Select7 = true; } - this.dynamicForm7.patchValue(saturday) + }else { + if(this.data[6].saturday.hours.length == 1){ + console.log('else length') + // this.addFilterToFiltersFormArray4() + this.Select7 = true; + } + } + this.dynamicForm7.patchValue(saturday) + + // this.dynamicForm7.patchValue(saturday) // this.dynamicForm7.patchValue(saturday) // }, 2000); @@ -356,26 +435,121 @@ export class EditWorkingHoursComponent implements OnInit { }); } - addFilterToFiltersFormArray() { + addFilterToFiltersFormArray(i) { this.filtersFormArray.push(this.createFilterGroup()); + // this.hiddenSelectedTime(i) + let index = this.startTimes.indexOf(this.dynamicForm1.value.filters1[i].endTime); + let index2 = this.startTimes.indexOf(this.dynamicForm1.value.filters1[i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + // if(this.selectFilterTimeDropdown.length){ + this.selectFilterTimeDropdown.push([[filteredTimes],[filteredTimes2]]) + // } + + } - addFilterToFiltersFormArray2() { - this.filtersFormArray2.push(this.createFilterGroup2()); + addFilterToFiltersFormArray2(i) { + this.filtersFormArray2.push(this.createFilterGroup()); + + let index = this.startTimes.indexOf(this.dynamicForm2.value.filters2[i].endTime); + let index2 = this.startTimes.indexOf(this.dynamicForm2.value.filters2[i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + // if(this.selectFilterTimeDropdown.length){ + this.selectFilterTimeDropdown2.push([[filteredTimes],[filteredTimes2]]) + } - addFilterToFiltersFormArray3() { + addFilterToFiltersFormArray3(i) { this.filtersFormArray3.push(this.createFilterGroup()); + // this.hiddenSelectedTime(i) + let index = this.startTimes.indexOf(this.dynamicForm3.value.filters3[i].endTime); + let index2 = this.startTimes.indexOf(this.dynamicForm3.value.filters3[i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + // if(this.selectFilterTimeDropdown.length){ + this.selectFilterTimeDropdown3.push([[filteredTimes],[filteredTimes2]]) + // } + } - addFilterToFiltersFormArray4() { + addFilterToFiltersFormArray4(i) { this.filtersFormArray4.push(this.createFilterGroup()); + // this.hiddenSelectedTime(i) + let index = this.startTimes.indexOf(this.dynamicForm4.value.filters4[i].endTime); + let index2 = this.startTimes.indexOf(this.dynamicForm4.value.filters4[i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + // if(this.selectFilterTimeDropdown.length){ + this.selectFilterTimeDropdown4.push([[filteredTimes],[filteredTimes2]]) + // } + + } - addFilterToFiltersFormArray5() { + addFilterToFiltersFormArray5(i) { this.filtersFormArray5.push(this.createFilterGroup()); + // this.hiddenSelectedTime(i) + let index = this.startTimes.indexOf(this.dynamicForm5.value.filters5[i].endTime); + let index2 = this.startTimes.indexOf(this.dynamicForm5.value.filters5[i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + // if(this.selectFilterTimeDropdown.length){ + this.selectFilterTimeDropdown5.push([[filteredTimes],[filteredTimes2]]) + // } + + } - addFilterToFiltersFormArray6() { + addFilterToFiltersFormArray6(i) { this.filtersFormArray6.push(this.createFilterGroup()); + // this.hiddenSelectedTime(i) + let index = this.startTimes.indexOf(this.dynamicForm6.value.filters6[i].endTime); + let index2 = this.startTimes.indexOf(this.dynamicForm6.value.filters6[i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + // if(this.selectFilterTimeDropdown.length){ + this.selectFilterTimeDropdown6.push([[filteredTimes],[filteredTimes2]]) + // } + + } - addFilterToFiltersFormArray7() { + addFilterToFiltersFormArray7(i) { this.filtersFormArray7.push(this.createFilterGroup()); + // this.hiddenSelectedTime(i) + let index = this.startTimes.indexOf(this.dynamicForm7.value.filters7[i].endTime); + let index2 = this.startTimes.indexOf(this.dynamicForm7.value.filters7[i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + // if(this.selectFilterTimeDropdown.length){ + this.selectFilterTimeDropdown7.push([[filteredTimes],[filteredTimes2]]) + // } + + } removeFilterFromFiltersFormArray(index) { @@ -411,7 +585,7 @@ export class EditWorkingHoursComponent implements OnInit { save() { this.Answer = []; let tmp = [ - this.dynamicForm.value, + this.dynamicForm1.value, this.dynamicForm2.value, this.dynamicForm3.value, this.dynamicForm4.value, @@ -422,7 +596,7 @@ export class EditWorkingHoursComponent implements OnInit { console.log(tmp); if (this.Select1 == true) { this.Answer.push( {sunday: { - hours:this.dynamicForm.value.filters, + hours:this.dynamicForm1.value.filters1, breaks: [], }}); @@ -535,7 +709,7 @@ export class EditWorkingHoursComponent implements OnInit { } get filtersFormArray() { - return this.dynamicForm.get("filters"); + return this.dynamicForm1.get("filters1"); } get filtersFormArray2() { return this.dynamicForm2.get("filters2"); @@ -583,11 +757,178 @@ export class EditWorkingHoursComponent implements OnInit { showOptions(event: MatCheckboxChange, value): void { console.log(event.checked, value); if (value == "sunday" && event.checked == true) { - this.Answer.push(this.dynamicForm.value); + this.Answer.push(this.dynamicForm1.value); } // this.form['value'].admin_checked = event.checked // console.log(this.form['value'].admin_checked) } + + fliterTimeSelect(endTimes,startTimes,i){ + // console.log(endTimes,startTimes,i) + const currentTime = startTimes[i]; // Get the current time + //console.log(currentTime) + const filteredTimes = endTimes.filter(time => time > currentTime); + //console.log(filteredTimes) + return filteredTimes + + // let dd = [[endTimes],[startTimes]] + // console.log(dd) + + } + + fliterTimeSelect2(data , i) + { +//console.log(data[i][0]) +return data[i][0][0] + } + + fliterTimeSelect3(data , i) + { + //console.log(data[i]) +return data[i][1][0] + } + + hiddenSelectedTime(i,selectFilterTimeDropdown,num){ + + console.log('222',this['dynamicForm'+num].value['filters'+num]) + + let index = this.startTimes.indexOf(this['dynamicForm'+num].value['filters'+num][i].endTime); + let index2 = this.startTimes.indexOf(this['dynamicForm'+num].value['filters'+num][i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + // if(this.selectFilterTimeDropdown.length){ + // this.selectFilterTimeDropdown.push([[filteredTimes],[filteredTimes2]]) + // } + console.log(i,filteredTimes,filteredTimes2, selectFilterTimeDropdown ) + + selectFilterTimeDropdown[i+1][0][0] = filteredTimes + // this.selectFilterTimeDropdown.push([[filteredTimes],[filteredTimes2]]) + + + + + } + + hiddenSelectedTime2(i,selectFilterTimeDropdown,num){ + console.log('111',this['dynamicForm'+num].value) + + + + let index = this.startTimes.indexOf(this['dynamicForm'+num].value['filters'+num][i].endTime); + let index2 = this.startTimes.indexOf(this['dynamicForm'+num].value['filters'+num][i].startTime); + // const filteredTimes = this.startTimes.filter(function(item) { + // return this.startTimes.indexOf(item) > index + // }); + + const filteredTimes = this.startTimes.filter(time => this.startTimes.indexOf(time) > index); + const filteredTimes2 = this.endTimes.filter(time => this.endTimes.indexOf(time) > index2); + selectFilterTimeDropdown[i][1][0] = filteredTimes2 + // console.log(this.selectFilterTimeDropdown[i][1][0],filteredTimes2) + console.log(this.startTimes,filteredTimes,filteredTimes2, this.selectFilterTimeDropdown) + } + + applyToAll(i,param){ + + // this.seedFiltersFormArray(); + // this.seedFiltersFormArray2(); + // this.seedFiltersFormArray3(); + // this.seedFiltersFormArray4(); + // this.seedFiltersFormArray5(); + // this.seedFiltersFormArray6(); + // this.seedFiltersFormArray7(); + + console.log(i,param) + let num = i + this.selectFilterTimeDropdown = param + this.selectFilterTimeDropdown2 = param + this.selectFilterTimeDropdown3 = param + this.selectFilterTimeDropdown4 = param + this.selectFilterTimeDropdown5 = param + this.selectFilterTimeDropdown6 = param + this.selectFilterTimeDropdown7 = param + console.log(this['dynamicForm'+num].value['filters'+num]) + + let sunday ={filters1 :this['dynamicForm'+num].value['filters'+num] } + let monday ={filters2 :this['dynamicForm'+num].value['filters'+num] } + let tuesday ={filters3 :this['dynamicForm'+num].value['filters'+num] } + let wednesday ={filters4 :this['dynamicForm'+num].value['filters'+num] } + let thursday ={filters5 :this['dynamicForm'+num].value['filters'+num] } + let friday ={filters6:this['dynamicForm'+num].value['filters'+num] } + let saturday ={filters7 :this['dynamicForm'+num].value['filters'+num] } + + if(this['dynamicForm'+num].value['filters'+num].length>1){ + console.log('length') + for(let j=1;j<=this['dynamicForm'+num].value['filters'+num].length-1;j++){ + if(i != 1){ + console.log('1') + this.filtersFormArray.push(this.createFilterGroup()); + } + if(i != 2){ + console.log('2') + this.filtersFormArray2.push(this.createFilterGroup()); + } + if(i != 3){ + console.log('3') + this.filtersFormArray3.push(this.createFilterGroup()); + } + if(i != 4){ + console.log('4') + this.filtersFormArray4.push(this.createFilterGroup()); + } + if(i != 5){ + console.log('5') + this.filtersFormArray5.push(this.createFilterGroup()); + } + if(i != 6){ + console.log('6') + this.filtersFormArray6.push(this.createFilterGroup()); + } + if(i != 7){ + console.log('7') + this.filtersFormArray7.push(this.createFilterGroup()); + } + + // this.filtersFormArray2.push(this.createFilterGroup()); + // this.filtersFormArray3.push(this.createFilterGroup()); + // this.filtersFormArray4.push(this.createFilterGroup()); + // this.filtersFormArray5.push(this.createFilterGroup()); + // this.filtersFormArray6.push(this.createFilterGroup()); + // this.filtersFormArray7.push(this.createFilterGroup()); + + // this.Select7 = true; + } + }else { + if(this['dynamicForm'+num].value['filters'+num].length == 1){ + console.log('else length') + // this.addFilterToFiltersFormArray4() + this.Select7 = true; + } + } + this.dynamicForm1.patchValue(sunday) + this.dynamicForm2.patchValue(monday) + this.dynamicForm3.patchValue(tuesday) + this.dynamicForm4.patchValue(wednesday) + this.dynamicForm5.patchValue(thursday) + this.dynamicForm6.patchValue(friday) + this.dynamicForm7.patchValue(saturday) + + + } + + gg(){ + this.filtersFormArray.push(this.createFilterGroup()); + this.filtersFormArray2.push(this.createFilterGroup()); + this.filtersFormArray3.push(this.createFilterGroup()); + this.filtersFormArray4.push(this.createFilterGroup()); + this.filtersFormArray5.push(this.createFilterGroup()); + this.filtersFormArray6.push(this.createFilterGroup()); + this.filtersFormArray7.push(this.createFilterGroup()); + // this.addFilterToFiltersFormArray(i) + } } diff --git a/ng-seed/src/app/appoinment/customers/add-customers/add-customers.component.html b/ng-seed/src/app/appoinment/customers/add-customers/add-customers.component.html index d4a0377..ebda3f3 100644 --- a/ng-seed/src/app/appoinment/customers/add-customers/add-customers.component.html +++ b/ng-seed/src/app/appoinment/customers/add-customers/add-customers.component.html @@ -58,7 +58,7 @@
- +
diff --git a/ng-seed/src/app/appoinment/front-desk/cosultant-assign-services/cosultant-assign-services.component.html b/ng-seed/src/app/appoinment/front-desk/cosultant-assign-services/cosultant-assign-services.component.html index 34e6139..57dfd97 100644 --- a/ng-seed/src/app/appoinment/front-desk/cosultant-assign-services/cosultant-assign-services.component.html +++ b/ng-seed/src/app/appoinment/front-desk/cosultant-assign-services/cosultant-assign-services.component.html @@ -11,7 +11,8 @@ ServiceName is required - Limit exceed + Limit exceed + Sure to delete {{local_data.servicesName}}? diff --git a/ng-seed/src/app/appoinment/front-desk/cosultant-assign-services/cosultant-assign-services.component.ts b/ng-seed/src/app/appoinment/front-desk/cosultant-assign-services/cosultant-assign-services.component.ts index f17e593..a0b3110 100644 --- a/ng-seed/src/app/appoinment/front-desk/cosultant-assign-services/cosultant-assign-services.component.ts +++ b/ng-seed/src/app/appoinment/front-desk/cosultant-assign-services/cosultant-assign-services.component.ts @@ -49,7 +49,7 @@ this.getServicesList() } getServicesList() { - let param ={"busId": localStorage.getItem('busId')} + let param ={"busId":localStorage.getItem('busId')} console.log(param) this._api.getServicesDetailsApi(param).subscribe(res => { if (res.status == 200) { diff --git a/ng-seed/src/app/appoinment/service-list-details/add-service/add-service.component.html b/ng-seed/src/app/appoinment/service-list-details/add-service/add-service.component.html index 815f757..2f82c9e 100644 --- a/ng-seed/src/app/appoinment/service-list-details/add-service/add-service.component.html +++ b/ng-seed/src/app/appoinment/service-list-details/add-service/add-service.component.html @@ -36,6 +36,6 @@
- +
\ No newline at end of file diff --git a/ng-seed/src/app/appoinment/user/add-user/add-user.component.html b/ng-seed/src/app/appoinment/user/add-user/add-user.component.html index 575d716..71917f1 100644 --- a/ng-seed/src/app/appoinment/user/add-user/add-user.component.html +++ b/ng-seed/src/app/appoinment/user/add-user/add-user.component.html @@ -12,7 +12,7 @@ Username is required Limit exceed --> - + Business -- @@ -32,6 +32,17 @@ role is required + + Name @@ -89,7 +100,7 @@
- +
diff --git a/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts b/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts index 66b6913..a1a4044 100644 --- a/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts +++ b/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts @@ -4,6 +4,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { Router } from '@angular/router'; import { NotifierService } from 'angular-notifier'; import { BusinessService } from 'app/appoinment/business/business-service/business.service'; +import { ApiServiceService } from 'app/appoinment/service-list-details/service-api-services/api-service.service'; import { environment } from 'environments/environment'; export interface UsersData { @@ -32,12 +33,16 @@ export class AddUserComponent implements OnInit { private apiUrl = environment.apiEndpoint; busId: any; disableBus: any=1; + userrole: any = []; + servicesList: any = []; + serviceCheckedData: any = []; + assignedServiceValue: any = []; constructor(private notifierService: NotifierService,private router: Router,private formBuilder: FormBuilder, public dialogRef: MatDialogRef, - @Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData,public _bus:BusinessService) { + @Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData,public _bus:BusinessService,public _ser:ApiServiceService) { console.log(data); this.local_data = {...data}; - console.log( this.local_data) + console.log(this.local_data) // this.local_data.busId = localStorage.getItem('busNameID') this.action = this.local_data.action; this.formData= new FormData(); @@ -48,7 +53,7 @@ export class AddUserComponent implements OnInit { ngOnInit() { this.hide = true; this.disableBus = localStorage.getItem('go_admin') - let userrole = localStorage.getItem('user_role') + this.userrole = localStorage.getItem('user_role') this.form = new FormGroup({ businessselect: new FormControl('',[Validators.required]), role: new FormControl('', [Validators.required]), @@ -65,7 +70,7 @@ export class AddUserComponent implements OnInit { )]), logo: new FormControl('', null), // confirmPassword: new FormControl('', [Validators.required, Validators.minLength(6)]), - createdBy:new FormControl(userrole,null), + createdBy:new FormControl(this.userrole,null), }); console.log(this.local_data); @@ -154,16 +159,21 @@ export class AddUserComponent implements OnInit { close() { this.dialogRef.close(); } - + submit(){ - console.log(this.form.value); + console.log(this.form.value); + if(this.userrole == 'BADMIN'){ + this.form.controls['businessselect'].clearValidators(); + this.form.controls['businessselect'].updateValueAndValidity(); + this.busId = localStorage.getItem('busId') + } if(this.action == 'Update'){ this.form.controls['password'].clearValidators(); this.form.controls['password'].updateValueAndValidity(); } if (!this.form.valid) { return; - } + } let tmp = this.form.value tmp.id = this.local_data.id console.log(tmp,this.formData.getAll('image')); @@ -186,8 +196,8 @@ export class AddUserComponent implements OnInit { this.formData.append('contactNo', tmp.contactNo); // this.formData.append('confirmPassword', tmp.password); // tmp.confirmPassword = this.local_data.confirmPassword - this.dialogRef.close({event:this.action,data: this.formData}); - console.log( this.formData,this.form.value); + this.dialogRef.close({event:this.action,data: this.formData,role:this.form.value.role}); + console.log(this.formData,this.form.value); console.log(this.action,this.local_data) } @@ -212,6 +222,7 @@ export class AddUserComponent implements OnInit { } // this.formData= new FormData(); // this.formData=[]; + this.formData= new FormData(); this.formData.append('image', file, file.name); // this.formData.append('file', file, file.name); } diff --git a/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.html b/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.html new file mode 100644 index 0000000..85d30c7 --- /dev/null +++ b/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.html @@ -0,0 +1,53 @@ +
Assign Service to Dr. {{pracititionerName}} +
+ + + Assign Service + + + {{details.servicesName}} + + + + + + +
+ +
+ + +
+
+ +
+
+
{{details.servicesName}}
+
{{servicesList_data[i].duration.length>0 ? servicesList_data[i].duration[0].durationNew : details.duration}} Mins | {{servicesList_data[i].duration.length>0 ? servicesList_data[i].duration[0].fees : details.fees}}
+ +
+ +
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+

No Service Assigned

+
+
+
\ No newline at end of file diff --git a/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.scss b/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.scss new file mode 100644 index 0000000..3dee33e --- /dev/null +++ b/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.scss @@ -0,0 +1,67 @@ +.p-1{ + padding: 1rem !important; + .flexCard{ + display: contents !important; + } + } + .mat-pane{ + width: 100%; + } + .scrollHV { + height: calc(100vh - 267px) !important; + } + .service-info{ + // line-height: 3rem!important; + font-size: 14px!important; + font-weight: 500!important; + color: #2f2c2c; + } + .service-info2{ + // line-height: 3rem!important; + font-size: 12px!important; + font-weight: 500!important; + color: #5F5F5F; + } + .indianSymbol { + content: "\20B9"; + } + + .mat-card{ + background-color: #FFF; + min-height: 45px; + border-bottom: 1px solid #F5F6F8; + position: relative; + margin: 17px 10px 17px 10px; + display: flex; + .mat-nav-list .mat-list-item:hover{ + background: none; + } + .name{ + font-size: 15px; + color: #111; + } + .time-amount{ + color: #5B6572!important; + font-size: 13px; + line-height: 25px; + } + .Customize{ + color: #567FC2!important; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 12px; + } + .mat-name{ + font-size: 14px; + color: #5B6572!important; + padding-top: 3rem; + padding-right: 8rem; + padding-left: 8rem; + } + .mat-status{ + font-size: 14px; + color: green!important; + padding-top: 3rem; + } + } \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.spec.ts b/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.spec.ts new file mode 100644 index 0000000..53ae61d --- /dev/null +++ b/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PractAssignServiceComponent } from './pract-assign-service.component'; + +describe('PractAssignServiceComponent', () => { + let component: PractAssignServiceComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PractAssignServiceComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PractAssignServiceComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.ts b/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.ts new file mode 100644 index 0000000..56a2249 --- /dev/null +++ b/ng-seed/src/app/appoinment/user/pract-assign-service/pract-assign-service.component.ts @@ -0,0 +1,147 @@ +import { Component, Inject, OnInit, Optional } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { UserService } from '../user-service/user.service'; +import { ApiServiceService } from 'app/appoinment/service-list-details/service-api-services/api-service.service'; +import { ConsultantService } from 'app/appoinment/consultant-setting/consultant-service/consultant.service'; + +@Component({ + selector: 'app-pract-assign-service', + templateUrl: './pract-assign-service.component.html', + styleUrls: ['./pract-assign-service.component.scss'] +}) +export class PractAssignServiceComponent implements OnInit { + assignService:any = [] + serviceCheckedData: number; + pracititionerUserId: any = []; + servicesList: any = []; + servicesList_array: any[]; + servicesList_data: any = []; + user_ID: any; + busId: any; + pracititionerName: any; + constructor(public _use:UserService, public dialogRef: MatDialogRef, + @Optional() @Inject(MAT_DIALOG_DATA) public data,public _ser:ApiServiceService,public _api:ConsultantService) { + console.log(data) + if(data.action == 'Update'){ + this.pracititionerUserId = data.obj.id + this.pracititionerName = data.obj.userName + }else{ + this.pracititionerUserId = data.userId + this.pracititionerName = data.obj + } + + } + + ngOnInit(): void { + // this.getServicesList() + // this.user_ID = localStorage.getItem('user_id') + this.busId = localStorage.getItem('busId') + this.getServicesList(this.pracititionerUserId,this.busId) + } + + closeDialog(){ + this.dialogRef.close({event:'Cancel'}); + } + + close() { + this.dialogRef.close(); +} + // getServicesList() { + // let param ={"busId":localStorage.getItem('busId')} + // console.log(param) + // this._ser.getServicesListDetails(param).subscribe(res => { + // if (res.status == 200) { + // this.servicesList = res.data; + // } + // else{ + // this.servicesList=[]; + // } + // }) + // } + + getValues(event: { + isUserInput: any; + source: { value: any; selected: any }; + },details) { + console.log(event,details,this.assignService) + if (event.isUserInput) { + if (event.source.selected === true) { + console.log('1',event.source.value) + this.serviceCheckedData = 1 + this.getCheckedService(details) + } else { + console.log('2',event.source.value) + this.serviceCheckedData = 0 + this.getCheckedService(details) + } + } + + } + + + + getCheckedService(params){ + console.log(params) + let data = {serviceId:params.serviceId,userId:this.pracititionerUserId,busId:params.busId,active:this.serviceCheckedData} + console.log(data) + this._use.getServiceCheckedDetails(data).subscribe(res => { + if (res.status == 200) { + console.log(res) + // this.checkedList = res.data; + this.getServicesList(this.pracititionerUserId,this.busId) + } + } ); + } + + getAssignedList(busId) { + this._api.getAssignedDetails(busId).subscribe(res => { + console.log(res) + if (res.status == 200) { + this.servicesList = res.data; + + let result = this.servicesList.filter((obj, index, self) => + index === self.findIndex((t) => ( + t.serviceId === obj.serviceId + )) + ); + this.servicesList = result + console.log(this.servicesList) + } + } ); + } + + getServicesList(id,busId) { + this.servicesList_array = [] + //this._pd.getTabStatusPdDetails(this.tabStatus) + this._api.getServicesListDetails(id,busId).subscribe(res => { + if (res.status == 200) { + this.servicesList_data = res.data; + console.log(this.servicesList_data) + res['data'].forEach(element => { + // tmp.push(element.service) + element.service.forEach(e => { + console.log(e) + this.servicesList_array.push(e) + this.assignService.push(e.servicesName) + }); + }); + + // this.servicesList_array = this.servicesList_array.filter((obj, index, self) => + // index === self.findIndex((t) => ( + // t.serviceId === obj.serviceId + // )) + // ); + // let result = this.assignService.filter((obj, index, self) => + // index === self.findIndex((t) => ( + // t.serviceId === obj.serviceId + // )) + // ); + // this.assignService = result + console.log(this.servicesList_array) + } + this.getAssignedList(this.busId) + }); + // this.assignService = this.checkedArray + } + +} diff --git a/ng-seed/src/app/appoinment/user/user-list/user-list.component.ts b/ng-seed/src/app/appoinment/user/user-list/user-list.component.ts index 4dbbe26..05b07fe 100644 --- a/ng-seed/src/app/appoinment/user/user-list/user-list.component.ts +++ b/ng-seed/src/app/appoinment/user/user-list/user-list.component.ts @@ -9,6 +9,7 @@ import { AddUserComponent } from '../add-user/add-user.component'; import { UserService } from '../user-service/user.service'; import { environment } from 'environments/environment'; import { BusinessService } from 'app/appoinment/business/business-service/business.service'; +import { PractAssignServiceComponent } from '../pract-assign-service/pract-assign-service.component'; export interface UsersData { id: number; @@ -164,7 +165,7 @@ export class UserListComponent implements OnInit { }).then((result) => { if (result.value) { // this.deleteRowData(element); - this.formAddUpdateAndDelete(name,element) + this.formAddUpdateAndDelete(name,element,'','') Swal.fire( 'Deleted!', 'Your imaginary file has been deleted.', @@ -203,7 +204,7 @@ export class UserListComponent implements OnInit { } if(result != undefined){ console.log(result) - this.formAddUpdateAndDelete(result,result.data) + this.formAddUpdateAndDelete(result,result.data,action,obj) } // console.log(result) // if(result.event == 'Add'){ @@ -216,7 +217,7 @@ export class UserListComponent implements OnInit { }); } - formAddUpdateAndDelete(result,row_obj){ + formAddUpdateAndDelete(result,row_obj,action,obj){ console.log(result,row_obj) let formValue = [] if(result.event == 'Add'){ @@ -264,9 +265,9 @@ export class UserListComponent implements OnInit { let user_role = localStorage.getItem('user_role') if(user_role != 'BADMIN'){ localStorage.setItem('busNameID',null) - } + } - // this.usersList = res.data; + // this.usersList = res.data; this.getUsersList() if(result.event == 'Add'){ this.notifierService.notify('success', 'User Added Successfully'); @@ -275,6 +276,12 @@ export class UserListComponent implements OnInit { } else if(result == 'Delete'){ this.notifierService.notify('success', 'User Deleted Successfully'); } + if(action == 'Update' && result.role == 'PRACTITIONER'){ + this.openAssignService(res['data'].id,action,obj) + }else if(result.role == 'PRACTITIONER'){ + this.openAssignService(res['data'].id,'',res['data'].userName) + } + } else{ this.notifierService.notify('warning', res.message); @@ -288,6 +295,19 @@ export class UserListComponent implements OnInit { }); } + openAssignService(userId,action,obj) { + const dialogRef = this.dialog.open(PractAssignServiceComponent, { + width: '25%', + height: '100%', + // maxWidth: '38vw', + position: { right: '0' }, + data:{userId,action,obj} + }); + dialogRef.afterClosed().subscribe(result => { + + }); + } + // addRowData(row_obj){ // var d = this.dataSource.data.length+1 // console.log(this.dataSource) diff --git a/ng-seed/src/app/appoinment/user/user-service/user.service.ts b/ng-seed/src/app/appoinment/user/user-service/user.service.ts index 8d9ec72..b9af196 100644 --- a/ng-seed/src/app/appoinment/user/user-service/user.service.ts +++ b/ng-seed/src/app/appoinment/user/user-service/user.service.ts @@ -34,6 +34,11 @@ export class UserService { // ) } + getServiceCheckedDetails(params): Observable{ + return this._http.post(this.apiUrl + 'AlterServicesMap', params) + } + + handleError(arg0: string, arg1: undefined[]): (err: any, caught: Observable) => import("rxjs").ObservableInput { throw new Error('Method not implemented.'); diff --git a/ng-seed/src/app/appoinment/user/user.module.ts b/ng-seed/src/app/appoinment/user/user.module.ts index 74c4d3d..5c0626b 100644 --- a/ng-seed/src/app/appoinment/user/user.module.ts +++ b/ng-seed/src/app/appoinment/user/user.module.ts @@ -8,6 +8,7 @@ import { DemoMaterialModule } from 'app/shared/demo.module'; import { NgScrollbarModule } from 'ngx-scrollbar'; import { AddUserComponent } from './add-user/add-user.component'; import { NotifierModule, NotifierOptions } from 'angular-notifier'; +import { PractAssignServiceComponent } from './pract-assign-service/pract-assign-service.component'; const customNotifierOptions: NotifierOptions = { position: { @@ -54,6 +55,7 @@ const customNotifierOptions: NotifierOptions = { declarations: [ UserListComponent, AddUserComponent, + PractAssignServiceComponent, ], imports: [ diff --git a/ng-seed/src/app/end-user/booking-summary/booking-summary.component.html b/ng-seed/src/app/end-user/booking-summary/booking-summary.component.html index f244959..b23120a 100644 --- a/ng-seed/src/app/end-user/booking-summary/booking-summary.component.html +++ b/ng-seed/src/app/end-user/booking-summary/booking-summary.component.html @@ -79,7 +79,7 @@ Date & Time
- : {{bookingSummary.appoinmentDate | date:'fullDate'}}({{bookingSummary.appoinmentSlots[0] | date:'shortTime'}}) + : {{bookingSummary.appoinmentDate}}{{bookingSummary.appoinmentSlots[0] | date:'shortTime'}}
diff --git a/ng-seed/src/app/end-user/consultants/consultants-list.component.ts b/ng-seed/src/app/end-user/consultants/consultants-list.component.ts index 6a1b22f..ccee00a 100644 --- a/ng-seed/src/app/end-user/consultants/consultants-list.component.ts +++ b/ng-seed/src/app/end-user/consultants/consultants-list.component.ts @@ -116,6 +116,7 @@ export class ConsultantsListComponent implements OnInit { localStorage.setItem('user_id',param.id) let URL = this.router.url; console.log(URL,param) + localStorage.setItem('advanced_slot_days',param['practitionerInfos'][0].days) let URL_AS_LIST = URL.split('/'); console.log(URL_AS_LIST); if(URL_AS_LIST[2] == 'business'){ diff --git a/ng-seed/src/app/end-user/customer-info/customer-info.component.html b/ng-seed/src/app/end-user/customer-info/customer-info.component.html index 933490d..6090832 100644 --- a/ng-seed/src/app/end-user/customer-info/customer-info.component.html +++ b/ng-seed/src/app/end-user/customer-info/customer-info.component.html @@ -31,7 +31,7 @@
- + Contact No is required Invalid Contact No Contact No must be at least 10 characters diff --git a/ng-seed/src/app/end-user/customer-info/customer-info.component.scss b/ng-seed/src/app/end-user/customer-info/customer-info.component.scss index 3939962..d055eed 100644 --- a/ng-seed/src/app/end-user/customer-info/customer-info.component.scss +++ b/ng-seed/src/app/end-user/customer-info/customer-info.component.scss @@ -70,4 +70,9 @@ mat-toolbar{ height: 50px; font-size: 14px } + + .custom-dialog-container{ + background: none !important; + padding: 0px !important; + } \ No newline at end of file diff --git a/ng-seed/src/app/end-user/customer-info/customer-info.component.ts b/ng-seed/src/app/end-user/customer-info/customer-info.component.ts index 9f870c5..8a2f91f 100644 --- a/ng-seed/src/app/end-user/customer-info/customer-info.component.ts +++ b/ng-seed/src/app/end-user/customer-info/customer-info.component.ts @@ -5,6 +5,9 @@ import { EndUserService } from '../end-user.service'; import firebase from 'firebase/app'; import 'firebase/auth'; import 'firebase/firestore'; +import { MatDialog } from '@angular/material/dialog'; +import { OptVerifyComponent } from './opt-verify/opt-verify.component'; +import { event } from 'jquery'; var config = { @@ -32,8 +35,9 @@ export class CustomerInfoComponent implements OnInit { otp!: string; verifykey: any; busName: string; + noChangeNo: any = 0; - constructor(private router: Router,private formBuilder: FormBuilder,public _cus:EndUserService, private ngZone: NgZone) { + constructor(public dialog: MatDialog,private router: Router,private formBuilder: FormBuilder,public _cus:EndUserService, private ngZone: NgZone) { // firebase.initializeApp(config) } @@ -61,7 +65,7 @@ export class CustomerInfoComponent implements OnInit { console.log(this.form.value) console.log('add') if(!this.form.valid){ - return + return } let row_obj = this.form.value console.log(row_obj) @@ -69,7 +73,7 @@ export class CustomerInfoComponent implements OnInit { cusName: row_obj.cusName, email: row_obj.email, address_1: row_obj.address_1, - phoneNo: this.phoneNumber.substring(3) , + phoneNo: row_obj.phoneNo, pincode: row_obj.pincode, state: row_obj.state, city: row_obj.city, @@ -100,126 +104,43 @@ export class CustomerInfoComponent implements OnInit { },1000) } - resendOTP() { - this.phoneNumber = this.form.value.phoneNo - if( this.phoneNumber.length!=10){ -alert("invalid Phone No...!") - }else{ - this.otpData = event - this.timeLeft = 60; - this.interval = setInterval(() => { - if(this.timeLeft > 0) { - this.timeLeft--; - } else { - clearInterval(this.interval); - } - },1000) - - this.reCaptchaVerifier = new firebase.auth.RecaptchaVerifier( - 'sign-in-button', - { - size: 'invisible', - } - ); - console.log(this.reCaptchaVerifier); - this.phoneNumber = "+91"+this.phoneNumber; - console.log(this.phoneNumber); - firebase - .auth() - .signInWithPhoneNumber(this.phoneNumber, this.reCaptchaVerifier) - .then((confirmationResult) => { - localStorage.setItem( - 'verificationId', - JSON.stringify(confirmationResult.verificationId) - ); - this.ngZone.run(() => { - //this.router.navigate(['/code']); - }); - }) - .catch((error) => { - console.log(error.message); - alert(error.message); - setTimeout(() => { - window.location.reload(); - }, 5000); - }); - } - } - verify(event){ - this.verifykey = JSON.parse(localStorage.getItem('verificationId') || '{}'); - console.log(this.verifykey); - this.otp = this.form.value.otp - console.log(this.otp); - var credential = firebase.auth.PhoneAuthProvider.credential( - this.verifykey, - this.otp - ); - console.log(credential); - firebase - .auth() - .signInWithCredential(credential) - .then((response) => { - console.log(response); - localStorage.setItem('user_data', JSON.stringify(response)); - this.ngZone.run(() => { - // this.router.navigate(['/dashboard']); - this.verifyOTP = event - }); - }) - .catch((error) => { - console.log(error); - alert(error.message); - }); - } - - getOTP(event) { + + getOTP(event) { this.phoneNumber = this.form.value.phoneNo if( this.phoneNumber.length!=10){ -alert("invalid Phone No...!") + alert("invalid Phone No...!") }else{ - this.otpData = event - this.timeLeft = 60; - this.interval = setInterval(() => { - if(this.timeLeft > 0) { - this.timeLeft--; - } else { - clearInterval(this.interval); - } - },1000) - - this.reCaptchaVerifier = new firebase.auth.RecaptchaVerifier( - 'sign-in-button', - { - size: 'invisible', - } - ); - console.log(this.reCaptchaVerifier); - this.phoneNumber = "+91"+this.phoneNumber; - console.log(this.phoneNumber); - firebase - .auth() - .signInWithPhoneNumber(this.phoneNumber, this.reCaptchaVerifier) - .then((confirmationResult) => { - localStorage.setItem( - 'verificationId', - JSON.stringify(confirmationResult.verificationId) - ); - this.ngZone.run(() => { - //this.router.navigate(['/code']); - }); - }) - .catch((error) => { - console.log(error.message); - alert(error.message); - setTimeout(() => { - window.location.reload(); - }, 5000); - }); + this.openOtp(event) + this.noChangeNo = event + console.log(this.noChangeNo) + // this.otpData = event } } + + openOtp(event) { + const dialogRef = this.dialog.open(OptVerifyComponent, { + width: '30%', + // height: '100%', + // maxWidth: '38vw', + // position: { right: '0' }, + disableClose: true , + panelClass: 'custom-dialog-container', + + data:{event,phoneNo:this.phoneNumber} + }); + dialogRef.afterClosed().subscribe(result => { + console.log(result) + if(result == 'signIn'){ + this.verifyOTP = 1 + }else{ + this.noChangeNo = 0 + } + }); + } + } diff --git a/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.html b/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.html new file mode 100644 index 0000000..8d79cf4 --- /dev/null +++ b/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.html @@ -0,0 +1,23 @@ +
+
+
+ +

OTP

+
+
+ + + +
+
+ +
+
+
+ + +
+ +
+
+
\ No newline at end of file diff --git a/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.scss b/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.scss new file mode 100644 index 0000000..7694db0 --- /dev/null +++ b/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.scss @@ -0,0 +1,7 @@ +.mat-dialog-container{ + background: none !important; + padding: 0px !important; +} +.base-border{ + margin-top: 0 !important; +} \ No newline at end of file diff --git a/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.spec.ts b/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.spec.ts new file mode 100644 index 0000000..da1cd00 --- /dev/null +++ b/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OptVerifyComponent } from './opt-verify.component'; + +describe('OptVerifyComponent', () => { + let component: OptVerifyComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ OptVerifyComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(OptVerifyComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.ts b/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.ts new file mode 100644 index 0000000..da7099a --- /dev/null +++ b/ng-seed/src/app/end-user/customer-info/opt-verify/opt-verify.component.ts @@ -0,0 +1,160 @@ +import { Component, Inject, NgZone, OnInit } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import firebase from 'firebase/app'; +import 'firebase/auth'; +import 'firebase/firestore'; + +@Component({ + selector: 'app-opt-verify', + templateUrl: './opt-verify.component.html', + styleUrls: ['./opt-verify.component.scss'] +}) +export class OptVerifyComponent implements OnInit { + form: FormGroup; + otpData: any = 0; + timeLeft: number = 0; + interval; + verifyOTP: any = 0; + phoneNumber: any; + reCaptchaVerifier!: any; + getOtpvalue:any =[] + otp!: string; + verifykey: any; + busName: string; + noChangeNo: any = 0; + constructor(public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,private ngZone: NgZone) { + this.getOtp(data) + } + + ngOnInit(): void { + } + + getOtp(data){ + console.log(data) + this.phoneNumber = data.phoneNo + this.timeLeft = 60; + this.interval = setInterval(() => { + if(this.timeLeft > 0) { + this.timeLeft--; + } else { + clearInterval(this.interval); + } + },1000) + + this.reCaptchaVerifier = new firebase.auth.RecaptchaVerifier( + 'sign-in-button', + { + size: 'invisible', + } + ); + console.log(this.reCaptchaVerifier); + this.phoneNumber = "+91"+this.phoneNumber; + console.log(this.phoneNumber); + firebase + .auth() + .signInWithPhoneNumber(this.phoneNumber, this.reCaptchaVerifier) + .then((confirmationResult) => { + localStorage.setItem( + 'verificationId', + JSON.stringify(confirmationResult.verificationId) + ); + this.ngZone.run(() => { + //this.router.navigate(['/code']); + }); + }) + .catch((error) => { + console.log(error.message); + alert(error.message); + setTimeout(() => { + window.location.reload(); + }, 5000); + }); + } + + verify(event){ + this.verifykey = JSON.parse(localStorage.getItem('verificationId') || '{}'); + console.log(this.verifykey); + this.otp = this.getOtpvalue + console.log(this.otp); + var credential = firebase.auth.PhoneAuthProvider.credential( + this.verifykey, + this.otp + ); + + console.log(credential); + firebase + .auth() + .signInWithCredential(credential) + .then((response) => { + console.log(response); + this.dialogRef.close(response.operationType); + localStorage.setItem('user_data', JSON.stringify(response)); + this.ngZone.run(() => { + // this.router.navigate(['/dashboard']); + console.log(response) + this.verifyOTP = event + }); + }) + .catch((error) => { + console.log(error); + this.dialogRef.close() + alert(error.message); + }); + } + + resendOTP() { + this.phoneNumber = this.phoneNumber + if( this.phoneNumber.length!=10){ +alert("invalid Phone No...!") + }else{ + this.otpData = event + this.timeLeft = 60; + this.interval = setInterval(() => { + if(this.timeLeft > 0) { + this.timeLeft--; + } else { + clearInterval(this.interval); + } + },1000) + + this.reCaptchaVerifier = new firebase.auth.RecaptchaVerifier( + 'sign-in-button', + { + size: 'invisible', + } + ); + console.log(this.reCaptchaVerifier); + this.phoneNumber = "+91"+this.phoneNumber; + console.log(this.phoneNumber); + firebase + .auth() + .signInWithPhoneNumber(this.phoneNumber, this.reCaptchaVerifier) + .then((confirmationResult) => { + localStorage.setItem( + 'verificationId', + JSON.stringify(confirmationResult.verificationId) + ); + this.ngZone.run(() => { + //this.router.navigate(['/code']); + }); + }) + .catch((error) => { + console.log(error.message); + alert(error.message); + setTimeout(() => { + window.location.reload(); + }, 5000); + }); + } + } + + closeDialog(){ + this.dialogRef.close({event:'Cancel'}); + } + + close() { + this.dialogRef.close(); +} + +} diff --git a/ng-seed/src/app/end-user/doctor-profile/doctor-profile.component.ts b/ng-seed/src/app/end-user/doctor-profile/doctor-profile.component.ts index 6134c3d..d40fbf5 100644 --- a/ng-seed/src/app/end-user/doctor-profile/doctor-profile.component.ts +++ b/ng-seed/src/app/end-user/doctor-profile/doctor-profile.component.ts @@ -136,6 +136,7 @@ export class DoctorProfileComponent implements OnInit { console.log(this.dp) this.profileDetails = this.bookedAppointment.practitionerInfos[0] console.log(this.profileDetails) + localStorage.setItem('advanced_slot_days',this.profileDetails.days) this.skillsDetails = JSON.parse(this.profileDetails.skills) // this.skillsDetails = JSON.parse(this.skillsDetails) diff --git a/ng-seed/src/app/end-user/end-user.module.ts b/ng-seed/src/app/end-user/end-user.module.ts index b676910..9acdb68 100644 --- a/ng-seed/src/app/end-user/end-user.module.ts +++ b/ng-seed/src/app/end-user/end-user.module.ts @@ -18,6 +18,7 @@ import { BookingSummaryComponent } from './booking-summary/booking-summary.compo import { SummaryComponent } from './summary/summary.component'; import { DoctorProfileComponent } from './doctor-profile/doctor-profile.component'; import { NgxSpinnerModule } from "ngx-spinner"; +import { OptVerifyComponent } from './customer-info/opt-verify/opt-verify.component'; @NgModule({ declarations: [ @@ -26,7 +27,7 @@ import { NgxSpinnerModule } from "ngx-spinner"; SearchCategoryComponent, ConsultantsListComponent, CentersListComponent, - PaymentComponent,CustomerInfoComponent, BookingSummaryComponent, SummaryComponent, DoctorProfileComponent + PaymentComponent,CustomerInfoComponent, BookingSummaryComponent, SummaryComponent, DoctorProfileComponent, OptVerifyComponent ], imports: [ CommonModule, diff --git a/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.html b/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.html index 46aec3f..c6690a6 100644 --- a/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.html +++ b/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.html @@ -66,7 +66,7 @@
- {{check(days) | date:'longDate'}} + {{check(days) | date:'longDate'}}
@@ -82,7 +82,7 @@
- + @@ -187,9 +187,9 @@
-
+
diff --git a/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.ts b/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.ts index c31acb1..d540d5c 100644 --- a/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.ts +++ b/ng-seed/src/app/end-user/slot-booking/slot-booking-details.component.ts @@ -54,6 +54,7 @@ export class SlotBookingDetailsComponent implements OnInit { servicesName: any=[]; user: any=[]; serviceMapdetails:any =[] + advanced_slot_days: any; constructor(private router:Router,private datepipe:DatePipe,public end_user:EndUserService) { this.end_user.appointmentBooked_observable$.subscribe((res) => { console.log('booked', res); @@ -86,7 +87,24 @@ export class SlotBookingDetailsComponent implements OnInit { this.slot_Split() + this.advanced_slot_days = parseInt(localStorage.getItem('advanced_slot_days'))-1 + console.log(this.advanced_slot_days) + + let tmp=[] + for(let i=0;i<=this.advanced_slot_days;i++){ + console.log(i) + var someDate = new Date(); + someDate.setDate(someDate.getDate() + i); //number of days to add, e.x. 15 days + var dateFormated = someDate.toISOString().substr(0,10); + console.log(dateFormated); + tmp.push(dateFormated) + this.days= tmp + + } + console.log(tmp) + console.log(this.days) + } @@ -291,17 +309,9 @@ if(this.getHours.length != 0){ } getApiData(){ - this.busName = localStorage.getItem('busName') - let tmp=[] - for(let i=0;i<=5;i++){ - var someDate = new Date(); - someDate.setDate(someDate.getDate() + i); //number of days to add, e.x. 15 days - var dateFormated = someDate.toISOString().substr(0,10); - console.log(dateFormated); - tmp.push(dateFormated) - } - console.log(tmp) - this.days= tmp + this.busName = localStorage.getItem('busName') + + let params ={"id":this.user.id} this.end_user.getSlots(params).subscribe(res => { if (res.status == 200) { @@ -314,7 +324,7 @@ if(this.getHours.length != 0){ } goToSlotBooking(){ // this.days[] - if( this.clicks <5){ + if( this.clicks