diff --git a/angular/src/app/app-routing.module.ts b/angular/src/app/app-routing.module.ts index d7050db..4261ff2 100644 --- a/angular/src/app/app-routing.module.ts +++ b/angular/src/app/app-routing.module.ts @@ -39,20 +39,7 @@ const routes: Routes = [ m => m.ViewAppointmentModule ), }, - { - path: 'appointment/book-appointment', - loadChildren: () => - import('./appointment/book-appointment/book-appointment.module').then( - m => m.BookAppointmentModule - ), - }, - { - path: 'appointment/edit-appointment', - loadChildren: () => - import('./appointment/edit-appointment/edit-appointment.module').then( - m => m.EditAppointmentModule - ), - }, + { path: 'patients', loadChildren: () => import('./patients/patients.module').then(m => m.PatientsModule), diff --git a/angular/src/app/appointment/appointment-calendar/appointment-calendar.component.html b/angular/src/app/appointment/appointment-calendar/appointment-calendar.component.html index c78954d..3baf9e8 100644 --- a/angular/src/app/appointment/appointment-calendar/appointment-calendar.component.html +++ b/angular/src/app/appointment/appointment-calendar/appointment-calendar.component.html @@ -1 +1,6 @@ + + + diff --git a/angular/src/app/appointment/appointment-calendar/appointment-calendar.component.ts b/angular/src/app/appointment/appointment-calendar/appointment-calendar.component.ts index 28f47de..2620209 100644 --- a/angular/src/app/appointment/appointment-calendar/appointment-calendar.component.ts +++ b/angular/src/app/appointment/appointment-calendar/appointment-calendar.component.ts @@ -1,16 +1,59 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { RouterOutlet } from '@angular/router'; import { FullCalendarModule } from '@fullcalendar/angular'; import { CalendarOptions } from '@fullcalendar/core'; // useful for typechecking import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from '@fullcalendar/interaction'; +import { AppointmentService } from '@proxy/appointments'; +import { PagingSortResultDto } from '@proxy/dto'; @Component({ selector: 'app-appointment-calendar', templateUrl: './appointment-calendar.component.html', styleUrl: './appointment-calendar.component.scss' }) -export class AppointmentCalendarComponent { +export class AppointmentCalendarComponent implements OnInit{ + appointments: any[] = []; + params: PagingSortResultDto; + selectedDate: string; + isModalVisible: boolean = false; + constructor(private appointmentService: AppointmentService) {} + + ngOnInit() { + + this.loadappointments({ + first: 0, + rows: 10, + sortField: 'id', + sortOrder: 1, + globalFilter: null, + }); } + loadappointments(event: any) { + let order = event.sortOrder == 1 ? ' asc' : ' desc'; + + this.params = { + skipCount: event.first, + maxResultCount: event.rows, + sorting: event.sortField + order, + search: event.globalFilter == null ? '' : event.globalFilter, + }; + this.appointmentService.getAppointmentList(this.params).subscribe(data => { + this.appointments = data.items; + this.updateCalendarEvents(); + }); + } + updateCalendarEvents() { + this.calendarOptions = { + initialView: 'dayGridMonth', + plugins: [dayGridPlugin, interactionPlugin], + events: this.appointments.map(appointment => ({ + title: appointment.firstName + ' - ' + appointment.doctor, + date: appointment.dateOfAppointment + })), + dateClick: (arg) => this.handleDateClick(arg) + }; + } + calendarOptions: CalendarOptions = { initialView: 'dayGridMonth', plugins: [dayGridPlugin, interactionPlugin], @@ -22,6 +65,10 @@ export class AppointmentCalendarComponent { }; handleDateClick(arg) { - alert('date click! ' + arg.dateStr) + this.selectedDate = arg.dateStr; + this.isModalVisible = true; + } + onModalClose() { + this.isModalVisible = false; } } diff --git a/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.html b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.html new file mode 100644 index 0000000..7edea7c --- /dev/null +++ b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.html @@ -0,0 +1,372 @@ + diff --git a/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.scss b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.scss new file mode 100644 index 0000000..c1581bc --- /dev/null +++ b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.scss @@ -0,0 +1,23 @@ +.hide_body{ + scrollbar-width: auto !important; + min-height: 150px; + max-height: calc(100vh - 13rem); + overflow-y: auto; + } + .is-valid { + border-color: green !important; + } + .is-invalid { + border-color: red !important; + } + + /* Adjust the z-index of the calendar dropdown */ +.p-calendar .p-datepicker { + z-index: 1050 !important; /* Make sure it's above other elements */ + } + + /* You can also adjust modal z-index if necessary */ + .modal { + z-index: 1040; /* Set lower z-index to ensure modal is behind the calendar */ + } + \ No newline at end of file diff --git a/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.spec.ts b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.spec.ts new file mode 100644 index 0000000..6259115 --- /dev/null +++ b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AppointmentDialogComponent } from './appointment-dialog.component'; + +describe('AppointmentDialogComponent', () => { + let component: AppointmentDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [AppointmentDialogComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(AppointmentDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.ts b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.ts new file mode 100644 index 0000000..d0e6a13 --- /dev/null +++ b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.ts @@ -0,0 +1,215 @@ +import { ConfirmationService, ToasterService } from '@abp/ng.theme.shared'; +import { HttpClient } from '@angular/common/http'; +import { + Component, + EventEmitter, + Input, + OnChanges, + OnInit, + Output, + SimpleChanges, + ViewChild, +} from '@angular/core'; +import { FormsModule, NgForm } from '@angular/forms'; +import { CreateOrUpdateAppointmentDto } from '@proxy/appoinments/dto'; +import { Gender, appointmentStatus, visitType, paymentStatus } from '@proxy/global-enum'; +import { DoctorService } from '@proxy/doctors'; +import { AppointmentService } from '@proxy/appointments'; +import { ButtonModule } from 'primeng/button'; +import { CalendarModule } from 'primeng/calendar'; +import { ChipModule } from 'primeng/chip'; +import { DialogModule } from 'primeng/dialog'; +import { DropdownModule } from 'primeng/dropdown'; +import { InputTextModule } from 'primeng/inputtext'; +import { InputTextareaModule } from 'primeng/inputtextarea'; +import { RadioButtonModule } from 'primeng/radiobutton'; +import { TableModule } from 'primeng/table'; +import { ViewAppointmentRoutingModule } from '../view-appointment/view-appointment-routing.module'; +import { CommonModule } from '@angular/common'; + +@Component({ + selector: 'app-appointment-dialog', + standalone: true, + imports: [ + ViewAppointmentRoutingModule, + TableModule, + DialogModule, + FormsModule, + TableModule, + ButtonModule, + DialogModule, + InputTextModule, + CalendarModule, + DropdownModule, + RadioButtonModule, + InputTextareaModule, + ChipModule, + CommonModule, + ], + templateUrl: './appointment-dialog.component.html', + styleUrl: './appointment-dialog.component.scss', +}) +export class AppointmentDialogComponent implements OnInit,OnChanges { + @Input() visible: boolean = false; // Control modal visibility + @Input() name: string; + @Input() isEditMode: boolean = false; // Determine if it's for edit or create + @Output() save = new EventEmitter(); // Event emitter for saving appointment + @Output() close = new EventEmitter(); // Event emitter for closing the modal + @Input() appointmentId: string; // To accept the appointment ID from the parent + @Input() selectedDate: string; + appointmentsForDate: any[] = []; + + loading: boolean = false; + AppointmentDialogTitle: string = ''; + AppointmentDialog: boolean = false; + genders = Gender; + Dateofbirth: Date = new Date(); + AppointmentDate: Date = new Date(); + doctors = []; + doctorOptions = []; + constructor( + private DoctorService: DoctorService, + private AppointmentService: AppointmentService, + private http: HttpClient, + private confirmation: ConfirmationService, + private toaster: ToasterService + ) {} + + ngOnInit(): void { + debugger; + this.getdoctorlist(); + if (!this.isEditMode) { + this.appointment = { + firstName: '', + lastName: '', + email: '', + gender: Gender.Male, + dateOfAppointment: '', + dob: '', + timeOfAppointment: '', + mobile: '', + injuryORContion: '', + note: '', + doctorId: '', + address: '', + appointmentStatus: null, + visitType: null, + paymentStatus: null, + insuranceProvider: '', + }; + } + } +ngOnChanges(changes: SimpleChanges): void { + if (changes['appointmentId'] && this.appointmentId) { + // When the appointment ID changes, fetch the appointment details + this.fetchAppointmentData(); + } + if (changes['selectedDate'] && this.selectedDate) { + this.fetchAppointmentsForDate(); + } +} +fetchAppointmentsForDate() { + // this.AppointmentService.getAppointmentsByDate(this.selectedDate).subscribe((data: any[]) => { + // this.appointmentsForDate = data; + // }); + debugger +} +fetchAppointmentData() { + // Fetch data based on appointment ID + this.AppointmentService.getAppointmentById(this.appointmentId).subscribe(result => { + this.appointment = result; + this.AppointmentDate = new Date(result.dateOfAppointment); + this.Dateofbirth = new Date(result.dob); + }); +} + appointment: CreateOrUpdateAppointmentDto = { + id: '', + firstName: '', + lastName: '', + email: '', + gender: Gender.Male, + mobile: '', + address: '', + dob: '', + doctorId: '', + dateOfAppointment: '', + timeOfAppointment: '', + injuryORContion: '', + note: '', + appointmentStatus: appointmentStatus.Scheduled, + visitType: visitType.NewPatient, + paymentStatus: paymentStatus.Unpaid, + insuranceProvider: '', + }; + + saveAppointment(form: NgForm) { + debugger; + if (form.invalid) { + Object.values(form.controls).forEach(control => control.markAsTouched()); + return; + } + this.appointment.dob = this.Dateofbirth.toDateString(); + this.appointment.dateOfAppointment = this.AppointmentDate.toDateString(); + if (this.isEditMode) { + this.AppointmentService.updateAppointment(this.appointment).subscribe( + () => { + this.toaster.success('Appointment updated successfully', 'Success'); + this.AppointmentDialog = false; + + this.onClose(); + }, + error => { + console.log(error); + this.toaster.error(error, 'Error'); + } + ); + } else { + this.AppointmentService.createAppointment(this.appointment).subscribe( + () => { + this.toaster.success('Appointment created successfully', 'Success'); + this.AppointmentDialog = false; + + this.onClose(); + }, + error => { + console.log(error); + this.toaster.error(error, 'Error'); + } + ); + } + } + getdoctorlist() { + this.DoctorService.get().subscribe(result => { + this.doctors = result; + this.doctorOptions = this.doctors.map(doctor => ({ + label: `Dr. ${doctor.firstName} ${doctor.lastName}`, + value: doctor.id, + })); + }); + } + appointmentStatuses = Object.keys(appointmentStatus) + .filter(key => !isNaN(Number(key))) + .map(key => ({ + label: appointmentStatus[key as unknown as keyof typeof appointmentStatus], + value: Number(key), + })); + visitTypes = Object.keys(visitType) + .filter(key => !isNaN(Number(key))) + .map(key => ({ + label: visitType[key as unknown as keyof typeof visitType], + value: Number(key), + })); + paymentStatuses = Object.keys(paymentStatus) + .filter(key => !isNaN(Number(key))) + .map(key => ({ + label: paymentStatus[key as unknown as keyof typeof paymentStatus], + value: Number(key), + })); + + onClose() { + debugger; + this.AppointmentDialog = false; + + this.close.emit(); // Emit close event + } +} diff --git a/angular/src/app/appointment/appointment-routing.module.ts b/angular/src/app/appointment/appointment-routing.module.ts new file mode 100644 index 0000000..35e2833 --- /dev/null +++ b/angular/src/app/appointment/appointment-routing.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +const routes: Routes = [ + { + path: '', + children: [ + { + path: 'appointment-calendar', + loadChildren: () => import('./appointment-calendar/appointment-calendar.module').then(m => m.AppointmentCalendarModule) + }, + { + path: 'view-appointment', + loadChildren: () => import('./view-appointment/view-appointment.module').then(m => m.ViewAppointmentModule) + }, + + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AppointmentRoutingModule { } diff --git a/angular/src/app/appointment/appointment.module.ts b/angular/src/app/appointment/appointment.module.ts new file mode 100644 index 0000000..ed06598 --- /dev/null +++ b/angular/src/app/appointment/appointment.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { AppointmentRoutingModule } from './appointment-routing.module'; +import { AppointmentDialogComponent } from './appointment-dialog/appointment-dialog.component'; + + +@NgModule({ + declarations: [], + imports: [ + CommonModule, + AppointmentRoutingModule, + AppointmentDialogComponent + ] +}) +export class AppointmentModule { } diff --git a/angular/src/app/appointment/book-appointment/book-appointment-routing.module.ts b/angular/src/app/appointment/book-appointment/book-appointment-routing.module.ts deleted file mode 100644 index c786b7b..0000000 --- a/angular/src/app/appointment/book-appointment/book-appointment-routing.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { BookAppointmentComponent } from './book-appointment.component'; - -const routes: Routes = [{ path: '', component: BookAppointmentComponent }]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class BookAppointmentRoutingModule { } diff --git a/angular/src/app/appointment/book-appointment/book-appointment.component.html b/angular/src/app/appointment/book-appointment/book-appointment.component.html deleted file mode 100644 index 5cf8def..0000000 --- a/angular/src/app/appointment/book-appointment/book-appointment.component.html +++ /dev/null @@ -1 +0,0 @@ -

book-appointment works!

diff --git a/angular/src/app/appointment/book-appointment/book-appointment.component.scss b/angular/src/app/appointment/book-appointment/book-appointment.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/angular/src/app/appointment/book-appointment/book-appointment.component.spec.ts b/angular/src/app/appointment/book-appointment/book-appointment.component.spec.ts deleted file mode 100644 index 28e8bcd..0000000 --- a/angular/src/app/appointment/book-appointment/book-appointment.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { BookAppointmentComponent } from './book-appointment.component'; - -describe('BookAppointmentComponent', () => { - let component: BookAppointmentComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [BookAppointmentComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(BookAppointmentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/angular/src/app/appointment/book-appointment/book-appointment.component.ts b/angular/src/app/appointment/book-appointment/book-appointment.component.ts deleted file mode 100644 index a178ea6..0000000 --- a/angular/src/app/appointment/book-appointment/book-appointment.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-book-appointment', - templateUrl: './book-appointment.component.html', - styleUrl: './book-appointment.component.scss' -}) -export class BookAppointmentComponent { - -} diff --git a/angular/src/app/appointment/book-appointment/book-appointment.module.ts b/angular/src/app/appointment/book-appointment/book-appointment.module.ts deleted file mode 100644 index 680d297..0000000 --- a/angular/src/app/appointment/book-appointment/book-appointment.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -import { BookAppointmentRoutingModule } from './book-appointment-routing.module'; -import { BookAppointmentComponent } from './book-appointment.component'; - - -@NgModule({ - declarations: [ - BookAppointmentComponent - ], - imports: [ - CommonModule, - BookAppointmentRoutingModule - ] -}) -export class BookAppointmentModule { } diff --git a/angular/src/app/appointment/edit-appointment/edit-appointment-routing.module.ts b/angular/src/app/appointment/edit-appointment/edit-appointment-routing.module.ts deleted file mode 100644 index 37d6f61..0000000 --- a/angular/src/app/appointment/edit-appointment/edit-appointment-routing.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { EditAppointmentComponent } from './edit-appointment.component'; - -const routes: Routes = [{ path: '', component: EditAppointmentComponent }]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class EditAppointmentRoutingModule { } diff --git a/angular/src/app/appointment/edit-appointment/edit-appointment.component.html b/angular/src/app/appointment/edit-appointment/edit-appointment.component.html deleted file mode 100644 index ef4d02c..0000000 --- a/angular/src/app/appointment/edit-appointment/edit-appointment.component.html +++ /dev/null @@ -1 +0,0 @@ -

edit-appointment works!

diff --git a/angular/src/app/appointment/edit-appointment/edit-appointment.component.scss b/angular/src/app/appointment/edit-appointment/edit-appointment.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/angular/src/app/appointment/edit-appointment/edit-appointment.component.spec.ts b/angular/src/app/appointment/edit-appointment/edit-appointment.component.spec.ts deleted file mode 100644 index 4a68273..0000000 --- a/angular/src/app/appointment/edit-appointment/edit-appointment.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { EditAppointmentComponent } from './edit-appointment.component'; - -describe('EditAppointmentComponent', () => { - let component: EditAppointmentComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [EditAppointmentComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(EditAppointmentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/angular/src/app/appointment/edit-appointment/edit-appointment.component.ts b/angular/src/app/appointment/edit-appointment/edit-appointment.component.ts deleted file mode 100644 index 38f39ab..0000000 --- a/angular/src/app/appointment/edit-appointment/edit-appointment.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-edit-appointment', - templateUrl: './edit-appointment.component.html', - styleUrl: './edit-appointment.component.scss' -}) -export class EditAppointmentComponent { - -} diff --git a/angular/src/app/appointment/edit-appointment/edit-appointment.module.ts b/angular/src/app/appointment/edit-appointment/edit-appointment.module.ts deleted file mode 100644 index 3fa5287..0000000 --- a/angular/src/app/appointment/edit-appointment/edit-appointment.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -import { EditAppointmentRoutingModule } from './edit-appointment-routing.module'; -import { EditAppointmentComponent } from './edit-appointment.component'; - - -@NgModule({ - declarations: [ - EditAppointmentComponent - ], - imports: [ - CommonModule, - EditAppointmentRoutingModule - ] -}) -export class EditAppointmentModule { } diff --git a/angular/src/app/appointment/view-appointment/view-appointment.component.html b/angular/src/app/appointment/view-appointment/view-appointment.component.html index ada818f..5aa0300 100644 --- a/angular/src/app/appointment/view-appointment/view-appointment.component.html +++ b/angular/src/app/appointment/view-appointment/view-appointment.component.html @@ -17,21 +17,21 @@
-

Appointment List

+

Appointment List

- - +
+ - +
-
@@ -67,7 +71,9 @@ Time Mobile No Email - Appointment Status + + Appointment Status + Visit Type Actions @@ -78,296 +84,45 @@ {{ appointment.firstName }} {{ appointment.lastName }} {{ appointment.doctor }} - - - {{ getGenderLabel(appointment.gender) }} - - + + {{ getGenderLabel(appointment.gender) }} + {{ appointment.dateOfAppointment | date }} {{ appointment.timeOfAppointment }} {{ appointment.mobile }} {{ appointment.email }} - - - {{ getStatusLabel(appointment.appointmentStatus) }} - + + {{ getStatusLabel(appointment.appointmentStatus) }} + - - - - {{ getVisitTypeLabel(appointment.visitType) }} - + + {{ getVisitTypeLabel(appointment.visitType) }} + - +
- -
-
-
- - - - - -
-
- -
- - - - - -
- -
- -
- - - - -
-
-
- -
- - - - - - Mobile number Required -
-
- - - - - -
- -
- - - - - - Email address Required -
-
- -
- - - DOB Required -
- -
- - -
-
- -
- - -
- -
- - - - - -
-
- -
- - - - - -
- -
- - - - - -
-
- -
- - -
- -
- - -
-
- -
- - -
- - -
- - -
- -
- - -
-
-
-
+ diff --git a/angular/src/app/appointment/view-appointment/view-appointment.component.scss b/angular/src/app/appointment/view-appointment/view-appointment.component.scss index 30a406c..932ddf9 100644 --- a/angular/src/app/appointment/view-appointment/view-appointment.component.scss +++ b/angular/src/app/appointment/view-appointment/view-appointment.component.scss @@ -1,15 +1,44 @@ +.is-valid { + border-color: green !important; +} +.is-invalid { + border-color: red !important; +} + + .table-header { - display: flex; - justify-content: space-between; - align-items: center; - } - - .badge { - display: inline-block; - padding: 0.2rem 0.6rem; - border-radius: 0.5rem; - color: white; - font-weight: bold; - font-size: 0.8rem; - } - \ No newline at end of file + display: flex; + justify-content: space-between; + align-items: center; +} + +.badge { + display: inline-block; + padding: 0.2rem 0.6rem; + border-radius: 0.5rem; + color: white; + font-weight: bold; + font-size: 0.8rem; +} + +.male { + background-color: green; +} + +.female { + background-color: purple; +} + +.pdf-icon { + color: red; + font-size: 1.2rem; +} + +.bg-pink { + background-color: #ff4081 !important; + color: white; +} + +.gap-1 { + gap: 5px; +} diff --git a/angular/src/app/appointment/view-appointment/view-appointment.component.ts b/angular/src/app/appointment/view-appointment/view-appointment.component.ts index 4ac9a18..55f7164 100644 --- a/angular/src/app/appointment/view-appointment/view-appointment.component.ts +++ b/angular/src/app/appointment/view-appointment/view-appointment.component.ts @@ -15,14 +15,15 @@ import { appointmentStatus, Gender, paymentStatus, visitType } from '@proxy/glob }) export class ViewAppointmentComponent { totalRecords: number = 0; + appointmentIdToEdit: string; + AppointmentDialogTitle: string = ''; AppointmentDialog: boolean = false; patients: []; - appointmentDialog = false; genders = Gender; Dateofbirth: Date = new Date(); AppointmentDate: Date = new Date(); - + isModalVisible:boolean=false; appointmentStatuses = Object.keys(appointmentStatus) .filter(key => !isNaN(Number(key))) .map(key => ({ @@ -122,26 +123,27 @@ export class ViewAppointmentComponent { }); } openNewAppointmentDialog() { + this.isModalVisible=true; this.isEditMode = false; - this.appointmentDialog = true; - this.appointment = { - firstName: '', - lastName: '', - email: '', - gender: Gender.Male, - dateOfAppointment: '', - dob: '', - timeOfAppointment: '', - mobile: '', - injuryORContion: '', - note: '', - doctorId: '', - address: '', - appointmentStatus: null, - visitType: null, - paymentStatus: null, - insuranceProvider: '', - }; + //this.AppointmentDialog = true; + // this.appointment = { + // firstName: '', + // lastName: '', + // email: '', + // gender: Gender.Male, + // dateOfAppointment: '', + // dob: '', + // timeOfAppointment: '', + // mobile: '', + // injuryORContion: '', + // note: '', + // doctorId: '', + // address: '', + // appointmentStatus: null, + // visitType: null, + // paymentStatus: null, + // insuranceProvider: '', + // }; } @@ -174,14 +176,17 @@ export class ViewAppointmentComponent { editAppointment(appointment: any) { debugger; this.isEditMode = true; - this.appointmentDialog = true; + this.appointmentIdToEdit = appointment.id; + this.isModalVisible=true; - this.AppointmentService.getAppointmentById(appointment.id).subscribe(result => { - debugger; - this.appointment = result; - this.AppointmentDate = new Date(result.dateOfAppointment); - this.Dateofbirth = new Date(result.dob); - }); + // this.AppointmentDialog = true; + // this.isModalVisible=true; + // this.AppointmentService.getAppointmentById(appointment.id).subscribe(result => { + // debugger; + // this.appointment = result; + // this.AppointmentDate = new Date(result.dateOfAppointment); + // this.Dateofbirth = new Date(result.dob); + // }); } deleteAppointment(id: string) { @@ -200,58 +205,17 @@ export class ViewAppointmentComponent { } }); } - saveAppointment(form: NgForm) { - debugger; - console.log(form.controls); - if (form.invalid) { - Object.values(form.controls).forEach(control => control.markAsTouched()); - return; - } - this.appointment.dob = this.Dateofbirth.toDateString(); - this.appointment.dateOfAppointment = this.AppointmentDate.toDateString(); - if (this.isEditMode) { - this.AppointmentService.updateAppointment(this.appointment).subscribe( - () => { - this.toaster.success('Appointment updated successfully', 'Success'); - this.AppointmentDialog = false; - this.loadappointments({ - first: 0, - rows: 10, - sortField: 'id', - sortOrder: 1, - globalFilter: null, - }); - this.closeDialog(); - }, - error => { - console.log(error); - this.toaster.error(error, 'Error'); - } - ); - } else { - this.AppointmentService.createAppointment(this.appointment).subscribe( - () => { - this.toaster.success('Appointment created successfully', 'Success'); - this.AppointmentDialog = false; - this.loadappointments({ - first: 0, - rows: 10, - sortField: 'id', - sortOrder: 1, - globalFilter: null, - }); - this.closeDialog(); - }, - error => { - console.log(error); - this.toaster.error(error.error.error.message, 'Error'); - } - ); - } - } - + closeDialog() { - this.appointmentDialog = false; + debugger + this.isModalVisible = false; + this.loadappointments({ + first: 0, + rows: 10, + sortField: 'id', + sortOrder: 1, + globalFilter: null, + }); } getdoctorlist() { this.DoctorService.get().subscribe(result => { @@ -263,4 +227,9 @@ export class ViewAppointmentComponent { })); }); } + saveAppointment(appointmentData: any) { + // Save appointment logic here + console.log('Appointment saved:', appointmentData); + this.closeDialog(); // Close the dialog after saving + } } diff --git a/angular/src/app/appointment/view-appointment/view-appointment.module.ts b/angular/src/app/appointment/view-appointment/view-appointment.module.ts index 1941a2c..316e466 100644 --- a/angular/src/app/appointment/view-appointment/view-appointment.module.ts +++ b/angular/src/app/appointment/view-appointment/view-appointment.module.ts @@ -14,6 +14,7 @@ import { RadioButtonModule } from 'primeng/radiobutton'; import { DoctorService } from '@proxy/doctors'; import { InputTextareaModule } from 'primeng/inputtextarea'; import { ChipModule } from 'primeng/chip'; +import { AppointmentDialogComponent } from "../appointment-dialog/appointment-dialog.component"; @NgModule({ declarations: [ViewAppointmentComponent], @@ -31,9 +32,9 @@ import { ChipModule } from 'primeng/chip'; DropdownModule, RadioButtonModule, InputTextareaModule, - ChipModule - - ], + ChipModule, + AppointmentDialogComponent +], providers:[DoctorService] }) export class ViewAppointmentModule {} diff --git a/angular/src/app/route.provider.ts b/angular/src/app/route.provider.ts index 7a54ae8..e8b1509 100644 --- a/angular/src/app/route.provider.ts +++ b/angular/src/app/route.provider.ts @@ -36,20 +36,7 @@ function configureRoutes(routesService: RoutesService) { iconClass: 'fas fa-clock', order: 103, }, - { - path: '/appointment/book-appointment', - name: 'Book Appointment', - parentName: 'Appointments', - iconClass: 'fas fa-clock', - order: 104, - }, - { - path: '/appointment/edit-appointment', - name: 'Edit Appointment', - parentName: 'Appointments', - iconClass: 'fas fa-clock', - order: 105, - }, + { path: '/patients', name: 'Patients', diff --git a/aspnet-core/src/HospitalManagementSystem.Application/Appointments/AppointmentAppService.cs b/aspnet-core/src/HospitalManagementSystem.Application/Appointments/AppointmentAppService.cs index 56978f5..bf885fe 100644 --- a/aspnet-core/src/HospitalManagementSystem.Application/Appointments/AppointmentAppService.cs +++ b/aspnet-core/src/HospitalManagementSystem.Application/Appointments/AppointmentAppService.cs @@ -34,12 +34,13 @@ namespace HospitalManagementSystem.Appointments private readonly IRepository _doctorRepository; private readonly IWebHostEnvironment _env; - public AppointmentAppService(ICurrentUser currentUser, ICurrentTenant currentTenant, IRepository appointmentsRepository, IRepository doctorRepository) + public AppointmentAppService(ICurrentUser currentUser, ICurrentTenant currentTenant, IRepository appointmentsRepository, IRepository doctorRepository, IWebHostEnvironment env) { _currentUser = currentUser; _currentTenant = currentTenant; _appointmentsRepository = appointmentsRepository; _doctorRepository = doctorRepository; + _env = env; } public async Task GetAsync() { @@ -163,15 +164,19 @@ namespace HospitalManagementSystem.Appointments for (int i = 0; i < Appointmentrecord.Count; i++) { - //worksheet.Cell(i + 2, 1).Value = Appointmentrecord[i].Patients.Name; - //worksheet.Cell(i + 2, 2).Value = Appointmentrecord[i].Patients.Gender.ToString(); - //worksheet.Cell(i + 2, 3).Value = Appointmentrecord[i].DateOfAdmission.ToShortDateString(); - //worksheet.Cell(i + 2, 4).Value = Appointmentrecord[i].Diagnosis; - //worksheet.Cell(i + 2, 5).Value = Appointmentrecord[i].NextFollowUp?.ToShortDateString(); - //worksheet.Cell(i + 2, 6).Value = Appointmentrecord[i].InsuranceProvider; - //worksheet.Cell(i + 2, 7).Value = Appointmentrecord[i].InsuranceProvider; - //worksheet.Cell(i + 2, 8).Value = Appointmentrecord[i].InsuranceProvider; - //worksheet.Cell(i + 2, 9).Value = Appointmentrecord[i].Status.ToString(); + worksheet.Cell(i + 2, 1).Value = Appointmentrecord[i].FirstName + "" + Appointmentrecord[i].LastName; + worksheet.Cell(i + 2, 2).Value = Appointmentrecord[i].Email; + worksheet.Cell(i + 2, 3).Value = Appointmentrecord[i].Gender.ToString(); + worksheet.Cell(i + 2, 4).Value = Appointmentrecord[i].DateOfAppointment?.ToShortDateString(); + worksheet.Cell(i + 2, 5).Value = Appointmentrecord[i].TimeOfAppointment; + worksheet.Cell(i + 2, 6).Value = Appointmentrecord[i].Mobile; + worksheet.Cell(i + 2, 7).Value = ""; + worksheet.Cell(i + 2, 8).Value = Appointmentrecord[i].InjuryORContion; + worksheet.Cell(i + 2, 9).Value = Appointmentrecord[i].AppointmentStatus.ToString(); + worksheet.Cell(i + 2, 10).Value = Appointmentrecord[i].VisitType.ToString(); + worksheet.Cell(i + 2, 11).Value = Appointmentrecord[i].PaymentStatus.ToString(); + worksheet.Cell(i + 2, 12).Value = Appointmentrecord[i].InsuranceProvider; + worksheet.Cell(i + 2, 13).Value = Appointmentrecord[i].Note; } worksheet.Columns().AdjustToContents();