diff --git a/lib/main.dart b/lib/main.dart index 9ca81ff8..c09d853d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,7 +4,16 @@ import 'package:fusion/screens/Academic/Add_Drop_Courses/add_drop_courses.dart'; import 'package:fusion/screens/Complaint/ComplaintHistory/complain_history.dart'; import 'package:fusion/screens/Complaint/Feedback/feedback.dart'; import 'package:fusion/screens/Complaint/LodgeComplaint/lodge_complaint.dart'; +import 'package:fusion/screens/Compounder/announcements.dart'; +import 'package:fusion/screens/Compounder/doctorSchedule.dart'; +import 'package:fusion/screens/Compounder/homepage.dart'; +import 'package:fusion/screens/Compounder/inventory.dart'; +import 'package:fusion/screens/Compounder/medicalReimbursement.dart'; +import 'package:fusion/screens/Compounder/pathologistSchedule.dart'; +import 'package:fusion/screens/Compounder/patientLog.dart'; import 'package:fusion/screens/Establishment/establishment_home_page.dart'; +import 'package:fusion/screens/Healthcenter/reimbursement.dart'; +import 'package:fusion/screens/Healthcenter/view_announcement.dart'; import 'package:fusion/screens/Library/Book_Search.dart'; import 'package:fusion/screens/Library/dues.dart'; import 'package:fusion/screens/Library/issued_items.dart'; @@ -40,7 +49,7 @@ import 'package:fusion/screens/Healthcenter/healthcentermodule.dart'; import 'package:fusion/screens/Healthcenter/feedback.dart'; import 'package:fusion/screens/Healthcenter/viewschedule.dart'; import 'package:fusion/screens/Healthcenter/history.dart'; -import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; +// import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; void main() { @@ -60,7 +69,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { MediaQueryData windowData = - MediaQueryData.fromWindow(WidgetsBinding.instance.window); + MediaQueryData.fromWindow(WidgetsBinding.instance.window); windowData = windowData.copyWith( textScaleFactor: 1, ); @@ -71,10 +80,10 @@ class MyApp extends StatelessWidget { title: 'Fusion', debugShowCheckedModeBanner: false, theme: ThemeData( - // primarySwatch: Colors.blueGrey, + // primarySwatch: Colors.blueGrey, // colorSchemeSeed: Color(0xFF2085D0), colorSchemeSeed: Color(0xFFF36C35), - fontFamily: 'Nunito', + fontFamily: 'Nunito', useMaterial3: true, ), initialRoute: '/landing', @@ -123,10 +132,21 @@ class MyApp extends StatelessWidget { '/profile': (context) => Profile(), '/health_center': (context) => HealthCenterMod( ModalRoute.of(context)!.settings.arguments.toString()), - '/health_center/healthcenter': (context) => HealthCenter(), + // '/health_center/healthcenter': (context) => HealthCenter(), '/health_center/feedback': (context) => FeedBack(), '/health_center/viewschedule': (context) => ViewSchedule(), - '/health_center/history': (context) => History(), + '/health_center/history': (context) => HealthRecordsPage(), + '/health_center/announcement': (context) => ViewAnnouncementPage(), + '/health_center/reimbursement': (context) => ReimbursementFormPage(), + + '/compounder/home': (context) => CompounderHome(), + '/compounder/doctor_schedule': (context) => DoctorAvailabilityPage(), + '/compounder/pathologist_schedule': (context) => + PathologistAvailabilityPage(), + '/compounder/announcements': (context) => AnnouncementPage(), + '/compounder/inventory': (context) => HealthCenterInventoryPage(), + '/compounder/reimbursement': (context) => ReimbursementPage(), + '/compounder/patient_log': (context) => HomePage(), }, ), ); diff --git a/lib/screens/Compounder/announcements.dart b/lib/screens/Compounder/announcements.dart new file mode 100644 index 00000000..1f3f0f44 --- /dev/null +++ b/lib/screens/Compounder/announcements.dart @@ -0,0 +1,159 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(MyApp()); +} + +class Announcement { + final String title; + final String description; + final DateTime dateTime; + + Announcement({ + required this.title, + required this.description, + required this.dateTime, + }); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Announcements', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: AnnouncementPage(), + ); + } +} + +class AnnouncementPage extends StatefulWidget { + @override + _AnnouncementPageState createState() => _AnnouncementPageState(); +} + +class _AnnouncementPageState extends State { + List announcements = []; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Announcements'), + ), + body: ListView.builder( + itemCount: announcements.length, + itemBuilder: (BuildContext context, int index) { + return ListTile( + title: Text(announcements[index].title), + subtitle: Text( + '${announcements[index].dateTime.day}/${announcements[index].dateTime.month}/${announcements[index].dateTime.year} ${announcements[index].dateTime.hour}:${announcements[index].dateTime.minute}'), + onTap: () { + // Handle onTap event + // For example, navigate to a detailed page + }, + ); + }, + ), + floatingActionButton: FloatingActionButton( + onPressed: () async { + // Call a method to show a dialog for entering new announcement details + final newAnnouncement = await _showAddAnnouncementDialog(context); + if (newAnnouncement != null) { + setState(() { + announcements.add(newAnnouncement); + }); + } + }, + child: Icon(Icons.add), + ), + ); + } + + Future _showAddAnnouncementDialog(BuildContext context) { + TextEditingController titleController = TextEditingController(); + TextEditingController descriptionController = TextEditingController(); + DateTime selectedDate = DateTime.now(); + TimeOfDay selectedTime = TimeOfDay.now(); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('Add Announcement'), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + controller: titleController, + decoration: InputDecoration(labelText: 'Title'), + ), + TextField( + controller: descriptionController, + decoration: InputDecoration(labelText: 'Description'), + ), + SizedBox(height: 10), + TextButton( + onPressed: () async { + final pickedDate = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now(), + lastDate: DateTime(2100), + ); + if (pickedDate != null) { + setState(() { + selectedDate = pickedDate; + }); + } + }, + child: Text('Select Date'), + ), + TextButton( + onPressed: () async { + final pickedTime = await showTimePicker( + context: context, + initialTime: selectedTime, + ); + if (pickedTime != null) { + setState(() { + selectedTime = pickedTime; + }); + } + }, + child: Text('Select Time'), + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + TextButton( + onPressed: () { + Navigator.of(context).pop(Announcement( + title: titleController.text, + description: descriptionController.text, + dateTime: DateTime( + selectedDate.year, + selectedDate.month, + selectedDate.day, + selectedTime.hour, + selectedTime.minute, + ), + )); + }, + child: Text('Add'), + ), + ], + ); + }, + ); + } +} diff --git a/lib/screens/Compounder/doctorSchedule.dart b/lib/screens/Compounder/doctorSchedule.dart new file mode 100644 index 00000000..eb98b244 --- /dev/null +++ b/lib/screens/Compounder/doctorSchedule.dart @@ -0,0 +1,216 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +void main() { + runApp(MyApp()); +} + +class Doctor { + String name; + TimeOfDay startTime; + TimeOfDay endTime; + List daysAvailable; + + Doctor(this.name, this.startTime, this.endTime, this.daysAvailable); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Doctor Availability', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: DoctorAvailabilityPage(), + ); + } +} + +class DoctorAvailabilityPage extends StatefulWidget { + @override + _DoctorAvailabilityPageState createState() => + _DoctorAvailabilityPageState(); +} + +class _DoctorAvailabilityPageState extends State { + List doctors = []; + List selectedDays = []; + + String? dropdownValue; + String? dropdownDayValue; + + List daysOfWeek = [ + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday', + 'Sunday', + ]; + + @override + void initState() { + super.initState(); + // Adding dummy doctor data + doctors.add(Doctor('Dr. John Doe', TimeOfDay(hour: 9, minute: 0), + TimeOfDay(hour: 17, minute: 0), ['Monday', 'Wednesday', 'Friday'])); + doctors.add(Doctor( + 'Dr. Jane Smith', + TimeOfDay(hour: 8, minute: 30), + TimeOfDay(hour: 16, minute: 30), + ['Tuesday', 'Thursday'])); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Doctor Availability'), + ), + body: ListView.builder( + itemCount: doctors.length, + itemBuilder: (context, index) { + return ListTile( + title: Text(doctors[index].name), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Days Available: ${doctors[index].daysAvailable.join(', ')}'), + Text( + 'Availability: ${formatTime(doctors[index].startTime)} - ${formatTime(doctors[index].endTime)}'), + ], + ), + ); + }, + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + _showAddDoctorDialog(context); + }, + child: Icon(Icons.add), + ), + ); + } + + String formatTime(TimeOfDay timeOfDay) { + final now = DateTime.now(); + final dateTime = DateTime(now.year, now.month, now.day, timeOfDay.hour, timeOfDay.minute); + return DateFormat.jm().format(dateTime); + } + + void _showAddDoctorDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + TimeOfDay startTime = TimeOfDay.now(); + TimeOfDay endTime = TimeOfDay.now(); + return StatefulBuilder( + builder: (context, setState) { + return AlertDialog( + title: Text('Add Doctor'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + DropdownButtonFormField( + value: dropdownValue, + onChanged: (String? newValue) { + setState(() { + dropdownValue = newValue; + }); + }, + items: + doctors.map>((Doctor doctor) { + return DropdownMenuItem( + value: doctor.name, + child: Text(doctor.name), + ); + }).toList(), + hint: Text('Select Doctor'), + ), + SizedBox(height: 10), + DropdownButtonFormField( + value: dropdownDayValue, + onChanged: (String? newValue) { + setState(() { + dropdownDayValue = newValue; + }); + }, + items: daysOfWeek + .map>((String day) { + return DropdownMenuItem( + value: day, + child: Text(day), + ); + }).toList(), + hint: Text('Select Day'), + ), + SizedBox(height: 10), + ListTile( + title: Text("Start Time"), + trailing: TextButton( + onPressed: () async { + final selectedTime = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); + if (selectedTime != null) { + setState(() { + startTime = selectedTime; + }); + } + }, + child: Text(formatTime(startTime)), + ), + ), + ListTile( + title: Text("End Time"), + trailing: TextButton( + onPressed: () async { + final selectedTime = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); + if (selectedTime != null) { + setState(() { + endTime = selectedTime; + }); + } + }, + child: Text(formatTime(endTime)), + ), + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + _addDoctor(startTime, endTime); + Navigator.of(context).pop(); + }, + child: Text('Add'), + ), + ], + ); + }, + ); + }, + ); + } + + void _addDoctor(TimeOfDay startTime, TimeOfDay endTime) { + String name = dropdownValue!; + List daysAvailable = [dropdownDayValue!]; + Doctor newDoctor = Doctor(name, startTime, endTime, daysAvailable); + setState(() { + doctors.add(newDoctor); + }); + } +} diff --git a/lib/screens/Compounder/inventory.dart b/lib/screens/Compounder/inventory.dart new file mode 100644 index 00000000..12df574d --- /dev/null +++ b/lib/screens/Compounder/inventory.dart @@ -0,0 +1,183 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(MaterialApp( + home: HealthCenterInventoryPage(), + )); +} + +class HealthCenterInventoryPage extends StatefulWidget { + @override + _HealthCenterInventoryPageState createState() => + _HealthCenterInventoryPageState(); +} + +class _HealthCenterInventoryPageState extends State { + List medicines = ['Medicine A', 'Medicine B', 'Medicine C']; + String selectedMedicine = 'Medicine A'; + int stock = 0; + String supplierName = ''; + DateTime expiryDate = DateTime.now(); + List expiredMedicines = []; + List changes = []; + + TextEditingController newMedicineController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Health Center Inventory'), + ), + body: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Select Medicine to Update Stock:'), + DropdownButton( + value: selectedMedicine, + onChanged: (String? newValue) { + setState(() { + selectedMedicine = newValue!; + }); + }, + items: medicines.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + SizedBox(height: 20), + Text('Update Stock:'), + TextField( + decoration: InputDecoration(labelText: 'Stock'), + keyboardType: TextInputType.number, + onChanged: (value) { + setState(() { + stock = int.parse(value); + }); + }, + ), + TextField( + controller: TextEditingController(text: supplierName), + decoration: InputDecoration(labelText: 'Supplier Name'), + onChanged: (value) { + setState(() { + supplierName = value; + }); + }, + ), + SizedBox(height: 10), + Text('Expiry Date:'), + SizedBox( + height: 100, + child: DatePicker( + selectedDate: expiryDate, + selectDate: (DateTime date) { + setState(() { + expiryDate = date; + }); + }, + ), + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + updateStock(selectedMedicine, stock, supplierName, expiryDate); + }, + child: Text('Update Inventory'), + ), + SizedBox(height: 20), + Text('Add New Medicine:'), + TextField( + controller: newMedicineController, + decoration: InputDecoration(labelText: 'New Medicine Name'), + ), + ElevatedButton( + onPressed: () { + addNewMedicine(newMedicineController.text); + }, + child: Text('Add Medicine'), + ), + SizedBox(height: 20), + Text('Expired Medicines:'), + Expanded( + child: ListView.builder( + itemCount: expiredMedicines.length, + itemBuilder: (BuildContext context, int index) { + return ListTile( + title: Text(expiredMedicines[index]), + ); + }, + ), + ), + SizedBox(height: 20), + Text('Changes Made:'), + Expanded( + child: ListView.builder( + itemCount: changes.length, + itemBuilder: (BuildContext context, int index) { + return ListTile( + title: Text(changes[index]), + ); + }, + ), + ), + ], + ), + ), + ); + } + + void updateStock(String selectedMedicine, int stock, String supplierName, + DateTime expiryDate) { + setState(() { + // Perform update + String updateInfo = + 'Stock of $selectedMedicine updated to $stock. Supplier: $supplierName, Expiry Date: $expiryDate'; + changes.add(updateInfo); + }); + } + + void addNewMedicine(String newMedicineName) { + setState(() { + medicines.add(newMedicineName); + changes.add('New medicine added: $newMedicineName'); + }); + } +} + +class DatePicker extends StatelessWidget { + final DateTime selectedDate; + final ValueChanged selectDate; + + DatePicker({required this.selectedDate, required this.selectDate}); + + Future _selectDate(BuildContext context) async { + final DateTime picked = (await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now(), + lastDate: DateTime(2101), + ))!; + if (picked != selectedDate) selectDate(picked); + } + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded( + child: TextButton( + onPressed: () => _selectDate(context), + child: Text( + '${selectedDate.year}-${selectedDate.month}-${selectedDate.day}', + ), + ), + ), + ], + ); + } +} diff --git a/lib/screens/Compounder/medicalReimbursement.dart b/lib/screens/Compounder/medicalReimbursement.dart new file mode 100644 index 00000000..aab55748 --- /dev/null +++ b/lib/screens/Compounder/medicalReimbursement.dart @@ -0,0 +1,186 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Reimbursement Form Status', + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: ReimbursementPage(), + ); + } +} + +class ReimbursementPage extends StatefulWidget { + @override + _ReimbursementPageState createState() => _ReimbursementPageState(); +} + +class _ReimbursementPageState extends State { + String? selectedRollNumber; + String? formStatus ; + List rollNumbers = ['Roll 1', 'Roll 2', 'Roll 3']; // Sample roll numbers + + List> previousEntries = []; + + void addNewEntry() { + if (selectedRollNumber!.isNotEmpty && formStatus!.isNotEmpty) { + setState(() { + previousEntries.add({ + 'Roll Number': selectedRollNumber!, + 'Status': formStatus!, + }); + }); + } + } + + void updateStatus(int index) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('Update Status'), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Select new status:'), + SizedBox(height: 10), + DropdownButtonFormField( + value: previousEntries[index]['Status'], + items: ['Received', 'Verified', 'Forwarded to DSA'] + .map((String status) { + return DropdownMenuItem( + value: status, + child: Text(status), + ); + }).toList(), + onChanged: (value) { + setState(() { + previousEntries[index]['Status'] = value!; + }); + }, + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Update'), + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Reimbursement Form Status'), + ), + body: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DropdownButtonFormField( + decoration: InputDecoration(labelText: 'Select Roll Number'), + value: selectedRollNumber, + items: rollNumbers.map((String rollNumber) { + return DropdownMenuItem( + value: rollNumber, + child: Text(rollNumber), + ); + }).toList(), + onChanged: (value) { + setState(() { + selectedRollNumber = value!; + }); + }, + ), + SizedBox(height: 20), + Text( + 'Form Status:', + style: TextStyle(fontSize: 18), + ), + Row( + children: [ + ElevatedButton( + onPressed: () { + setState(() { + formStatus = 'Received'; + }); + }, + child: Text('Received'), + ), + SizedBox(width: 10), + ElevatedButton( + onPressed: () { + setState(() { + formStatus = 'Verified'; + }); + }, + child: Text('Verified'), + ), + SizedBox(width: 10), + ElevatedButton( + onPressed: () { + setState(() { + formStatus = 'Forwarded to DSA'; + }); + }, + child: Text('Forwarded to DSA'), + ), + ], + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + addNewEntry(); + }, + child: Text('Add New Entry'), + ), + SizedBox(height: 20), + Text( + 'Previous Entries:', + style: TextStyle(fontSize: 18), + ), + SizedBox(height: 10), + Expanded( + child: ListView.builder( + itemCount: previousEntries.length, + itemBuilder: (context, index) { + return ListTile( + title: Text( + 'Roll Number: ${previousEntries[index]['Roll Number']} - Status: ${previousEntries[index]['Status']}', + ), + onTap: () { + updateStatus(index); + }, + ); + }, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/Compounder/pathologistSchedule.dart b/lib/screens/Compounder/pathologistSchedule.dart new file mode 100644 index 00000000..1d163a13 --- /dev/null +++ b/lib/screens/Compounder/pathologistSchedule.dart @@ -0,0 +1,219 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +void main() { + runApp(MyApp()); +} + +class Pathologist { + String name; + TimeOfDay startTime; + TimeOfDay endTime; + List daysAvailable; + + Pathologist(this.name, this.startTime, this.endTime, this.daysAvailable); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Pathologist Availability', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: PathologistAvailabilityPage(), + ); + } +} + +class PathologistAvailabilityPage extends StatefulWidget { + @override + _PathologistAvailabilityPageState createState() => + _PathologistAvailabilityPageState(); +} + +class _PathologistAvailabilityPageState + extends State { + List pathologists = []; + + String? dropdownValue; + + @override + void initState() { + super.initState(); + // Adding dummy pathologist data + pathologists.add(Pathologist('Dr. John Doe', TimeOfDay(hour: 9, minute: 0), + TimeOfDay(hour: 17, minute: 0), [])); + pathologists.add(Pathologist( + 'Dr. Jane Smith', + TimeOfDay(hour: 8, minute: 30), + TimeOfDay(hour: 16, minute: 30), + [])); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Pathologist Availability'), + ), + body: ListView.builder( + itemCount: pathologists.length, + itemBuilder: (context, index) { + return ListTile( + title: Text(pathologists[index].name), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Days Available: ${formatDates(pathologists[index].daysAvailable)}'), + Text( + 'Availability: ${formatTime(pathologists[index].startTime)} - ${formatTime(pathologists[index].endTime)}'), + ], + ), + ); + }, + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + _showAddPathologistDialog(context); + }, + child: Icon(Icons.add), + ), + ); + } + + String formatTime(TimeOfDay timeOfDay) { + final now = DateTime.now(); + final dateTime = DateTime( + now.year, now.month, now.day, timeOfDay.hour, timeOfDay.minute); + return DateFormat.jm().format(dateTime); + } + + String formatDates(List dates) { + if (dates.isEmpty) { + return 'No specific days, available every day'; + } + return dates + .map((date) => DateFormat('MMM d').format(date)) + .join(', '); + } + + void _showAddPathologistDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + TimeOfDay startTime = TimeOfDay.now(); + TimeOfDay endTime = TimeOfDay.now(); + List selectedDays = []; + return StatefulBuilder( + builder: (context, setState) { + return AlertDialog( + title: Text('Add Pathologist'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + DropdownButtonFormField( + value: dropdownValue, + onChanged: (String? newValue) { + setState(() { + dropdownValue = newValue; + }); + }, + items: pathologists + .map>((Pathologist pathologist) { + return DropdownMenuItem( + value: pathologist.name, + child: Text(pathologist.name), + ); + }).toList(), + hint: Text('Select Pathologist'), + ), + SizedBox(height: 10), + ListTile( + title: Text("Start Time"), + trailing: TextButton( + onPressed: () async { + final selectedTime = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); + if (selectedTime != null) { + setState(() { + startTime = selectedTime; + }); + } + }, + child: Text(formatTime(startTime)), + ), + ), + ListTile( + title: Text("End Time"), + trailing: TextButton( + onPressed: () async { + final selectedTime = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); + if (selectedTime != null) { + setState(() { + endTime = selectedTime; + }); + } + }, + child: Text(formatTime(endTime)), + ), + ), + ElevatedButton( + onPressed: () async { + final DateTime? pickedDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime.now(), + lastDate: DateTime(2101), + ); + if (pickedDate != null) { + setState(() { + selectedDays.add(pickedDate); + }); + } + }, + child: Text('Select Date'), + ), + SizedBox(height: 10), + Text('Selected Dates: ${formatDates(selectedDays)}'), + ], + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + _addPathologist(startTime, endTime, selectedDays); + Navigator.of(context).pop(); + }, + child: Text('Add'), + ), + ], + ); + }, + ); + }, + ); + } + + void _addPathologist( + TimeOfDay startTime, TimeOfDay endTime, List selectedDays) { + String name = dropdownValue!; + Pathologist newPathologist = + Pathologist(name, startTime, endTime, selectedDays); + setState(() { + pathologists.add(newPathologist); + }); + } +} diff --git a/lib/screens/Compounder/patientLog.dart b/lib/screens/Compounder/patientLog.dart new file mode 100644 index 00000000..ab8a1a0e --- /dev/null +++ b/lib/screens/Compounder/patientLog.dart @@ -0,0 +1,259 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(MyApp()); +} + +class PrescriptionEntry { + String rollNumber; + String doctor; + String medicine; + int quantity; + int days; + int timesPerDay; + String healthIssue; + DateTime date; + + PrescriptionEntry({ + required this.rollNumber, + required this.doctor, + required this.medicine, + required this.quantity, + required this.days, + required this.timesPerDay, + required this.healthIssue, + required this.date, + }); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Prescription Entry', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: HomePage(), + ); + } +} + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + List entries = []; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Prescription Entries'), + ), + body: ListView.builder( + itemCount: entries.length, + itemBuilder: (context, index) { + PrescriptionEntry entry = entries[index]; + return ListTile( + title: Text(entry.medicine), + subtitle: Text( + 'Doctor: ${entry.doctor}\nQuantity: ${entry.quantity}\nDays: ${entry.days}\nTimes per Day: ${entry.timesPerDay}\nHealth Issue: ${entry.healthIssue}\nDate: ${entry.date.toString().split(' ')[0]}'), + ); + }, + ), + floatingActionButton: FloatingActionButton( + onPressed: () async { + final entry = await Navigator.push( + context, + MaterialPageRoute(builder: (context) => PrescriptionEntryModal()), + ); + if (entry != null) { + setState(() { + entries.add(entry); + }); + } + }, + child: Icon(Icons.add), + ), + ); + } +} + +class PrescriptionEntryModal extends StatefulWidget { + @override + _PrescriptionEntryModalState createState() => _PrescriptionEntryModalState(); +} + +class _PrescriptionEntryModalState extends State { + late List rollNumbers; + late List doctors; + late List medicines; + String? selectedRollNumber; + String? selectedDoctor; + String? selectedMedicine; + int quantity = 1; + int days = 1; + int timesPerDay = 1; + String healthIssue = ''; + late DateTime selectedDate; + + @override + void initState() { + super.initState(); + // Initialize dropdown data + rollNumbers = ['Roll Number 1', 'Roll Number 2', 'Roll Number 3']; + doctors = ['Doctor 1', 'Doctor 2', 'Doctor 3']; + medicines = ['Medicine A', 'Medicine B', 'Medicine C']; + selectedDate = DateTime.now(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Add Prescription Entry'), + ), + body: Padding( + padding: const EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + DropdownButtonFormField( + value: selectedRollNumber, + items: rollNumbers.map((rollNumber) { + return DropdownMenuItem( + value: rollNumber, + child: Text(rollNumber), + ); + }).toList(), + onChanged: (value) { + setState(() { + selectedRollNumber = value; + }); + }, + decoration: InputDecoration( + labelText: 'Roll Number', + ), + ), + SizedBox(height: 16), + DropdownButtonFormField( + value: selectedDoctor, + items: doctors.map((doctor) { + return DropdownMenuItem( + value: doctor, + child: Text(doctor), + ); + }).toList(), + onChanged: (value) { + setState(() { + selectedDoctor = value; + }); + }, + decoration: InputDecoration( + labelText: 'Doctor', + ), + ), + SizedBox(height: 16), + DropdownButtonFormField( + value: selectedMedicine, + items: medicines.map((medicine) { + return DropdownMenuItem( + value: medicine, + child: Text(medicine), + ); + }).toList(), + onChanged: (value) { + setState(() { + selectedMedicine = value; + }); + }, + decoration: InputDecoration( + labelText: 'Medicine', + ), + ), + SizedBox(height: 16), + TextFormField( + keyboardType: TextInputType.number, + onChanged: (value) { + quantity = int.tryParse(value) ?? 1; + }, + decoration: InputDecoration( + labelText: 'Quantity', + ), + ), + SizedBox(height: 16), + TextFormField( + keyboardType: TextInputType.number, + onChanged: (value) { + days = int.tryParse(value) ?? 1; + }, + decoration: InputDecoration( + labelText: 'Number of Days', + ), + ), + SizedBox(height: 16), + TextFormField( + keyboardType: TextInputType.number, + onChanged: (value) { + timesPerDay = int.tryParse(value) ?? 1; + }, + decoration: InputDecoration( + labelText: 'Times per Day', + ), + ), + SizedBox(height: 16), + TextFormField( + onChanged: (value) { + healthIssue = value; + }, + decoration: InputDecoration( + labelText: 'Health Issue', + ), + ), + SizedBox(height: 16), + ListTile( + title: Text('Date: ${selectedDate.toString().split(' ')[0]}'), + trailing: Icon(Icons.calendar_today), + onTap: () async { + final DateTime? pickedDate = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime(2000), + lastDate: DateTime(2101), + ); + if (pickedDate != null && pickedDate != selectedDate) { + setState(() { + selectedDate = pickedDate; + }); + } + }, + ), + SizedBox(height: 16), + ElevatedButton( + onPressed: () { + // Create a PrescriptionEntry object + PrescriptionEntry entry = PrescriptionEntry( + rollNumber: selectedRollNumber!, + doctor: selectedDoctor!, + medicine: selectedMedicine!, + quantity: quantity, + days: days, + timesPerDay: timesPerDay, + healthIssue: healthIssue, + date: selectedDate, + ); + Navigator.pop(context, entry); + }, + child: Text('Add Entry'), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/Healthcenter/Appointment.dart b/lib/screens/Healthcenter/Appointment.dart deleted file mode 100644 index 8188e9d5..00000000 --- a/lib/screens/Healthcenter/Appointment.dart +++ /dev/null @@ -1,145 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:date_field/date_field.dart'; - -class Appointment extends StatefulWidget { - @override - _AppointmentState createState() => _AppointmentState(); -} - -//int get _value=>_value; - -class _AppointmentState extends State { - int _value = 1; - - @override - Widget build(BuildContext context) { - return Container( - // color: Colors.red, - width: 200, - //height: 120, - //color: Colors.blue, - alignment: Alignment.topCenter, - padding: EdgeInsets.all(30.0), - child: ListView( - children: [ - Text( - "Doctor", - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - textAlign: TextAlign.start, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 0.0), - child: Container( - height: 0.5, - width: 130.0, - color: Colors.black, - ), - ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DropdownButton( - dropdownColor: Colors.deepOrangeAccent, - elevation: 16, - value: _value, - isExpanded: true, - hint: Text("-SELECT-"), - items: [ - DropdownMenuItem( - child: Text("--SELECT--"), - value: 1, - ), - DropdownMenuItem( - child: Text("Dr Tony Gupta"), - value: 2, - ), - DropdownMenuItem( - child: Text("Dr Hrishi Goyal"), - value: 3, - ), - DropdownMenuItem(child: Text("Dr Preeti Singh"), value: 4), - ], - onChanged: (value) { - setState(() { - //_value = value; - }); - }), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - //SessionView, - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'Date', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => - (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.access_time_rounded), - labelText: 'From Time', - ), - mode: DateTimeFieldPickerMode.time, - autovalidateMode: AutovalidateMode.always, - validator: (e) => - (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.access_time_rounded), - labelText: 'To Time', - ), - mode: DateTimeFieldPickerMode.time, - autovalidateMode: AutovalidateMode.always, - validator: (e) => - (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - TextFormField( - cursorHeight: 30, - decoration: new InputDecoration( - labelText: "Issues/Symptoms", - fillColor: Colors.white, - border: new OutlineInputBorder(), - //fillColor: Colors.green - ), - style: new TextStyle( - fontFamily: "Poppins", - ), - ), - Padding(padding: EdgeInsets.symmetric(vertical: 5.0)), - Center( - child: TextButton( - child: Text( - 'Submit', - style: TextStyle(fontSize: 15.0), - ), - // color: Colors.deepOrangeAccent, - onPressed: () {}, - ), - ), - ], - ), - ); - } -} diff --git a/lib/screens/Healthcenter/HealthCenter.dart b/lib/screens/Healthcenter/HealthCenter.dart deleted file mode 100644 index 987b6b02..00000000 --- a/lib/screens/Healthcenter/HealthCenter.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:flutter/material.dart'; -import 'Appointment.dart'; -import 'ambulanceRequest.dart'; - -class HealthCenter extends StatefulWidget { - @override - _HealthCenterState createState() => _HealthCenterState(); -} - -class _HealthCenterState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - appBar:AppBar( - title: Text("Health Center"), - backgroundColor: Colors.black, - ), - body:Container( - child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - SizedBox(height: 5.0), - DefaultTabController( - length: 2, // length of tabs - initialIndex: 0, - child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Container( - //color: Colors.deepOrangeAccent, - child: TabBar( - labelColor: Colors.deepOrange, - indicatorColor: Colors.deepOrangeAccent, - unselectedLabelColor: Colors.black, - tabs: [ - Tab(child: Text("Doctor Appointment",style: TextStyle(fontWeight: FontWeight.bold),),), - Tab(child: Text("Ambulance Request",style: TextStyle(fontWeight: FontWeight.bold),),), - ], - ), - ), - Container( - height: 520, //height of TabBarView - decoration: BoxDecoration( - border: Border(top: BorderSide(color: Colors.grey, width: 0.5)) - ), - child: TabBarView(children: [ - Appointment(), - AmbulanceRequest(), - - ]) - ) - ]) - ), - ]), - ), - ); - } -} diff --git a/lib/screens/Healthcenter/ambulanceRequest.dart b/lib/screens/Healthcenter/ambulanceRequest.dart deleted file mode 100644 index 41e92bc1..00000000 --- a/lib/screens/Healthcenter/ambulanceRequest.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:date_field/date_field.dart'; - -class AmbulanceRequest extends StatefulWidget { - @override - _AmbulanceRequestState createState() => _AmbulanceRequestState(); -} - -class _AmbulanceRequestState extends State { - @override - Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.all(20.0), - child: Column( - children: [ - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'From', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => - (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'To', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => - (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - TextFormField( - maxLines: 4, - cursorHeight: 30, - decoration: new InputDecoration( - labelText: "Reason", - fillColor: Colors.white, - border: new OutlineInputBorder(), - //fillColor: Colors.green - ), - style: new TextStyle( - fontFamily: "Poppins", - ), - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - Center( - child: TextButton( - child: Text( - 'Submit', - style: TextStyle(fontSize: 15.0), - ), - // color: Colors.deepOrangeAccent, - onPressed: () {}, - ), - ), - ], - ), - ); - } -} diff --git a/lib/screens/Healthcenter/healthcentermodule.dart b/lib/screens/Healthcenter/healthcentermodule.dart index a785697d..9c1d206e 100644 --- a/lib/screens/Healthcenter/healthcentermodule.dart +++ b/lib/screens/Healthcenter/healthcentermodule.dart @@ -177,15 +177,15 @@ class _HealthCenterModState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ InkWell( - child: myContainer("Appointments/requests"), + child: myContainer("Announcements"), onTap: () { Navigator.pushNamed( - context, '/health_center/healthcenter', + context, '/health_center/announcement', arguments: data); }, ), InkWell( - child: myContainer("History"), + child: myContainer("Health Records"), onTap: () { Navigator.pushNamed(context, '/health_center/history', arguments: data); @@ -207,6 +207,22 @@ class _HealthCenterModState extends State { arguments: data); }, ), + InkWell( + child: myContainer("Pathologist Schedule"), + onTap: () { + Navigator.pushNamed( + context, '/health_center/viewschedule', + arguments: data); + }, + ), + InkWell( + child: myContainer("Medical Reimbursement"), + onTap: () { + Navigator.pushNamed( + context, '/health_center/reimbursement', + arguments: data); + }, + ), ], ), ), diff --git a/lib/screens/Healthcenter/history.dart b/lib/screens/Healthcenter/history.dart index 42b01fe0..cee19d6f 100644 --- a/lib/screens/Healthcenter/history.dart +++ b/lib/screens/Healthcenter/history.dart @@ -1,306 +1,113 @@ import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:fusion/models/health.dart'; -class History extends StatefulWidget { - @override - _HistoryState createState() => _HistoryState(); +void main() { + runApp(MyApp()); +} + +class HealthRecord { + final String doctorName; + final DateTime dateOfVisit; + final List prescribedMedicines; + + HealthRecord({ + required this.doctorName, + required this.dateOfVisit, + required this.prescribedMedicines, + }); } -class _HistoryState extends State { +class MyApp extends StatelessWidget { + final List healthRecords = [ + HealthRecord( + doctorName: "Dr. John Doe", + dateOfVisit: DateTime(2023, 12, 15), + prescribedMedicines: ["Medicine A", "Medicine B"], + ), + HealthRecord( + doctorName: "Dr. Jane Smith", + dateOfVisit: DateTime(2023, 11, 20), + prescribedMedicines: ["Medicine C", "Medicine D", "Medicine E"], + ), + ]; + @override Widget build(BuildContext context) { - final HealthData data = - ModalRoute.of(context)!.settings.arguments as HealthData; - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: AppBar( - title: Text("History"), - backgroundColor: Colors.black, - ), - body: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - SizedBox(height: 20.0), - DefaultTabController( - length: 5, // length of tabs - initialIndex: 0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Container( - //color: Colors.deepOrangeAccent, - child: TabBar( - isScrollable: true, - labelColor: Colors.deepOrange, - indicatorColor: Colors.deepOrangeAccent, - unselectedLabelColor: Colors.black, - tabs: [ - Tab( - child: Text( - "Prescription", - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - Tab( - child: Text( - "Ambulance", - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - Tab( - child: Text( - "Hospital", - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - Tab( - child: Text( - "Appointment", - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - Tab( - child: Text( - "Feedback", - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - ], - ), - ), - Container( - height: 520, //height of TabBarView - decoration: BoxDecoration( - border: Border( - top: BorderSide( - color: Colors.grey, width: 0.5))), - child: TabBarView(children: [ - prescription(data), - ambulance(data), - hospital(data), - appointment(data), - feedback(data), - ])) - ])), - ]), + return MaterialApp( + title: 'Health Records', + theme: ThemeData( + primarySwatch: Colors.blue, ), + home: HealthRecordsPage(), ); } +} - Container feedback(HealthData data) { - return new Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 15, horizontal: 5), - child: Table(border: TableBorder.all(color: Colors.black), children: [ - TableRow(children: [ - tableCell("\nFeeback\n"), - tableCell("\nResponse\n"), - tableCell("\nDate\n"), - ]), - data.complaints != null && data.complaints!.isNotEmpty - ? TableRow(children: [ - for (var complaints in data.complaints!) - tableCell2("\n" + complaints["feedback"].toString() + "\n"), - for (var complaints in data.complaints!) - tableCell2("\n" + complaints["complaint"].toString() + "\n"), - for (var complaints in data.complaints!) - tableCell2("\n" + complaints["date"].toString() + "\n"), - ]) - : TableRow(children: [ - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - ]), - ]), - ); - } +class HealthRecordsPage extends StatelessWidget { + // final List healthRecords; - Container appointment(HealthData data) { - return new Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 15, horizontal: 5), - child: Table(border: TableBorder.all(color: Colors.black), children: [ - TableRow(children: [ - tableCell("\nDoctor\n"), - tableCell("\nDescription\n"), - tableCell("\nDate\n"), - ]), - data.appointments != null && data.appointments!.isNotEmpty - ? TableRow(children: [ - tableCell2("\n" + "Name not available" + "\n"), - for (var appointments in data.appointments!) - tableCell2( - "\n" + appointments!["description"].toString() + "\n"), - for (var appointments in data.appointments!) - tableCell2("\n" + appointments!["date"].toString() + "\n"), - ]) - : TableRow(children: [ - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - ]), - ]), - ); - } + // HealthRecordsPage({required this.healthRecords}); - Container hospital(HealthData data) { - return new Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 15, horizontal: 5), - child: Table(border: TableBorder.all(color: Colors.black), children: [ - TableRow(children: [ - tableCell("\nDoctor\n"), - tableCell("\nHospital\n"), - Center( - child: Column( - children: [ - tableCell("\nAdmit"), - tableCell("Date\n"), - ], - )), - Center( - child: Column( - children: [ - tableCell("\nDischarge"), - tableCell("Date\n"), - ], - )), - tableCell("\nReason\n"), - ]), - data.hospitals != null && data.hospitals!.isNotEmpty - ? TableRow(children: [ - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - ]) - : TableRow(children: [ - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - ]), - ]), - ); - } + final List healthRecords = [ + HealthRecord( + doctorName: "Dr. John Doe", + dateOfVisit: DateTime(2023, 12, 15), + prescribedMedicines: ["Medicine A", "Medicine B"], + ), + HealthRecord( + doctorName: "Dr. Jane Smith", + dateOfVisit: DateTime(2023, 11, 20), + prescribedMedicines: ["Medicine C", "Medicine D", "Medicine E"], + ), + ]; - Container ambulance(HealthData data) { - return new Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 15, horizontal: 5), - child: Table(border: TableBorder.all(color: Colors.black), children: [ - TableRow(children: [ - tableCell("\nCause\n"), - Center( - child: Column( - children: [ - tableCell("\nRequested"), - tableCell("Date\n"), - ], - ), - ), - tableCell("\nStart Date\n"), - tableCell("\nEnd Date\n"), - ]), - data.ambulances != null && data.ambulances!.isNotEmpty - ? TableRow(children: [ - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - ]) - : TableRow(children: [ - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - tableCell2("\n" + "NA" + "\n"), - ]) - ]), + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Health Records'), + ), + body: ListView.builder( + itemCount: healthRecords.length, + itemBuilder: (context, index) { + final healthRecord = healthRecords[index]; + return ListTile( + title: Text( + '${healthRecord.doctorName} - ${healthRecord.dateOfVisit.toString()}'), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PrescribedMedicinesPage( + prescribedMedicines: healthRecord.prescribedMedicines), + ), + ); + }, + ); + }, + ), ); } +} - Container prescription(HealthData data) { - return new Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 15, horizontal: 5), - child: Table(border: TableBorder.all(color: Colors.black), children: [ - TableRow(children: [ - tableCell("\nTreated By\n"), - if (data.prescription != null && data.prescription!.isNotEmpty) - for (var prescription in data.prescription!) - tableCell2("\n" + "Name Not available" + "\n") - else - tableCell2("\n" + "NA" + "\n"), - ]), - TableRow(children: [ - tableCell("\nDate\n"), - if (data.prescription != null && data.prescription!.isNotEmpty) - for (var prescription in data.prescription!) - tableCell2("\n" + prescription!['date'].toString() + "\n") - else - tableCell2("\n" + "NA" + "\n"), - ]), - TableRow(children: [ - tableCell("\nDetail\n"), - if (data.prescription != null && data.prescription!.isNotEmpty) - for (var prescription in data.prescription!) - tableCell2("\n" + prescription!["details"].toString() + "\n") - else - tableCell2("\n" + "NA" + "\n"), - ]), - TableRow(children: [ - tableCell("\nTest\n"), - if (data.prescription != null && data.prescription!.isNotEmpty) - for (var prescription in data.prescription!) - tableCell2("\n" + prescription!["test"].toString() + "\n") - else - tableCell2("\n" + "NA" + "\n"), - ]), - TableRow(children: [ - tableCell("\nMedicine\n"), - if (data.medicines != null && data.medicines!.isNotEmpty) - for (var medicines in data.medicines!) - tableCell2("\n" + medicines!["medicine_id"].toString() + "\n") - else - tableCell2("\n" + "NA" + "\n"), - ]), - TableRow(children: [ - tableCell("\nNo of Days\n"), - if (data.medicines != null && data.medicines!.isNotEmpty) - for (var medicines in data.medicines!) - tableCell2("\n" + medicines!["days"].toString() + "\n") - else - tableCell2("\n" + "NA" + "\n"), - ]), - TableRow(children: [ - tableCell("\nNo of Times/day\n"), - if (data.medicines != null && data.medicines!.isNotEmpty) - for (var medicines in data.medicines!) - tableCell2("\n" + medicines!["times"].toString() + "\n") - else - tableCell2("\n" + "NA" + "\n"), - ]), - ]), - ); - } +class PrescribedMedicinesPage extends StatelessWidget { + final List prescribedMedicines; - TableCell tableCell(String s) { - return TableCell( - child: Center( - child: Text(s, - style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)), - ), - ); - } + PrescribedMedicinesPage({required this.prescribedMedicines}); - TableCell tableCell2(String s) { - return TableCell( - child: Center( - child: Text(s, style: TextStyle(fontSize: 16)), + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Prescribed Medicines'), + ), + body: ListView.builder( + itemCount: prescribedMedicines.length, + itemBuilder: (context, index) { + final medicine = prescribedMedicines[index]; + return ListTile( + title: Text(medicine), + ); + }, ), ); } diff --git a/lib/screens/Healthcenter/reimbursement.dart b/lib/screens/Healthcenter/reimbursement.dart new file mode 100644 index 00000000..a1d10e9c --- /dev/null +++ b/lib/screens/Healthcenter/reimbursement.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Reimbursement Form', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: ReimbursementFormPage(), + ); + } +} + +class ReimbursementFormPage extends StatelessWidget { + final String reimbursementFormUrl = 'https://example.com/reimbursement_form.pdf'; + + Future _launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Reimbursement Form'), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Click the button below to download the reimbursement form:', + textAlign: TextAlign.center, + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + _launchURL(reimbursementFormUrl); + }, + child: Text('Download Form'), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/Healthcenter/view_announcement.dart b/lib/screens/Healthcenter/view_announcement.dart new file mode 100644 index 00000000..64d50838 --- /dev/null +++ b/lib/screens/Healthcenter/view_announcement.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(MyApp()); +} + +class Announcement { + final String title; + final DateTime dateTime; + + Announcement({required this.title, required this.dateTime}); +} + +class MyApp extends StatelessWidget { + final List announcements = [ + Announcement( + title: "Important Announcement 1", + dateTime: DateTime(2024, 2, 20, 10, 30), // Dummy data + ), + Announcement( + title: "Important Announcement 2", + dateTime: DateTime(2024, 2, 19, 15, 45), // Dummy data + ), + ]; + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Announcements', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: ViewAnnouncementPage(), + ); + } +} + +class ViewAnnouncementPage extends StatelessWidget { + final List announcements = [ + Announcement( + title: "Announcement 1", + dateTime: DateTime(2024, 2, 20, 10, 30), // Dummy data + ), + Announcement( + title: "Announcement 2", + dateTime: DateTime(2024, 2, 19, 15, 45), // Dummy data + ), + ]; + + // ViewAnnouncementPage({required this.announcements}); + + @override + Widget build(BuildContext context) { + announcements.sort( + (a, b) => b.dateTime.compareTo(a.dateTime)); // Sort in reverse order + + return Scaffold( + appBar: AppBar( + title: Text('Announcements'), + ), + body: ListView.builder( + itemCount: announcements.length, + itemBuilder: (context, index) { + final announcement = announcements[index]; + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), + child: Container( + decoration: BoxDecoration( + color: Colors.grey[300], // Setting gray background color + borderRadius: BorderRadius.circular(12.0), // Adding border radius + ), + child: ListTile( + contentPadding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), // Padding for ListTile content + title: Text(announcement.title), + // Tile color (overrides container color if not null) + subtitle: Text( + '${announcement.dateTime.day}/${announcement.dateTime.month}/${announcement.dateTime.year} ' + '${announcement.dateTime.hour}:${announcement.dateTime.minute}', + ), + ), + ), + ); + }, + ), + ); + } +} diff --git a/lib/screens/LoginandDashboard/login_page.dart b/lib/screens/LoginandDashboard/login_page.dart index ca09fee2..81b3a26a 100644 --- a/lib/screens/LoginandDashboard/login_page.dart +++ b/lib/screens/LoginandDashboard/login_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:fusion/constants.dart'; +import 'package:fusion/screens/Compounder/homepage.dart'; import 'package:fusion/services/login_service.dart'; class LoginPage extends StatefulWidget { @@ -20,7 +21,6 @@ class _LoginPageState extends State { @override Widget build(BuildContext context) { - final Widget logoWidget = CircleAvatar( backgroundColor: Colors.transparent, radius: 54.0, @@ -30,13 +30,16 @@ class _LoginPageState extends State { keyboardType: TextInputType.emailAddress, autofocus: false, decoration: InputDecoration( - label: Text('Username', style: TextStyle( - fontSize: 12.0, - ),), + label: Text( + 'Username', + style: TextStyle( + fontSize: 12.0, + ), + ), contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), border: OutlineInputBorder( - // borderRadius: BorderRadius.circular(32.0), - ), + // borderRadius: BorderRadius.circular(32.0), + ), ), onChanged: (input) { username = input; @@ -44,11 +47,9 @@ class _LoginPageState extends State { validator: (String? value) { if (value?.length == 0) { return 'Please enter username'; - } - else if (value?.contains('@') == true) { + } else if (value?.contains('@') == true) { return 'Please enter username only'; } - }, autofillHints: [AutofillHints.username], ); @@ -57,13 +58,16 @@ class _LoginPageState extends State { autofocus: false, obscureText: true, decoration: InputDecoration( - label: Text('Password', style: TextStyle( - fontSize: 12.0, - ),), + label: Text( + 'Password', + style: TextStyle( + fontSize: 12.0, + ), + ), contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), border: OutlineInputBorder( - // borderRadius: BorderRadius.circular(32.0), - ), + // borderRadius: BorderRadius.circular(32.0), + ), ), onChanged: (input) { pass = input; @@ -91,9 +95,8 @@ class _LoginPageState extends State { bool complete = await auth.login(username ?? "", pass ?? ""); TextInput.finishAutofillContext(); if (complete == true) { - Navigator.pushReplacementNamed(context, "/landing"); + Navigator.pushReplacementNamed(context, '/landing'); } - Navigator.pushReplacementNamed(context, "/landing"); } }, // color: Colors.deepOrangeAccent, @@ -116,6 +119,15 @@ class _LoginPageState extends State { style: TextStyle(color: Colors.black54, fontSize: 12), ), ); + final compounder = TextButton( + onPressed: () { + Navigator.pushNamed(context, "/compounder/home"); + }, + child: Text( + 'Login as Compounder', + style: TextStyle(color: Colors.black54, fontSize: 12), + ), + ); return Scaffold( backgroundColor: Colors.white, body: Center( @@ -141,7 +153,7 @@ class _LoginPageState extends State { ), Padding( padding: EdgeInsets.only(bottom: 15), - child: emailFormField, + child: emailFormField, ), Padding( padding: EdgeInsets.only(bottom: 15), @@ -149,6 +161,7 @@ class _LoginPageState extends State { ), loginButton, forgotLabel, + compounder, ], ), ),