diff --git a/README.md b/README.md index aa48f389..c2acfc6a 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Flutter: Use Stable Version *2.0* * `git checkout ` * Switches to the branch you just created -## To update your Project * `git fetch upstream` * Gets the new commits on the main repository diff --git a/lib/Components/side_drawer.dart b/lib/Components/side_drawer.dart index be08db0e..f4623c40 100644 --- a/lib/Components/side_drawer.dart +++ b/lib/Components/side_drawer.dart @@ -13,6 +13,8 @@ class _SideDrawerState extends State { int count = 0; String? name; String? depttype; + + late String user; @override void initState() { super.initState(); @@ -23,6 +25,7 @@ class _SideDrawerState extends State { depttype = service.profileData.profile!['department']!['name'] + " " + service.profileData.profile!['user_type']; + user = service.profileData.profile!['user_type']; } @override @@ -124,6 +127,26 @@ class _SideDrawerState extends State { ModulesPadding( line: 'Gymkhana Module', pageMover: '/gymkhana_homepage'), + user.toLowerCase().contains("student")? + ModulesPadding( + line: 'Hostel', + pageMover:'/superadmin/hostel_admin', + // pageMover: '/caretaker/hostel_caretaker', + // pageMover: '/student/hostel_student', + isActive: true, + ):user.toLowerCase().contains('warden')? + ModulesPadding( + line: 'Hostel', + pageMover: '/warden/hostel_warden', + isActive: true, + ):ModulesPadding( + line: 'Hostel', + // pageMover: '/caretaker/hostel_caretaker', + pageMover: '/student/hostel_student', + // pageMover:'/superadmin/hostel_admin', + isActive: true, + ), + ModulesPadding( line: 'Establishment Module', pageMover: '/establishment'), diff --git a/lib/main.dart b/lib/main.dart index 4cd5af87..e153909c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,12 +1,12 @@ import 'package:flutter/material.dart'; import 'dart:async'; 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/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/Establishment/establishment_home_page.dart'; import 'package:fusion/screens/Library/Book_Search.dart'; -import 'package:fusion/screens/Library/dues.dart'; +// import 'package:fusion/screens/Library/dues.dart'; import 'package:fusion/screens/Library/issued_items.dart'; import 'package:fusion/screens/Library/lib_home_screen.dart'; import 'package:fusion/screens/LoginandDashboard/DashboardComponents/news.dart'; @@ -28,7 +28,7 @@ import 'package:fusion/screens/Gymkhana/Polls.dart'; import 'package:fusion/screens/Gymkhana/Apply.dart'; import 'package:fusion/screens/Gymkhana/Record.dart'; import 'package:fusion/screens/Gymkhana/Club.dart'; -import 'package:fusion/screens/Complaint/complaint.dart'; +// import 'package:fusion/screens/Complaint/complaint.dart'; import 'package:fusion/screens/Profile/profile.dart'; import 'package:fusion/screens/Programme_Curriculum/Batches/batches.dart'; import 'package:fusion/screens/Programme_Curriculum/Courses/courses.dart'; @@ -45,6 +45,11 @@ import 'package:fusion/screens/Healthcenter/viewschedule.dart'; import 'package:fusion/screens/Healthcenter/history.dart'; import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/screens/Hostel/caretaker/hostel_caretaker.dart'; +import 'package:fusion/screens/Hostel/student/hostel_student.dart'; +import 'package:fusion/screens/Hostel/warden/hostel_warden.dart'; +import 'package:fusion/screens/Hostel/superadmin/hostel_admin.dart'; + void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -63,8 +68,9 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { MediaQueryData windowData = - MediaQueryData.fromView(WidgetsBinding.instance.window); - windowData = windowData.copyWith( + MediaQueryData.fromView(WidgetsBinding.instance.window); + + windowData = windowData.copyWith( textScaler: TextScaler.linear(1), ); return MediaQuery( @@ -74,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', @@ -119,13 +125,13 @@ class MyApp extends StatelessWidget { '/library_homepage': (context) => LibraryHomeScreen(), '/library_homepage/book_search': (context) => BookSearch(), '/library_homepage/issued_items': (context) => IssuedItems(), - '/library_homepage/dues': (context) => LibraryDues(), - '/complaint': (context) => - Complaint(ModalRoute.of(context)!.settings.arguments.toString()), - '/complaint/lodge_complaint': (context) => LodgeComplaint( - ModalRoute.of(context)!.settings.arguments.toString()), - '/complaint/complaint_history': (context) => ComplainHistory(), - '/complaint/feedback': (context) => ComplaintFeedBack(), + // '/library_homepage/dues': (context) => LibraryDues(), + // '/complaint': (context) => + // Complaint(ModalRoute.of(context)!.settings.arguments.toString()), + // '/complaint/lodge_complaint': (context) => LodgeComplaint( + // ModalRoute.of(context)!.settings.arguments.toString()), + // '/complaint/complaint_history': (context) => ComplainHistory(), + // '/complaint/feedback': (context) => ComplaintFeedBack(), '/profile': (context) => Profile(), '/health_center': (context) => HealthCenterMod( ModalRoute.of(context)!.settings.arguments.toString()), @@ -133,6 +139,10 @@ class MyApp extends StatelessWidget { '/health_center/feedback': (context) => FeedBack(), '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), + '/caretaker/hostel_caretaker': (context) => Hostelcaretaker(), + '/wardern/hostel_wardern': (context) => Hostelwarden(), + '/student/hostel_student': (context) => Hostelstudent(), + '/superadmin/hostel_admin': (context) => HostelAdmin(), }, ), ); diff --git a/lib/screens/Complaint/ComplaintHistory/complain_history.dart b/lib/screens/Academic/Complaint/ComplaintHistory/complain_history.dart similarity index 100% rename from lib/screens/Complaint/ComplaintHistory/complain_history.dart rename to lib/screens/Academic/Complaint/ComplaintHistory/complain_history.dart diff --git a/lib/screens/Complaint/ComplaintHistory/complaints_card.dart b/lib/screens/Academic/Complaint/ComplaintHistory/complaints_card.dart similarity index 100% rename from lib/screens/Complaint/ComplaintHistory/complaints_card.dart rename to lib/screens/Academic/Complaint/ComplaintHistory/complaints_card.dart diff --git a/lib/screens/Complaint/ComplaintHistory/declined_complaints.dart b/lib/screens/Academic/Complaint/ComplaintHistory/declined_complaints.dart similarity index 100% rename from lib/screens/Complaint/ComplaintHistory/declined_complaints.dart rename to lib/screens/Academic/Complaint/ComplaintHistory/declined_complaints.dart diff --git a/lib/screens/Complaint/ComplaintHistory/get_complaint_by_id.dart b/lib/screens/Academic/Complaint/ComplaintHistory/get_complaint_by_id.dart similarity index 100% rename from lib/screens/Complaint/ComplaintHistory/get_complaint_by_id.dart rename to lib/screens/Academic/Complaint/ComplaintHistory/get_complaint_by_id.dart diff --git a/lib/screens/Complaint/ComplaintHistory/on-hold_complaints.dart b/lib/screens/Academic/Complaint/ComplaintHistory/on-hold_complaints.dart similarity index 100% rename from lib/screens/Complaint/ComplaintHistory/on-hold_complaints.dart rename to lib/screens/Academic/Complaint/ComplaintHistory/on-hold_complaints.dart diff --git a/lib/screens/Complaint/ComplaintHistory/pending_complaints.dart b/lib/screens/Academic/Complaint/ComplaintHistory/pending_complaints.dart similarity index 100% rename from lib/screens/Complaint/ComplaintHistory/pending_complaints.dart rename to lib/screens/Academic/Complaint/ComplaintHistory/pending_complaints.dart diff --git a/lib/screens/Complaint/ComplaintHistory/resolved_complaints.dart b/lib/screens/Academic/Complaint/ComplaintHistory/resolved_complaints.dart similarity index 100% rename from lib/screens/Complaint/ComplaintHistory/resolved_complaints.dart rename to lib/screens/Academic/Complaint/ComplaintHistory/resolved_complaints.dart diff --git a/lib/screens/Complaint/ComplaintHistory/update_complaint.dart b/lib/screens/Academic/Complaint/ComplaintHistory/update_complaint.dart similarity index 99% rename from lib/screens/Complaint/ComplaintHistory/update_complaint.dart rename to lib/screens/Academic/Complaint/ComplaintHistory/update_complaint.dart index 8ea7af87..917de43c 100644 --- a/lib/screens/Complaint/ComplaintHistory/update_complaint.dart +++ b/lib/screens/Academic/Complaint/ComplaintHistory/update_complaint.dart @@ -172,8 +172,8 @@ class _UpdateComplaintState extends State { widget.id!, complaint_date, finishedDate, - complaint_type!, - location!, + complaint_type, + location, specific_location!, details!, status, diff --git a/lib/screens/Complaint/Constants/constants.dart b/lib/screens/Academic/Complaint/Constants/constants.dart similarity index 100% rename from lib/screens/Complaint/Constants/constants.dart rename to lib/screens/Academic/Complaint/Constants/constants.dart diff --git a/lib/screens/Complaint/Feedback/feedback.dart b/lib/screens/Academic/Complaint/Feedback/feedback.dart similarity index 100% rename from lib/screens/Complaint/Feedback/feedback.dart rename to lib/screens/Academic/Complaint/Feedback/feedback.dart diff --git a/lib/screens/Complaint/LodgeComplaint/lodge_complaint.dart b/lib/screens/Academic/Complaint/LodgeComplaint/lodge_complaint.dart similarity index 100% rename from lib/screens/Complaint/LodgeComplaint/lodge_complaint.dart rename to lib/screens/Academic/Complaint/LodgeComplaint/lodge_complaint.dart diff --git a/lib/screens/Complaint/complaint.dart b/lib/screens/Academic/Complaint/complaint.dart similarity index 98% rename from lib/screens/Complaint/complaint.dart rename to lib/screens/Academic/Complaint/complaint.dart index f1b5ed77..a7fc09ed 100644 --- a/lib/screens/Complaint/complaint.dart +++ b/lib/screens/Academic/Complaint/complaint.dart @@ -4,12 +4,9 @@ import 'package:fusion/Components/appBar.dart'; import 'package:fusion/models/profile.dart'; import 'package:fusion/services/profile_service.dart'; import 'package:http/http.dart'; -import 'ComplaintHistory/complain_history.dart'; import 'package:flutter/material.dart'; import 'package:fusion/Components/side_drawer.dart'; import 'dart:ui'; -import 'LodgeComplaint/lodge_complaint.dart'; -import 'Feedback/feedback.dart'; import 'package:provider/provider.dart'; class Complaint extends StatefulWidget { diff --git a/lib/screens/Academic/Registration/final_registration.dart b/lib/screens/Academic/Registration/final_registration.dart index 4ca4b245..dbcdae07 100644 --- a/lib/screens/Academic/Registration/final_registration.dart +++ b/lib/screens/Academic/Registration/final_registration.dart @@ -1,74 +1,74 @@ -import 'package:flutter/material.dart'; - -class FinalRegistration extends StatefulWidget { - final data; - const FinalRegistration({Key? key, this.data}) : super(key: key); - @override - _FinalRegistrationState createState() => _FinalRegistrationState(); -} - -class _FinalRegistrationState extends State { - getRows(List? map) { - List list = []; - map?.forEach((element) { - element.length > 0 - ? list.add(DataRow(cells: [ - DataCell(Text(element[0]['course_id']['id'].toString())), - DataCell(Text(element[0]['course_code'].toString())), - DataCell(Text(element[0]['course_id']['course_name'].toString())), - DataCell(Text(element[0]['credits'].toString())), - DataCell(Text(element[0]['sem'].toString())) - ])) - : true; - }); - return list; - } - - @override - Widget build(BuildContext context) { - List? finalData = widget.data?.final_registration_choices; - return Container( - child: Column( - children: [ - SizedBox(height: 10), - Text("Final Choices Of Courses"), - if (finalData != null && finalData[0].length > 0) - SingleChildScrollView( - scrollDirection: Axis.vertical, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: DataTable(columns: [ - DataColumn( - label: Text("Course ID"), - numeric: false, - ), - DataColumn( - label: Text("Course Code"), - numeric: false, - ), - DataColumn( - label: Text("Course Name"), - numeric: false, - ), - DataColumn( - label: Text("Credits"), - numeric: false, - ), - DataColumn( - label: Text("Semester"), - numeric: false, - ) - ], rows: getRows(finalData)), - ), - ), - if (finalData == null || finalData[0].length == 0) - Expanded( - child: Center( - child: Text( - 'Final Registration Date is yet to come', - style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold), - ))) - ], - )); - } -} +// import 'package:flutter/material.dart'; +// +// class FinalRegistration extends StatefulWidget { +// final data; +// const FinalRegistration({Key? key, this.data}) : super(key: key); +// @override +// _FinalRegistrationState createState() => _FinalRegistrationState(); +// } +// +// class _FinalRegistrationState extends State { +// getRows(List? map) { +// List list = []; +// map?.forEach((element) { +// element.length > 0 +// ? list.add(DataRow(cells: [ +// DataCell(Text(element[0]['course_id']['id'].toString())), +// DataCell(Text(element[0]['course_code'].toString())), +// DataCell(Text(element[0]['course_id']['course_name'].toString())), +// DataCell(Text(element[0]['credits'].toString())), +// DataCell(Text(element[0]['sem'].toString())) +// ])) +// : true; +// }); +// return list; +// } +// +// @override +// Widget build(BuildContext context) { +// List? finalData = widget.data?.final_registration_choices; +// return Container( +// child: Column( +// children: [ +// SizedBox(height: 10), +// Text("Final Choices Of Courses"), +// if (finalData[0].length > 0) +// SingleChildScrollView( +// scrollDirection: Axis.vertical, +// child: SingleChildScrollView( +// scrollDirection: Axis.horizontal, +// child: DataTable(columns: [ +// DataColumn( +// label: Text("Course ID"), +// numeric: false, +// ), +// DataColumn( +// label: Text("Course Code"), +// numeric: false, +// ), +// DataColumn( +// label: Text("Course Name"), +// numeric: false, +// ), +// DataColumn( +// label: Text("Credits"), +// numeric: false, +// ), +// DataColumn( +// label: Text("Semester"), +// numeric: false, +// ) +// ], rows: getRows(finalData)), +// ), +// ), +// if (finalData[0].length == 0) +// Expanded( +// child: Center( +// child: Text( +// 'Final Registration Date is yet to come', +// style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold), +// ))) +// ], +// )); +// } +// } diff --git a/lib/screens/Academic/Registration/registration_home_page.dart b/lib/screens/Academic/Registration/registration_home_page.dart index 24dfac50..f6729e1e 100644 --- a/lib/screens/Academic/Registration/registration_home_page.dart +++ b/lib/screens/Academic/Registration/registration_home_page.dart @@ -73,7 +73,7 @@ class _RegistrationHomePageState extends State { children: [ Courses(data: data.currently_registered), PreRegistration(), - FinalRegistration(data: data) + // FinalRegistration(data: data) // FinalRegistration(data: data) ], ), diff --git a/lib/screens/Gymkhana/Record.dart b/lib/screens/Gymkhana/Record.dart index adcfacf2..0a5f8f05 100644 --- a/lib/screens/Gymkhana/Record.dart +++ b/lib/screens/Gymkhana/Record.dart @@ -123,10 +123,10 @@ class Srecord { late String Category; Srecord( - {this.Name: "default-name", - this.Rollno: "000000", - this.Club: "default-club", - this.Category: "default-category"}); + {this.Name = "default-name", + this.Rollno = "000000", + this.Club = "default-club", + this.Category = "default-category"}); } var Srecords = [ diff --git a/lib/screens/Hostel/caretaker/complaintregister.dart b/lib/screens/Hostel/caretaker/complaintregister.dart index 90bec5c0..d1672a61 100644 --- a/lib/screens/Hostel/caretaker/complaintregister.dart +++ b/lib/screens/Hostel/caretaker/complaintregister.dart @@ -1,96 +1,97 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:fusion/Components/side_drawer.dart'; - -class Complaintregister extends StatelessWidget { - const Complaintregister({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Complaint Register'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - foregroundColor: Colors.white, - ), - body: Padding( - padding: const EdgeInsets.fromLTRB(20, 30, 20, 0), // Add padding to the body - child: GridView.count( - crossAxisCount: 2, - childAspectRatio: 1.5, // Adjust the aspect ratio to make the cards horizontally rectangular - children: List.generate( - roomNumbers.length, - (index) => InkWell( - onTap: () { - // Navigate to a new screen when the card is tapped - Navigator.push( - context, - MaterialPageRoute(builder: (context) => DetailScreen(roomNumber: roomNumbers[index])), - ); - }, - child: Card( - color: Color.fromARGB(255, 245, 103, 47), - child: Padding( - padding: const EdgeInsets.all(8.0), // Add padding to make the cards compact - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - roomNumbers[index], - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: Colors.white, // Set the text color to white - ), - ), - Icon(Icons.arrow_forward, color: Colors.white), // Set the arrow color to white - ], - ), - ), - ), - ), - ), - ), - ), - ), - ); - } -} - -class DetailScreen extends StatelessWidget { - final String roomNumber; - - const DetailScreen({Key? key, required this.roomNumber}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Room $roomNumber Details'), - ), - body: Center( - child: Text( - 'Room $roomNumber Details', - style: TextStyle( - color: Colors.white, // Set the text color to white - ), - ), - ), - ); - } -} - -List roomNumbers = [ - '101', - '102', - '103', - '104', - '105', - '106', - '107', - '108', - '109', - '110', -]; + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Complaintregister extends StatelessWidget { + const Complaintregister({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Complaint Register'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: const EdgeInsets.fromLTRB(20, 30, 20, 0), // Add padding to the body + child: GridView.count( + crossAxisCount: 2, + childAspectRatio: 1.5, // Adjust the aspect ratio to make the cards horizontally rectangular + children: List.generate( + roomNumbers.length, + (index) => InkWell( + onTap: () { + // Navigate to a new screen when the card is tapped + Navigator.push( + context, + MaterialPageRoute(builder: (context) => DetailScreen(roomNumber: roomNumbers[index])), + ); + }, + child: Card( + color: Color.fromARGB(255, 245, 103, 47), + child: Padding( + padding: const EdgeInsets.all(8.0), // Add padding to make the cards compact + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + roomNumbers[index], + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.white, // Set the text color to white + ), + ), + Icon(Icons.arrow_forward, color: Colors.white), // Set the arrow color to white + ], + ), + ), + ), + ), + ), + ), + ), + ), + ); + } +} + +class DetailScreen extends StatelessWidget { + final String roomNumber; + + const DetailScreen({Key? key, required this.roomNumber}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Room $roomNumber Details'), + ), + body: Center( + child: Text( + 'Room $roomNumber Details', + style: TextStyle( + color: Colors.white, // Set the text color to white + ), + ), + ), + ); + } +} + +List roomNumbers = [ + '101', + '102', + '103', + '104', + '105', + '106', + '107', + '108', + '109', + '110', +]; \ No newline at end of file diff --git a/lib/screens/Hostel/caretaker/guestroom.dart b/lib/screens/Hostel/caretaker/guestroom.dart index 0d764690..a070486c 100644 --- a/lib/screens/Hostel/caretaker/guestroom.dart +++ b/lib/screens/Hostel/caretaker/guestroom.dart @@ -1,226 +1,227 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:fusion/Components/side_drawer.dart'; -class Guestroom extends StatelessWidget { - const Guestroom({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Guest Room'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - foregroundColor: Colors.white, - ), - body: Container( - child: Padding( - padding: const EdgeInsets.fromLTRB(20, 40, 20, 20), - child: Container( - width: double.infinity, // Prevent horizontal scrolling - child: Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - alignment: Alignment.topLeft, - child: const Text( - 'Status', - style: TextStyle( - fontSize: 23, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.left, - ), - ), - Container( - width: MediaQuery.of(context).size.width - 40, - height: 250, - decoration: BoxDecoration( - color: Color.fromARGB( - 255, 245, 103, 47), // Change to orange color - borderRadius: BorderRadius.circular(8), - ), - padding: const EdgeInsets.all(8), - margin: const EdgeInsets.symmetric(vertical: 4), - child: const Text( - '', - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - ), - Container( - alignment: Alignment.topLeft, - padding: const EdgeInsets.only(top: 30, bottom: 10), - child: const Text( - 'Guest Room 1', - style: TextStyle( - fontSize: 23, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.left, - ), - ), - Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment - .center, // Align vertically center - children: [ - Column( - children: [ - Container( - width: MediaQuery.of(context).size.width - 40, - height: 70, // Set the height to 30px - padding: const EdgeInsets.only(top: 10, bottom: 10), - child: ElevatedButton( - onPressed: () { - // View Documents - }, - child: const Text('View Documents', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Color.fromARGB(255, 245, 103, 47), // Add background color - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - - ), - ), - ), - Container( - child: Row( - children: [ - ElevatedButton.icon( - onPressed: () { - // Approve - }, - icon: Icon(Icons.check, color: Colors.white), - label: const Text('Approve', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - ), - ), - SizedBox(width: 10), - ElevatedButton.icon( - onPressed: () { - // Cancel - }, - icon: Icon(Icons.close, color: Colors.white), - label: const Text('Cancel', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.red, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - ), - Container( - alignment: Alignment.topLeft, - padding: const EdgeInsets.only(top: 30, bottom: 10), - child: const Text( - 'Guest Room 2', - style: TextStyle( - fontSize: 23, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.left, - ), - ), - Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment - .center, // Align vertically center - children: [ - Column( - children: [ - Container( - width: MediaQuery.of(context).size.width - 40, - height: 70, // Set the height to 30px - padding: const EdgeInsets.only(top: 10, bottom: 10), - child: ElevatedButton( - onPressed: () { - // View Documents - }, - child: const Text('View Documents', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Color.fromARGB(255, 245, 103, 47), // Add background color - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - - ), - ), - ), - Container( - child: Row( - children: [ - ElevatedButton.icon( - onPressed: () { - // Approve - }, - icon: Icon(Icons.check, color: Colors.white), - label: const Text('Approve', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - ), - ), - SizedBox(width: 10), - ElevatedButton.icon( - onPressed: () { - // Cancel - }, - icon: Icon(Icons.close, color: Colors.white), - label: const Text('Cancel', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.red, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - ), - ], - ), - ), - ], - ), - ), - ), - ), - ), - ), - ); - } -} + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:fusion/Components/side_drawer.dart'; +class Guestroom extends StatelessWidget { + const Guestroom({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Guest Room'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Container( + child: Padding( + padding: const EdgeInsets.fromLTRB(20, 40, 20, 20), + child: Container( + width: double.infinity, // Prevent horizontal scrolling + child: Expanded( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.topLeft, + child: const Text( + 'Status', + style: TextStyle( + fontSize: 23, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.left, + ), + ), + Container( + width: MediaQuery.of(context).size.width - 40, + height: 250, + decoration: BoxDecoration( + color: Color.fromARGB( + 255, 245, 103, 47), // Change to orange color + borderRadius: BorderRadius.circular(8), + ), + padding: const EdgeInsets.all(8), + margin: const EdgeInsets.symmetric(vertical: 4), + child: const Text( + '', + style: TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + alignment: Alignment.topLeft, + padding: const EdgeInsets.only(top: 30, bottom: 10), + child: const Text( + 'Guest Room 1', + style: TextStyle( + fontSize: 23, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.left, + ), + ), + Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment + .center, // Align vertically center + children: [ + Column( + children: [ + Container( + width: MediaQuery.of(context).size.width - 40, + height: 70, // Set the height to 30px + padding: const EdgeInsets.only(top: 10, bottom: 10), + child: ElevatedButton( + onPressed: () { + // View Documents + }, + child: const Text('View Documents', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Color.fromARGB(255, 245, 103, 47), // Add background color + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + + ), + ), + ), + Container( + child: Row( + children: [ + ElevatedButton.icon( + onPressed: () { + // Approve + }, + icon: Icon(Icons.check, color: Colors.white), + label: const Text('Approve', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + ), + ), + SizedBox(width: 10), + ElevatedButton.icon( + onPressed: () { + // Cancel + }, + icon: Icon(Icons.close, color: Colors.white), + label: const Text('Cancel', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + Container( + alignment: Alignment.topLeft, + padding: const EdgeInsets.only(top: 30, bottom: 10), + child: const Text( + 'Guest Room 2', + style: TextStyle( + fontSize: 23, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.left, + ), + ), + Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment + .center, // Align vertically center + children: [ + Column( + children: [ + Container( + width: MediaQuery.of(context).size.width - 40, + height: 70, // Set the height to 30px + padding: const EdgeInsets.only(top: 10, bottom: 10), + child: ElevatedButton( + onPressed: () { + // View Documents + }, + child: const Text('View Documents', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Color.fromARGB(255, 245, 103, 47), // Add background color + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + + ), + ), + ), + Container( + child: Row( + children: [ + ElevatedButton.icon( + onPressed: () { + // Approve + }, + icon: Icon(Icons.check, color: Colors.white), + label: const Text('Approve', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + ), + ), + SizedBox(width: 10), + ElevatedButton.icon( + onPressed: () { + // Cancel + }, + icon: Icon(Icons.close, color: Colors.white), + label: const Text('Cancel', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/Hostel/caretaker/hostel_caretaker.dart b/lib/screens/Hostel/caretaker/hostel_caretaker.dart index 72a73f02..87bc7947 100644 --- a/lib/screens/Hostel/caretaker/hostel_caretaker.dart +++ b/lib/screens/Hostel/caretaker/hostel_caretaker.dart @@ -1,343 +1,343 @@ -import 'package:flutter/material.dart'; -// import 'package:fusion/Components/appBar.dart'; -import 'package:fusion/Components/side_drawer.dart'; -import 'package:fusion/screens/Hostel/caretaker/guestroom.dart'; -import 'package:fusion/screens/Hostel/caretaker/inventory.dart'; -import 'package:fusion/screens/Hostel/caretaker/managefines.dart'; -import 'package:fusion/screens/Hostel/caretaker/managerooms.dart'; -import 'package:fusion/screens/Hostel/caretaker/leaveapplication.dart'; -import 'package:fusion/screens/Hostel/caretaker/staffinfo.dart'; -import 'package:fusion/screens/Hostel/caretaker/managestudent.dart'; -import 'package:fusion/screens/Hostel/caretaker/noticeboard.dart'; -import 'package:fusion/screens/Hostel/caretaker/report.dart'; -import 'package:fusion/screens/Hostel/caretaker/complaintregister.dart'; - -class HostelHomepage extends StatelessWidget { - const HostelHomepage({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Hostel'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - foregroundColor: Colors.white, - ), - body: Container( - padding: const EdgeInsets.all(20.0), - child: Container( - child: GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - childAspectRatio: 1.0, - mainAxisSpacing: 5.0, - crossAxisSpacing: 5.0, - ), - children: [ - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Guestroom()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.add_home, - color: Colors.white, - size: 30, - ), - Text( - 'Guest Room', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Staffinfo()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.person, - color: Colors.white, - size: 30, - ), - Text( - 'Staff Info', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Managerooms()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.home, - color: Colors.white, - size: 30, - ), - Text( - 'Manage Rooms', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Managefines()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.monetization_on, - color: Colors.white, - size: 30, - ), - Text( - 'Manage Fines', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Report()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.report, - color: Colors.white, - size: 30, - ), - Text( - 'Report', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => Leaveapplication()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.card_travel, - color: Colors.white, - size: 30, - ), - Text( - 'Leave', - style: TextStyle(color: Colors.white, fontSize: 15), - ), - Text( - 'Application', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => Complaintregister()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.report_problem_rounded, - color: Colors.white, - size: 30, - ), - Text( - 'Complaint', - style: TextStyle(color: Colors.white, fontSize: 15), - ), - Text( - 'Register', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Managestudent()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.school, - color: Colors.white, - size: 30, - ), - Text( - 'Manage', - style: TextStyle(color: Colors.white, fontSize: 15), - ), - Text( - 'Student', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Noticeboard()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.dashboard, - color: Colors.white, - size: 30, - ), - Text( - 'Notice Board', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Inventory()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.inventory, - color: Colors.white, - size: 30, - ), - Text( - 'Inventory', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - ]), - ), - ), - ); - } -} +import 'package:flutter/material.dart'; +// import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/screens/Hostel/caretaker/guestroom.dart'; +import 'package:fusion/screens/Hostel/caretaker/inventory.dart'; +import 'package:fusion/screens/Hostel/caretaker/managefines.dart'; +import 'package:fusion/screens/Hostel/caretaker/managerooms.dart'; +import 'package:fusion/screens/Hostel/caretaker/leaveapplication.dart'; +import 'package:fusion/screens/Hostel/caretaker/staffinfo.dart'; +import 'package:fusion/screens/Hostel/caretaker/managestudent.dart'; +import 'package:fusion/screens/Hostel/caretaker/noticeboard.dart'; +import 'package:fusion/screens/Hostel/caretaker/report.dart'; +import 'package:fusion/screens/Hostel/caretaker/complaintregister.dart'; + +class Hostelcaretaker extends StatelessWidget { + const Hostelcaretaker({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Hostel'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Container( + padding: const EdgeInsets.all(20.0), + child: Container( + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: 1.0, + mainAxisSpacing: 5.0, + crossAxisSpacing: 5.0, + ), + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Guestroom()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.add_home, + color: Colors.white, + size: 30, + ), + Text( + 'Guest Room', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Staffinfo()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.person, + color: Colors.white, + size: 30, + ), + Text( + 'Staff Info', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Managerooms()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.home, + color: Colors.white, + size: 30, + ), + Text( + 'Manage Rooms', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Managefines()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.monetization_on, + color: Colors.white, + size: 30, + ), + Text( + 'Manage Fines', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Report()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.report, + color: Colors.white, + size: 30, + ), + Text( + 'Report', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Leaveapplication()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.card_travel, + color: Colors.white, + size: 30, + ), + Text( + 'Leave', + style: TextStyle(color: Colors.white, fontSize: 15), + ), + Text( + 'Application', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Complaintregister()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.report_problem_rounded, + color: Colors.white, + size: 30, + ), + Text( + 'Complaint', + style: TextStyle(color: Colors.white, fontSize: 15), + ), + Text( + 'Register', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Managestudent()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.school, + color: Colors.white, + size: 30, + ), + Text( + 'Manage', + style: TextStyle(color: Colors.white, fontSize: 15), + ), + Text( + 'Student', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Noticeboard()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.dashboard, + color: Colors.white, + size: 30, + ), + Text( + 'Notice Board', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Inventory()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.inventory, + color: Colors.white, + size: 30, + ), + Text( + 'Inventory', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + ]), + ), + ), + ); + } +} diff --git a/lib/screens/Hostel/caretaker/inventory.dart b/lib/screens/Hostel/caretaker/inventory.dart index 8358b8c3..8d09770f 100644 --- a/lib/screens/Hostel/caretaker/inventory.dart +++ b/lib/screens/Hostel/caretaker/inventory.dart @@ -1,71 +1,72 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:fusion/Components/side_drawer.dart'; - -class Inventory extends StatelessWidget { - const Inventory({ Key? key }) : super(key: key); - - @override - Widget build(BuildContext context){ - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Inventory'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), // Set the background color to orange - foregroundColor: Colors.white, - ), - body: Padding( - padding: const EdgeInsets.only(top: 30, left: 20, right: 20, bottom: 30), - child: Column( - children: [ - Text( - 'Inventory Amount: \$1000', // Replace with actual inventory amount - style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: Color.fromARGB(255, 245, 103, 47)), - ), - SizedBox(height: 16), - Text( - 'Expense History:', // Replace with actual expense history - style: TextStyle(fontSize: 18), - ), - Expanded( - child: ListView( - children: [ - ListTile( - title: Text('Expense 1'), // Replace with actual expense details - ), - ListTile( - title: Text('Expense 2'), // Replace with actual expense details - ), - // Add more ListTiles for additional expenses - ], - ), - ), - Padding( - padding: const EdgeInsets.only(top: 10), - child: ElevatedButton( - onPressed: () { - // Add logic to create a new expense - }, - style: ElevatedButton.styleFrom( - foregroundColor: Colors.white, - backgroundColor: Color.fromARGB(255, 245, 103, 47), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), - side: BorderSide( - color: Color.fromARGB(255, 245, 103, 47), - width: 2, - ), - ), - ), - child: Text( - 'Create New Expense', - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - ), - ], - ), - ), - ); - } -} + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Inventory extends StatelessWidget { + const Inventory({ Key? key }) : super(key: key); + + @override + Widget build(BuildContext context){ + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Inventory'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), // Set the background color to orange + foregroundColor: Colors.white, + ), + body: Padding( + padding: const EdgeInsets.only(top: 30, left: 20, right: 20, bottom: 30), + child: Column( + children: [ + Text( + 'Inventory Amount: \$1000', // Replace with actual inventory amount + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: Color.fromARGB(255, 245, 103, 47)), + ), + SizedBox(height: 16), + Text( + 'Expense History:', // Replace with actual expense history + style: TextStyle(fontSize: 18), + ), + Expanded( + child: ListView( + children: [ + ListTile( + title: Text('Expense 1'), // Replace with actual expense details + ), + ListTile( + title: Text('Expense 2'), // Replace with actual expense details + ), + // Add more ListTiles for additional expenses + ], + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10), + child: ElevatedButton( + onPressed: () { + // Add logic to create a new expense + }, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, + backgroundColor: Color.fromARGB(255, 245, 103, 47), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), + side: BorderSide( + color: Color.fromARGB(255, 245, 103, 47), + width: 2, + ), + ), + ), + child: Text( + 'Create New Expense', + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/Hostel/caretaker/leaveapplication.dart b/lib/screens/Hostel/caretaker/leaveapplication.dart index c1c71542..e5849cc1 100644 --- a/lib/screens/Hostel/caretaker/leaveapplication.dart +++ b/lib/screens/Hostel/caretaker/leaveapplication.dart @@ -1,227 +1,228 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:fusion/Components/side_drawer.dart'; - -class Leaveapplication extends StatelessWidget { - const Leaveapplication({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Leave Application'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - foregroundColor: Colors.white, - ), - body: Container( - child: Padding( - padding: const EdgeInsets.fromLTRB(20, 40, 20, 20), - child: Container( - width: double.infinity, // Prevent horizontal scrolling - child: Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - alignment: Alignment.topLeft, - child: const Text( - 'Status', - style: TextStyle( - fontSize: 23, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.left, - ), - ), - Container( - width: MediaQuery.of(context).size.width - 40, - height: 250, - decoration: BoxDecoration( - color: Color.fromARGB( - 255, 245, 103, 47), // Change to orange color - borderRadius: BorderRadius.circular(8), - ), - padding: const EdgeInsets.all(8), - margin: const EdgeInsets.symmetric(vertical: 4), - child: const Text( - '', - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - ), - Container( - alignment: Alignment.topLeft, - padding: const EdgeInsets.only(top: 30, bottom: 10), - child: const Text( - '21bcs198', - style: TextStyle( - fontSize: 23, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.left, - ), - ), - Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment - .center, // Align vertically center - children: [ - Column( - children: [ - Container( - width: MediaQuery.of(context).size.width - 40, - height: 70, // Set the height to 30px - padding: const EdgeInsets.only(top: 10, bottom: 10), - child: ElevatedButton( - onPressed: () { - // Leave Form - }, - child: const Text('Leave Form', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Color.fromARGB(255, 245, 103, 47), // Add background color - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - - ), - ), - ), - Container( - child: Row( - children: [ - ElevatedButton.icon( - onPressed: () { - // Approve - }, - icon: Icon(Icons.check, color: Colors.white), - label: const Text('Approve', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - ), - ), - SizedBox(width: 10), - ElevatedButton.icon( - onPressed: () { - // Cancel - }, - icon: Icon(Icons.close, color: Colors.white), - label: const Text('Cancel', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.red, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - ), - Container( - alignment: Alignment.topLeft, - padding: const EdgeInsets.only(top: 30, bottom: 10), - child: const Text( - '21bcs199', - style: TextStyle( - fontSize: 23, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.left, - ), - ), - Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment - .center, // Align vertically center - children: [ - Column( - children: [ - Container( - width: MediaQuery.of(context).size.width - 40, - height: 70, // Set the height to 30px - padding: const EdgeInsets.only(top: 10, bottom: 10), - child: ElevatedButton( - onPressed: () { - // Leave Form - }, - child: const Text('Leave Form', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Color.fromARGB(255, 245, 103, 47), // Add background color - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - - ), - ), - ), - Container( - child: Row( - children: [ - ElevatedButton.icon( - onPressed: () { - // Approve - }, - icon: Icon(Icons.check, color: Colors.white), - label: const Text('Approve', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - ), - ), - SizedBox(width: 10), - ElevatedButton.icon( - onPressed: () { - // Cancel - }, - icon: Icon(Icons.close, color: Colors.white), - label: const Text('Cancel', style: TextStyle(color: Colors.white)), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.red, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), // Set border radius to 5px - ), - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - ), - ], - ), - ), - ], - ), - ), - ), - ), - ), - ), - ); - } -} + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Leaveapplication extends StatelessWidget { + const Leaveapplication({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Leave Application'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Container( + child: Padding( + padding: const EdgeInsets.fromLTRB(20, 40, 20, 20), + child: Container( + width: double.infinity, // Prevent horizontal scrolling + child: Expanded( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.topLeft, + child: const Text( + 'Status', + style: TextStyle( + fontSize: 23, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.left, + ), + ), + Container( + width: MediaQuery.of(context).size.width - 40, + height: 250, + decoration: BoxDecoration( + color: Color.fromARGB( + 255, 245, 103, 47), // Change to orange color + borderRadius: BorderRadius.circular(8), + ), + padding: const EdgeInsets.all(8), + margin: const EdgeInsets.symmetric(vertical: 4), + child: const Text( + '', + style: TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + alignment: Alignment.topLeft, + padding: const EdgeInsets.only(top: 30, bottom: 10), + child: const Text( + '21bcs198', + style: TextStyle( + fontSize: 23, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.left, + ), + ), + Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment + .center, // Align vertically center + children: [ + Column( + children: [ + Container( + width: MediaQuery.of(context).size.width - 40, + height: 70, // Set the height to 30px + padding: const EdgeInsets.only(top: 10, bottom: 10), + child: ElevatedButton( + onPressed: () { + // Leave Form + }, + child: const Text('Leave Form', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Color.fromARGB(255, 245, 103, 47), // Add background color + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + + ), + ), + ), + Container( + child: Row( + children: [ + ElevatedButton.icon( + onPressed: () { + // Approve + }, + icon: Icon(Icons.check, color: Colors.white), + label: const Text('Approve', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + ), + ), + SizedBox(width: 10), + ElevatedButton.icon( + onPressed: () { + // Cancel + }, + icon: Icon(Icons.close, color: Colors.white), + label: const Text('Cancel', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + Container( + alignment: Alignment.topLeft, + padding: const EdgeInsets.only(top: 30, bottom: 10), + child: const Text( + '21bcs199', + style: TextStyle( + fontSize: 23, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.left, + ), + ), + Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment + .center, // Align vertically center + children: [ + Column( + children: [ + Container( + width: MediaQuery.of(context).size.width - 40, + height: 70, // Set the height to 30px + padding: const EdgeInsets.only(top: 10, bottom: 10), + child: ElevatedButton( + onPressed: () { + // Leave Form + }, + child: const Text('Leave Form', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Color.fromARGB(255, 245, 103, 47), // Add background color + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + + ), + ), + ), + Container( + child: Row( + children: [ + ElevatedButton.icon( + onPressed: () { + // Approve + }, + icon: Icon(Icons.check, color: Colors.white), + label: const Text('Approve', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + ), + ), + SizedBox(width: 10), + ElevatedButton.icon( + onPressed: () { + // Cancel + }, + icon: Icon(Icons.close, color: Colors.white), + label: const Text('Cancel', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), // Set border radius to 5px + ), + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/Hostel/caretaker/managefines.dart b/lib/screens/Hostel/caretaker/managefines.dart index 33ffd727..1a60cccd 100644 --- a/lib/screens/Hostel/caretaker/managefines.dart +++ b/lib/screens/Hostel/caretaker/managefines.dart @@ -1,436 +1,438 @@ -import 'dart:convert'; -import 'package:flutter/material.dart'; - -class Student { - late final String name; - late final String rollNo; - late final double fineAmount; - late final String reason; - late final String description; - - Student({ - required this.name, - required this.rollNo, - required this.fineAmount, - required this.reason, - required this.description, - }); -} - -class Managefines extends StatefulWidget { - const Managefines({Key? key}) : super(key: key); - - @override - _ManagefinesState createState() => _ManagefinesState(); -} - -class _ManagefinesState extends State { - List students = []; - List filteredStudents = []; - - @override - void initState() { - super.initState(); - _fetchFines(); - } - - Future _fetchFines() async { - // Simulating API call to fetch fines - final String finesData = ''' - [ - {"name": "Raju", "rollNo": "21bcs001", "fineAmount": 50.0, "reason": "Late Entry", "description": "Late by 15 minutes"}, - {"name": "Keerthan", "rollNo": "21bme002", "fineAmount": 30.0, "reason": "Hostel Damage", "description": "Broken window glass"}, - {"name": "Aravind", "rollNo": "21bcs003", "fineAmount": 20.0, "reason": "Misbehaviour", "description": "Argument with warden"} - ] - '''; - final List finesList = json.decode(finesData); - setState(() { - students = finesList.map((fine) => Student( - name: fine['name'], - rollNo: fine['rollNo'], - fineAmount: fine['fineAmount'], - reason: fine['reason'], - description: fine['description'], - )).toList(); - filteredStudents = List.from(students); - }); - } - - Future _editFineDetails(Student student) async { - // Display dialog to edit fine details - showDialog( - context: context, - builder: (BuildContext context) { - double fineAmount = student.fineAmount; - String reason = student.reason; - String description = student.description; - - return AlertDialog( - title: Text('Edit Fine Details'), - content: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TextField( - decoration: InputDecoration(labelText: 'Fine Amount'), - controller: TextEditingController(text: fineAmount.toString()), - onChanged: (value) { - fineAmount = double.tryParse(value) ?? 0.0; - }, - ), - Text('Reason'), - DropdownButtonFormField( - value: reason, - onChanged: (value) { - setState(() { - reason = value!; - }); - }, - items: ['Late Entry', 'Hostel Damage', 'Misbehaviour', 'Others'] - .map>( - (String value) => DropdownMenuItem( - value: value, - child: Text(value), - ), - ) - .toList(), - ), - TextField( - decoration: InputDecoration(labelText: 'Description'), - controller: TextEditingController(text: description), - onChanged: (value) { - description = value; - }, - ), - ], - ), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('Cancel'), - ), - ElevatedButton( - onPressed: () { - // Perform the edit operation here - setState(() { - // Find the index of the student in the list - int index = students.indexWhere((s) => s.rollNo == student.rollNo); - if (index != -1) { - // Update the properties of the student object directly - students[index].fineAmount = fineAmount; - students[index].reason = reason; - students[index].description = description; - // Update the filteredStudents list as well - int filteredIndex = filteredStudents.indexWhere((s) => s.rollNo == student.rollNo); - if (filteredIndex != -1) { - filteredStudents[filteredIndex].fineAmount = fineAmount; - filteredStudents[filteredIndex].reason = reason; - filteredStudents[filteredIndex].description = description; - } - } - }); - // Simulate PUT API call to update fine details - // _updateFineDetails(student); - Navigator.of(context).pop(); - }, - child: Text('Submit'), - ), - ], - ); - }, - ); - } - - - Future _deleteFineDetails(Student student) async { - // Show confirmation dialog before deleting the fine - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text('Confirm Deletion'), - content: Text('Are you sure you want to delete this fine?'), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('Cancel'), - ), - ElevatedButton( - onPressed: () { - // Delete the fine - _deleteFine(student); - Navigator.of(context).pop(); - }, - child: Text('Delete'), - ), - ], - ); - }, - ); - } - - void _deleteFine(Student student) { - setState(() { - students.remove(student); - filteredStudents.remove(student); - }); - // Simulate DELETE API call to delete fine details - // _invokeDeleteAPI(student.rollNo); - } - - Future _showAddDialog() async { - String name = ''; - String rollNo = ''; - double fineAmount = 0.0; - String reason = 'Late Entry'; - String description = ''; - - await showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text('Add New Fine'), - content: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TextField( - decoration: InputDecoration(labelText: 'Name'), - onChanged: (value) { - name = value; - }, - ), - TextField( - decoration: InputDecoration(labelText: 'Roll No'), - onChanged: (value) { - rollNo = value; - }, - ), - TextField( - decoration: InputDecoration(labelText: 'Fine Amount'), - onChanged: (value) { - fineAmount = double.tryParse(value) ?? 0.0; - }, - ), - DropdownButtonFormField( - value: reason, - onChanged: (value) { - setState(() { - reason = value!; - }); - }, - items: ['Late Entry', 'Hostel Damage', 'Misbehaviour', 'Others'] - .map>( - (String value) => DropdownMenuItem( - value: value, - child: Text(value), - ), - ) - .toList(), - ), - TextField( - decoration: InputDecoration(labelText: 'Description'), - onChanged: (value) { - description = value; - }, - ), - ], - ), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('Cancel'), - ), - ElevatedButton( - onPressed: () { - // Perform the add operation here - setState(() { - final newFine = Student( - name: name, - rollNo: rollNo, - fineAmount: fineAmount, - reason: reason, - description: description, - ); - students.add(newFine); - filteredStudents.add(newFine); - }); - // Simulate POST API call to add new fine details - // _addFineDetails(name, rollNo, fineAmount, reason, description); - Navigator.of(context).pop(); - }, - child: Text('Submit'), - ), - ], - ); - }, - ); - } - - void _searchFines(String query) { - setState(() { - if (query.isNotEmpty) { - filteredStudents = students.where((student) { - return student.name.toLowerCase().contains(query.toLowerCase()) || - student.rollNo.toLowerCase().contains(query.toLowerCase()); - }).toList(); - } else { - filteredStudents = List.from(students); - } - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Manage Fines'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - actions: [ - IconButton( - icon: Icon(Icons.search), - onPressed: () async { - final String? result = await showSearch( - context: context, - delegate: FineSearchDelegate(students: students), - ); - if (result != null) { - _searchFines(result); - } - }, - ), - ], - ), - body: SingleChildScrollView( - child: DataTable( - columns: const [ - DataColumn(label: Text('Name')), - DataColumn(label: Text('Roll No')), - DataColumn(label: Text('Fine Amount')), - DataColumn(label: Text('Reason')), - DataColumn(label: Text('Description')), - DataColumn(label: Text('Edit')), - DataColumn(label: Text('Remove')), - ], - rows: List.generate( - filteredStudents.length, - (index) => DataRow( - cells: [ - DataCell(Text(filteredStudents[index].name)), - DataCell(Text(filteredStudents[index].rollNo)), - DataCell(Text('₹${filteredStudents[index].fineAmount.toString()}')), - DataCell(Text(filteredStudents[index].reason)), - DataCell(Text(filteredStudents[index].description)), - DataCell( - IconButton( - icon: Icon(Icons.edit), - onPressed: () { - _editFineDetails(filteredStudents[index]); - }, - ), - ), - DataCell( - IconButton( - icon: Icon(Icons.delete), - onPressed: () { - _deleteFineDetails(filteredStudents[index]); - }, - ), - ), - ], - ), - ), - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _showAddDialog, - child: Icon(Icons.add), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - ), - ); - } -} - -class FineSearchDelegate extends SearchDelegate { - final List students; - - FineSearchDelegate({required this.students}); - - @override - ThemeData appBarTheme(BuildContext context) { - final ThemeData theme = Theme.of(context); - return theme.copyWith( - appBarTheme: AppBarTheme( - backgroundColor: theme.scaffoldBackgroundColor, // Match with screen's UI theme - iconTheme: IconThemeData(color: theme.primaryColor), // Match with screen's UI theme - ), - ); - } - - @override - List buildActions(BuildContext context) { - return [ - - IconButton( - icon: Icon(Icons.clear), - onPressed: () { - query = ''; - }, - ), - ]; - } - - @override - Widget buildLeading(BuildContext context) { - return IconButton( - icon: Icon(Icons.arrow_back), - onPressed: () { - close(context, ''); // Pass an empty string as a result to indicate closing the search screen - }, - ); - } - - @override - Widget buildResults(BuildContext context) { - return _buildSearchResults(context); - } - - @override - Widget buildSuggestions(BuildContext context) { - return _buildSearchResults(context); - } - - Widget _buildSearchResults(BuildContext context) { - final List filteredStudents = students.where((student) { - final String lowercaseQuery = query.toLowerCase(); - return student.name.toLowerCase().contains(lowercaseQuery) || - student.rollNo.toLowerCase().contains(lowercaseQuery); - }).toList(); - return ListView.builder( - itemCount: filteredStudents.length, - itemBuilder: (context, index) { - return ListTile( - title: Text(filteredStudents[index].name), - subtitle: Text(filteredStudents[index].rollNo), - onTap: () { - close(context, filteredStudents[index].rollNo); - }, - ); - }, - ); - } -} - -void main() { - runApp(MaterialApp( - home: Managefines(), - )); -} + +import 'dart:convert'; +import 'package:flutter/material.dart'; + +class Student { + late final String name; + late final String rollNo; + late final double fineAmount; + late final String reason; + late final String description; + + Student({ + required this.name, + required this.rollNo, + required this.fineAmount, + required this.reason, + required this.description, + }); +} + +class Managefines extends StatefulWidget { + const Managefines({Key? key}) : super(key: key); + + @override + _ManagefinesState createState() => _ManagefinesState(); +} + +class _ManagefinesState extends State { + List students = []; + List filteredStudents = []; + + @override + void initState() { + super.initState(); + _fetchFines(); + } + + Future _fetchFines() async { + // Simulating API call to fetch fines + final String finesData = ''' + [ + {"name": "Raju", "rollNo": "21bcs001", "fineAmount": 50.0, "reason": "Late Entry", "description": "Late by 15 minutes"}, + {"name": "Keerthan", "rollNo": "21bme002", "fineAmount": 30.0, "reason": "Hostel Damage", "description": "Broken window glass"}, + {"name": "Aravind", "rollNo": "21bcs003", "fineAmount": 20.0, "reason": "Misbehaviour", "description": "Argument with warden"} + ] + '''; + final List finesList = json.decode(finesData); + setState(() { + students = finesList.map((fine) => Student( + name: fine['name'], + rollNo: fine['rollNo'], + fineAmount: fine['fineAmount'], + reason: fine['reason'], + description: fine['description'], + )).toList(); + filteredStudents = List.from(students); + }); + } + + Future _editFineDetails(Student student) async { + // Display dialog to edit fine details + showDialog( + context: context, + builder: (BuildContext context) { + double fineAmount = student.fineAmount; + String reason = student.reason; + String description = student.description; + + return AlertDialog( + title: Text('Edit Fine Details'), + content: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + decoration: InputDecoration(labelText: 'Fine Amount'), + controller: TextEditingController(text: fineAmount.toString()), + onChanged: (value) { + fineAmount = double.tryParse(value) ?? 0.0; + }, + ), + Text('Reason'), + DropdownButtonFormField( + value: reason, + onChanged: (value) { + setState(() { + reason = value!; + }); + }, + items: ['Late Entry', 'Hostel Damage', 'Misbehaviour', 'Others'] + .map>( + (String value) => DropdownMenuItem( + value: value, + child: Text(value), + ), + ) + .toList(), + ), + TextField( + decoration: InputDecoration(labelText: 'Description'), + controller: TextEditingController(text: description), + onChanged: (value) { + description = value; + }, + ), + ], + ), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + // Perform the edit operation here + setState(() { + // Find the index of the student in the list + int index = students.indexWhere((s) => s.rollNo == student.rollNo); + if (index != -1) { + // Update the properties of the student object directly + students[index].fineAmount = fineAmount; + students[index].reason = reason; + students[index].description = description; + // Update the filteredStudents list as well + int filteredIndex = filteredStudents.indexWhere((s) => s.rollNo == student.rollNo); + if (filteredIndex != -1) { + filteredStudents[filteredIndex].fineAmount = fineAmount; + filteredStudents[filteredIndex].reason = reason; + filteredStudents[filteredIndex].description = description; + } + } + }); + // Simulate PUT API call to update fine details + // _updateFineDetails(student); + Navigator.of(context).pop(); + }, + child: Text('Submit'), + ), + ], + ); + }, + ); + } + + + Future _deleteFineDetails(Student student) async { + // Show confirmation dialog before deleting the fine + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('Confirm Deletion'), + content: Text('Are you sure you want to delete this fine?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + // Delete the fine + _deleteFine(student); + Navigator.of(context).pop(); + }, + child: Text('Delete'), + ), + ], + ); + }, + ); + } + + void _deleteFine(Student student) { + setState(() { + students.remove(student); + filteredStudents.remove(student); + }); + // Simulate DELETE API call to delete fine details + // _invokeDeleteAPI(student.rollNo); + } + + Future _showAddDialog() async { + String name = ''; + String rollNo = ''; + double fineAmount = 0.0; + String reason = 'Late Entry'; + String description = ''; + + await showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('Add New Fine'), + content: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + decoration: InputDecoration(labelText: 'Name'), + onChanged: (value) { + name = value; + }, + ), + TextField( + decoration: InputDecoration(labelText: 'Roll No'), + onChanged: (value) { + rollNo = value; + }, + ), + TextField( + decoration: InputDecoration(labelText: 'Fine Amount'), + onChanged: (value) { + fineAmount = double.tryParse(value) ?? 0.0; + }, + ), + DropdownButtonFormField( + value: reason, + onChanged: (value) { + setState(() { + reason = value!; + }); + }, + items: ['Late Entry', 'Hostel Damage', 'Misbehaviour', 'Others'] + .map>( + (String value) => DropdownMenuItem( + value: value, + child: Text(value), + ), + ) + .toList(), + ), + TextField( + decoration: InputDecoration(labelText: 'Description'), + onChanged: (value) { + description = value; + }, + ), + ], + ), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + // Perform the add operation here + setState(() { + final newFine = Student( + name: name, + rollNo: rollNo, + fineAmount: fineAmount, + reason: reason, + description: description, + ); + students.add(newFine); + filteredStudents.add(newFine); + }); + // Simulate POST API call to add new fine details + // _addFineDetails(name, rollNo, fineAmount, reason, description); + Navigator.of(context).pop(); + }, + child: Text('Submit'), + ), + ], + ); + }, + ); + } + + void _searchFines(String query) { + setState(() { + if (query.isNotEmpty) { + filteredStudents = students.where((student) { + return student.name.toLowerCase().contains(query.toLowerCase()) || + student.rollNo.toLowerCase().contains(query.toLowerCase()); + }).toList(); + } else { + filteredStudents = List.from(students); + } + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Manage Fines'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + actions: [ + IconButton( + icon: Icon(Icons.search), + onPressed: () async { + final String? result = await showSearch( + context: context, + delegate: FineSearchDelegate(students: students), + ); + if (result != null) { + _searchFines(result); + } + }, + ), + ], + ), + body: SingleChildScrollView( + child: DataTable( + columns: const [ + DataColumn(label: Text('Name')), + DataColumn(label: Text('Roll No')), + DataColumn(label: Text('Fine Amount')), + DataColumn(label: Text('Reason')), + DataColumn(label: Text('Description')), + DataColumn(label: Text('Edit')), + DataColumn(label: Text('Remove')), + ], + rows: List.generate( + filteredStudents.length, + (index) => DataRow( + cells: [ + DataCell(Text(filteredStudents[index].name)), + DataCell(Text(filteredStudents[index].rollNo)), + DataCell(Text('₹${filteredStudents[index].fineAmount.toString()}')), + DataCell(Text(filteredStudents[index].reason)), + DataCell(Text(filteredStudents[index].description)), + DataCell( + IconButton( + icon: Icon(Icons.edit), + onPressed: () { + _editFineDetails(filteredStudents[index]); + }, + ), + ), + DataCell( + IconButton( + icon: Icon(Icons.delete), + onPressed: () { + _deleteFineDetails(filteredStudents[index]); + }, + ), + ), + ], + ), + ), + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _showAddDialog, + child: Icon(Icons.add), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + ), + ); + } +} + +class FineSearchDelegate extends SearchDelegate { + final List students; + + FineSearchDelegate({required this.students}); + + @override + ThemeData appBarTheme(BuildContext context) { + final ThemeData theme = Theme.of(context); + return theme.copyWith( + appBarTheme: AppBarTheme( + backgroundColor: theme.scaffoldBackgroundColor, // Match with screen's UI theme + iconTheme: IconThemeData(color: theme.primaryColor), // Match with screen's UI theme + ), + ); + } + + @override + List buildActions(BuildContext context) { + return [ + + IconButton( + icon: Icon(Icons.clear), + onPressed: () { + query = ''; + }, + ), + ]; + } + + @override + Widget buildLeading(BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back), + onPressed: () { + close(context, ''); // Pass an empty string as a result to indicate closing the search screen + }, + ); + } + + @override + Widget buildResults(BuildContext context) { + return _buildSearchResults(context); + } + + @override + Widget buildSuggestions(BuildContext context) { + return _buildSearchResults(context); + } + + Widget _buildSearchResults(BuildContext context) { + final List filteredStudents = students.where((student) { + final String lowercaseQuery = query.toLowerCase(); + return student.name.toLowerCase().contains(lowercaseQuery) || + student.rollNo.toLowerCase().contains(lowercaseQuery); + }).toList(); + return ListView.builder( + itemCount: filteredStudents.length, + itemBuilder: (context, index) { + return ListTile( + title: Text(filteredStudents[index].name), + subtitle: Text(filteredStudents[index].rollNo), + onTap: () { + close(context, filteredStudents[index].rollNo); + }, + ); + }, + ); + } +} + +void main() { + runApp(MaterialApp( + home: Managefines(), + )); +} + diff --git a/lib/screens/Hostel/caretaker/managerooms.dart b/lib/screens/Hostel/caretaker/managerooms.dart index 9d149eb5..53e77e79 100644 --- a/lib/screens/Hostel/caretaker/managerooms.dart +++ b/lib/screens/Hostel/caretaker/managerooms.dart @@ -1,293 +1,295 @@ -import 'dart:convert'; -import 'package:flutter/material.dart'; - -class Room { - final int roomNumber; - final int capacity; - final int currentOccupancy; - final String status; - final List studentNames; - final int numberOfStudents; - - Room({ - required this.roomNumber, - required this.capacity, - required this.currentOccupancy, - required this.status, - required this.studentNames, - required this.numberOfStudents, - }); -} - -class Managerooms extends StatefulWidget { - const Managerooms({Key? key}) : super(key: key); - - @override - _ManageroomsState createState() => _ManageroomsState(); -} - -class _ManageroomsState extends State { - List rooms = []; - List filteredRooms = []; - - @override - void initState() { - super.initState(); - _fetchRoomDetails(); - } - - Future _fetchRoomDetails() async { - // Simulating GET API call to fetch room details - final String roomData = ''' - [ - {"roomNumber": 101, "capacity": 2, "currentOccupancy": 1, "status": "Partially Allotted", "studentNames": ["John Doe"], "numberOfStudents": 1}, - {"roomNumber": 102, "capacity": 3, "currentOccupancy": 2, "status": "Fully Allotted", "studentNames": ["Alice", "Bob"], "numberOfStudents": 2}, - {"roomNumber": 103, "capacity": 4, "currentOccupancy": 4, "status": "Fully Allotted", "studentNames": ["Charlie", "David", "Eve", "Frank"], "numberOfStudents": 4}, - ] - '''; - final List roomList = json.decode(roomData); - setState(() { - rooms = roomList.map((room) => Room( - roomNumber: room['roomNumber'], - capacity: room['capacity'], - currentOccupancy: room['currentOccupancy'], - status: room['status'], - studentNames: List.from(room['studentNames']), - numberOfStudents: room['numberOfStudents'], - )).toList(); - filteredRooms = List.from(rooms); - }); - } - - Future _editStudentDetails(Room room) async { - // Display dialog to edit student details - showDialog( - context: context, - builder: (BuildContext context) { - // Implement the edit room details dialog - return AlertDialog( - title: Text('Edit Student Details'), - content: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Add fields to edit student details - ], - ), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('Cancel'), - ), - ElevatedButton( - onPressed: () { - // Perform the edit operation here - // Update the room details - // Simulate POST API call to update room details - Navigator.of(context).pop(); - }, - child: Text('Submit'), - ), - ], - ); - }, - ); - } - - Future _deleteStudentDetails(Room room) async { - // Show confirmation dialog before deleting the student - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text('Confirm Deletion'), - content: Text('Are you sure you want to delete the student?'), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('Cancel'), - ), - ElevatedButton( - onPressed: () { - // Delete the student from the room - _deleteStudent(room); - Navigator.of(context).pop(); - }, - child: Text('Delete'), - ), - ], - ); - }, - ); - } - - void _deleteStudent(Room room) { - setState(() { - // Implement logic to delete the student from the room - }); - // Simulate DELETE API call to delete student details - } - - Future _showAddDialog() async { - // Implement add student to room dialog - } - - void _searchRooms(int roomNumber) { - setState(() { - if (roomNumber != 0) { - filteredRooms = rooms.where((room) => room.roomNumber == roomNumber).toList(); - } else { - filteredRooms.clear(); // Clear filtered list if no search is active - filteredRooms.addAll(rooms); // Repopulate with all rooms - } - }); - } - - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Manage Rooms'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - actions: [ - IconButton( - icon: Icon(Icons.search), - onPressed: () async { - final int? result = await showSearch( - context: context, - delegate: RoomSearchDelegate(rooms: rooms), - ); - if (result != null) { - _searchRooms(result); - } - }, - ), - ], - ), - body: SingleChildScrollView( - child: DataTable( - columns: const [ - DataColumn(label: Text('Room No')), - DataColumn(label: Text('Capacity')), - DataColumn(label: Text('Current Occupancy')), - DataColumn(label: Text('Status')), - DataColumn(label: Text('Student Names')), - DataColumn(label: Text('No of Students')), - DataColumn(label: Text('Edit')), - DataColumn(label: Text('Delete')), - DataColumn(label: Text('Add')), - ], - rows: filteredRooms.map((room) { - return DataRow(cells: [ - DataCell(Text(room.roomNumber.toString())), - DataCell(Text(room.capacity.toString())), - DataCell(Text(room.currentOccupancy.toString())), - DataCell(Text(room.status)), - DataCell(Text(room.studentNames.join(', '))), - DataCell(Text(room.numberOfStudents.toString())), - DataCell( - IconButton( - icon: Icon(Icons.edit), - onPressed: () { - _editStudentDetails(room); - }, - ), - ), - DataCell( - IconButton( - icon: Icon(Icons.delete), - onPressed: () { - _deleteStudentDetails(room); - }, - ), - ), - DataCell( - IconButton( - icon: Icon(Icons.add), - onPressed: () { - _showAddDialog(); - }, - ), - ), - ]); - }).toList(), - ), - ), - ); - } -} - -class RoomSearchDelegate extends SearchDelegate { - final List rooms; - - RoomSearchDelegate({required this.rooms}); - - @override - ThemeData appBarTheme(BuildContext context) { - final ThemeData theme = Theme.of(context); - return theme.copyWith( - appBarTheme: AppBarTheme( - backgroundColor: theme.scaffoldBackgroundColor, // Match with screen's UI theme - iconTheme: IconThemeData(color: theme.primaryColor), // Match with screen's UI theme - ), - ); - } - - @override - List buildActions(BuildContext context) { - return [ - IconButton( - icon: Icon(Icons.clear), - onPressed: () { - query = ''; - }, - ), - ]; - } - - @override - Widget buildLeading(BuildContext context) { - return IconButton( - icon: Icon(Icons.arrow_back), - onPressed: () { - close(context, null); - }, - ); - } - - @override - Widget buildResults(BuildContext context) { - return _buildSearchResults(context); - } - - @override - Widget buildSuggestions(BuildContext context) { - return _buildSearchResults(context); - } - - Widget _buildSearchResults(BuildContext context) { - return ListView.builder( - itemCount: rooms.length, - itemBuilder: (context, index) { - return ListTile( - title: Text('Room No: ${rooms[index].roomNumber}'), - onTap: () { - close(context, rooms[index].roomNumber); - }, - ); - }, - ); - } -} - -void main() { - runApp(MaterialApp( - home: Managerooms(), - )); -} + +import 'dart:convert'; +import 'package:flutter/material.dart'; + +class Room { + final int roomNumber; + final int capacity; + final int currentOccupancy; + final String status; + final List studentNames; + final int numberOfStudents; + + Room({ + required this.roomNumber, + required this.capacity, + required this.currentOccupancy, + required this.status, + required this.studentNames, + required this.numberOfStudents, + }); +} + +class Managerooms extends StatefulWidget { + const Managerooms({Key? key}) : super(key: key); + + @override + _ManageroomsState createState() => _ManageroomsState(); +} + +class _ManageroomsState extends State { + List rooms = []; + List filteredRooms = []; + + @override + void initState() { + super.initState(); + _fetchRoomDetails(); + } + + Future _fetchRoomDetails() async { + // Simulating GET API call to fetch room details + final String roomData = ''' + [ + {"roomNumber": 101, "capacity": 2, "currentOccupancy": 1, "status": "Partially Allotted", "studentNames": ["John Doe"], "numberOfStudents": 1}, + {"roomNumber": 102, "capacity": 3, "currentOccupancy": 2, "status": "Fully Allotted", "studentNames": ["Alice", "Bob"], "numberOfStudents": 2}, + {"roomNumber": 103, "capacity": 4, "currentOccupancy": 4, "status": "Fully Allotted", "studentNames": ["Charlie", "David", "Eve", "Frank"], "numberOfStudents": 4}, + ] + '''; + final List roomList = json.decode(roomData); + setState(() { + rooms = roomList.map((room) => Room( + roomNumber: room['roomNumber'], + capacity: room['capacity'], + currentOccupancy: room['currentOccupancy'], + status: room['status'], + studentNames: List.from(room['studentNames']), + numberOfStudents: room['numberOfStudents'], + )).toList(); + filteredRooms = List.from(rooms); + }); + } + + Future _editStudentDetails(Room room) async { + // Display dialog to edit student details + showDialog( + context: context, + builder: (BuildContext context) { + // Implement the edit room details dialog + return AlertDialog( + title: Text('Edit Student Details'), + content: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Add fields to edit student details + ], + ), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + // Perform the edit operation here + // Update the room details + // Simulate POST API call to update room details + Navigator.of(context).pop(); + }, + child: Text('Submit'), + ), + ], + ); + }, + ); + } + + Future _deleteStudentDetails(Room room) async { + // Show confirmation dialog before deleting the student + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('Confirm Deletion'), + content: Text('Are you sure you want to delete the student?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + // Delete the student from the room + _deleteStudent(room); + Navigator.of(context).pop(); + }, + child: Text('Delete'), + ), + ], + ); + }, + ); + } + + void _deleteStudent(Room room) { + setState(() { + // Implement logic to delete the student from the room + }); + // Simulate DELETE API call to delete student details + } + + Future _showAddDialog() async { + // Implement add student to room dialog + } + + void _searchRooms(int roomNumber) { + setState(() { + if (roomNumber != 0) { + filteredRooms = rooms.where((room) => room.roomNumber == roomNumber).toList(); + } else { + filteredRooms.clear(); // Clear filtered list if no search is active + filteredRooms.addAll(rooms); // Repopulate with all rooms + } + }); + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Manage Rooms'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + actions: [ + IconButton( + icon: Icon(Icons.search), + onPressed: () async { + final int? result = await showSearch( + context: context, + delegate: RoomSearchDelegate(rooms: rooms), + ); + if (result != null) { + _searchRooms(result); + } + }, + ), + ], + ), + body: SingleChildScrollView( + child: DataTable( + columns: const [ + DataColumn(label: Text('Room No')), + DataColumn(label: Text('Capacity')), + DataColumn(label: Text('Current Occupancy')), + DataColumn(label: Text('Status')), + DataColumn(label: Text('Student Names')), + DataColumn(label: Text('No of Students')), + DataColumn(label: Text('Edit')), + DataColumn(label: Text('Delete')), + DataColumn(label: Text('Add')), + ], + rows: filteredRooms.map((room) { + return DataRow(cells: [ + DataCell(Text(room.roomNumber.toString())), + DataCell(Text(room.capacity.toString())), + DataCell(Text(room.currentOccupancy.toString())), + DataCell(Text(room.status)), + DataCell(Text(room.studentNames.join(', '))), + DataCell(Text(room.numberOfStudents.toString())), + DataCell( + IconButton( + icon: Icon(Icons.edit), + onPressed: () { + _editStudentDetails(room); + }, + ), + ), + DataCell( + IconButton( + icon: Icon(Icons.delete), + onPressed: () { + _deleteStudentDetails(room); + }, + ), + ), + DataCell( + IconButton( + icon: Icon(Icons.add), + onPressed: () { + _showAddDialog(); + }, + ), + ), + ]); + }).toList(), + ), + ), + ); + } +} + +class RoomSearchDelegate extends SearchDelegate { + final List rooms; + + RoomSearchDelegate({required this.rooms}); + + @override + ThemeData appBarTheme(BuildContext context) { + final ThemeData theme = Theme.of(context); + return theme.copyWith( + appBarTheme: AppBarTheme( + backgroundColor: theme.scaffoldBackgroundColor, // Match with screen's UI theme + iconTheme: IconThemeData(color: theme.primaryColor), // Match with screen's UI theme + ), + ); + } + + @override + List buildActions(BuildContext context) { + return [ + IconButton( + icon: Icon(Icons.clear), + onPressed: () { + query = ''; + }, + ), + ]; + } + + @override + Widget buildLeading(BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back), + onPressed: () { + close(context, null); + }, + ); + } + + @override + Widget buildResults(BuildContext context) { + return _buildSearchResults(context); + } + + @override + Widget buildSuggestions(BuildContext context) { + return _buildSearchResults(context); + } + + Widget _buildSearchResults(BuildContext context) { + return ListView.builder( + itemCount: rooms.length, + itemBuilder: (context, index) { + return ListTile( + title: Text('Room No: ${rooms[index].roomNumber}'), + onTap: () { + close(context, rooms[index].roomNumber); + }, + ); + }, + ); + } +} + +void main() { + runApp(MaterialApp( + home: Managerooms(), + )); +} + diff --git a/lib/screens/Hostel/caretaker/managestudent.dart b/lib/screens/Hostel/caretaker/managestudent.dart index 11b48b8a..1c128a3d 100644 --- a/lib/screens/Hostel/caretaker/managestudent.dart +++ b/lib/screens/Hostel/caretaker/managestudent.dart @@ -1,5 +1,3 @@ -//All the 4 functionalities like add new student,edit existing student details,delete a student,search a student -// by his/her name via search bar are all perfectly working in this code.No need further debugging except to integrate API's from web team. import 'dart:convert'; import 'package:flutter/material.dart'; @@ -353,9 +351,11 @@ class _ManagestudentState extends State { }); } + @override Widget build(BuildContext context) { return Scaffold( + appBar: AppBar( title: Text('Manage Students'), backgroundColor: Color.fromARGB(255, 245, 103, 47), @@ -507,3 +507,4 @@ void main() { home: Managestudent(), )); } + diff --git a/lib/screens/Hostel/caretaker/noticeboard.dart b/lib/screens/Hostel/caretaker/noticeboard.dart index b1e3ac41..76ba05a8 100644 --- a/lib/screens/Hostel/caretaker/noticeboard.dart +++ b/lib/screens/Hostel/caretaker/noticeboard.dart @@ -1,10 +1,9 @@ -//All the 2 functionalities add new notice,remove existing notice are all perfectly -//working in this code with proper formatting.No need further debugging on this code. import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:fusion/Components/side_drawer.dart'; + class Notice { final String headline; final String description; @@ -13,6 +12,7 @@ class Notice { Notice(this.headline, this.description, this.date); } + class Noticeboard extends StatefulWidget { const Noticeboard({Key? key}) : super(key: key); @@ -21,6 +21,7 @@ class Noticeboard extends StatefulWidget { } class _NoticeboardState extends State { + List notices = []; // Define the 'notices' list @override @@ -54,12 +55,14 @@ class _NoticeboardState extends State { setState(() {}); } + @override Widget build(BuildContext context) { return Scaffold( drawer: SideDrawer(), appBar: AppBar( title: const Text('Notice Board'), + backgroundColor: const Color.fromARGB(255, 245, 103, 47), foregroundColor: Colors.white, ), @@ -133,10 +136,12 @@ class _NoticeboardState extends State { ), ), ], + ), ), floatingActionButton: FloatingActionButton( onPressed: () { + // Display dialog to add a new notice showDialog( context: context, @@ -212,4 +217,5 @@ class _NoticeboardState extends State { // Your implementation to invoke POST API // Example: http.post(url, body: {'headline': headline, 'description': description, 'file': file}); } + } diff --git a/lib/screens/Hostel/caretaker/report.dart b/lib/screens/Hostel/caretaker/report.dart index db8a7a89..614871ce 100644 --- a/lib/screens/Hostel/caretaker/report.dart +++ b/lib/screens/Hostel/caretaker/report.dart @@ -1,224 +1,225 @@ -import 'dart:convert'; -import 'package:flutter/material.dart'; -import 'package:fusion/Components/side_drawer.dart'; - -class Student { - final String name; - final int rollNumber; - bool isPresent; - - Student({ - required this.name, - required this.rollNumber, - this.isPresent = false, - }); -} - -class Report extends StatefulWidget { - const Report({Key? key}) : super(key: key); - - @override - _ReportState createState() => _ReportState(); -} - -class _ReportState extends State { - late DateTime selectedDate; - late List students; - late List filteredStudents; - - @override - void initState() { - super.initState(); - selectedDate = DateTime.now(); - _fetchStudentDetails(); - } - - Future _fetchStudentDetails() async { - // Simulating fetching student data from an API - final String studentData = ''' - [ - {"name": "John Doe", "rollNumber": 101}, - {"name": "Alice Smith", "rollNumber": 102}, - {"name": "Bob Johnson", "rollNumber": 103} - ] - '''; - final List studentList = json.decode(studentData); - setState(() { - students = studentList.map((student) => Student( - name: student['name'], - rollNumber: student['rollNumber'], - )).toList(); - filteredStudents = List.from(students); - }); - } - - void _searchStudents(String query) { - setState(() { - if (query.isEmpty) { - filteredStudents = List.from(students); - } else { - filteredStudents = students - .where((student) => - student.name.toLowerCase().contains(query.toLowerCase()) || - student.rollNumber.toString().contains(query)) - .toList(); - } - }); - } - - Future _selectDate(BuildContext context) async { - final DateTime? picked = await showDatePicker( - context: context, - initialDate: selectedDate, - firstDate: DateTime(2000), - lastDate: DateTime.now(), - selectableDayPredicate: (DateTime date) { - // Allow only past dates to be selected - return date.isBefore(DateTime.now()); - }, - ); - if (picked != null && picked != selectedDate) { - setState(() { - selectedDate = picked; - }); - } - } - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Report'), - ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Expanded( - child: TextButton( - onPressed: () => _selectDate(context), - child: Text( - 'Selected Date: ${selectedDate.year}-${selectedDate.month}-${selectedDate.day}', - style: TextStyle(fontSize: 16), - ), - ), - ), - IconButton( - icon: Icon(Icons.search), - onPressed: () { - showSearch( - context: context, - delegate: StudentSearchDelegate(students: students), - ); - }, - ), - ], - ), - ), - Expanded( - child: ListView.builder( - itemCount: filteredStudents.length, - itemBuilder: (context, index) { - return ListTile( - title: Text( - filteredStudents[index].name, - style: TextStyle(fontSize: 18), - ), - subtitle: Text( - 'Roll No: ${filteredStudents[index].rollNumber}', - style: TextStyle(fontSize: 14), - ), - trailing: IconButton( - icon: filteredStudents[index].isPresent - ? Icon(Icons.check_circle, color: Colors.green) - : Icon(Icons.cancel, color: Colors.red), - onPressed: () { - setState(() { - filteredStudents[index].isPresent = - !filteredStudents[index].isPresent; - }); - }, - ), - ); - }, - ), - ), - ], - ), - ); - } -} - -class StudentSearchDelegate extends SearchDelegate { - final List students; - - StudentSearchDelegate({required this.students}); - - @override - ThemeData appBarTheme(BuildContext context) { - final ThemeData theme = Theme.of(context); - return theme.copyWith( - appBarTheme: AppBarTheme( - backgroundColor: theme.scaffoldBackgroundColor, - iconTheme: IconThemeData(color: theme.primaryColor), - ), - ); - } - - @override - List buildActions(BuildContext context) { - return [ - IconButton( - icon: Icon(Icons.clear), - onPressed: () { - query = ''; - }, - ), - ]; - } - - @override - Widget buildLeading(BuildContext context) { - return IconButton( - icon: Icon(Icons.arrow_back), - onPressed: () { - close(context, null); - }, - ); - } - - @override - Widget buildResults(BuildContext context) { - return _buildSearchResults(context); - } - - @override - Widget buildSuggestions(BuildContext context) { - return _buildSearchResults(context); - } - - Widget _buildSearchResults(BuildContext context) { - return ListView.builder( - itemCount: students.length, - itemBuilder: (context, index) { - return ListTile( - title: Text(students[index].name), - subtitle: Text('Roll No: ${students[index].rollNumber}'), - onTap: () { - close(context, students[index]); - }, - ); - }, - ); - } -} - -void main() { - runApp(MaterialApp( - home: Report(), - )); -} + +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Student { + final String name; + final int rollNumber; + bool isPresent; + + Student({ + required this.name, + required this.rollNumber, + this.isPresent = false, + }); +} + +class Report extends StatefulWidget { + const Report({Key? key}) : super(key: key); + + @override + _ReportState createState() => _ReportState(); +} + +class _ReportState extends State { + late DateTime selectedDate; + late List students; + late List filteredStudents; + + @override + void initState() { + super.initState(); + selectedDate = DateTime.now(); + _fetchStudentDetails(); + } + + Future _fetchStudentDetails() async { + // Simulating fetching student data from an API + final String studentData = ''' + [ + {"name": "John Doe", "rollNumber": 101}, + {"name": "Alice Smith", "rollNumber": 102}, + {"name": "Bob Johnson", "rollNumber": 103} + ] + '''; + final List studentList = json.decode(studentData); + setState(() { + students = studentList.map((student) => Student( + name: student['name'], + rollNumber: student['rollNumber'], + )).toList(); + filteredStudents = List.from(students); + }); + } + + void _searchStudents(String query) { + setState(() { + if (query.isEmpty) { + filteredStudents = List.from(students); + } else { + filteredStudents = students + .where((student) => + student.name.toLowerCase().contains(query.toLowerCase()) || + student.rollNumber.toString().contains(query)) + .toList(); + } + }); + } + + Future _selectDate(BuildContext context) async { + final DateTime? picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime(2000), + lastDate: DateTime.now(), + selectableDayPredicate: (DateTime date) { + // Allow only past dates to be selected + return date.isBefore(DateTime.now()); + }, + ); + if (picked != null && picked != selectedDate) { + setState(() { + selectedDate = picked; + }); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Report'), + ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Expanded( + child: TextButton( + onPressed: () => _selectDate(context), + child: Text( + 'Selected Date: ${selectedDate.year}-${selectedDate.month}-${selectedDate.day}', + style: TextStyle(fontSize: 16), + ), + ), + ), + IconButton( + icon: Icon(Icons.search), + onPressed: () { + showSearch( + context: context, + delegate: StudentSearchDelegate(students: students), + ); + }, + ), + ], + ), + ), + Expanded( + child: ListView.builder( + itemCount: filteredStudents.length, + itemBuilder: (context, index) { + return ListTile( + title: Text( + filteredStudents[index].name, + style: TextStyle(fontSize: 18), + ), + subtitle: Text( + 'Roll No: ${filteredStudents[index].rollNumber}', + style: TextStyle(fontSize: 14), + ), + trailing: IconButton( + icon: filteredStudents[index].isPresent + ? Icon(Icons.check_circle, color: Colors.green) + : Icon(Icons.cancel, color: Colors.red), + onPressed: () { + setState(() { + filteredStudents[index].isPresent = + !filteredStudents[index].isPresent; + }); + }, + ), + ); + }, + ), + ), + ], + ), + ); + } +} + +class StudentSearchDelegate extends SearchDelegate { + final List students; + + StudentSearchDelegate({required this.students}); + + @override + ThemeData appBarTheme(BuildContext context) { + final ThemeData theme = Theme.of(context); + return theme.copyWith( + appBarTheme: AppBarTheme( + backgroundColor: theme.scaffoldBackgroundColor, + iconTheme: IconThemeData(color: theme.primaryColor), + ), + ); + } + + @override + List buildActions(BuildContext context) { + return [ + IconButton( + icon: Icon(Icons.clear), + onPressed: () { + query = ''; + }, + ), + ]; + } + + @override + Widget buildLeading(BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back), + onPressed: () { + close(context, null); + }, + ); + } + + @override + Widget buildResults(BuildContext context) { + return _buildSearchResults(context); + } + + @override + Widget buildSuggestions(BuildContext context) { + return _buildSearchResults(context); + } + + Widget _buildSearchResults(BuildContext context) { + return ListView.builder( + itemCount: students.length, + itemBuilder: (context, index) { + return ListTile( + title: Text(students[index].name), + subtitle: Text('Roll No: ${students[index].rollNumber}'), + onTap: () { + close(context, students[index]); + }, + ); + }, + ); + } +} + +void main() { + runApp(MaterialApp( + home: Report(), + )); +} \ No newline at end of file diff --git a/lib/screens/Hostel/caretaker/staffinfo.dart b/lib/screens/Hostel/caretaker/staffinfo.dart index 49caf93a..51ab79d4 100644 --- a/lib/screens/Hostel/caretaker/staffinfo.dart +++ b/lib/screens/Hostel/caretaker/staffinfo.dart @@ -1,66 +1,67 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:fusion/Components/side_drawer.dart'; - -class Staffinfo extends StatelessWidget { - const Staffinfo({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Staff Info'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - foregroundColor: Colors.white, - ), - body: Padding( - padding: EdgeInsets.only(left: 20, right: 20, top: 50), - child: SingleChildScrollView( - child: Center( - child: Column( - children: [ - for (int i = 1; i < 15; i++) - Card( - color: Color.fromARGB(255, 245, 103, 47), - child: ListTile( - title: Row( - children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Staff $i', - style: TextStyle( - color: Colors.white, - fontSize: 20, - ), - ), - Icon( - Icons.arrow_forward_ios, - color: Colors.white, - ), - ], - ), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: () { - // Add new staff info logic here - }, - child: Icon(Icons.add), - backgroundColor: Color.fromARGB(255, 255, 152, 111), - foregroundColor: Color(0xffffffff), - ), - ); - } -} + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Staffinfo extends StatelessWidget { + const Staffinfo({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Staff Info'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: EdgeInsets.only(left: 20, right: 20, top: 50), + child: SingleChildScrollView( + child: Center( + child: Column( + children: [ + for (int i = 1; i < 15; i++) + Card( + color: Color.fromARGB(255, 245, 103, 47), + child: ListTile( + title: Row( + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Staff $i', + style: TextStyle( + color: Colors.white, + fontSize: 20, + ), + ), + Icon( + Icons.arrow_forward_ios, + color: Colors.white, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + // Add new staff info logic here + }, + child: Icon(Icons.add), + backgroundColor: Color.fromARGB(255, 255, 152, 111), + foregroundColor: Color(0xffffffff), + ), + ); + } +} diff --git a/lib/screens/Hostel/student/allottedrooms.dart b/lib/screens/Hostel/student/allottedrooms.dart new file mode 100644 index 00000000..5cc22b76 --- /dev/null +++ b/lib/screens/Hostel/student/allottedrooms.dart @@ -0,0 +1,152 @@ +import 'dart:convert'; +import 'package:flutter/material.dart'; + +// Updated JSON data representing hostel details with room numbers +const String hostelData = ''' +[ + { + "hostelNumber": 1, + "students": [ + {"name": "Student 1", "rollNumber": "21bcs01", "program": "BTECH", "room": "F101"}, + {"name": "Student 2", "rollNumber": "21bcs02", "program": "BTECH", "room": "F101"}, + {"name": "Student 3", "rollNumber": "21bcs03", "program": "BTECH", "room": "F102"}, + {"name": "Student 4", "rollNumber": "21bcs04", "program": "BTECH", "room": "F102"}, + {"name": "Student 5", "rollNumber": "21bcs05", "program": "BTECH", "room": "S102"}, + {"name": "Student 6", "rollNumber": "21bcs06", "program": "BTECH", "room": "S102"}, + {"name": "Student 7", "rollNumber": "21bcs07", "program": "BTECH", "room": "S103"}, + {"name": "Student 8", "rollNumber": "21bcs08", "program": "BTECH", "room": "S103"}, + {"name": "Student 9", "rollNumber": "21bcs09", "program": "BTECH", "room": "F103"}, + {"name": "Student 10", "rollNumber": "21bcs10", "program": "BTECH", "room": "F103"} + ] + }, + { + "hostelNumber": 2, + "students": [ + {"name": "Student 11", "rollNumber": "22bcs01", "program": "BTECH", "room": "F201"}, + {"name": "Student 12", "rollNumber": "22bcs02", "program": "BTECH", "room": "F201"}, + {"name": "Student 13", "rollNumber": "22bcs03", "program": "BTECH", "room": "F202"}, + {"name": "Student 14", "rollNumber": "22bcs04", "program": "BTECH", "room": "F202"}, + {"name": "Student 15", "rollNumber": "22bcs05", "program": "BTECH", "room": "S202"}, + {"name": "Student 16", "rollNumber": "22bcs06", "program": "BTECH", "room": "S202"}, + {"name": "Student 17", "rollNumber": "22bcs07", "program": "BTECH", "room": "S203"}, + {"name": "Student 18", "rollNumber": "22bcs08", "program": "BTECH", "room": "S203"}, + {"name": "Student 19", "rollNumber": "22bcs09", "program": "BTECH", "room": "F203"}, + {"name": "Student 20", "rollNumber": "22bcs10", "program": "BTECH", "room": "F203"} + ] + }, + { + "hostelNumber": 3, + "students": [ + {"name": "Student 21", "rollNumber": "23bcs01", "program": "BTECH", "room": "F301"}, + {"name": "Student 22", "rollNumber": "23bcs02", "program": "BTECH", "room": "F301"}, + {"name": "Student 23", "rollNumber": "23bcs03", "program": "BTECH", "room": "F302"}, + {"name": "Student 24", "rollNumber": "23bcs04", "program": "BTECH", "room": "F302"}, + {"name": "Student 25", "rollNumber": "23bcs05", "program": "BTECH", "room": "S302"}, + {"name": "Student 26", "rollNumber": "23bcs06", "program": "BTECH", "room": "S302"}, + {"name": "Student 27", "rollNumber": "23bcs07", "program": "BTECH", "room": "S303"}, + {"name": "Student 28", "rollNumber": "23bcs08", "program": "BTECH", "room": "S303"}, + {"name": "Student 29", "rollNumber": "23bcs09", "program": "BTECH", "room": "F303"}, + {"name": "Student 30", "rollNumber": "23bcs10", "program": "BTECH", "room": "F303"} + ] + }, + { + "hostelNumber": 4, + "students": [ + {"name": "Student 31", "rollNumber": "24bcs01", "program": "BTECH", "room": "F401"}, + {"name": "Student 32", "rollNumber": "24bcs02", "program": "BTECH", "room": "F401"}, + {"name": "Student 33", "rollNumber": "24bcs03", "program": "BTECH", "room": "F402"}, + {"name": "Student 34", "rollNumber": "24bcs04", "program": "BTECH", "room": "F402"}, + {"name": "Student 35", "rollNumber": "24bcs05", "program": "BTECH", "room": "S402"}, + {"name": "Student 36", "rollNumber": "24bcs06", "program": "BTECH", "room": "S402"}, + {"name": "Student 37", "rollNumber": "24bcs07", "program": "BTECH", "room": "S403"}, + {"name": "Student 38", "rollNumber": "24bcs08", "program": "BTECH", "room": "S403"}, + {"name": "Student 39", "rollNumber": "24bcs09", "program": "BTECH", "room": "F403"}, + {"name": "Student 40", "rollNumber": "24bcs10", "program": "BTECH", "room": "F403"} + ] + } +] +'''; + +class Allottedrooms extends StatefulWidget { + @override + _AllottedroomsState createState() => _AllottedroomsState(); +} + +class _AllottedroomsState extends State { + final List> hostels = + (json.decode(hostelData) as List) + .map((i) => i as Map) + .toList(); + String? selectedHostel; + + @override + void initState() { + super.initState(); + selectedHostel = hostels[0]['hostelNumber'].toString(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Allotted Rooms'), + backgroundColor: const Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Column( + children: [ + DropdownButton( + value: selectedHostel, + onChanged: (String? newValue) { + setState(() { + selectedHostel = newValue; + }); + }, + items: hostels.map>((hostel) { + return DropdownMenuItem( + value: hostel['hostelNumber'].toString(), + child: Text( + 'Hostel ${hostel['hostelNumber']}', + style: TextStyle(color: Colors.black), + ), + ); + }).toList(), + ), + Expanded( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: DataTable( + columns: const [ + DataColumn(label: Text('Name')), + DataColumn(label: Text('Roll Number')), + DataColumn(label: Text('Program')), + DataColumn(label: Text('Room')), + ], + rows: (hostels.firstWhere( + (hostel) => + hostel['hostelNumber'].toString() == + selectedHostel)['students'] as List) + .map((student) { + return DataRow( + cells: [ + DataCell(Text(student['name'])), + DataCell(Text(student['rollNumber'])), + DataCell(Text(student['program'])), + DataCell(Text(student['room'])), + ], + ); + }).toList(), + ), + ), + ), + ], + ), + ); + } +} + +void main() { + runApp(MaterialApp( + home: Allottedrooms(), + )); +} diff --git a/lib/screens/Hostel/student/complaintregister.dart b/lib/screens/Hostel/student/complaintregister.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/screens/Hostel/student/fines.dart b/lib/screens/Hostel/student/fines.dart new file mode 100644 index 00000000..4e6d8a51 --- /dev/null +++ b/lib/screens/Hostel/student/fines.dart @@ -0,0 +1,112 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Fines extends StatelessWidget { + const Fines({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // JSON data representing fines + const String fineData = ''' + { + "MyFine": [ + { + "hall": "4", + "amount": 200, + "status": "paid", + "reason": "Hall fee payment", + "action": "done" + }, + { + "hall": "4", + "amount": 50, + "status": "unpaid", + "reason": "Using unauthorized appliance (fan)", + "action": "pay" + }, + { + "hall": "4", + "amount": 500, + "status": "unpaid", + "reason": "Damage to hall property", + "action": "pay" + }, + { + "hall": "4", + "amount": 100, + "status": "unpaid", + "reason": "Violation of hall rules", + "action": "pay" + } + ] + } + '''; + + final Map fines = json.decode(fineData); + + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Fines'), + backgroundColor: const Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'My Fines', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 10), + Expanded( + child: ListView.builder( + itemCount: fines['MyFine'].length, + itemBuilder: (context, index) { + var fine = fines['MyFine'][index]; + return Card( + margin: const EdgeInsets.only(bottom: 10), + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Hall: ${fine['hall']}'), + Text('Amount: \$${fine['amount']}'), + Text( + 'Status: ${fine['status'].toString().toUpperCase()}', + style: TextStyle( + color: fine['status'] == 'unpaid' + ? Colors.red + : Colors.green, + ), + ), + Text('Reason: ${fine['reason']}'), + if (fine['status'] == 'unpaid') + ElevatedButton( + onPressed: () { + // Implement action for unpaid fine + }, + child: Text(fine['action'].toString()), + ), + ], + ), + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +} + +void main() { + runApp(MaterialApp(home: Fines())); +} \ No newline at end of file diff --git a/lib/screens/Hostel/student/guestroom.dart b/lib/screens/Hostel/student/guestroom.dart new file mode 100644 index 00000000..a77b15c1 --- /dev/null +++ b/lib/screens/Hostel/student/guestroom.dart @@ -0,0 +1,320 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(MaterialApp( + home: Guestroom(), + )); +} + +class Guestroom extends StatefulWidget { + const Guestroom({Key? key}) : super(key: key); + + @override + _GuestroomState createState() => _GuestroomState(); +} + +class _GuestroomState extends State { + String? selectedHall; + DateTime? arrivalDate; + DateTime? departureDate; + TimeOfDay? arrivalTime; + TimeOfDay? departureTime; + int? numOfGuests; + String? nationality; + int? numOfRooms; + String? roomType; + String? guestName; + String? guestAddress; + String? guestEmail; + String? guestPhoneNumber; + bool availableRoom = false; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Guest Room'), + backgroundColor: const Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: SingleChildScrollView( + padding: const EdgeInsets.fromLTRB(20.0, 40.0, 20.0, 20.0), + child: Card( + elevation: 4, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Book Guest Room', + style: TextStyle( + fontSize: 23.0, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 20.0), + DropdownButtonFormField( + value: selectedHall, + onChanged: (String? newValue) { + setState(() { + selectedHall = newValue; + }); + }, + items: ['1', '2', '3', '4'].map((String value) { + return DropdownMenuItem( + value: value, + child: Text('Hall $value'), + ); + }).toList(), + decoration: InputDecoration( + labelText: 'Hall', + border: OutlineInputBorder(), + ), + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Arrival Date', + border: OutlineInputBorder(), + ), + onTap: () async { + final DateTime? picked = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime.now(), + lastDate: DateTime(2101), + ); + if (picked != null && picked != arrivalDate) { + setState(() { + arrivalDate = picked; + }); + } + }, + controller: TextEditingController( + text: arrivalDate != null + ? "${arrivalDate!.day}/${arrivalDate!.month}/${arrivalDate!.year}" + : "", + ), + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Departure Date', + border: OutlineInputBorder(), + ), + onTap: () async { + final DateTime? picked = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime.now(), + lastDate: DateTime(2101), + ); + if (picked != null && picked != departureDate) { + setState(() { + departureDate = picked; + }); + } + }, + controller: TextEditingController( + text: departureDate != null + ? "${departureDate!.day}/${departureDate!.month}/${departureDate!.year}" + : "", + ), + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Arrival Time', + border: OutlineInputBorder(), + ), + onTap: () async { + final TimeOfDay? picked = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); + if (picked != null && picked != arrivalTime) { + setState(() { + arrivalTime = picked; + }); + } + }, + controller: TextEditingController( + text: arrivalTime != null + ? "${arrivalTime!.hour}:${arrivalTime!.minute}" + : "", + ), + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Departure Time', + border: OutlineInputBorder(), + ), + onTap: () async { + final TimeOfDay? picked = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); + if (picked != null && picked != departureTime) { + setState(() { + departureTime = picked; + }); + } + }, + controller: TextEditingController( + text: departureTime != null + ? "${departureTime!.hour}:${departureTime!.minute}" + : "", + ), + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Number of Guests', + border: OutlineInputBorder(), + ), + keyboardType: TextInputType.number, + onChanged: (value) { + // Parse and set the number of guests + setState(() { + numOfGuests = int.tryParse(value); + }); + }, + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Nationality', + border: OutlineInputBorder(), + ), + onChanged: (value) { + setState(() { + nationality = value; + }); + }, + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Number of Rooms', + border: OutlineInputBorder(), + ), + keyboardType: TextInputType.number, + onChanged: (value) { + // Parse and set the number of rooms + setState(() { + numOfRooms = int.tryParse(value); + }); + }, + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Room Type', + border: OutlineInputBorder(), + ), + onChanged: (value) { + setState(() { + roomType = value; + }); + }, + ), + const SizedBox(height: 10.0), + SwitchListTile( + title: Text("Available Room"), + value: availableRoom, + onChanged: (newValue) { + setState(() { + availableRoom = newValue; + }); + }, + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Name of Guest', + border: OutlineInputBorder(), + ), + onChanged: (value) { + setState(() { + guestName = value; + }); + }, + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Guest Address', + border: OutlineInputBorder(), + ), + onChanged: (value) { + setState(() { + guestAddress = value; + }); + }, + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Guest Email', + border: OutlineInputBorder(), + ), + onChanged: (value) { + setState(() { + guestEmail = value; + }); + }, + ), + const SizedBox(height: 10.0), + TextFormField( + decoration: InputDecoration( + labelText: 'Guest Phone Number', + border: OutlineInputBorder(), + ), + keyboardType: TextInputType.phone, + onChanged: (value) { + setState(() { + guestPhoneNumber = value; + }); + }, + ), + const SizedBox(height: 20.0), + ElevatedButton.icon( + onPressed: () { + // Handle booking logic + }, + icon: const Icon(Icons.add, color: Colors.white), + label: const Text('Book New', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + ), + ), + const SizedBox(height: 10.0), + ElevatedButton.icon( + onPressed: () { + // Handle cancel logic + }, + icon: const Icon(Icons.close, color: Colors.white), + label: const Text('Cancel', style: TextStyle(color: Colors.white)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/Hostel/student/hostel_student.dart b/lib/screens/Hostel/student/hostel_student.dart new file mode 100644 index 00000000..4b117e3e --- /dev/null +++ b/lib/screens/Hostel/student/hostel_student.dart @@ -0,0 +1,194 @@ +import 'package:flutter/material.dart';import 'package:fusion/screens/Hostel/student/allottedrooms.dart'; + +import 'package:fusion/screens/Hostel/student/fines.dart'; +import 'package:fusion/screens/Hostel/student/guestroom.dart'; +import 'package:fusion/screens/Hostel/student/leaveapplication.dart'; +import 'package:fusion/screens/Hostel/student/noticeboard.dart'; + + +import 'package:fusion/Components/side_drawer.dart'; + +class Hostelstudent extends StatelessWidget { + const Hostelstudent({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Account'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Container( + padding: const EdgeInsets.all(20.0), + child: Container( + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: 1.0, + mainAxisSpacing: 5.0, + crossAxisSpacing: 5.0, + ), + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Guestroom()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.add_home, + color: Colors.white, + size: 30, + ), + Text( + 'Guest Room', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Allottedrooms()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.home, + color: Colors.white, + size: 30, + ), + Text( + 'Alloted rooms', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Fines()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.monetization_on, + color: Colors.white, + size: 30, + ), + Text( + 'Manage Fines', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + ), + + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Leaveapplication()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.card_travel, + color: Colors.white, + size: 30, + ), + Text( + 'Leave', + style: TextStyle(color: Colors.white, fontSize: 15), + ), + Text( + 'Application', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Noticeboard()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.dashboard, + color: Colors.white, + size: 30, + ), + Text( + 'Notice Board', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + + ]), + ), + ), + ); + } +} diff --git a/lib/screens/Hostel/student/leaveapplication.dart b/lib/screens/Hostel/student/leaveapplication.dart new file mode 100644 index 00000000..0cfc81cd --- /dev/null +++ b/lib/screens/Hostel/student/leaveapplication.dart @@ -0,0 +1,124 @@ +import 'package:flutter/material.dart'; + +class Leaveapplication extends StatefulWidget { + const Leaveapplication({Key? key}) : super(key: key); + + @override + _LeaveapplicationState createState() => _LeaveapplicationState(); +} + +class _LeaveapplicationState extends State { + final GlobalKey _formKey = GlobalKey(); + String? studentName; + String? rollNumber; + String? phoneNumber; + String? reason; + DateTime? startDate; + DateTime? endDate; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Leave Application'), + backgroundColor: const Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: Card( + elevation: 4, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), + child: Padding( + padding: const EdgeInsets.all(20), + child: Form( + key: _formKey, + child: ListView( + children: [ + TextFormField( + decoration: const InputDecoration(labelText: 'Student Name'), + onSaved: (String? value) { + studentName = value; + }, + ), + TextFormField( + decoration: const InputDecoration(labelText: 'Roll Number'), + onSaved: (String? value) { + rollNumber = value; + }, + ), + TextFormField( + decoration: const InputDecoration(labelText: 'Phone Number'), + onSaved: (String? value) { + phoneNumber = value; + }, + ), + TextFormField( + decoration: const InputDecoration(labelText: 'Reason'), + onSaved: (String? value) { + reason = value; + }, + ), + const SizedBox(height: 20), + ElevatedButton( + onPressed: () async { + final DateTime? picked = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime.now(), + lastDate: DateTime(2101), + ); + if (picked != null) { + setState(() { + startDate = picked; + }); + } + }, + child: Text( + startDate != null + ? 'Start Date: ${startDate!.day}/${startDate!.month}/${startDate!.year}' + : 'Select Start Date', + ), + ), + const SizedBox(height: 20), + ElevatedButton( + onPressed: () async { + final DateTime? picked = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime.now(), + lastDate: DateTime(2101), + ); + if (picked != null) { + setState(() { + endDate = picked; + }); + } + }, + child: Text( + endDate != null + ? 'End Date: ${endDate!.day}/${endDate!.month}/${endDate!.year}' + : 'Select End Date', + ), + ), + const SizedBox(height: 20), + ElevatedButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + _formKey.currentState!.save(); + // TODO: Implement submit functionality + } + }, + child: const Text('Submit'), + ), + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/Hostel/student/noticeboard.dart b/lib/screens/Hostel/student/noticeboard.dart new file mode 100644 index 00000000..3e3cd7b7 --- /dev/null +++ b/lib/screens/Hostel/student/noticeboard.dart @@ -0,0 +1,190 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Noticeboard extends StatelessWidget { + final List> notices = [ + { + "hall": "4", + "heading": "Annual Sports Meet", + "madeBy": { + "name": "John Doe", + "rollNo": "21bcs001" + }, + "description": "Get ready for an action-packed day of sports!", + "content": [ + "Date: April 25, 2024", + "Venue: Sports Ground", + "Events: Football, Cricket, Badminton, and more" + ] + }, + { + "hall": "3", + "heading": "Guest Lecture on AI", + "madeBy": { + "name": "Jane Smith", + "rollNo": "21bcs002" + }, + "description": "Learn about the latest advancements in Artificial Intelligence.", + "content": [ + "Speaker: Dr. Michael Johnson", + "Date: May 5, 2024", + "Time: 10:00 AM - 12:00 PM", + "Venue: Lecture Hall 1" + ] + }, + { + "hall": "2", + "heading": "Web Development Workshop", + "madeBy": { + "name": "Alice Lee", + "rollNo": "21bcs003" + }, + "description": "Enhance your web development skills with hands-on sessions.", + "content": [ + "Date: May 15, 2024", + "Time: 9:00 AM - 5:00 PM", + "Venue: Computer Lab 3", + "Topics: HTML, CSS, JavaScript" + ] + }, + { + "hall": "1", + "heading": "Cultural Night", + "madeBy": { + "name": "David Brown", + "rollNo": "21bcs004" + }, + "description": "Join us for an evening of music, dance, and fun!", + "content": [ + "Date: June 10, 2024", + "Time: 6:00 PM onwards", + "Venue: Auditorium", + "Performances: Music bands, Dance groups, Comedy acts" + ] + }, + { + "hall": "5", + "heading": "Congratulations to Toppers", + "madeBy": { + "name": "Emily Taylor", + "rollNo": "21bcs005" + }, + "description": "Celebrating the academic excellence of our top performers!", + "content": [ + "Top Scorers: John Smith, Alice Johnson, Michael Lee", + "Subject Toppers: Mathematics, Physics, Computer Science", + "Prize Distribution Ceremony: June 5, 2024" + ] + } + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Notice Board'), + backgroundColor: const Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: ListView.builder( + itemCount: notices.length, + itemBuilder: (context, index) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Card( + elevation: 4, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: InkWell( + onTap: () { + _showNoticeDetails(context, notices[index]); + }, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + notices[index]['heading'], + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + ), + Text( + 'Made By: ${notices[index]['madeBy']['name']} - ${notices[index]['madeBy']['rollNo']}', + style: TextStyle( + color: Colors.grey[700], + ), + ), + ], + ), + SizedBox(height: 8), + Text( + notices[index]['description'], + style: TextStyle( + color: Colors.grey[700], + ), + ), + ], + ), + ), + ), + ), + ); + }, + ), + ); + } + + void _showNoticeDetails(BuildContext context, Map notice) { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text(notice['heading']), + content: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + 'Description: ${notice['description']}', + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 8), + ...List.from(notice['content'] + .map((content) => Text(content))), + SizedBox(height: 8), + Text( + 'Made By: ${notice['madeBy']['name']} - ${notice['madeBy']['rollNo']}', + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text('Close'), + ), + ], + ); + }, + ); + } +} + +void main() { + runApp(MaterialApp( + home: Noticeboard(), + )); +} diff --git a/lib/screens/Hostel/superadmin/add_hostel.dart b/lib/screens/Hostel/superadmin/add_hostel.dart new file mode 100644 index 00000000..b6d6da55 --- /dev/null +++ b/lib/screens/Hostel/superadmin/add_hostel.dart @@ -0,0 +1,135 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class AddHostelScreen extends StatefulWidget { + const AddHostelScreen({Key? key}) : super(key: key); + + @override + _AddHostelScreenState createState() => _AddHostelScreenState(); +} + +class _AddHostelScreenState extends State { + final _formKey = GlobalKey(); + + String? _selectedSeater; + + final List _seaterTypes = ['Single', 'Double', 'Triple']; + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Add Hostel'), + backgroundColor: const Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: Card( + elevation: 5, + child: Padding( + padding: const EdgeInsets.all(20), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Add Hostel', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 20), + TextFormField( + decoration: InputDecoration( + labelText: 'Hall ID', + border: OutlineInputBorder(), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter Hall ID'; + } + return null; + }, + ), + SizedBox(height: 20), + TextFormField( + decoration: InputDecoration( + labelText: 'Max Accommodation', + border: OutlineInputBorder(), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter Max Accommodation'; + } + return null; + }, + ), + SizedBox(height: 20), + TextFormField( + decoration: InputDecoration( + labelText: 'Assigned Batch', + border: OutlineInputBorder(), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter Assigned Batch'; + } + return null; + }, + ), + SizedBox(height: 20), + DropdownButtonFormField( + decoration: InputDecoration( + labelText: 'Type of Seater', + border: OutlineInputBorder(), + ), + value: _selectedSeater, + items: _seaterTypes.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + onChanged: (value) { + setState(() { + _selectedSeater = value; + }); + }, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please select Type of Seater'; + } + return null; + }, + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + _showSuccessSnackBar(); + } + }, + child: Text('Add Hostel'), + style: ElevatedButton.styleFrom( + primary: const Color.fromARGB(255, 245, 103, 47), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 50), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } + + void _showSuccessSnackBar() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Hall successfully added'), + ), + ); + } +} diff --git a/lib/screens/Hostel/superadmin/assign_batch.dart b/lib/screens/Hostel/superadmin/assign_batch.dart new file mode 100644 index 00000000..9bfb50be --- /dev/null +++ b/lib/screens/Hostel/superadmin/assign_batch.dart @@ -0,0 +1,120 @@ +import 'package:flutter/material.dart'; + +class AssignBatchScreen extends StatefulWidget { + const AssignBatchScreen({Key? key}) : super(key: key); + + @override + _AssignBatchScreenState createState() => _AssignBatchScreenState(); +} + +class _AssignBatchScreenState extends State { + final _formKey = GlobalKey(); + + String? _selectedHall; + String? _batchID; + + final List _hallList = ['Hall 1', 'Hall 2', 'Hall 3', 'Hall 4', 'Hall 5']; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Assign Batch'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), // Background color + foregroundColor: Colors.white, // Foreground color (for back button and title) + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: Card( + elevation: 5, + child: Padding( + padding: const EdgeInsets.all(20), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Assign Batch', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 20), + DropdownButtonFormField( + decoration: InputDecoration( + labelText: 'Select Hall', + border: OutlineInputBorder(), + ), + value: _selectedHall, + items: _hallList.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + onChanged: (value) { + setState(() { + _selectedHall = value; + }); + }, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please select a hall'; + } + return null; + }, + ), + SizedBox(height: 20), + TextFormField( + decoration: InputDecoration( + labelText: 'Batch ID', + border: OutlineInputBorder(), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter Batch ID'; + } + return null; + }, + onChanged: (value) { + setState(() { + _batchID = value; + }); + }, + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + _assignBatch(); + } + }, + child: Text('Assign'), + style: ElevatedButton.styleFrom( + primary: Color.fromARGB(255, 245, 103, 47), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 50), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } + + void _assignBatch() { + // Simulate assigning batch logic + // Replace this with actual logic to assign batch + String message = 'Batch successfully assigned to $_selectedHall'; + _showSuccessSnackBar(message); + } + + void _showSuccessSnackBar(String message) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(message), + ), + ); + } +} diff --git a/lib/screens/Hostel/superadmin/assign_caretaker.dart b/lib/screens/Hostel/superadmin/assign_caretaker.dart new file mode 100644 index 00000000..5df0ad41 --- /dev/null +++ b/lib/screens/Hostel/superadmin/assign_caretaker.dart @@ -0,0 +1,122 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class AssignCaretakerScreen extends StatefulWidget { + const AssignCaretakerScreen({Key? key}) : super(key: key); + + @override + _AssignCaretakerScreenState createState() => _AssignCaretakerScreenState(); +} + +class _AssignCaretakerScreenState extends State { + final _formKey = GlobalKey(); + + String? _selectedHall; + String? _caretakerUsername; + + final List _hallList = ['1', '2', '3', '4']; + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Assign Caretaker'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: Card( + elevation: 5, + child: Padding( + padding: const EdgeInsets.all(20), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Assign Caretaker', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 20), + DropdownButtonFormField( + decoration: InputDecoration( + labelText: 'Select Hall', + border: OutlineInputBorder(), + ), + value: _selectedHall, + items: _hallList.map((String value) { + return DropdownMenuItem( + value: value, + child: Text('Hall $value'), + ); + }).toList(), + onChanged: (value) { + setState(() { + _selectedHall = value; + }); + }, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please select a hall'; + } + return null; + }, + ), + SizedBox(height: 20), + TextFormField( + decoration: InputDecoration( + labelText: 'Caretaker Username', + border: OutlineInputBorder(), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter caretaker username'; + } + return null; + }, + onChanged: (value) { + setState(() { + _caretakerUsername = value; + }); + }, + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + _assignCaretaker(); + } + }, + child: Text('Assign'), + style: ElevatedButton.styleFrom( + primary: Color.fromARGB(255, 245, 103, 47), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 50), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } + + void _assignCaretaker() { + // Simulate assigning caretaker logic + // Replace this with actual logic to assign caretaker + String message = 'Caretaker successfully assigned to Hall $_selectedHall'; + _showSuccessSnackBar(message); + } + + void _showSuccessSnackBar(String message) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(message), + ), + ); + } +} diff --git a/lib/screens/Hostel/superadmin/assign_warden.dart b/lib/screens/Hostel/superadmin/assign_warden.dart new file mode 100644 index 00000000..5e76f0eb --- /dev/null +++ b/lib/screens/Hostel/superadmin/assign_warden.dart @@ -0,0 +1,123 @@ +// assign_warden.dart +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class AssignWardenScreen extends StatefulWidget { + const AssignWardenScreen({Key? key}) : super(key: key); + + @override + _AssignWardenScreenState createState() => _AssignWardenScreenState(); +} + +class _AssignWardenScreenState extends State { + final _formKey = GlobalKey(); + + String? _selectedHall; + String? _wardenID; + + final List _hallList = ['Hall 1', 'Hall 2', 'Hall 3', 'Hall 4', 'Hall 5']; + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Assign Warden'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: Card( + elevation: 5, + child: Padding( + padding: const EdgeInsets.all(20), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Assign Warden', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 20), + DropdownButtonFormField( + decoration: InputDecoration( + labelText: 'Select Hall', + border: OutlineInputBorder(), + ), + value: _selectedHall, + items: _hallList.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + onChanged: (value) { + setState(() { + _selectedHall = value; + }); + }, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please select a hall'; + } + return null; + }, + ), + SizedBox(height: 20), + TextFormField( + decoration: InputDecoration( + labelText: 'Warden ID', + border: OutlineInputBorder(), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter Warden ID'; + } + return null; + }, + onChanged: (value) { + setState(() { + _wardenID = value; + }); + }, + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + _assignWarden(); + } + }, + child: Text('Assign'), + style: ElevatedButton.styleFrom( + primary: Color.fromARGB(255, 245, 103, 47), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 50), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } + + void _assignWarden() { + // Simulate assigning warden logic + // Replace this with actual logic to assign warden + String message = 'Warden successfully assigned to $_selectedHall'; + _showSuccessSnackBar(message); + } + + void _showSuccessSnackBar(String message) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(message), + ), + ); + } +} diff --git a/lib/screens/Hostel/superadmin/hostel_admin.dart b/lib/screens/Hostel/superadmin/hostel_admin.dart new file mode 100644 index 00000000..74798068 --- /dev/null +++ b/lib/screens/Hostel/superadmin/hostel_admin.dart @@ -0,0 +1,116 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/screens/Hostel/superadmin/add_hostel.dart'; +import 'package:fusion/screens/Hostel/superadmin/assign_warden.dart'; +import 'package:fusion/screens/Hostel/superadmin/assign_batch.dart'; +import 'package:fusion/screens/Hostel/superadmin/assign_caretaker.dart'; +import 'package:fusion/screens/Hostel/superadmin/view_hostel_history.dart'; +import 'package:fusion/screens/Hostel/superadmin/view_hostel.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class HostelAdmin extends StatelessWidget { + const HostelAdmin({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Hostel Admin'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Container( + padding: const EdgeInsets.all(20.0), + child: Container( + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: 1.0, + mainAxisSpacing: 5.0, + crossAxisSpacing: 5.0, + ), + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => AddHostelScreen()), + ); + }, + child: buildCard(Icons.add, 'Add Hostel', context), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => AssignWardenScreen()), + ); + }, + child: buildCard(Icons.person_add_alt_1, 'Assign Warden', context), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => AssignBatchScreen()), + ); + }, + child: buildCard(Icons.batch_prediction, 'Assign Batch', context), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => AssignCaretakerScreen()), + ); + }, + child: buildCard(Icons.person_add, 'Assign Caretaker', context), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => ViewHostelHistoryScreen()), + ); + }, + child: buildCard(Icons.history, 'View Hostel History', context), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => ViewHostelScreen()), + ); + }, + child: buildCard(Icons.home, 'View Hostel', context), + ), + ], + ), + ), + ), + ); + } + + Widget buildCard(IconData icon, String title, BuildContext context) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + icon, + color: Colors.white, + size: 30, + ), + Text( + title, + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ); + } +} diff --git a/lib/screens/Hostel/superadmin/view_hostel.dart b/lib/screens/Hostel/superadmin/view_hostel.dart new file mode 100644 index 00000000..773ed7a7 --- /dev/null +++ b/lib/screens/Hostel/superadmin/view_hostel.dart @@ -0,0 +1,109 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class ViewHostelScreen extends StatelessWidget { + const ViewHostelScreen({Key? key}) : super(key: key); + + // Define the hostel data + static const List> hostelData = [ + { + "hostels": [ + { + "hallId": "1", + "hallName": "Hall 1", + "seaterType": "single", + "maxAccommodation": 400, + "occupied": 400, + "vacantSeats": 0, + "assignedBatch": "2019", + "assignedCaretaker": "None", + "assignedWardenID": "None" + }, + { + "hallId": "2", + "hallName": "Hall 2", + "seaterType": "single", + "maxAccommodation": 500, + "occupied": 400, + "vacantSeats": 100, + "assignedBatch": "2021", + "assignedCaretaker": "shyam", + "assignedWardenID": "GD" + }, + { + "hallId": "3", + "hallName": "Hall 3", + "seaterType": "single", + "maxAccommodation": 400, + "occupied": 380, + "vacantSeats": 20, + "assignedBatch": "2019", + "assignedCaretaker": "pankaj", + "assignedWardenID": "None" + } + ] +} + + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('View Hostel'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: const EdgeInsets.all(16.0), + child: Card( + elevation: 5, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: Text( + 'Hostel List', + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + ), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: DataTable( + columns: const [ + DataColumn(label: Text('Hall ID')), + DataColumn(label: Text('Hall Name')), + DataColumn(label: Text('Seater Type')), + DataColumn(label: Text('Max Accommodation')), + DataColumn(label: Text('Occupied')), + DataColumn(label: Text('Vacant Seats')), + DataColumn(label: Text('Assigned Batch')), + DataColumn(label: Text('Assigned Caretaker')), + DataColumn(label: Text('Assigned Warden ID')), + ], + rows: hostelData.map((data) { + return DataRow( + cells: [ + DataCell(Text(data['hallId'])), + DataCell(Text(data['hallName'])), + DataCell(Text(data['seaterType'])), + DataCell(Text(data['maxAccommodation'].toString())), + DataCell(Text(data['occupied'].toString())), + DataCell(Text(data['vacantSeats'].toString())), + DataCell(Text(data['assignedBatch'])), + DataCell(Text(data['assignedCaretaker'])), + DataCell(Text(data['assignedWardenID'])), + ], + ); + }).toList(), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/Hostel/superadmin/view_hostel_history.dart b/lib/screens/Hostel/superadmin/view_hostel_history.dart new file mode 100644 index 00000000..75258a7e --- /dev/null +++ b/lib/screens/Hostel/superadmin/view_hostel_history.dart @@ -0,0 +1,146 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class ViewHostelHistoryScreen extends StatefulWidget { + const ViewHostelHistoryScreen({Key? key}) : super(key: key); + + @override + _ViewHostelHistoryScreenState createState() => _ViewHostelHistoryScreenState(); +} + +class _ViewHostelHistoryScreenState extends State { + String _selectedHall = 'Hall 1'; // Default selected hall + static const Map? hostelHistoryData = { + "Hall 1": [ + { + "hall": "Hall 1", + "batch": "2019", + "caretaker": "Pankaj", + "warden": "None", + "date": "2024-04-18" + }, + { + "hall": "Hall 1", + "batch": "2020", + "caretaker": "Pankaj", + "warden": "None", + "date": "2024-04-18" + } + ], + "Hall 2": [ + { + "hall": "Hall 2", + "batch": "2019", + "caretaker": "Anita", + "warden": "None", + "date": "2024-04-18" + }, + { + "hall": "Hall 2", + "batch": "2020", + "caretaker": "Anita", + "warden": "None", + "date": "2024-04-18" + } + ], + // Add more hostel histories as needed + }; + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: Text('View Hostel History - $_selectedHall'), // Display selected hall + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Column( + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: DropdownButton( + value: _selectedHall, + onChanged: (newValue) { + setState(() { + _selectedHall = newValue!; + }); + }, + items: hostelHistoryData?.keys.map((hall) { + return DropdownMenuItem( + value: hall, + child: Text(hall), + ); + }).toList(), + ), + ), + Card( + elevation: 3, + margin: EdgeInsets.all(16.0), + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Table( + border: TableBorder.all(color: Colors.grey), + columnWidths: { + 0: FlexColumnWidth(1), + 1: FlexColumnWidth(1), + 2: FlexColumnWidth(1), + 3: FlexColumnWidth(1), + 4: FlexColumnWidth(1), + }, + children: [ + _buildTableRow('Hall', 'Batch', 'Caretaker', 'Warden', 'Date'), + ..._buildRows(), + ], + ), + ), + ), + ], + ), + ); + } + + List _buildRows() { + List rows = []; + hostelHistoryData?[_selectedHall]?.forEach((history) { + rows.add( + TableRow( + children: [ + _buildTableCell(history['hall']), + _buildTableCell(history['batch']), + _buildTableCell(history['caretaker']), + _buildTableCell(history['warden']), + _buildTableCell(history['date']), + ], + ), + ); + }); + return rows; + } + + Widget _buildTableCell(String value) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Text(value), + ); + } + + TableRow _buildTableRow(String hall, String batch, String caretaker, String warden, String date) { + return TableRow( + decoration: BoxDecoration(color: Colors.grey[300]), + children: [ + _buildTableCell(hall), + _buildTableCell(batch), + _buildTableCell(caretaker), + _buildTableCell(warden), + _buildTableCell(date), + ], + ); + } +} + +void main() { + runApp(MaterialApp( + home: ViewHostelHistoryScreen(), + )); +} diff --git a/lib/screens/Hostel/warden/hostel_warden.dart b/lib/screens/Hostel/warden/hostel_warden.dart index d28e38d9..79b182ae 100644 --- a/lib/screens/Hostel/warden/hostel_warden.dart +++ b/lib/screens/Hostel/warden/hostel_warden.dart @@ -1,187 +1,189 @@ -// ignore_for_file: prefer_const_constructors - -import 'package:flutter/material.dart'; -import 'package:fusion/Components/side_drawer.dart'; -import 'package:fusion/screens/Hostel/warden/managerooms.dart'; -import 'package:fusion/screens/Hostel/warden/managestudent.dart'; -import 'package:fusion/screens/Hostel/warden/noticeboard.dart'; -import 'package:fusion/screens/Hostel/warden/report.dart'; - -import 'package:fusion/screens/Hostel/warden/staffinfo.dart'; - -class Account extends StatelessWidget { - const Account({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Account'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - foregroundColor: Colors.white, - ), - body: Container( - padding: const EdgeInsets.all(20.0), - child: Container( - child: GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - childAspectRatio: 1.0, - mainAxisSpacing: 5.0, - crossAxisSpacing: 5.0, - ), - children: [ - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Staffinfo()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.person, - color: Colors.white, - size: 30, - ), - Text( - 'Staff Info', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Managerooms()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.person, - color: Colors.white, - size: 30, - ), - Text( - 'Staff Info', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Report()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.report, - color: Colors.white, - size: 30, - ), - Text( - 'Report', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Managestudent()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.school, - color: Colors.white, - size: 30, - ), - Text( - 'Manage', - style: TextStyle(color: Colors.white, fontSize: 15), - ), - Text( - 'Student', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Noticeboard()), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Color.fromARGB(255, 245, 103, 47), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Icon( - Icons.dashboard, - color: Colors.white, - size: 30, - ), - Text( - 'Notice Board', - style: TextStyle(color: Colors.white, fontSize: 15), - ) - ], - ), - ), - ), - - ]), - ), - ), - ); - } -} + +// ignore_for_file: prefer_const_constructors + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/screens/Hostel/warden/managerooms.dart'; +import 'package:fusion/screens/Hostel/warden/managestudent.dart'; +import 'package:fusion/screens/Hostel/warden/noticeboard.dart'; +import 'package:fusion/screens/Hostel/warden/report.dart'; + +import 'package:fusion/screens/Hostel/warden/staffinfo.dart'; + +class Account extends StatelessWidget { + const Account({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Account'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Container( + padding: const EdgeInsets.all(20.0), + child: Container( + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: 1.0, + mainAxisSpacing: 5.0, + crossAxisSpacing: 5.0, + ), + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Staffinfo()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.person, + color: Colors.white, + size: 30, + ), + Text( + 'Staff Info', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Managerooms()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.person, + color: Colors.white, + size: 30, + ), + Text( + 'Staff Info', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Report()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.report, + color: Colors.white, + size: 30, + ), + Text( + 'Report', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Managestudent()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.school, + color: Colors.white, + size: 30, + ), + Text( + 'Manage', + style: TextStyle(color: Colors.white, fontSize: 15), + ), + Text( + 'Student', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => Noticeboard()), + ); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color.fromARGB(255, 245, 103, 47), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon( + Icons.dashboard, + color: Colors.white, + size: 30, + ), + Text( + 'Notice Board', + style: TextStyle(color: Colors.white, fontSize: 15), + ) + ], + ), + ), + ), + + ]), + ), + ), + ); + } +} + diff --git a/lib/screens/Hostel/warden/managerooms.dart b/lib/screens/Hostel/warden/managerooms.dart index 9d149eb5..53e77e79 100644 --- a/lib/screens/Hostel/warden/managerooms.dart +++ b/lib/screens/Hostel/warden/managerooms.dart @@ -1,293 +1,295 @@ -import 'dart:convert'; -import 'package:flutter/material.dart'; - -class Room { - final int roomNumber; - final int capacity; - final int currentOccupancy; - final String status; - final List studentNames; - final int numberOfStudents; - - Room({ - required this.roomNumber, - required this.capacity, - required this.currentOccupancy, - required this.status, - required this.studentNames, - required this.numberOfStudents, - }); -} - -class Managerooms extends StatefulWidget { - const Managerooms({Key? key}) : super(key: key); - - @override - _ManageroomsState createState() => _ManageroomsState(); -} - -class _ManageroomsState extends State { - List rooms = []; - List filteredRooms = []; - - @override - void initState() { - super.initState(); - _fetchRoomDetails(); - } - - Future _fetchRoomDetails() async { - // Simulating GET API call to fetch room details - final String roomData = ''' - [ - {"roomNumber": 101, "capacity": 2, "currentOccupancy": 1, "status": "Partially Allotted", "studentNames": ["John Doe"], "numberOfStudents": 1}, - {"roomNumber": 102, "capacity": 3, "currentOccupancy": 2, "status": "Fully Allotted", "studentNames": ["Alice", "Bob"], "numberOfStudents": 2}, - {"roomNumber": 103, "capacity": 4, "currentOccupancy": 4, "status": "Fully Allotted", "studentNames": ["Charlie", "David", "Eve", "Frank"], "numberOfStudents": 4}, - ] - '''; - final List roomList = json.decode(roomData); - setState(() { - rooms = roomList.map((room) => Room( - roomNumber: room['roomNumber'], - capacity: room['capacity'], - currentOccupancy: room['currentOccupancy'], - status: room['status'], - studentNames: List.from(room['studentNames']), - numberOfStudents: room['numberOfStudents'], - )).toList(); - filteredRooms = List.from(rooms); - }); - } - - Future _editStudentDetails(Room room) async { - // Display dialog to edit student details - showDialog( - context: context, - builder: (BuildContext context) { - // Implement the edit room details dialog - return AlertDialog( - title: Text('Edit Student Details'), - content: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Add fields to edit student details - ], - ), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('Cancel'), - ), - ElevatedButton( - onPressed: () { - // Perform the edit operation here - // Update the room details - // Simulate POST API call to update room details - Navigator.of(context).pop(); - }, - child: Text('Submit'), - ), - ], - ); - }, - ); - } - - Future _deleteStudentDetails(Room room) async { - // Show confirmation dialog before deleting the student - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text('Confirm Deletion'), - content: Text('Are you sure you want to delete the student?'), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('Cancel'), - ), - ElevatedButton( - onPressed: () { - // Delete the student from the room - _deleteStudent(room); - Navigator.of(context).pop(); - }, - child: Text('Delete'), - ), - ], - ); - }, - ); - } - - void _deleteStudent(Room room) { - setState(() { - // Implement logic to delete the student from the room - }); - // Simulate DELETE API call to delete student details - } - - Future _showAddDialog() async { - // Implement add student to room dialog - } - - void _searchRooms(int roomNumber) { - setState(() { - if (roomNumber != 0) { - filteredRooms = rooms.where((room) => room.roomNumber == roomNumber).toList(); - } else { - filteredRooms.clear(); // Clear filtered list if no search is active - filteredRooms.addAll(rooms); // Repopulate with all rooms - } - }); - } - - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Manage Rooms'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - actions: [ - IconButton( - icon: Icon(Icons.search), - onPressed: () async { - final int? result = await showSearch( - context: context, - delegate: RoomSearchDelegate(rooms: rooms), - ); - if (result != null) { - _searchRooms(result); - } - }, - ), - ], - ), - body: SingleChildScrollView( - child: DataTable( - columns: const [ - DataColumn(label: Text('Room No')), - DataColumn(label: Text('Capacity')), - DataColumn(label: Text('Current Occupancy')), - DataColumn(label: Text('Status')), - DataColumn(label: Text('Student Names')), - DataColumn(label: Text('No of Students')), - DataColumn(label: Text('Edit')), - DataColumn(label: Text('Delete')), - DataColumn(label: Text('Add')), - ], - rows: filteredRooms.map((room) { - return DataRow(cells: [ - DataCell(Text(room.roomNumber.toString())), - DataCell(Text(room.capacity.toString())), - DataCell(Text(room.currentOccupancy.toString())), - DataCell(Text(room.status)), - DataCell(Text(room.studentNames.join(', '))), - DataCell(Text(room.numberOfStudents.toString())), - DataCell( - IconButton( - icon: Icon(Icons.edit), - onPressed: () { - _editStudentDetails(room); - }, - ), - ), - DataCell( - IconButton( - icon: Icon(Icons.delete), - onPressed: () { - _deleteStudentDetails(room); - }, - ), - ), - DataCell( - IconButton( - icon: Icon(Icons.add), - onPressed: () { - _showAddDialog(); - }, - ), - ), - ]); - }).toList(), - ), - ), - ); - } -} - -class RoomSearchDelegate extends SearchDelegate { - final List rooms; - - RoomSearchDelegate({required this.rooms}); - - @override - ThemeData appBarTheme(BuildContext context) { - final ThemeData theme = Theme.of(context); - return theme.copyWith( - appBarTheme: AppBarTheme( - backgroundColor: theme.scaffoldBackgroundColor, // Match with screen's UI theme - iconTheme: IconThemeData(color: theme.primaryColor), // Match with screen's UI theme - ), - ); - } - - @override - List buildActions(BuildContext context) { - return [ - IconButton( - icon: Icon(Icons.clear), - onPressed: () { - query = ''; - }, - ), - ]; - } - - @override - Widget buildLeading(BuildContext context) { - return IconButton( - icon: Icon(Icons.arrow_back), - onPressed: () { - close(context, null); - }, - ); - } - - @override - Widget buildResults(BuildContext context) { - return _buildSearchResults(context); - } - - @override - Widget buildSuggestions(BuildContext context) { - return _buildSearchResults(context); - } - - Widget _buildSearchResults(BuildContext context) { - return ListView.builder( - itemCount: rooms.length, - itemBuilder: (context, index) { - return ListTile( - title: Text('Room No: ${rooms[index].roomNumber}'), - onTap: () { - close(context, rooms[index].roomNumber); - }, - ); - }, - ); - } -} - -void main() { - runApp(MaterialApp( - home: Managerooms(), - )); -} + +import 'dart:convert'; +import 'package:flutter/material.dart'; + +class Room { + final int roomNumber; + final int capacity; + final int currentOccupancy; + final String status; + final List studentNames; + final int numberOfStudents; + + Room({ + required this.roomNumber, + required this.capacity, + required this.currentOccupancy, + required this.status, + required this.studentNames, + required this.numberOfStudents, + }); +} + +class Managerooms extends StatefulWidget { + const Managerooms({Key? key}) : super(key: key); + + @override + _ManageroomsState createState() => _ManageroomsState(); +} + +class _ManageroomsState extends State { + List rooms = []; + List filteredRooms = []; + + @override + void initState() { + super.initState(); + _fetchRoomDetails(); + } + + Future _fetchRoomDetails() async { + // Simulating GET API call to fetch room details + final String roomData = ''' + [ + {"roomNumber": 101, "capacity": 2, "currentOccupancy": 1, "status": "Partially Allotted", "studentNames": ["John Doe"], "numberOfStudents": 1}, + {"roomNumber": 102, "capacity": 3, "currentOccupancy": 2, "status": "Fully Allotted", "studentNames": ["Alice", "Bob"], "numberOfStudents": 2}, + {"roomNumber": 103, "capacity": 4, "currentOccupancy": 4, "status": "Fully Allotted", "studentNames": ["Charlie", "David", "Eve", "Frank"], "numberOfStudents": 4}, + ] + '''; + final List roomList = json.decode(roomData); + setState(() { + rooms = roomList.map((room) => Room( + roomNumber: room['roomNumber'], + capacity: room['capacity'], + currentOccupancy: room['currentOccupancy'], + status: room['status'], + studentNames: List.from(room['studentNames']), + numberOfStudents: room['numberOfStudents'], + )).toList(); + filteredRooms = List.from(rooms); + }); + } + + Future _editStudentDetails(Room room) async { + // Display dialog to edit student details + showDialog( + context: context, + builder: (BuildContext context) { + // Implement the edit room details dialog + return AlertDialog( + title: Text('Edit Student Details'), + content: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Add fields to edit student details + ], + ), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + // Perform the edit operation here + // Update the room details + // Simulate POST API call to update room details + Navigator.of(context).pop(); + }, + child: Text('Submit'), + ), + ], + ); + }, + ); + } + + Future _deleteStudentDetails(Room room) async { + // Show confirmation dialog before deleting the student + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('Confirm Deletion'), + content: Text('Are you sure you want to delete the student?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('Cancel'), + ), + ElevatedButton( + onPressed: () { + // Delete the student from the room + _deleteStudent(room); + Navigator.of(context).pop(); + }, + child: Text('Delete'), + ), + ], + ); + }, + ); + } + + void _deleteStudent(Room room) { + setState(() { + // Implement logic to delete the student from the room + }); + // Simulate DELETE API call to delete student details + } + + Future _showAddDialog() async { + // Implement add student to room dialog + } + + void _searchRooms(int roomNumber) { + setState(() { + if (roomNumber != 0) { + filteredRooms = rooms.where((room) => room.roomNumber == roomNumber).toList(); + } else { + filteredRooms.clear(); // Clear filtered list if no search is active + filteredRooms.addAll(rooms); // Repopulate with all rooms + } + }); + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Manage Rooms'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + actions: [ + IconButton( + icon: Icon(Icons.search), + onPressed: () async { + final int? result = await showSearch( + context: context, + delegate: RoomSearchDelegate(rooms: rooms), + ); + if (result != null) { + _searchRooms(result); + } + }, + ), + ], + ), + body: SingleChildScrollView( + child: DataTable( + columns: const [ + DataColumn(label: Text('Room No')), + DataColumn(label: Text('Capacity')), + DataColumn(label: Text('Current Occupancy')), + DataColumn(label: Text('Status')), + DataColumn(label: Text('Student Names')), + DataColumn(label: Text('No of Students')), + DataColumn(label: Text('Edit')), + DataColumn(label: Text('Delete')), + DataColumn(label: Text('Add')), + ], + rows: filteredRooms.map((room) { + return DataRow(cells: [ + DataCell(Text(room.roomNumber.toString())), + DataCell(Text(room.capacity.toString())), + DataCell(Text(room.currentOccupancy.toString())), + DataCell(Text(room.status)), + DataCell(Text(room.studentNames.join(', '))), + DataCell(Text(room.numberOfStudents.toString())), + DataCell( + IconButton( + icon: Icon(Icons.edit), + onPressed: () { + _editStudentDetails(room); + }, + ), + ), + DataCell( + IconButton( + icon: Icon(Icons.delete), + onPressed: () { + _deleteStudentDetails(room); + }, + ), + ), + DataCell( + IconButton( + icon: Icon(Icons.add), + onPressed: () { + _showAddDialog(); + }, + ), + ), + ]); + }).toList(), + ), + ), + ); + } +} + +class RoomSearchDelegate extends SearchDelegate { + final List rooms; + + RoomSearchDelegate({required this.rooms}); + + @override + ThemeData appBarTheme(BuildContext context) { + final ThemeData theme = Theme.of(context); + return theme.copyWith( + appBarTheme: AppBarTheme( + backgroundColor: theme.scaffoldBackgroundColor, // Match with screen's UI theme + iconTheme: IconThemeData(color: theme.primaryColor), // Match with screen's UI theme + ), + ); + } + + @override + List buildActions(BuildContext context) { + return [ + IconButton( + icon: Icon(Icons.clear), + onPressed: () { + query = ''; + }, + ), + ]; + } + + @override + Widget buildLeading(BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back), + onPressed: () { + close(context, null); + }, + ); + } + + @override + Widget buildResults(BuildContext context) { + return _buildSearchResults(context); + } + + @override + Widget buildSuggestions(BuildContext context) { + return _buildSearchResults(context); + } + + Widget _buildSearchResults(BuildContext context) { + return ListView.builder( + itemCount: rooms.length, + itemBuilder: (context, index) { + return ListTile( + title: Text('Room No: ${rooms[index].roomNumber}'), + onTap: () { + close(context, rooms[index].roomNumber); + }, + ); + }, + ); + } +} + +void main() { + runApp(MaterialApp( + home: Managerooms(), + )); +} + diff --git a/lib/screens/Hostel/warden/managestudent.dart b/lib/screens/Hostel/warden/managestudent.dart index 35dff3f3..330570c9 100644 --- a/lib/screens/Hostel/warden/managestudent.dart +++ b/lib/screens/Hostel/warden/managestudent.dart @@ -1,3 +1,4 @@ + //All the 4 functionalities like add new student,edit existing student details,delete a student,search a student // by his/her name (or) roll.no via search bar are all perfectly working in this code.No need further debugging except to integrate API's. @@ -353,9 +354,11 @@ class _ManagestudentState extends State { }); } + @override Widget build(BuildContext context) { return Scaffold( + appBar: AppBar( title: Text('Manage Students'), backgroundColor: Color.fromARGB(255, 245, 103, 47), @@ -506,4 +509,5 @@ void main() { runApp(MaterialApp( home: Managestudent(), )); + } diff --git a/lib/screens/Hostel/warden/noticeboard.dart b/lib/screens/Hostel/warden/noticeboard.dart index 2fe8bb5d..5d1fe9bd 100644 --- a/lib/screens/Hostel/warden/noticeboard.dart +++ b/lib/screens/Hostel/warden/noticeboard.dart @@ -1,5 +1,3 @@ -//All the 2 functionalities like add new notice,remove existing notice are all perfectly -//working in this code with proper formatting.No need further debugging on this code. import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -13,6 +11,7 @@ class Notice { Notice(this.headline, this.description, this.date); } + class Noticeboard extends StatefulWidget { const Noticeboard({Key? key}) : super(key: key); @@ -21,6 +20,7 @@ class Noticeboard extends StatefulWidget { } class _NoticeboardState extends State { + List notices = []; // Define the 'notices' list @override @@ -54,12 +54,14 @@ class _NoticeboardState extends State { setState(() {}); } + @override Widget build(BuildContext context) { return Scaffold( drawer: SideDrawer(), appBar: AppBar( title: const Text('Notice Board'), + backgroundColor: const Color.fromARGB(255, 245, 103, 47), foregroundColor: Colors.white, ), @@ -133,10 +135,12 @@ class _NoticeboardState extends State { ), ), ], + ), ), floatingActionButton: FloatingActionButton( onPressed: () { + // Display dialog to add a new notice showDialog( context: context, @@ -212,4 +216,5 @@ class _NoticeboardState extends State { // Your implementation to invoke POST API // Example: http.post(url, body: {'headline': headline, 'description': description, 'file': file}); } + } diff --git a/lib/screens/Hostel/warden/report.dart b/lib/screens/Hostel/warden/report.dart index dd3f1934..1b651159 100644 --- a/lib/screens/Hostel/warden/report.dart +++ b/lib/screens/Hostel/warden/report.dart @@ -1,18 +1,20 @@ -import 'package:flutter/material.dart'; -import 'package:fusion/Components/side_drawer.dart'; -class Report extends StatelessWidget { -const Report ({Key?key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer:SideDrawer(), - appBar: AppBar( - title: const Text('Report'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - foregroundColor: Colors.white, - ), - ); - } -} - + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; +class Report extends StatelessWidget { +const Report ({Key?key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer:SideDrawer(), + appBar: AppBar( + title: const Text('Report'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + ); + } +} + + diff --git a/lib/screens/Hostel/warden/staffinfo.dart b/lib/screens/Hostel/warden/staffinfo.dart index 2f53a24a..62ef9453 100644 --- a/lib/screens/Hostel/warden/staffinfo.dart +++ b/lib/screens/Hostel/warden/staffinfo.dart @@ -1,65 +1,67 @@ -import 'package:flutter/material.dart'; -import 'package:fusion/Components/side_drawer.dart'; - -class Staffinfo extends StatelessWidget { - const Staffinfo({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: SideDrawer(), - appBar: AppBar( - title: const Text('Staff Info'), - backgroundColor: Color.fromARGB(255, 245, 103, 47), - foregroundColor: Colors.white, - ), - body: Padding( - padding: EdgeInsets.only(left: 20, right: 20, top: 50), - child: SingleChildScrollView( - child: Center( - child: Column( - children: [ - for (int i = 1; i < 15; i++) - Card( - color: Color.fromARGB(255, 245, 103, 47), - child: ListTile( - title: Row( - children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Staff $i', - style: TextStyle( - color: Colors.white, - fontSize: 20, - ), - ), - Icon( - Icons.arrow_forward_ios, - color: Colors.white, - ), - ], - ), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: () { - // Add new staff info logic here - }, - child: Icon(Icons.add), - backgroundColor: Color.fromARGB(255, 255, 152, 111), - foregroundColor: Color(0xffffffff), - ), - ); - } -} + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Staffinfo extends StatelessWidget { + const Staffinfo({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + drawer: SideDrawer(), + appBar: AppBar( + title: const Text('Staff Info'), + backgroundColor: Color.fromARGB(255, 245, 103, 47), + foregroundColor: Colors.white, + ), + body: Padding( + padding: EdgeInsets.only(left: 20, right: 20, top: 50), + child: SingleChildScrollView( + child: Center( + child: Column( + children: [ + for (int i = 1; i < 15; i++) + Card( + color: Color.fromARGB(255, 245, 103, 47), + child: ListTile( + title: Row( + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Staff $i', + style: TextStyle( + color: Colors.white, + fontSize: 20, + ), + ), + Icon( + Icons.arrow_forward_ios, + color: Colors.white, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + // Add new staff info logic here + }, + child: Icon(Icons.add), + backgroundColor: Color.fromARGB(255, 255, 152, 111), + foregroundColor: Color(0xffffffff), + ), + ); + } +} +