From 988b16611b7a2015280686c1d1ed5370e20b9766 Mon Sep 17 00:00:00 2001 From: Aditig2 Date: Tue, 18 Apr 2023 23:43:29 +0530 Subject: [PATCH 1/2] SA-2 student ui --- lib/Components/side_drawer.dart | 4 +- lib/api.dart | 4 +- lib/main.dart | 10 + .../CentralMess/application_status.dart | 58 ++++++ lib/screens/CentralMess/applications.dart | 185 ++++++++++++++++++ lib/screens/CentralMess/centralmess_home.dart | 163 +++++++++++++++ lib/screens/CentralMess/feedback.dart | 118 +++++++++++ lib/screens/CentralMess/menu.dart | 64 ++++++ lib/screens/CentralMess/payment_details.dart | 58 ++++++ lib/screens/CentralMess/registeration.dart | 88 +++++++++ lib/services/login_service.dart | 2 +- 11 files changed, 750 insertions(+), 4 deletions(-) create mode 100644 lib/screens/CentralMess/application_status.dart create mode 100644 lib/screens/CentralMess/applications.dart create mode 100644 lib/screens/CentralMess/centralmess_home.dart create mode 100644 lib/screens/CentralMess/feedback.dart create mode 100644 lib/screens/CentralMess/menu.dart create mode 100644 lib/screens/CentralMess/payment_details.dart create mode 100644 lib/screens/CentralMess/registeration.dart diff --git a/lib/Components/side_drawer.dart b/lib/Components/side_drawer.dart index be08db0e..558a250a 100644 --- a/lib/Components/side_drawer.dart +++ b/lib/Components/side_drawer.dart @@ -133,7 +133,9 @@ class _SideDrawerState extends State { ModulesPadding(line: 'Awards & Scholarship Module'), ModulesPadding( line: 'Complaint Module', pageMover: '/complaint'), - ModulesPadding(line: 'Central Mess Module'), + ModulesPadding(line: 'Central Mess Module', + isActive : true, + pageMover: '/centralmess_home',), ModulesPadding(line: 'Feeds Module'), ModulesPadding( line: 'Health Center Module', diff --git a/lib/api.dart b/lib/api.dart index 802bee2d..1986fd5b 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -1,9 +1,9 @@ //Server and local links String klocalLink = "127.0.0.1:8000"; -String kserverLink = "172.27.16.215:80"; +String kserverLink = "172.27.16.214"; //Login Service -String kAuthUrl = "172.27.16.215:80"; +String kAuthUrl = "172.27.16.214"; String kAuthLogin = "/api/auth/login/"; //Profile Service diff --git a/lib/main.dart b/lib/main.dart index 9ca81ff8..da321469 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,11 @@ import 'package:flutter/material.dart'; import 'dart:async'; import 'package:fusion/screens/Academic/Add_Drop_Courses/add_drop_courses.dart'; +import 'package:fusion/screens/CentralMess/applications.dart'; +import 'package:fusion/screens/CentralMess/centralmess_home.dart'; +import 'package:fusion/screens/CentralMess/feedback.dart'; +import 'package:fusion/screens/CentralMess/menu.dart'; +import 'package:fusion/screens/CentralMess/registeration.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'; @@ -127,6 +132,11 @@ class MyApp extends StatelessWidget { '/health_center/feedback': (context) => FeedBack(), '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), + '/centralmess_home': (context) => CentralMessHome(), + '/centralmess_home/menu': (context) => MessMenu(), + '/centralmess_home/registeration' : (context) => MessRegisteration(), + '/centralmess_home/feedback' : (context) => MessFeedback(), + '/centralmess_home/applications' : (context) => MessApplication(), }, ), ); diff --git a/lib/screens/CentralMess/application_status.dart b/lib/screens/CentralMess/application_status.dart new file mode 100644 index 00000000..183f1a92 --- /dev/null +++ b/lib/screens/CentralMess/application_status.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; +import '../../Components/appBar.dart'; +import '../../Components/side_drawer.dart'; + + +List> daily = [['Application type','Application Date', 'From', 'To', 'Status'], + ['Leave', '03/03/2023', '10/03/2023', '12/03/2023', 'Pending'],]; +class Status extends StatelessWidget { + const Status({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: SingleChildScrollView( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Flexible( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: _buildRows(daily), + ), + ), + ) + ], + ), + ), + ); + } +} + + +List _buildCells(List val) { + return List.generate( + val.length, + (index) => Container( + alignment: Alignment.center, + width: 120.0, + height: 60.0, + color: Colors.white, + margin: EdgeInsets.all(4.0), + child: Text(val[index]), + ), + ); +} + +List _buildRows(List> items) { + return List.generate( + items.length, + (index) => Row( + children: _buildCells(items[index]), + ), + ); +} diff --git a/lib/screens/CentralMess/applications.dart b/lib/screens/CentralMess/applications.dart new file mode 100644 index 00000000..fd126246 --- /dev/null +++ b/lib/screens/CentralMess/applications.dart @@ -0,0 +1,185 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/CustomElevatedButton.dart'; +import 'package:fusion/constants.dart'; +import 'package:fusion/screens/CentralMess/application_status.dart'; + +import '../../Components/side_drawer.dart'; + +class MessApplication extends StatelessWidget { + const MessApplication({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return DefaultTabController( + initialIndex: 1, + length: 2, + child: Scaffold( + appBar: AppBar( + backgroundColor: kPrimaryColor, + bottom: TabBar( + tabs: [ + Tab( + text: 'Leave application', + ), + Tab( + text: 'Food Requests', + ), + ], + ), + ), + drawer: SideDrawer(), + body: const TabBarView( + children: [ + Center( + child: RequestForm( + val: 'Request for Leave', + isFood: false, + ), + ), + Center( + child: RequestForm( + val: 'Request for Special Food', + isFood: true, + ), + ), + ], + ), + ), + ); + } +} + +class RequestForm extends StatelessWidget { + const RequestForm({Key? key, required this.val, required this.isFood}) + : super(key: key); + final String val; + final bool isFood; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + val, + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + Text( + 'Mess :', + style: TextStyle(fontSize: 15, height: 2), + ), + TextField( + keyboardType: TextInputType.multiline, + maxLines: null, + decoration: InputDecoration( + isDense: true, + contentPadding: EdgeInsets.all(8), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: kPrimaryColor), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: kPrimaryColor), + ), + ), + style: TextStyle(color: Colors.black), + ), + SizedBox( + height: 20, + ), + Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'From :', + style: TextStyle(fontSize: 15, height: 2), + ), + myTextfield(), + ], + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'To :', + style: TextStyle(fontSize: 15, height: 2), + ), + myTextfield(), + ], + ), + ) + ], + ), + SizedBox( + height: 20, + ), + isFood + ? Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Purpose :', + style: TextStyle(fontSize: 15, height: 2), + ), + myTextfield(), + ], + ), + ) + : Container(), + SizedBox( + height: 20, + ), + CustomElevatedButton( + onPressed: () {}, text: 'Submit', isFilled: true), + SizedBox( + height: 20, + ), + CustomElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const Status()), + ); + }, + text: 'Status', + isFilled: true), + ], + ), + ); + } +} + +class myTextfield extends StatelessWidget { + const myTextfield({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return TextField( + keyboardType: TextInputType.multiline, + maxLines: null, + decoration: InputDecoration( + isDense: true, + contentPadding: EdgeInsets.all(8), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: kPrimaryColor), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: kPrimaryColor), + ), + ), + style: TextStyle(color: Colors.black), + ); + } +} diff --git a/lib/screens/CentralMess/centralmess_home.dart b/lib/screens/CentralMess/centralmess_home.dart new file mode 100644 index 00000000..00901883 --- /dev/null +++ b/lib/screens/CentralMess/centralmess_home.dart @@ -0,0 +1,163 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +import '../../services/service_locator.dart'; +import '../../services/storage_service.dart'; +class CentralMessHome extends StatefulWidget { + @override + _CentralMessHomeState createState() => + _CentralMessHomeState(); +} + +class _CentralMessHomeState extends State { + bool _loading = false; + int count = 0; + String? name; + String? depttype; + @override + void initState() { + super.initState(); + var service = locator(); + name = service.profileData.user!["first_name"] + + " " + + service.profileData.user!["last_name"]; + depttype = service.profileData.profile!['department']!['name'] + + " " + + service.profileData.profile!['user_type']; + print(service.profileData.user); + } + + BoxDecoration myBoxDecoration() { + return BoxDecoration( + border: new Border.all( + color: Colors.deepOrangeAccent, + width: 2.0, + style: BorderStyle.solid, + ), + borderRadius: new BorderRadius.all(new Radius.circular(15.0))); + } + + Text myText(String text) { + return Text( + text, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500, color: Colors.white), + ); + } + + Padding myContainer(String text) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: myText(text), + ),), + decoration: new BoxDecoration( + color: Colors.deepOrangeAccent, + boxShadow: [ + BoxShadow( + color: Colors.black, + offset: Offset(0.0, 1.0), + blurRadius: 2.0, + ) + ], + borderRadius: new BorderRadius.all(new Radius.circular(5.0)), + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + final data = ''; + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric( + horizontal: 50.0, vertical: 20.0), + shadowColor: Colors.black, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 170.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/profile_pic.png'), + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + height: 10.0, + ), + Text( + name!, //Display name of User + style: + TextStyle(fontSize: 20.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + Text( + depttype!, // Display Type of User + style: + TextStyle(fontSize: 15.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + InkWell( + child: myContainer("Menu"), + onTap: () { + Navigator.pushNamed( + context, '/centralmess_home/menu', + arguments: data); + }, + ), + InkWell( + child: myContainer("Registeration/Payment details"), + onTap: () { + Navigator.pushNamed( + context, '/centralmess_home/registeration', + arguments: data); + }, + ), + InkWell( + child: myContainer("Applications"), + onTap: () { + Navigator.pushNamed( + context, '/centralmess_home/applications', + arguments: data); + }, + ), + InkWell( + child: myContainer("Feedback"), + onTap: () { + Navigator.pushNamed( + context, '/centralmess_home/feedback', + arguments: data); + }, + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/screens/CentralMess/feedback.dart b/lib/screens/CentralMess/feedback.dart new file mode 100644 index 00000000..6b19cd87 --- /dev/null +++ b/lib/screens/CentralMess/feedback.dart @@ -0,0 +1,118 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/constants.dart'; + +import '../../Components/appBar.dart'; +import '../../Components/side_drawer.dart'; + +class MessFeedback extends StatelessWidget { + const MessFeedback({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'The feedback form for mess:', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 20, + ), + Row( + children: [ + Text('Type:'), + SizedBox( + width: 20, + ), + DropdownButtonExample() + ], + ), + SizedBox( + height: 20, + ), + Text('Description:'), + TextField( + keyboardType: TextInputType.multiline, + maxLines: null, + decoration: InputDecoration( + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: kPrimaryColor), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: kPrimaryColor), + ), + ), + ), + SizedBox( + height: 20, + ), + Center( + child: GestureDetector( + onTap: () {}, + child: Container( + decoration: BoxDecoration( + color: kPrimaryColor, + borderRadius: BorderRadius.circular(10), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Text('Send', + style: TextStyle( + color: Colors.white + ),), + ), + ), + ) + ), + ], + ), + ), + ); + } +} + +class DropdownButtonExample extends StatefulWidget { + const DropdownButtonExample({key}); + + @override + State createState() => _DropdownButtonExampleState(); +} + +const List list = ['Cleanliness', 'Food', 'Maintenance', 'Others']; + +class _DropdownButtonExampleState extends State { + String dropdownValue = list.first; + + @override + Widget build(BuildContext context) { + return DropdownButton( + value: dropdownValue, + icon: const Icon( + Icons.arrow_downward, + color: Colors.deepOrangeAccent, + ), + elevation: 16, + onChanged: (String? value) { + // This is called when the user selects an item. + setState(() { + dropdownValue = value!; + }); + }, + items: list.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ); + } +} diff --git a/lib/screens/CentralMess/menu.dart b/lib/screens/CentralMess/menu.dart new file mode 100644 index 00000000..8dc74d6a --- /dev/null +++ b/lib/screens/CentralMess/menu.dart @@ -0,0 +1,64 @@ +import 'package:flutter/material.dart'; + +import '../../Components/appBar.dart'; +import '../../Components/side_drawer.dart'; +import '../../constants.dart'; + +List weekdays = ['','Monday', 'Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']; +List> daily = [['Breakfast', 'Lunch', 'Dinner'],['a','b','c'],['d','e','f']]; + +class MessMenu extends StatelessWidget { + const MessMenu({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: SingleChildScrollView( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: _buildCells(weekdays), + ), + Flexible( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: _buildRows(daily), + ), + ), + ) + ], + ), + ), + ); + } +} + + +List _buildCells(List val) { + return List.generate( + val.length, + (index) => Container( + alignment: Alignment.center, + width: 120.0, + height: 60.0, + color: Colors.white, + margin: EdgeInsets.all(4.0), + child: Text(val[index]), + ), + ); +} + +List _buildRows(List> items) { + return List.generate( + items.length, + (index) => Row( + children: _buildCells(items[index]), + ), + ); +} diff --git a/lib/screens/CentralMess/payment_details.dart b/lib/screens/CentralMess/payment_details.dart new file mode 100644 index 00000000..bcb24054 --- /dev/null +++ b/lib/screens/CentralMess/payment_details.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; +import '../../Components/appBar.dart'; +import '../../Components/side_drawer.dart'; + + +List> daily = [['Month', 'Monthly Bill', 'Rebate count', 'Rebate amount', 'Total', 'Status'], + ['January 2023','13500','10','4500','9000','Not paid'],]; +class PaymentDetails extends StatelessWidget { + const PaymentDetails({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: SingleChildScrollView( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Flexible( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: _buildRows(daily), + ), + ), + ) + ], + ), + ), + ); + } +} + + +List _buildCells(List val) { + return List.generate( + val.length, + (index) => Container( + alignment: Alignment.center, + width: 120.0, + height: 60.0, + color: Colors.white, + margin: EdgeInsets.all(4.0), + child: Text(val[index]), + ), + ); +} + +List _buildRows(List> items) { + return List.generate( + items.length, + (index) => Row( + children: _buildCells(items[index]), + ), + ); +} diff --git a/lib/screens/CentralMess/registeration.dart b/lib/screens/CentralMess/registeration.dart new file mode 100644 index 00000000..53456a1c --- /dev/null +++ b/lib/screens/CentralMess/registeration.dart @@ -0,0 +1,88 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/constants.dart'; +import 'package:fusion/screens/CentralMess/payment_details.dart'; + +import '../../Components/appBar.dart'; +import '../../Components/side_drawer.dart'; + +class MessRegisteration extends StatelessWidget { + const MessRegisteration({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 20,), + Card( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 30), + child: RichText( + text: TextSpan( + style: TextStyle(color: Colors.black, + height: 1.5 + ), + children: [ + TextSpan( + text: 'Mess Registeration', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold + ) + ), + TextSpan( + text: '\nCurrently registered for no-mess', + style: TextStyle( + fontSize: 15 + ) + ), + TextSpan( + text: '\n\nMess registeration period has ended.', + style: TextStyle( + fontSize: 15 + ) + ) + ] + ), + ), + ) + ), + SizedBox( + height: 30, + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const PaymentDetails()), + ); + }, + child: Container( + decoration: BoxDecoration( + color: kPrimaryColor, + borderRadius: BorderRadius.circular(10), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10), + child: Text( + 'Payment Details', + style: TextStyle( + color: Colors.white, + fontSize: 15, + + ), + ), + ), + ), + ) + ], + ), + ) + ); + } +} diff --git a/lib/services/login_service.dart b/lib/services/login_service.dart index 17d79b42..57fd7d96 100644 --- a/lib/services/login_service.dart +++ b/lib/services/login_service.dart @@ -13,7 +13,7 @@ class LoginService { Map headers = { 'Content-Type': 'application/json; charset=UTF-8' }; - + print(data); var client = http.Client(); var response = await client.post( Uri.http( From f89f579e4f2bbbb5adbb10ddcccbc1914b6e7027 Mon Sep 17 00:00:00 2001 From: Aditig2 Date: Thu, 20 Apr 2023 05:46:09 +0530 Subject: [PATCH 2/2] SA-2 final changes --- android/app/build.gradle | 2 + lib/Components/messtable.dart | 74 +++++ lib/Components/side_drawer.dart | 101 +++--- lib/api.dart | 3 + lib/main.dart | 13 +- lib/models/mess.dart | 96 ++++++ lib/screens/CentralMess/applications.dart | 2 +- lib/screens/CentralMess/centralmess_home.dart | 36 ++- lib/screens/CentralMess/feedback_stats.dart | 57 ++++ lib/screens/CentralMess/menu.dart | 118 +++++-- lib/screens/CentralMess/menuchangereq.dart | 122 +++++++ lib/screens/CentralMess/menuchangestatus.dart | 26 ++ lib/screens/CentralMess/respondmanager.dart | 55 ++++ .../CentralMess/respondmenuchange.dart | 32 ++ lib/screens/LoginandDashboard/dashboard.dart | 300 +++++++++--------- lib/services/mess_service.dart | 27 ++ 16 files changed, 830 insertions(+), 234 deletions(-) create mode 100644 lib/Components/messtable.dart create mode 100644 lib/models/mess.dart create mode 100644 lib/screens/CentralMess/feedback_stats.dart create mode 100644 lib/screens/CentralMess/menuchangereq.dart create mode 100644 lib/screens/CentralMess/menuchangestatus.dart create mode 100644 lib/screens/CentralMess/respondmanager.dart create mode 100644 lib/screens/CentralMess/respondmenuchange.dart create mode 100644 lib/services/mess_service.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index 2b47ce25..aeea5cca 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -34,6 +34,8 @@ android { lintOptions { disable 'InvalidPackage' + checkReleaseBuilds false + abortOnError false } defaultConfig { diff --git a/lib/Components/messtable.dart b/lib/Components/messtable.dart new file mode 100644 index 00000000..ba5b57d1 --- /dev/null +++ b/lib/Components/messtable.dart @@ -0,0 +1,74 @@ +import 'package:flutter/material.dart'; + +class MessTable extends StatelessWidget { + const MessTable({Key? key, required this.head, required this.body,this.child}) : super(key: key); + final List> head; + final List> body; + final Widget? child; + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [..._buildHeading(head),..._buildRows(body,child)] + ), + ); + } +} + + +List _buildCells(List val) { + return List.generate( + val.length, + (index) => Container( + alignment: Alignment.center, + width: 120.0, + height: 60.0, + color: Colors.white, + margin: EdgeInsets.all(4.0), + child: Text(val[index]), + ), + ); +} + +List _buildRows(List> items,Widget? child) { + + return List.generate( + items.length, + (index) => Row( + children: [..._buildCells(items[index]), + child??Container(),], + ), + ); +} + +List _buildHeading(List> items) { + return List.generate( + items.length, + (index) => Row( + children: _buildCells(items[index]), + ), + ); +} + +class RespondButton extends StatelessWidget { + const RespondButton({Key? key, required this.val, required this.color,required this.onclick}) : super(key: key); + final String val; + final Color color; + final void Function() onclick; + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onclick, + child: Container( + alignment: Alignment.center, + width: 120.0, + height: 25.0, + color: color, + margin: EdgeInsets.all(4.0), + child: Text(val), + ), + ); + } +} \ No newline at end of file diff --git a/lib/Components/side_drawer.dart b/lib/Components/side_drawer.dart index 558a250a..51d0cfcf 100644 --- a/lib/Components/side_drawer.dart +++ b/lib/Components/side_drawer.dart @@ -23,6 +23,7 @@ class _SideDrawerState extends State { depttype = service.profileData.profile!['department']!['name'] + " " + service.profileData.profile!['user_type']; + print(service.profileData.profile); } @override @@ -105,52 +106,52 @@ class _SideDrawerState extends State { ), _loading ? Card( - color: Colors.black, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // ModulesPadding( - // line: 'DashBoard', pageMover: '/dashboard'), - ModulesPadding( - line: 'Academics Module', - pageMover: '/academic_home_page', - isActive: true, - ), - ModulesPadding( - line: 'Programme Curriculum', - pageMover: '/programme_curriculum_home', - isActive: true, - ), - ModulesPadding( - line: 'Gymkhana Module', - pageMover: '/gymkhana_homepage'), - ModulesPadding( - line: 'Establishment Module', - pageMover: '/establishment'), - ModulesPadding( - line: 'Library Module', - pageMover: '/library_homepage'), - ModulesPadding(line: 'Awards & Scholarship Module'), - ModulesPadding( - line: 'Complaint Module', pageMover: '/complaint'), - ModulesPadding(line: 'Central Mess Module', - isActive : true, - pageMover: '/centralmess_home',), - ModulesPadding(line: 'Feeds Module'), - ModulesPadding( - line: 'Health Center Module', - pageMover: '/health_center', - ), - ModulesPadding(line: 'Leave Module'), - ModulesPadding(line: 'Placement Module'), - ModulesPadding(line: 'Visitors Hostel Module'), - ModulesPadding(line: 'File Tracking Module'), - ], - ), - ) - : SizedBox( - width: 2.0, + color: Colors.black, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // ModulesPadding( + // line: 'DashBoard', pageMover: '/dashboard'), + ModulesPadding( + line: 'Academics Module', + pageMover: '/academic_home_page', + isActive: true, + ), + ModulesPadding( + line: 'Programme Curriculum', + pageMover: '/programme_curriculum_home', + isActive: true, ), + ModulesPadding( + line: 'Gymkhana Module', + pageMover: '/gymkhana_homepage'), + ModulesPadding( + line: 'Establishment Module', + pageMover: '/establishment'), + ModulesPadding( + line: 'Library Module', + pageMover: '/library_homepage'), + ModulesPadding(line: 'Awards & Scholarship Module'), + ModulesPadding( + line: 'Complaint Module', pageMover: '/complaint'), + ModulesPadding(line: 'Central Mess Module', + isActive : true, + pageMover: '/centralmess_home',), + ModulesPadding(line: 'Feeds Module'), + ModulesPadding( + line: 'Health Center Module', + pageMover: '/health_center', + ), + ModulesPadding(line: 'Leave Module'), + ModulesPadding(line: 'Placement Module'), + ModulesPadding(line: 'Visitors Hostel Module'), + ModulesPadding(line: 'File Tracking Module'), + ], + ), + ) + : SizedBox( + width: 2.0, + ), ModulesCard( cardLine: 'Profile', icon: Icons.account_circle, @@ -194,11 +195,11 @@ class ModulesPadding extends StatelessWidget { ), onPressed: isActive ? () async { - var _prefs = await StorageService.getInstance(); - String token = _prefs!.userInDB?.token ?? ""; - Navigator.pushReplacementNamed(context, pageMover!, - arguments: token); - } + var _prefs = await StorageService.getInstance(); + String token = _prefs!.userInDB?.token ?? ""; + Navigator.pushReplacementNamed(context, pageMover!, + arguments: token); + } : () {}, ); } diff --git a/lib/api.dart b/lib/api.dart index 1986fd5b..682b6b92 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -39,3 +39,6 @@ String kAcademicProceduresEndTT = String kAcademicProceduresHolidaysTT = "/static/academic_procedures/List_of_Holidays.pdf"; String kAcademicProceduresTT = "/static/academic_procedures/"; + + +String kMessMenu = "/mess/api/menuApi"; \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index da321469..15cbc7c0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,11 +1,16 @@ import 'package:flutter/material.dart'; import 'dart:async'; import 'package:fusion/screens/Academic/Add_Drop_Courses/add_drop_courses.dart'; +import 'package:fusion/screens/CentralMess/application_status.dart'; import 'package:fusion/screens/CentralMess/applications.dart'; import 'package:fusion/screens/CentralMess/centralmess_home.dart'; import 'package:fusion/screens/CentralMess/feedback.dart'; +import 'package:fusion/screens/CentralMess/feedback_stats.dart'; import 'package:fusion/screens/CentralMess/menu.dart'; +import 'package:fusion/screens/CentralMess/menuchangereq.dart'; import 'package:fusion/screens/CentralMess/registeration.dart'; +import 'package:fusion/screens/CentralMess/respondmanager.dart'; +import 'package:fusion/screens/CentralMess/respondmenuchange.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'; @@ -132,11 +137,17 @@ class MyApp extends StatelessWidget { '/health_center/feedback': (context) => FeedBack(), '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), - '/centralmess_home': (context) => CentralMessHome(), + '/centralmess_home': (context) => CentralMessHome(ModalRoute.of(context)!.settings.arguments.toString()), '/centralmess_home/menu': (context) => MessMenu(), '/centralmess_home/registeration' : (context) => MessRegisteration(), '/centralmess_home/feedback' : (context) => MessFeedback(), '/centralmess_home/applications' : (context) => MessApplication(), + '/centralmess_home/menuchangereq': (context) => ReqMenuChange(), + '/centralmess_home/feedback_stats': (context) => FeedbackStats(), + '/centralmess_home/application_status' : (context) => Status(), + 'centralmess_home/respondmanager' : (context) => RespondRequests(), + 'centralmess_home/respondmenuchange' : (context) => ResMenuChange(), + }, ), ); diff --git a/lib/models/mess.dart b/lib/models/mess.dart new file mode 100644 index 00000000..db19e882 --- /dev/null +++ b/lib/models/mess.dart @@ -0,0 +1,96 @@ +class MessItem{ + int id; + String mealTime; + String dish; + String messOption; + MessItem({required this.id, required this.mealTime,required this.dish,required this.messOption}); + + factory MessItem.fromJson(Map x){ + return MessItem(id:x['id'],mealTime:x['meal_time'],dish:x['dish'],messOption:x['mess_option']); + } +} + +List getdata(String x) +{ + int len = x.length; + return [x.substring(0,len-1),x[len-1]]; +} + +void insertatindex(List x, String time,String dish) { + if (time == 'B') { + x[0] = dish; + } else if (time == 'L') { + x[1] = dish; + } else { + x[2] = dish; + } +} + +List> processMessItems(List messitems){ + List M=['','','']; + List T = ['','','']; + List W = ['','','']; + List TH = ['','','']; + List F = ['','','']; + List S = ['','','']; + List SU = ['','','']; + Map mp={}; + for(var m in messitems) + { + var temp = getdata(m.mealTime); + String day=temp[0]; + String time = temp[1]; + if(!mp.containsKey(day)) + { + mp[day]=1; + switch(day){ + case 'M': insertatindex(M,time,m.dish); + break; + case 'T':insertatindex(T,time,m.dish); + break; + + case 'W':insertatindex(W,time,m.dish); + break; + + case 'TH':insertatindex(TH,time,m.dish); + break; + + case 'F':insertatindex(F,time,m.dish); + break; + + case 'S':insertatindex(S,time,m.dish); + break; + + case 'SU':insertatindex(SU,time,m.dish); + break; + } + } + else if(mp[day]!<=3) + { + mp[day]= mp[day]!+1; + switch(day){ + case 'M': insertatindex(M,time,m.dish); + break; + case 'T':insertatindex(T,time,m.dish); + break; + + case 'W':insertatindex(W,time,m.dish); + break; + + case 'TH':insertatindex(TH,time,m.dish); + break; + + case 'F':insertatindex(F,time,m.dish); + break; + + case 'S':insertatindex(S,time,m.dish); + break; + + case 'SU':insertatindex(SU,time,m.dish); + break; + } + } + } + return [M,T,W,TH,F,S,SU]; +} + diff --git a/lib/screens/CentralMess/applications.dart b/lib/screens/CentralMess/applications.dart index fd126246..905650af 100644 --- a/lib/screens/CentralMess/applications.dart +++ b/lib/screens/CentralMess/applications.dart @@ -11,7 +11,7 @@ class MessApplication extends StatelessWidget { @override Widget build(BuildContext context) { return DefaultTabController( - initialIndex: 1, + initialIndex: 0, length: 2, child: Scaffold( appBar: AppBar( diff --git a/lib/screens/CentralMess/centralmess_home.dart b/lib/screens/CentralMess/centralmess_home.dart index 00901883..0fd05aae 100644 --- a/lib/screens/CentralMess/centralmess_home.dart +++ b/lib/screens/CentralMess/centralmess_home.dart @@ -5,6 +5,9 @@ import 'package:fusion/Components/side_drawer.dart'; import '../../services/service_locator.dart'; import '../../services/storage_service.dart'; class CentralMessHome extends StatefulWidget { + final String? token; + static String tag = 'academic-page'; + CentralMessHome(this.token); @override _CentralMessHomeState createState() => _CentralMessHomeState(); @@ -15,9 +18,12 @@ class _CentralMessHomeState extends State { int count = 0; String? name; String? depttype; + bool isConvener = false; + bool isManager = false; @override void initState() { super.initState(); + print('inmess${widget.token}'); var service = locator(); name = service.profileData.user!["first_name"] + " " + @@ -25,7 +31,8 @@ class _CentralMessHomeState extends State { depttype = service.profileData.profile!['department']!['name'] + " " + service.profileData.profile!['user_type']; - print(service.profileData.user); + print(service.profileData.user!['id']); + if(service.profileData.current!.length > 1)isConvener = service.profileData.current![1]["designation"]["name"].contains("mess_convener"); } BoxDecoration myBoxDecoration() { @@ -71,7 +78,8 @@ class _CentralMessHomeState extends State { @override Widget build(BuildContext context) { - final data = ''; + final data = widget.token; + print(data); return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), @@ -154,6 +162,30 @@ class _CentralMessHomeState extends State { arguments: data); }, ), + isConvener? InkWell( + child: myContainer("Request Menu Change"), + onTap: () { + Navigator.pushNamed( + context, '/centralmess_home/menuchangereq', + arguments: data); + }, + ):Container(), + isConvener? InkWell( + child: myContainer("View Feedback"), + onTap: () { + Navigator.pushNamed( + context, '/centralmess_home/feedback_stats', + arguments: data); + }, + ):Container(), + isManager? InkWell( + child: myContainer("Respond Requests"), + onTap: () { + Navigator.pushNamed( + context, '/centralmess_home/respondmanager', + arguments: data); + }, + ):Container(), ], ), ], diff --git a/lib/screens/CentralMess/feedback_stats.dart b/lib/screens/CentralMess/feedback_stats.dart new file mode 100644 index 00000000..1e707719 --- /dev/null +++ b/lib/screens/CentralMess/feedback_stats.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/messtable.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/constants.dart'; + +class FeedbackStats extends StatefulWidget { + const FeedbackStats({Key? key}) : super(key: key); + + @override + State createState() => _FeedbackStatsState(); +} + +class _FeedbackStatsState extends State { + + List> head = [['Date', 'Student ID', 'Description', 'Mess']]; + List> food = [['10 april 2023', '20bcs018', 'not edible', 'Mess 2']]; + List> maintenance =[[]]; + List> cleanliness = [[]]; + List> other = [['10 april 2023', '20bcs018', 'not edible', 'Mess 2']]; + @override + Widget build(BuildContext context) { + return DefaultTabController( + initialIndex: 0, + length: 4, + child: Scaffold( + appBar: AppBar( + backgroundColor: kPrimaryColor, + bottom: TabBar( + tabs: [ + Tab( + text: 'Food', + ), + Tab( + text: 'Cleanliness', + ), + Tab( + text: 'Maintenance', + ), + Tab( + text: 'Other', + ), + ], + ), + ), + drawer: SideDrawer(), + body: TabBarView( + children: [ + MessTable(head: head, body: food), + MessTable(head: head, body: cleanliness), + MessTable(head: head, body: maintenance), + MessTable(head: head, body: other), + ], + ), + ), + ); + } +} diff --git a/lib/screens/CentralMess/menu.dart b/lib/screens/CentralMess/menu.dart index 8dc74d6a..19664df8 100644 --- a/lib/screens/CentralMess/menu.dart +++ b/lib/screens/CentralMess/menu.dart @@ -1,44 +1,71 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; +import 'package:http/http.dart'; import '../../Components/appBar.dart'; import '../../Components/side_drawer.dart'; import '../../constants.dart'; +import '../../models/mess.dart'; +import '../../services/mess_service.dart'; + -List weekdays = ['','Monday', 'Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']; -List> daily = [['Breakfast', 'Lunch', 'Dinner'],['a','b','c'],['d','e','f']]; +List> daily = [['Breakfast', 'Lunch', 'Dinner'], + ["Dal Makhani",'Razma Sabji, chana Dal, Boondi Raita, Plain Rice','Mix-veg Arhar Dal, Chapati, Veg-Pulao'], + ['Sprouts, Idli Sambhar, Nariyal Chutney','Aaloo Jeera Sabji, Dal Makhni, Jeera Rice, Chapati, Suji halwa ( one time )','Aaloo Jeera Sabji, Dal Makhni, jeera Rice, Chapati, Suji halwa'], + ["Sprouts, Poha jalebi, Namkeen, Chopped Onion, Lemon", "Choole-Puri, Arhar Dal, Green-Salad, Plain Rice, Boondi Raita, Chutney", "Shimla mirch, Chana Dal, Jeera Rice, Chapati, tamater-chutney"], + ["Sprouts, Namkeen Sevaiyan, Black Channa", "paneer tikka masala and dal roti", "Safed matar Sabji, Chana dal, Jeera Rice, Chapati, Fruit custurd(One time)"], + ["Sprouts, Uttapam, Sambhar, Nariyal Chutney", "burger", "Aaloo beans sabji, Dal makhani, Chapati, Plain Rice"], + ["Sprouts, Aloo sabji, Puri", "uttpam dal roti", "Rajma"], + ["Sprouts, Aloo Paratha, Dahi", "Aloo tamator mater, Moong Dal chhilka Fry, Jeera Rice, Chapati, boondi raita, Fryms", "Sahi/Matar paneer, arhar dal, Veg-Biryani, Tawa Veg, Gulab-Jamun (2-pieces)"] +]; -class MessMenu extends StatelessWidget { - const MessMenu({Key? key}) : super(key: key); +class MessMenu extends StatefulWidget { @override - Widget build(BuildContext context) { - return Scaffold( - appBar: DefaultAppBar().buildAppBar(), - drawer: SideDrawer(), - body: SingleChildScrollView( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: _buildCells(weekdays), - ), - Flexible( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: _buildRows(daily), - ), - ), - ) - ], - ), - ), - ); - } + _MessMenuState createState() => _MessMenuState(); } +class _MessMenuState extends State { + bool _loading = true; + List classitems = []; + List> messitemsintable=[]; + late MessService messservice; + List weekdays = ['','Monday', 'Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']; + List bld = ['Breakfast','Lunch','Dinner']; + void getAndSetMenu()async{ + print('texp'); + print(messitemsintable); + if(messitemsintable.isEmpty) + { + try{ + messservice=MessService(); + Response res = await messservice.getMessMenu(ModalRoute.of(context)!.settings.arguments.toString()); + + var responseBody =jsonDecode(res.body); + var jsonlist = responseBody['payload']; + for(var x in jsonlist) + { + classitems.add(MessItem.fromJson(x)); + } + + + setState(() { + messitemsintable=processMessItems(classitems); + _loading=false; + }); + }catch(e){ + print(e); + setState(() { + _loading=false; + }); + } + } +} + @override + void initState() { + super.initState(); + } List _buildCells(List val) { return List.generate( @@ -62,3 +89,34 @@ List _buildRows(List> items) { ), ); } + + @override + Widget build(BuildContext context) { + getAndSetMenu(); + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: _loading?CircularProgressIndicator():SingleChildScrollView( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: _buildCells(weekdays), + ), + Flexible( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [..._buildRows([bld]), + ..._buildRows(messitemsintable)], + ), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/screens/CentralMess/menuchangereq.dart b/lib/screens/CentralMess/menuchangereq.dart new file mode 100644 index 00000000..bd8aa1cb --- /dev/null +++ b/lib/screens/CentralMess/menuchangereq.dart @@ -0,0 +1,122 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/CustomElevatedButton.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/screens/CentralMess/menuchangestatus.dart'; +import '../../constants.dart'; + +class ReqMenuChange extends StatefulWidget { + const ReqMenuChange({Key? key}) : super(key: key); + + @override + State createState() => _ReqMenuChangeState(); +} + +class _ReqMenuChangeState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: kPrimaryColor, + ), + drawer: SideDrawer(), + body: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Current Dish :',style: TextStyle(fontSize: 17),), + SizedBox( + height: 10, + ), + DropdownButtonExample(), + SizedBox( + height: 20, + ), + Text('Request Dish :', + style: TextStyle(fontSize: 17),), + MyTextField(), + SizedBox( + height: 20, + ), + Text('Reason :',style: TextStyle(fontSize: 17),), + MyTextField(), + SizedBox( + height: 10, + ), + + Row( + children: [ + Expanded(child: CustomElevatedButton(onPressed: (){}, text: 'Request', isFilled: true)), + SizedBox(width: 10,), + Expanded(child: CustomElevatedButton(onPressed: (){Navigator.push( + context, + MaterialPageRoute(builder: (context) => const MenuChangeStatus()), + );}, text: 'Status', isFilled: true)), + ], + ), + ], + ), + ), + ); + } +} + +class MyTextField extends StatelessWidget { + const MyTextField({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return TextField( + keyboardType: TextInputType.multiline, + maxLines: null, + decoration: InputDecoration( + isDense: true, + contentPadding: EdgeInsets.all(8), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: kPrimaryColor), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: kPrimaryColor), + ), + ), + style: TextStyle(color: Colors.black), + ); + } +} + +class DropdownButtonExample extends StatefulWidget { + const DropdownButtonExample({key}); + + @override + State createState() => _DropdownButtonExampleState(); +} + +const List list = ['Cleanliness', 'Food', 'Maintenance', 'Others']; + +class _DropdownButtonExampleState extends State { + String dropdownValue = list.first; + + @override + Widget build(BuildContext context) { + return DropdownButton( + value: dropdownValue, + icon: const Icon( + Icons.arrow_downward, + color: Colors.deepOrangeAccent, + ), + elevation: 16, + onChanged: (String? value) { + // This is called when the user selects an item. + setState(() { + dropdownValue = value!; + }); + }, + items: list.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ); + } +} \ No newline at end of file diff --git a/lib/screens/CentralMess/menuchangestatus.dart b/lib/screens/CentralMess/menuchangestatus.dart new file mode 100644 index 00000000..19edb42b --- /dev/null +++ b/lib/screens/CentralMess/menuchangestatus.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import '../../Components/messtable.dart'; +import '../../Components/side_drawer.dart'; +import '../../constants.dart'; + + +class MenuChangeStatus extends StatelessWidget { + const MenuChangeStatus({Key? key}) : super(key: key); + + final List> head1 = const [['Date', 'Student', 'Current dish', 'Requested Dish', 'Reason', 'Status']]; + final List> dish = const [['January 2023','20bcs018', 'Daal rice', 'Biryani','Repeated', 'Approved'],]; + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: kPrimaryColor, + ), + drawer: SideDrawer(), + body: Column( + children: [ + MessTable(head: head1,body: dish), + ], + ), + ); + } +} diff --git a/lib/screens/CentralMess/respondmanager.dart b/lib/screens/CentralMess/respondmanager.dart new file mode 100644 index 00000000..15079161 --- /dev/null +++ b/lib/screens/CentralMess/respondmanager.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import '../../Components/messtable.dart'; +import '../../Components/side_drawer.dart'; +import '../../constants.dart'; + + +class RespondRequests extends StatelessWidget { + const RespondRequests({Key? key}) : super(key: key); + + final List> head1 = const [['Date', 'Student', 'From', 'To', 'Approve/Reject']]; + final List> head2 = const [['Date', 'Student', 'Purpose', 'From', 'To', 'Approve/Reject']]; + final List> rebate = const [['January 2023','20bcs018','20/03/2023','25/03/2023'],]; + final List> food = const [['January 2023','20bcs018', 'Sick', '20/03/2023','25/03/2023'],]; + @override + Widget build(BuildContext context) { + return DefaultTabController( + initialIndex: 0, + length: 2, + child: Scaffold( + appBar: AppBar( + backgroundColor: kPrimaryColor, + bottom: TabBar( + tabs: [ + Tab( + text: 'Respond to Rebate', + ), + Tab( + text: 'Respond to Food Requests', + ), + ], + ), + ), + drawer: SideDrawer(), + body: TabBarView( + children: [ + MessTable(head: head1,body: rebate,child: + Column( + children: [ + RespondButton(val: 'Accept', color: Colors.green, onclick: () { },), + RespondButton(val: 'Reject', color: Colors.red, onclick: () { },), + ], + ),), + MessTable(head: head2, body: food, child: + Column( + children: [ + RespondButton(val: 'Accept', color: Colors.green, onclick: () { },), + RespondButton(val: 'Reject', color: Colors.red, onclick: () { },), + ], + ),) + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/CentralMess/respondmenuchange.dart b/lib/screens/CentralMess/respondmenuchange.dart new file mode 100644 index 00000000..fe3ec2b2 --- /dev/null +++ b/lib/screens/CentralMess/respondmenuchange.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; +import '../../Components/messtable.dart'; +import '../../Components/side_drawer.dart'; +import '../../constants.dart'; + + +class ResMenuChange extends StatelessWidget { + const ResMenuChange({Key? key}) : super(key: key); + + final List> head1 = const [['Date', 'Student', 'Current dish', 'Requested Dish', 'Reason', 'Approve/Reject']]; + final List> dish = const [['January 2023','20bcs018', 'Daal rice', 'Biryani','Repeated'],]; + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: kPrimaryColor, + ), + drawer: SideDrawer(), + body: Column( + children: [ + MessTable(head: head1,body: dish,child: + Column( + children: [ + RespondButton(val: 'Accept', color: Colors.green, onclick: () { },), + RespondButton(val: 'Reject', color: Colors.red, onclick: () { },), + ], + ),), + ], + ), + ); + } +} diff --git a/lib/screens/LoginandDashboard/dashboard.dart b/lib/screens/LoginandDashboard/dashboard.dart index 80c2719f..fe0c10d5 100644 --- a/lib/screens/LoginandDashboard/dashboard.dart +++ b/lib/screens/LoginandDashboard/dashboard.dart @@ -86,168 +86,168 @@ class _DashboardState extends State { body: _loading == true ? Center(child: CircularProgressIndicator()) : StreamBuilder( - stream: _dashboardController.stream, - builder: (context, AsyncSnapshot snapshot) { - return ListView( - shrinkWrap: true, - physics: ClampingScrollPhysics(), + stream: _dashboardController.stream, + builder: (context, AsyncSnapshot snapshot) { + return ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric( + horizontal: 50.0, vertical: 20.0), + shadowColor: Colors.black, + child: Column( children: [ - Card( - elevation: 2.0, - margin: EdgeInsets.symmetric( - horizontal: 50.0, vertical: 20.0), - shadowColor: Colors.black, - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 20.0), - width: 170.0, - height: 170.0, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/profile_pic.png'), - fit: BoxFit.cover, - ), - ), - ), - SizedBox( - height: 10.0, - ), - Text( - name, //Display name of User - style: - TextStyle(fontSize: 20.0, color: Colors.black), - ), - SizedBox( - height: 10.0, - ), - Text( - studentType, // Display Type of User - style: - TextStyle(fontSize: 15.0, color: Colors.black), - ), - SizedBox( - height: 10.0, - ), - ], + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 170.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/profile_pic.png'), + fit: BoxFit.cover, + ), ), ), - Card( - color: Colors.black, - child: Padding( - padding: const EdgeInsets.all(10.0), + SizedBox( + height: 10.0, + ), + Text( + name, //Display name of User + style: + TextStyle(fontSize: 20.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + Text( + studentType, // Display Type of User + style: + TextStyle(fontSize: 15.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ), + Card( + color: Colors.black, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + setState(() { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + }); + }, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - GestureDetector( - onTap: () { - _notificationsBool = true; - _announcementsBool = false; - _newsBool = false; - setState(() { - _notificationsBool = true; - _announcementsBool = false; - _newsBool = false; - }); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Notifications', - style: TextStyle( - fontSize: 16.0, - color: Colors.white, - ), - ), - Icon( - Icons.notifications_active_rounded, - color: _notificationsBool - ? Colors.deepOrangeAccent - : Colors.white, - ), - ], + Text( + 'Notifications', + style: TextStyle( + fontSize: 16.0, + color: Colors.white, ), ), - GestureDetector( - onTap: () { - _newsBool = true; - _announcementsBool = false; - _notificationsBool = false; - setState(() { - _newsBool = true; - _announcementsBool = false; - _notificationsBool = false; - }); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - 'News', - style: TextStyle( - fontSize: 16.0, - color: Colors.white, - ), - ), - Icon( - Icons.email, - color: _newsBool - ? Colors.deepOrangeAccent - : Colors.white, - ), - ], - ), + Icon( + Icons.notifications_active_rounded, + color: _notificationsBool + ? Colors.deepOrangeAccent + : Colors.white, ), - GestureDetector( - onTap: () { - _announcementsBool = true; - _newsBool = false; - _notificationsBool = false; - setState(() { - _announcementsBool = true; - _newsBool = false; - _notificationsBool = false; - }); - }, - child: Padding( - padding: const EdgeInsets.only(right: 16.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Announcements', - style: TextStyle( - fontSize: 16.0, - color: Colors.white, - ), - ), - Icon( - Icons.announcement, - color: _announcementsBool - ? Colors.deepOrangeAccent - : Colors.white, - ), - ], - ), + ], + ), + ), + GestureDetector( + onTap: () { + _newsBool = true; + _announcementsBool = false; + _notificationsBool = false; + setState(() { + _newsBool = true; + _announcementsBool = false; + _notificationsBool = false; + }); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + 'News', + style: TextStyle( + fontSize: 16.0, + color: Colors.white, ), ), + Icon( + Icons.email, + color: _newsBool + ? Colors.deepOrangeAccent + : Colors.white, + ), ], ), ), - ), - _notificationsBool - ? NotificationCard( - notifications: data.notifications, - ) - : NewsCard(), - ], - ); - }, - ), + GestureDetector( + onTap: () { + _announcementsBool = true; + _newsBool = false; + _notificationsBool = false; + setState(() { + _announcementsBool = true; + _newsBool = false; + _notificationsBool = false; + }); + }, + child: Padding( + padding: const EdgeInsets.only(right: 16.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Announcements', + style: TextStyle( + fontSize: 16.0, + color: Colors.white, + ), + ), + Icon( + Icons.announcement, + color: _announcementsBool + ? Colors.deepOrangeAccent + : Colors.white, + ), + ], + ), + ), + ), + ], + ), + ), + ), + _notificationsBool + ? NotificationCard( + notifications: data.notifications, + ) + : NewsCard(), + ], + ); + }, + ), ); } @@ -256,4 +256,4 @@ class _DashboardState extends State { _dashboardController.close(); super.dispose(); } -} +} \ No newline at end of file diff --git a/lib/services/mess_service.dart b/lib/services/mess_service.dart new file mode 100644 index 00000000..f7e7ca9b --- /dev/null +++ b/lib/services/mess_service.dart @@ -0,0 +1,27 @@ +import 'package:fusion/api.dart'; +import 'package:fusion/constants.dart'; +import 'package:http/http.dart' as http; + +class MessService { + Future getMessMenu(String token) async { + try { + Map headers = {'Authorization': 'Token ' + token}; + print("fetching menu Details"); + var client = http.Client(); + http.Response response = await client.get( + Uri.http( + getLink(), + kMessMenu, //Constant api path + ), + headers: headers, + ); + if (response.statusCode != 200) { + throw Exception('Can\'t get Mess data'); + } + print("successfully fetched details"); + return response; + } catch (e) { + rethrow; + } + } +}