From 1505674033beac7ab77dc5a54cdda87def08d9ea Mon Sep 17 00:00:00 2001 From: Arindam Upadhyay <20bec018@iiitdmj.ac.in> Date: Mon, 27 Mar 2023 13:11:13 +0530 Subject: [PATCH 1/4] script structured --- clone.sh | 13 ------------- scripts/clone.sh | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 clone.sh create mode 100644 scripts/clone.sh diff --git a/clone.sh b/clone.sh deleted file mode 100644 index 3a3780c4..00000000 --- a/clone.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -#branches=("ac-1" "ac-2" "ac-3" "ac-4" "ac-5" "ps-1" "ps-2" "gad-1" "gad-2" "gad-3" "gad-4" "gad-5" "hr" "sa-1" "sa-2" "sa-3" "sa-4" "os-1" "os-2" "os-3" "os-4" "rspc") -branches=("ac") -for branch in "${branches[@]}" -do - echo "Creating $branch" - - git checkout -b "$branch" - git push origin "$branch" - - echo "Pushed new branch $branch to remote" -done \ No newline at end of file diff --git a/scripts/clone.sh b/scripts/clone.sh new file mode 100644 index 00000000..20bf0276 --- /dev/null +++ b/scripts/clone.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +branches=("ac" "ac-1" "ac-2" "ac-3" "ac-4" "ac-5" "ps-1" "ps-2" "gad-1" "gad-2" "gad-3" "gad-4" "gad-5" "hr" "sa-1" "sa-2" "sa-3" "sa-4" "os-1" "os-2" "os-3" "os-4" "rspc") + +for branch in "${branches[@]}" +do + echo "Creating $branch..." + + git checkout -b "$branch" + git push origin "$branch" + + echo "Pushed new branch $branch to remote" +done \ No newline at end of file From aa2e5791c9de58bf6f19f7220e74d8c2306c14d5 Mon Sep 17 00:00:00 2001 From: AgPriyanshu18 Date: Fri, 17 Nov 2023 17:02:40 +0530 Subject: [PATCH 2/4] Server Url updated --- android/build.gradle | 4 ++-- android/gradle/wrapper/gradle-wrapper.properties | 2 +- lib/api.dart | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index b3a325d5..a78be8cb 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.8.21' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index cc5527d7..6b665338 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/lib/api.dart b/lib/api.dart index 802bee2d..73d1c6bc 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -1,10 +1,11 @@ //Server and local links String klocalLink = "127.0.0.1:8000"; -String kserverLink = "172.27.16.215:80"; +String kserverLink = "172.27.16.214:8000"; //Login Service -String kAuthUrl = "172.27.16.215:80"; +String kAuthUrl = "172.27.16.214:8000"; String kAuthLogin = "/api/auth/login/"; +// String kAuthLogin = "/accounts/login"; //Profile Service String kProfile = "/api/profile/"; From d329bf366a06f21c4acea0b74852b8a843557da7 Mon Sep 17 00:00:00 2001 From: Praneki <97080887+PraneGIT@users.noreply.github.com> Date: Wed, 17 Apr 2024 21:51:24 +0530 Subject: [PATCH 3/4] Gad 5 to main (#162) * Ui Changes and Added functionality of designation * Updated kserverLink,kAuthUrl and gradle ver (7.4.2) --------- Co-authored-by: TusharGupta03 --- android/build.gradle | 2 +- lib/Components/appBar2.dart | 106 +++++ lib/Components/bottom_navigation_bar.dart | 148 +++++++ lib/Components/side_drawer2.dart | 264 ++++++++++++ lib/DesignationProvider.dart | 12 + lib/api.dart | 1 + lib/main.dart | 12 +- .../DashboardComponents/announcement.dart | 200 +++++++++ .../DashboardComponents/cardItems.dart | 76 ++-- .../DashboardComponents/news.dart | 201 +++++++++ .../DashboardComponents/notify.dart | 152 +++++++ lib/screens/LoginandDashboard/dashboard.dart | 389 +++++++++++------- lib/screens/LoginandDashboard/login_page.dart | 155 ++++--- lib/services/appBar_services.dart | 14 + lib/services/dashboard_service.dart | 51 ++- lib/services/login_service.dart | 16 +- lib/services/storage_service.dart | 14 +- 17 files changed, 1543 insertions(+), 270 deletions(-) create mode 100644 lib/Components/appBar2.dart create mode 100644 lib/Components/bottom_navigation_bar.dart create mode 100644 lib/Components/side_drawer2.dart create mode 100644 lib/DesignationProvider.dart create mode 100644 lib/screens/LoginandDashboard/DashboardComponents/announcement.dart create mode 100644 lib/screens/LoginandDashboard/DashboardComponents/news.dart create mode 100644 lib/screens/LoginandDashboard/DashboardComponents/notify.dart create mode 100644 lib/services/appBar_services.dart diff --git a/android/build.gradle b/android/build.gradle index a78be8cb..881e7e55 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/lib/Components/appBar2.dart b/lib/Components/appBar2.dart new file mode 100644 index 00000000..a1f63393 --- /dev/null +++ b/lib/Components/appBar2.dart @@ -0,0 +1,106 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/constants.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; + +class CustomAppBar extends StatefulWidget implements PreferredSizeWidget { + final String curr_desig; + final String headerTitle; + + final ValueChanged onDesignationChanged; + + const CustomAppBar({ + Key? key, + required this.curr_desig, + required this.headerTitle, + + required this.onDesignationChanged, + }) : super(key: key); + + @override + _CustomAppBarState createState() => _CustomAppBarState(); + + @override + Size get preferredSize => Size.fromHeight(kToolbarHeight); +} + +class _CustomAppBarState extends State { + late List designations; + late String current; + var service = locator(); + + @override + void initState() { + super.initState(); + designations = (service!.getFromDisk('designations') as List) + .map((dynamic item) => item.toString()) + .toList(); + + current = service!.getFromDisk( + 'Current_designation'); // Ensure designations is not null before accessing index 0 + } + + @override + Widget build(BuildContext context) { + return AppBar( + iconTheme: IconThemeData(color: Colors.white), + backgroundColor: kPrimaryColor, + title: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: Padding( + padding: EdgeInsets.only(right: 20.0), // Add some right padding to ensure space for the dropdown + child: Text( + widget.headerTitle, // Example of a long title + overflow: TextOverflow.ellipsis, // Prevents overflow by adding ellipsis + style: TextStyle( + color: Colors.white, + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + DropdownButtonHideUnderline( + child: DropdownButton( + padding: const EdgeInsets.all(15), + borderRadius: BorderRadius.circular(5), + value: current, + icon: Icon(Icons.arrow_drop_down, color: Colors.white), + iconSize: 24, + style: TextStyle(color: Colors.white, fontSize: 18), + dropdownColor: + kPrimaryColor, // Set the dropdown background color to orange + onChanged: (String? newValue) { + widget.onDesignationChanged(newValue!); + setState(() { + current = newValue!; + service!.saveToDisk('Current_designation', current); + }); + }, + items: designations.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text( + value, + style: TextStyle( + color: Colors.white), // Set the text color to white + ), + ); + }).toList(), + onTap: () { + // Find the index of the selected value + int index = designations.indexOf(current); + // Scroll the dropdown to the selected value + Scrollable.ensureVisible(context, + alignment: 0.5, duration: Duration(milliseconds: 300)); + }, + ), + ), + ], + ), + actions: [], + ); + } +} \ No newline at end of file diff --git a/lib/Components/bottom_navigation_bar.dart b/lib/Components/bottom_navigation_bar.dart new file mode 100644 index 00000000..f95ad3c3 --- /dev/null +++ b/lib/Components/bottom_navigation_bar.dart @@ -0,0 +1,148 @@ +import 'package:flutter/material.dart'; + +class MyBottomNavigationBar extends StatefulWidget { + @override + _MyBottomNavigationBarState createState() => _MyBottomNavigationBarState(); +} + +class _MyBottomNavigationBarState extends State { + bool _notificationsBool = false; + bool _announcementsBool = false; + bool _newsBool = false; + bool _homeBool = false; + + @override + Widget build(BuildContext context) { + return SizedBox( + height: 100.0, + child: Padding( + padding: EdgeInsets.only(bottom: 40), + child: Card( + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(17.0), + ), + child: Padding( + padding: const EdgeInsets.only( + left: 13.0, right: 10.0, top: 5.0, bottom: 5.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + _notificationsBool = false; + _announcementsBool = false; + _newsBool = false; + _homeBool = true; + setState(() { + _notificationsBool = false; + _announcementsBool = false; + _newsBool = false; + _homeBool = true; + }); + Navigator.pushReplacementNamed(context, "/dashboard"); + + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.home_rounded, + color: Colors.white, + size: _homeBool ? 30.0 : 25.0, + ), + ], + ), + ), + GestureDetector( + onTap: () { + _newsBool = true; + _announcementsBool = false; + _notificationsBool = false; + _homeBool = false; + + setState(() { + _newsBool = true; + _announcementsBool = false; + _notificationsBool = false; + _homeBool = false; + }); + Navigator.pushReplacementNamed(context, "/news"); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.newspaper_rounded, + color: Colors.white, + size: _newsBool ? 30.0 : 25.0, + ), + ], + ), + ), + GestureDetector( + onTap: () { + _announcementsBool = false; + _newsBool = false; + _notificationsBool = true; + _homeBool = false; + + setState(() { + _announcementsBool = false; + _newsBool = false; + _notificationsBool = true; + _homeBool = false; + }); + Navigator.pushReplacementNamed(context, "/notification"); + }, + child: Padding( + padding: const EdgeInsets.only(right: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.notifications_active_rounded, + color: Colors.white, + size: _notificationsBool ? 30.0 : 25.0, + ), + ], + ), + ), + ), + GestureDetector( + onTap: () { + _announcementsBool = true; + _newsBool = false; + _notificationsBool = false; + _homeBool = false; + + setState(() { + _announcementsBool = true; + _newsBool = false; + _notificationsBool = false; + _homeBool = false; + }); + Navigator.pushReplacementNamed(context, "/announcement"); + }, + child: Padding( + padding: const EdgeInsets.only(right: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.campaign_rounded, + color: Colors.white, + size: _announcementsBool ? 30.0 : 25.0, + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/Components/side_drawer2.dart b/lib/Components/side_drawer2.dart new file mode 100644 index 00000000..97c80e8d --- /dev/null +++ b/lib/Components/side_drawer2.dart @@ -0,0 +1,264 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/services/login_service.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; + +class SideDrawer extends StatefulWidget { + final String curr_desig; + + const SideDrawer({ + Key? key, + required this.curr_desig, + }) : super(key: key); + + @override + _SideDrawerState createState() => _SideDrawerState(); +} + +class _SideDrawerState extends State { + bool _loading = false; + int count = 0; + late String name; + late String depttype; + late String type; + @override + void initState() { + super.initState(); + var service = locator(); + print(service.profileData); + name = service.profileData.user!["first_name"] + + " " + + service.profileData.user!["last_name"]; + depttype = service.profileData.profile!['department']!['name']; + + type = service.profileData.profile!['user_type']; + print(depttype); + } + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Container( + margin: const EdgeInsets.only(right: 50.0), + height: MediaQuery.of(context).size.height, + color: Colors.white, + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + Column( + children: [ + Card( + elevation: 2.0, + margin: + EdgeInsets.symmetric(horizontal: 12.0, vertical: 30.0), + // shadowColor: Colors.black, + color: Colors.white, + + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 0.0), + width: 270.0, + height: 120.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/profile_pic.png'), + fit: BoxFit.contain, + ), + ), + ), + SizedBox( + height: 10.0, + ), + Text( + name, //Display name of User + style: TextStyle( + fontSize: 20.0, + color: Colors.black, + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10.0, + ), + Text( + depttype + + " " + + widget.curr_desig, // Display Type of User + style: TextStyle( + fontSize: 17.0, + color: Colors.black, + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ), + ], + ), + ModulesCard(cardLine: 'DashBoard', pageMover: '/dashboard'), + + if ((type != "staff" || widget.curr_desig=="acadmin"|| widget.curr_desig== "corelabcaretaker")) + ModulesCard( + cardLine: 'Academics Module', + pageMover: '/academic_home_page', + ), + + if ((type == "student" || widget.curr_desig=="acadmin")) + ModulesCard( + cardLine: 'Programme Curriculum', + pageMover: '/programme_curriculum_home', + ), + + if ((type == "student") || widget.curr_desig== "Dean_s" || widget.curr_desig== "DeanPnD" || widget.curr_desig== "dean_rspc" || widget.curr_desig== "dean_s" ) + ModulesCard( + cardLine: 'Gymkhana Module', + pageMover: '/gymkhana_homepage', + ), + + if ((type == "student" || widget.curr_desig== "mess_manager" || widget.curr_desig== "mess_warden")) + ModulesCard(cardLine: 'Central Mess Module',pageMover: '/central_mess_home'), + + + ModulesCard( + cardLine: 'Health Center Module', + pageMover: '/health_center', + ), + if ((type == "student" )) + ModulesCard(cardLine: 'Leave Module'), + + if ((type == "student" )) + ModulesCard(cardLine: 'Purchase and Store'), + + if ((type == "student" )) + ModulesCard(cardLine: 'Human Resource'), + + if(type == "student"|| widget.curr_desig=="placement chairman" || widget.curr_desig=="placement officer") + ModulesCard(cardLine: 'Placement Module'), + + ModulesCard(cardLine: 'Visitors Hostel Module',pageMover: '/visitor_hostel'), + + if(type != "student") + ModulesCard(cardLine: 'File Tracking Module',pageMover: '/compose_file'), + + ModulesCard( + cardLine: 'Establishment Module', pageMover: '/establishment'), + + ModulesCard( + cardLine: 'Library Module', pageMover: '/library_homepage'), + + if(type == "student" || widget.curr_desig== "spacsconvenor"|| widget.curr_desig== "spacsassistant") + ModulesCard(cardLine: 'Awards & Scholarship Module'), + + ModulesCard(cardLine: 'Complaint Module', pageMover: '/complaint'), + + ModulesCard(cardLine: 'Research Module'), + + ModulesCard(cardLine: 'Counselling Cell'), + + if ((type == "faculty" ||widget.curr_desig== "acadadmin" )) + ModulesCard(cardLine: 'Examination Module',pageMover: '/examination',), + + + + if ((widget.curr_desig== "Executive Engineer (Civil)" ||widget.curr_desig== "EE" || widget.curr_desig== "Admin IWD" || widget.curr_desig== "Electrical_AE" || widget.curr_desig== "mess_manager" || widget.curr_desig== "Electrical_JE" || widget.curr_desig== "Civil_AE" || widget.curr_desig== "Civil_JE" || widget.curr_desig== "Director" || widget.curr_desig== "dean_s" || widget.curr_desig== "Dean_s" || widget.curr_desig== "DeanPnD" )) + ModulesCard(cardLine: 'IWD',pageMover: '/iwd/home_page'), + + + ModulesCard(cardLine: 'Courses Module', pageMover: '/registered_courses', + ), + ModulesCard(cardLine: 'HR Module', pageMover: '/hr_homepage', + ), + + + // ModulesCard( + // cardLine: 'Profile', + // icon: Icons.account_circle, + // pageMover: '/profile'), + + // ModulesCard(cardLine: 'Office Of Dean Students'), + // ModulesCard(cardLine: 'Office Of Dean Academics'), + // ModulesCard(cardLine: 'Director Office'), + // ModulesCard(cardLine: 'Office Of Purchase Officer'), + // ModulesCard(cardLine: 'Office Of Registrar'), + // ModulesCard(cardLine: 'Office Of P&D'), + // ModulesCard(cardLine: 'Office Of HOD (Branch)'), + // ModulesCard(cardLine: 'Finance & Accounts'), + // ModulesCard(cardLine: 'Meet Our Team'), + ModulesCard(cardLine: 'Log Out', icon: Icons.logout), + ], + ), + ), + ); + } + +String _getGymkhanaPage() { + + // Determine the pageMover based on designation + print(widget.curr_desig); + if (widget.curr_desig == 'co-ordinator') { + + return '/gymkhana_coordinator'; + } + else if(widget.curr_desig == 'Counsellor'){ + return '/gymkhana_counsellor'; + } + else if(widget.curr_desig == 'Convenor'){ + return '/gymkhana_convenor'; + } + else if(widget.curr_desig == 'Dean Academic'){ + return '/gymkhana_dean'; + } + + else + return '/gymkhana_homepage'; + } +// ignore: must_be_immutable +} + +class ModulesCard extends StatelessWidget { + final String? cardLine; + final String? pageMover; + IconData? icon; + ModulesCard({this.cardLine, this.icon, this.pageMover}); + @override + Widget build(BuildContext context) { + return GestureDetector( + //behaviour to translucent to get Tap even on blank or empty space within container + behavior: HitTestBehavior.translucent, + child: Card( + color: Colors.white, + margin: const EdgeInsets.all(10.0), + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + cardLine!, + style: TextStyle(fontSize: 16.0, color: Colors.black), + ), + Icon( + icon, + color: Colors.deepOrangeAccent, + ), + ], + ), + ), + ), + onTap: () async { + var _prefs = await StorageService.getInstance(); + String token = _prefs!.userInDB?.token ?? ""; + if (cardLine == 'Log Out') { + LoginService auth = LoginService(); + auth.logout(); + Navigator.pushReplacementNamed(context, "/landing"); + } + if (pageMover != null) + Navigator.pushReplacementNamed(context, pageMover!, arguments: token); + }, + ); + } +} \ No newline at end of file diff --git a/lib/DesignationProvider.dart b/lib/DesignationProvider.dart new file mode 100644 index 00000000..34031248 --- /dev/null +++ b/lib/DesignationProvider.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class DesignationProvider extends ChangeNotifier { + late String _designation; + + String get designation => _designation; + + void updateDesignation(String newDesignation) { + _designation = newDesignation; + notifyListeners(); // Notify listeners about the change + } +} \ No newline at end of file diff --git a/lib/api.dart b/lib/api.dart index 73d1c6bc..1f76a52b 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -21,6 +21,7 @@ String kComplaintRemove = "/complaint/api/removecomplain/"; //Dashboard String kDashboard = "/api/dashboard/"; +String kNotification = "/api/notification/"; String kNotificationRead = "/api/notification/read/"; //Gymkhana diff --git a/lib/main.dart b/lib/main.dart index 9ca81ff8..4cd5af87 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,10 @@ import 'package:fusion/screens/Library/Book_Search.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'; import 'package:fusion/screens/LoginandDashboard/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/notify.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/announcement.dart'; import 'package:fusion/screens/LoginandDashboard/login_page.dart'; import 'package:fusion/screens/Academic/academic_home_page.dart'; import 'package:fusion/screens/Academic/Current_Semester/current_semester_home_page.dart'; @@ -60,9 +63,9 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { MediaQueryData windowData = - MediaQueryData.fromWindow(WidgetsBinding.instance.window); + MediaQueryData.fromView(WidgetsBinding.instance.window); windowData = windowData.copyWith( - textScaleFactor: 1, + textScaler: TextScaler.linear(1), ); return MediaQuery( data: windowData, @@ -81,6 +84,9 @@ class MyApp extends StatelessWidget { routes: { '/landing': (context) => LandingPage(), '/login_page': (context) => LoginPage(), + '/notification':(context)=>Notify(), + '/news':(context)=>News(), + '/announcement':(context)=>Announcement(), '/dashboard': (context) => Dashboard(), '/academic_home_page': (context) => AcademicHomePage( ModalRoute.of(context)!.settings.arguments.toString()), @@ -131,4 +137,4 @@ class MyApp extends StatelessWidget { ), ); } -} +} \ No newline at end of file diff --git a/lib/screens/LoginandDashboard/DashboardComponents/announcement.dart b/lib/screens/LoginandDashboard/DashboardComponents/announcement.dart new file mode 100644 index 00000000..c0db276f --- /dev/null +++ b/lib/screens/LoginandDashboard/DashboardComponents/announcement.dart @@ -0,0 +1,200 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/models/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; +import 'package:fusion/services/dashboard_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; + +class Announcement extends StatefulWidget { + static String tag = 'home-page'; + @override + _AnnouncementState createState() => _AnnouncementState(); +} + +class _AnnouncementState extends State { + bool _notificationsBool = false; + bool _newsBool = false; + bool _announcementsBool = true; + bool _homeBool = false; + + bool _loading = true; + late String name; + late String studentType; + // Stream Controller for API + late StreamController _dashboardController; + late DashboardService dashboardService; + late DashboardData data; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data2; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + @override + void initState() { + super.initState(); + _dashboardController = StreamController(); + dashboardService = DashboardService(); + _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + print("gfsgsgd"); + Response response = await dashboardService.getDashboard(); + print("1"); + Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + + setState(() { + data = DashboardData.fromJson(jsonDecode(response.body)); + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name'] + + ' ' + + data2.profile!['user_type']; + } catch (e) { + print(e); + } + } + + loadData() async { + getData().then((res) { + _dashboardController.add(res); + _profileController.add(res); + }); + } + + final GlobalKey scaffoldKey = new GlobalKey(); + showSnack() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('New Content Loaded'), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "Announcement", + + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + }, + ), + bottomNavigationBar: MyBottomNavigationBar(), + drawer: SideDrawer(curr_desig: curr_desig), + body: _loading == true + ? Center(child: CircularProgressIndicator()) + : StreamBuilder( + stream: _dashboardController.stream, + builder: (context, AsyncSnapshot snapshot) { + return Stack(children: [ + Positioned( + left: 0, + child: Column( + children: [ + Card( + elevation: 0, + margin: EdgeInsets.symmetric( + horizontal: 10.0, vertical: 10.0), + color: Colors.transparent, + child: Padding( + padding: const EdgeInsets.only( + top: 10.0, + bottom: 10.0, + left: 13.0, + right: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + setState(() { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + }); + Navigator.pushReplacementNamed( + context, "/notification"); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + // Only handle navigation when the icon is clicked + _notificationsBool = false; + _announcementsBool = true; + _newsBool = false; + setState(() { + _notificationsBool = false; + _announcementsBool = true; + _newsBool = false; + }); + Navigator.pushReplacementNamed( + context, "/landing"); + }, + child: Icon( + Icons.navigate_before_rounded, + color: Colors.black, + size: 25.0, + ), + ), + SizedBox(width: 20.0), + Text( + 'Announcement', + style: TextStyle( + fontSize: 22.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 170.0), + ], + ), + ), + ], + ), + ), + ), + + + ], + ), + ), + ]); + }, + ), + ); + } + + @override + void dispose() { + _dashboardController.close(); + super.dispose(); + } +} \ No newline at end of file diff --git a/lib/screens/LoginandDashboard/DashboardComponents/cardItems.dart b/lib/screens/LoginandDashboard/DashboardComponents/cardItems.dart index fffcde98..63afcdd9 100644 --- a/lib/screens/LoginandDashboard/DashboardComponents/cardItems.dart +++ b/lib/screens/LoginandDashboard/DashboardComponents/cardItems.dart @@ -1,36 +1,34 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:fusion/models/notification.dart' as notif; import 'package:fusion/services/dashboard_service.dart'; class NotificationCard extends StatelessWidget { final List? notifications; - const NotificationCard({Key? key, required this.notifications}) - : super(key: key); + const NotificationCard({Key? key, required this.notifications}) : super(key: key); @override Widget build(BuildContext context) { return Card( elevation: 2.0, - margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), + margin: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), shadowColor: Colors.black, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: getCards(), + child: SingleChildScrollView( // Added to allow scrolling + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: getCards(), + ), ), ); } - getCards() { - List cards = []; - for (int i = 0; i < notifications!.length; i++) { - cards.add(InfoCard( - notification: notifications![i], - )); - } - return cards; + List getCards() { + // Transforming the notifications into InfoCard widgets + return notifications!.map((notif.Notification notification) { + return InfoCard( + notification: notification, + ); + }).toList(); } } @@ -38,19 +36,20 @@ class NewsCard extends StatelessWidget { @override Widget build(BuildContext context) { return Card( - elevation: 2.0, - margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), + elevation: 0, + margin: EdgeInsets.symmetric( + horizontal: 10.0, vertical: 10.0), shadowColor: Colors.black, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Card( elevation: 3.0, - margin: EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0), + margin: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0), shadowColor: Colors.black, - child: Center( + child: const Center( child: Padding( - padding: const EdgeInsets.all(18.0), + padding: EdgeInsets.all(18.0), child: Text('Work in progress'), ), ), @@ -64,9 +63,10 @@ class NewsCard extends StatelessWidget { class InfoCard extends StatefulWidget { final notif.Notification notification; - InfoCard({ + const InfoCard({ + Key? key, required this.notification, - }); + }) : super(key: key); @override _InfoCardState createState() => _InfoCardState(); @@ -77,46 +77,38 @@ class _InfoCardState extends State { Widget build(BuildContext context) { return Card( elevation: 3.0, - margin: EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0), + margin: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0), shadowColor: Colors.black, child: Column( children: [ - SizedBox( - height: 10.0, - ), + const SizedBox(height: 10.0), Text( widget.notification.data!["module"], textAlign: TextAlign.left, - style: TextStyle( + style: const TextStyle( fontSize: 20.0, color: Colors.deepOrangeAccent, fontWeight: FontWeight.bold, ), ), - SizedBox( - height: 10.0, - ), + const SizedBox(height: 10.0), Padding( padding: const EdgeInsets.all(8.0), child: Text( widget.notification.verb!, - style: TextStyle(fontSize: 15.0, color: Colors.black), + style: const TextStyle(fontSize: 15.0, color: Colors.black), ), ), - SizedBox( - height: 10.0, - ), + const SizedBox(height: 10.0), ElevatedButton( - child: widget.notification.unread! - ? Text('Mark As Read') - : Text('Mark As Unread'), + child: Text(widget.notification.unread! ? 'Mark As Read' : 'Mark As Unread'), onPressed: () { // Respond to button press DashboardService service = DashboardService(); setState(() { try { service.markRead(widget.notification.id!.toString()); - }catch(e){ + } catch (e) { print(e); } }); @@ -124,10 +116,8 @@ class _InfoCardState extends State { style: ButtonStyle( backgroundColor: MaterialStateProperty.resolveWith( (Set states) { - if (states.contains(MaterialState.pressed)) - return Colors.deepOrange; - return Colors - .deepOrangeAccent; // Use the component's default. + if (states.contains(MaterialState.pressed)) return Colors.deepOrange; + return Colors.deepOrangeAccent; // Default Color }, ), ), diff --git a/lib/screens/LoginandDashboard/DashboardComponents/news.dart b/lib/screens/LoginandDashboard/DashboardComponents/news.dart new file mode 100644 index 00000000..268ae36a --- /dev/null +++ b/lib/screens/LoginandDashboard/DashboardComponents/news.dart @@ -0,0 +1,201 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/models/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; +import 'package:fusion/services/dashboard_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; + +class News extends StatefulWidget { + static String tag = 'home-page'; + @override + _NewsState createState() => _NewsState(); +} + +class _NewsState extends State { + bool _notificationsBool = false; + bool _newsBool = true; + bool _announcementsBool = false; + bool _homeBool = false; + + bool _loading = true; + late String name; + late String studentType; + // Stream Controller for API + late StreamController _dashboardController; + late DashboardService dashboardService; + late DashboardData data; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data2; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + + @override + void initState() { + super.initState(); + _dashboardController = StreamController(); + dashboardService = DashboardService(); + _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + print("gfsgsgd"); + Response response = await dashboardService.getDashboard(); + print("1"); + Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + + setState(() { + data = DashboardData.fromJson(jsonDecode(response.body)); + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name'] + + ' ' + + data2.profile!['user_type']; + } catch (e) { + print(e); + } + } + + loadData() async { + getData().then((res) { + _dashboardController.add(res); + _profileController.add(res); + }); + } + + final GlobalKey scaffoldKey = new GlobalKey(); + showSnack() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('New Content Loaded'), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "News", + + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + }, + ), + drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: MyBottomNavigationBar(), + body: _loading == true + ? Center(child: CircularProgressIndicator()) + : StreamBuilder( + stream: _dashboardController.stream, + builder: (context, AsyncSnapshot snapshot) { + return Stack(children: [ + Positioned( + left: 0, + child: Column( + children: [ + Card( + elevation: 0, + margin: EdgeInsets.symmetric( + horizontal: 10.0, vertical: 10.0), + color: Colors.transparent, + child: Padding( + padding: const EdgeInsets.only( + top: 10.0, + bottom: 10.0, + left: 13.0, + right: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + setState(() { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + }); + Navigator.pushReplacementNamed( + context, "/notification"); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + // Only handle navigation when the icon is clicked + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + setState(() { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + }); + Navigator.pushReplacementNamed( + context, "/landing"); + }, + child: Icon( + Icons.navigate_before_rounded, + color: Colors.black, + size: 25.0, + ), + ), + SizedBox(width: 20.0), + Text( + 'News', + style: TextStyle( + fontSize: 22.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 170.0), + ], + ), + ), + ], + ), + ), + ), + + + ], + ), + ), + ]); + }, + ), + ); + } + + @override + void dispose() { + _dashboardController.close(); + super.dispose(); + } +} \ No newline at end of file diff --git a/lib/screens/LoginandDashboard/DashboardComponents/notify.dart b/lib/screens/LoginandDashboard/DashboardComponents/notify.dart new file mode 100644 index 00000000..198820b5 --- /dev/null +++ b/lib/screens/LoginandDashboard/DashboardComponents/notify.dart @@ -0,0 +1,152 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/models/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; +import 'package:fusion/services/dashboard_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/models/notification.dart' as notif; +import 'package:intl/intl.dart'; + +class Notify extends StatefulWidget { + static String tag = 'home-page'; + @override + _NotifyState createState() => _NotifyState(); +} + +class _NotifyState extends State { + List _notifications = []; + bool _loading = true; + late String name; + late String studentType; + + // Stream Controller for API + late StreamController _dashboardController; + late DashboardService dashboardService; + late DashboardData data; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data2; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + @override + void initState() { + super.initState(); + _dashboardController = StreamController(); + dashboardService = DashboardService(); + _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + print("gfsgsgd"); + Response response = await dashboardService.getNotification(); + print("1"); + Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + + setState(() { + data = DashboardData.fromJson(jsonDecode(response.body)); + _notifications = notif.Notification.fromListJson(jsonDecode(response.body)['notifications']); + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name'] + + ' ' + + data2.profile!['user_type']; + } catch (e) { + print(e); + } + } + + loadData() async { + getData().then((res) { + _dashboardController.add(res); + _profileController.add(res); + }); + } + + final GlobalKey scaffoldKey = new GlobalKey(); + showSnack() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('New Content Loaded'), + ), + ); + } + + @override +Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "Notifications", + + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + }, + ), // This is default app bar used in all modules + drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: + MyBottomNavigationBar(), // This is sideDrawer used in all modules + body: _loading + ? Center(child: CircularProgressIndicator()) + : ListView.builder( + itemCount: _notifications.length, + padding: EdgeInsets.all(8.0), // Add padding around the list for better spacing + itemBuilder: (context, index) { + final notification = _notifications[index]; + final formattedDate = notification.timestamp != null + ? DateFormat('yyyy-MM-dd – kk:mm').format(notification.timestamp!) + : "No Date"; + + return Card( + elevation: 4.0, // Adjust the shadow's elevation + margin: EdgeInsets.symmetric(vertical: 4.0, horizontal: 0), // Spacing between cards + child: ListTile( + leading: Icon(notification.unread ?? false ? Icons.notifications_active : Icons.notifications_off), + title: Text(notification.verb ?? "No Title"), + subtitle: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + notification.description ?? "No Description", + overflow: TextOverflow.ellipsis, + ), + ), + Text(formattedDate, textAlign: TextAlign.right), + ], + ), + onTap: () { + // Handle tap + }, + ), + ); + }, + ), + + + ); + } + + @override + void dispose() { + _dashboardController.close(); + super.dispose(); + } +} \ No newline at end of file diff --git a/lib/screens/LoginandDashboard/dashboard.dart b/lib/screens/LoginandDashboard/dashboard.dart index 80c2719f..24f372d5 100644 --- a/lib/screens/LoginandDashboard/dashboard.dart +++ b/lib/screens/LoginandDashboard/dashboard.dart @@ -2,15 +2,17 @@ import 'dart:async'; import 'dart:convert'; import 'package:fusion/models/profile.dart'; import 'package:fusion/services/profile_service.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:fusion/Components/appBar.dart'; -import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; import 'package:fusion/models/dashboard.dart'; import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; import 'package:fusion/services/dashboard_service.dart'; import 'package:http/http.dart'; +import 'package:fusion/services/appBar_services.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; class Dashboard extends StatefulWidget { static String tag = 'home-page'; @@ -20,9 +22,11 @@ class Dashboard extends StatefulWidget { } class _DashboardState extends State { - bool _notificationsBool = true; + bool _notificationsBool = false; bool _newsBool = false; bool _announcementsBool = false; + bool _homeBool = true; + bool _loading = true; late String name; late String studentType; @@ -33,6 +37,12 @@ class _DashboardState extends State { late StreamController _profileController; late ProfileService profileService; late ProfileData data2; + late List designationsArray; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + bool isStudent = false; + + final appBarServices _appBarServices = appBarServices(); @override void initState() { super.initState(); @@ -45,17 +55,28 @@ class _DashboardState extends State { getData() async { try { + print("gfsgsgd"); Response response = await dashboardService.getDashboard(); + print("1"); Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + setState(() { data = DashboardData.fromJson(jsonDecode(response.body)); data2 = ProfileData.fromJson(jsonDecode(response2.body)); _loading = false; }); + print(data2.user!); + print( + '-----------------------------------=---------------------------------------'); name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; - studentType = data2.profile!['department']!['name'] + - ' ' + - data2.profile!['user_type']; + studentType = data2.profile!['department']!['name']; + + if (data2.profile!['user_type'] == 'student') { + isStudent = true; + } } catch (e) { print(e); } @@ -68,6 +89,15 @@ class _DashboardState extends State { }); } + fetchDesignations() async { + try { + designationsArray = await _appBarServices.getDesignations(); + } catch (e) { + print("Error fetching designations: $e"); + return null; + } + } + final GlobalKey scaffoldKey = new GlobalKey(); showSnack() { ScaffoldMessenger.of(context).showSnackBar( @@ -80,174 +110,221 @@ class _DashboardState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: DefaultAppBar() - .buildAppBar(), // This is default app bar used in all modules - drawer: SideDrawer(), // This is sideDrawer used in all modules - body: _loading == true - ? Center(child: CircularProgressIndicator()) - : StreamBuilder( - 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( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "Dashboard", + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + }, + ), // This is default app bar used in all modules + drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: + MyBottomNavigationBar(), // This is sideDrawer used in all modules + body: Column( + children: [ + Expanded( + child: _loading == true + ? Center(child: CircularProgressIndicator()) + : StreamBuilder( + stream: _dashboardController.stream, + builder: (context, AsyncSnapshot snapshot) { + return ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), 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, - ), - ], - ), - ), - 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, - children: [ - Text( - 'Notifications', - style: TextStyle( - fontSize: 16.0, - color: Colors.white, + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 30.0), + // shadowColor: Colors.black, + color: Colors.white, + + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 190.0, + decoration: BoxDecoration( + image: DecorationImage( + image: + AssetImage('assets/profile_pic.png'), + fit: BoxFit.cover, ), ), - Icon( - Icons.notifications_active_rounded, - color: _notificationsBool - ? Colors.deepOrangeAccent - : Colors.white, - ), - ], - ), + ), + SizedBox( + height: 10.0, + ), + Text( + name, //Display name of User + style: TextStyle( + fontSize: 20.0, + color: Colors.black, + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10.0, + ), + Text( + studentType + + " " + + curr_desig, // Display Type of User + style: TextStyle( + fontSize: 17.0, + color: Colors.black, + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10.0, + ), + ], ), - GestureDetector( - onTap: () { - _newsBool = true; - _announcementsBool = false; - _notificationsBool = false; - setState(() { - _newsBool = true; - _announcementsBool = false; - _notificationsBool = false; - }); - }, + ), + + Card( + margin: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 50.0), // Set the border radius here + ), + child: Padding( + padding: const EdgeInsets.only( + top: 10.0, + bottom: 10.0, + left: 13.0, + right: 10.0), child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment + .spaceEvenly, // Align the children along the main axis with space between them + crossAxisAlignment: CrossAxisAlignment + .center, // Align the children along the cross axis (vertically by default) + // mainAxisSize: MainAxisSize.max, children: [ - Text( - 'News', - style: TextStyle( - fontSize: 16.0, - color: Colors.white, + GestureDetector( + onTap: () { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + setState(() { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + }); + Navigator.pushReplacementNamed( + context, "/profile"); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Icon( + Icons.account_circle, + color: Colors.white, + size: 30.0, + ), + SizedBox(width: 40.0), + Text( + 'Professsional Profile', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + Icon( + Icons.arrow_forward_ios_rounded, + color: Colors.white, + ), + ], ), ), - Icon( - Icons.email, - color: _newsBool - ? Colors.deepOrangeAccent - : Colors.white, - ), ], ), ), - GestureDetector( - onTap: () { - _announcementsBool = true; - _newsBool = false; - _notificationsBool = false; - setState(() { - _announcementsBool = true; - _newsBool = false; - _notificationsBool = false; - }); - }, + ), + + if (!isStudent) + Card( + margin: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 50.0), // Set the border radius here + ), child: Padding( - padding: const EdgeInsets.only(right: 16.0), + padding: const EdgeInsets.only( + top: 10.0, + bottom: 10.0, + left: 13.0, + right: 10.0), child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceEvenly, children: [ - Text( - 'Announcements', - style: TextStyle( - fontSize: 16.0, - color: Colors.white, + GestureDetector( + onTap: () { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + setState(() { + _notificationsBool = true; + _announcementsBool = false; + _newsBool = false; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment + .spaceEvenly, // Align the children along the main axis with space between them + crossAxisAlignment: CrossAxisAlignment + .center, // Align the children along the cross axis (vertically by default) + mainAxisSize: MainAxisSize.max, + children: [ + Icon( + Icons.notifications_active_rounded, + color: Colors.white, + ), + SizedBox(width: 40.0), + Text( + 'Admistrative Profile', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + Icon( + Icons.arrow_forward_ios_rounded, + color: Colors.white, + ), + ], ), ), - Icon( - Icons.announcement, - color: _announcementsBool - ? Colors.deepOrangeAccent - : Colors.white, - ), ], ), ), ), - ], - ), - ), - ), - _notificationsBool - ? NotificationCard( - notifications: data.notifications, - ) - : NewsCard(), - ], - ); - }, - ), + + // _notificationsBool + // ? NotificationCard( + // notifications: data.notifications, + // ) + // : NewsCard(), + ], + ); + }, + ), + ), + // Place the BottomNavigationBar here + ], + ), ); } @@ -256,4 +333,4 @@ class _DashboardState extends State { _dashboardController.close(); super.dispose(); } -} +} \ No newline at end of file diff --git a/lib/screens/LoginandDashboard/login_page.dart b/lib/screens/LoginandDashboard/login_page.dart index ca09fee2..aff38280 100644 --- a/lib/screens/LoginandDashboard/login_page.dart +++ b/lib/screens/LoginandDashboard/login_page.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:fusion/constants.dart'; @@ -10,7 +9,9 @@ class LoginPage extends StatefulWidget { _LoginPageState createState() => _LoginPageState(); } -bool checkBoxValue = false; +bool _focused = false; +bool _focused2 = false; +double bottom =10; class _LoginPageState extends State { final GlobalKey _formKey = GlobalKey(); @@ -23,21 +24,45 @@ class _LoginPageState extends State { final Widget logoWidget = CircleAvatar( backgroundColor: Colors.transparent, - radius: 54.0, - child: Image.asset('assets/logo.jpg'), + radius: (_focused || _focused2) ? 110.0 : 150.0, + child:Container( + + child: Image.asset('assets/logo.jpg'), + ), ); - final Widget emailFormField = TextFormField( + final Widget emailFormField = Focus( + onFocusChange: (focus) { + setState(() { + _focused = focus; + if (focus==true){ + bottom=400; + } + + }); + }, + child:TextFormField( keyboardType: TextInputType.emailAddress, autofocus: false, decoration: InputDecoration( label: Text('Username', style: TextStyle( - fontSize: 12.0, + fontSize: 18.0, ),), contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - border: OutlineInputBorder( - // borderRadius: BorderRadius.circular(32.0), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(width: 0, color: Color(0xFFf4f4f4)), + borderRadius: BorderRadius.circular(20.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(width: 0, color: Color(0xFFf4f4f4)), + borderRadius: BorderRadius.circular(20.0), ), + // enabledBorder: InputBorder.none, + fillColor: Color(0xFFf4f4f4), // Green color + filled: true, + floatingLabelBehavior: FloatingLabelBehavior.never, ), + cursorColor: Colors.black, + onChanged: (input) { username = input; }, @@ -48,23 +73,45 @@ class _LoginPageState extends State { else if (value?.contains('@') == true) { return 'Please enter username only'; } + return null; }, autofillHints: [AutofillHints.username], - ); + )); + + final Widget passwordFormField = Focus( + onFocusChange: (focus) { + setState(() { + _focused2 = focus; + if (focus==true){ + bottom=400; + } - final Widget passwordFormField = TextFormField( + }); + }, + child: TextFormField( autofocus: false, obscureText: true, decoration: InputDecoration( label: Text('Password', style: TextStyle( - fontSize: 12.0, + fontSize: 18.0, ),), contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - border: OutlineInputBorder( - // borderRadius: BorderRadius.circular(32.0), + + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(width: 0, color: Color(0xFFf4f4f4)), + borderRadius: BorderRadius.circular(20.0), ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(width: 0, color: Color(0xFFf4f4f4)), + borderRadius: BorderRadius.circular(20.0), + ), + // enabledBorder: InputBorder.none, + fillColor: Color(0xFFf4f4f4), // Green color + filled: true, + floatingLabelBehavior: FloatingLabelBehavior.never, ), + cursorColor: Colors.black, onChanged: (input) { pass = input; }, @@ -74,12 +121,13 @@ class _LoginPageState extends State { } else if (value.length < 6) { return 'Password must be at least 6 characters'; } + return null; }, autofillHints: [AutofillHints.password], - ); + )); final loginButton = Padding( - padding: EdgeInsets.symmetric(vertical: 16.0), + padding: EdgeInsets.only(top: 16.0), child: ElevatedButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all(kPrimaryColor), @@ -102,7 +150,8 @@ class _LoginPageState extends State { style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, - fontSize: 14.0, + fontSize: 22.0, + ), ), ), @@ -124,13 +173,16 @@ class _LoginPageState extends State { key: _formKey, child: ListView( shrinkWrap: true, - padding: EdgeInsets.only(left: 24.0, right: 24.0), + padding: EdgeInsets.only(top:8.0,left: 24.0, right: 24.0), children: [ - logoWidget, + Padding( + padding: const EdgeInsets.only(top: 0.0), // Change the top padding here + child: logoWidget, + ), Padding( padding: const EdgeInsets.only(bottom: 30.0), child: Text( - 'Fusion Login', + 'Fusion', style: TextStyle( color: kPrimaryColor, fontWeight: FontWeight.bold, @@ -141,14 +193,21 @@ class _LoginPageState extends State { ), Padding( padding: EdgeInsets.only(bottom: 15), - child: emailFormField, + child: emailFormField, ), Padding( padding: EdgeInsets.only(bottom: 15), child: passwordFormField, ), - loginButton, - forgotLabel, + Padding( + padding: EdgeInsets.only(bottom: 0.0), + child: loginButton, + ), + Padding( + padding: EdgeInsets.only(top:0.0,bottom: bottom), + child: forgotLabel, + ), + ], ), ), @@ -157,29 +216,29 @@ class _LoginPageState extends State { ); } - // void _showDialog() { - // // flutter defined function - // showDialog( - // context: context, - // builder: (BuildContext context) { - // // return object of type Dialog - // return AlertDialog( - // title: Text("Invalid Username/Password"), - // content: Text("Please enter correct Username or Password"), - // actions: [ - // // usually buttons at the bottom of the dialog - // new TextButton( - // child: new Text( - // "Close", - // style: TextStyle(color: Colors.deepOrangeAccent), - // ), - // onPressed: () { - // Navigator.of(context).pop(); - // }, - // ), - // ], - // ); - // }, - // ); - // } -} +// void _showDialog() { +// // flutter defined function +// showDialog( +// context: context, +// builder: (BuildContext context) { +// // return object of type Dialog +// return AlertDialog( +// title: Text("Invalid Username/Password"), +// content: Text("Please enter correct Username or Password"), +// actions: [ +// // usually buttons at the bottom of the dialog +// new TextButton( +// child: new Text( +// "Close", +// style: TextStyle(color: Colors.deepOrangeAccent), +// ), +// onPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ], +// ); +// }, +// ); +// } +} \ No newline at end of file diff --git a/lib/services/appBar_services.dart b/lib/services/appBar_services.dart new file mode 100644 index 00000000..bc7ba3c0 --- /dev/null +++ b/lib/services/appBar_services.dart @@ -0,0 +1,14 @@ +import 'package:fusion/services/storage_service.dart'; + +class appBarServices { + getDesignations() async { + try { + var storageService = await StorageService.getInstance(); + List? designations = storageService!.getFromDisk('designations'); + + return designations; + } catch (e) { + rethrow; + } + } +} \ No newline at end of file diff --git a/lib/services/dashboard_service.dart b/lib/services/dashboard_service.dart index 8e4520a9..ef348125 100644 --- a/lib/services/dashboard_service.dart +++ b/lib/services/dashboard_service.dart @@ -7,12 +7,12 @@ import 'package:http/http.dart' as http; class DashboardService { getDashboard() async { try { - var storage_service = locator(); - if (storage_service.userInDB?.token == null) + var storageService = locator(); + if (storageService.userInDB?.token == null) throw Exception('Token Error'); Map headers = { - 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") + 'Authorization': 'Token ' + (storageService.userInDB?.token ?? "") }; var client = http.Client(); http.Response response = await client.get( @@ -24,6 +24,43 @@ class DashboardService { ); if (response.statusCode == 200) { print("success"); + print(response); + return response; + } + throw Exception('Can\'t load'); + } catch (e) { + rethrow; + } + } + + + getNotification() async { + try { + print("gett"); + var storageService = locator(); + if (storageService.userInDB?.token == null) + throw Exception('Token Error'); + + + Map headers = { + 'Authorization': 'Token ' + (storageService.userInDB?.token ?? "") + }; + print("gett2"); + + var client = http.Client(); + http.Response response = await client.get( + Uri.http( + getLink(), + kNotification, // constant dashboard path + ), + headers: headers, + ); + + print("gett3"); + + if (response.statusCode == 200) { + print("success"); + print(response); return response; } throw Exception('Can\'t load'); @@ -34,12 +71,12 @@ class DashboardService { markRead(String id) async { try { - StorageService? storage_service = await StorageService.getInstance(); + StorageService? storageService = await StorageService.getInstance(); - if (storage_service?.userInDB?.token == null) + if (storageService?.userInDB?.token == null) throw Exception('Token Error'); - String token = storage_service?.userInDB?.token ?? ""; + String token = storageService?.userInDB?.token ?? ""; Map headers = {'Authorization': 'Token ' + token}; Map body = {"id": id}; var client = http.Client(); @@ -60,4 +97,4 @@ class DashboardService { rethrow; } } -} +} \ No newline at end of file diff --git a/lib/services/login_service.dart b/lib/services/login_service.dart index 17d79b42..97277ffc 100644 --- a/lib/services/login_service.dart +++ b/lib/services/login_service.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:fusion/constants.dart'; import 'package:fusion/api.dart'; import 'package:fusion/models/user.dart'; import 'package:fusion/services/storage_service.dart'; @@ -25,8 +24,15 @@ class LoginService { var prefs = await StorageService.getInstance(); print("response.body: ${response.body}"); - var storage_service = await StorageService.getInstance(); - storage_service!.saveUserInDB(User((jsonDecode(response.body))["token"])); + var storageService = await StorageService.getInstance(); + storageService!.saveUserInDB(User((jsonDecode(response.body))["token"])); + storageService.saveToDisk>( + 'designations', + (jsonDecode(response.body)["designations"] as List) + .map((dynamic item) => item.toString()) + .toList(), + ); + storageService.saveStringToDisk("Current_designation",jsonDecode(response.body)["designations"][0]); return true; } catch (e) { rethrow; @@ -35,8 +41,8 @@ class LoginService { void logout() async { try { - var storage_service = await StorageService.getInstance(); - storage_service!.deleteKey("user"); + var storageService = await StorageService.getInstance(); + storageService!.deleteKey("user"); } catch (e) { rethrow; } diff --git a/lib/services/storage_service.dart b/lib/services/storage_service.dart index 94d39ea4..9d118326 100644 --- a/lib/services/storage_service.dart +++ b/lib/services/storage_service.dart @@ -13,19 +13,19 @@ class StorageService with ChangeNotifier { static const String ProfileKey = "ProfileKey"; User? get userInDB { - var userJson = _getFromDisk(UserKey); + var userJson = getFromDisk(UserKey); return userJson == null ? null : User.fromJson(jsonDecode(userJson)); } ProfileData get profileData { - var profileJson = _getFromDisk(ProfileKey); + var profileJson = getFromDisk(ProfileKey); // print(jsonDecode(profileJson)); return ProfileData.fromJson(jsonDecode(profileJson)); } AcademicData get academicData { - var profileJson = _getFromDisk(ProfileKey); + var profileJson = getFromDisk(ProfileKey); // print(jsonDecode(profileJson)); return AcademicData.fromJson(jsonDecode(profileJson)); } @@ -49,9 +49,9 @@ class StorageService with ChangeNotifier { return _instance; } - dynamic _getFromDisk(String key) { + dynamic getFromDisk(String key) { var value = _sharedPreferences?.get(key); - // print('(TRACE) LocalStorageService:_getFromDisk. key: $key value: $value'); + // print('(TRACE) LocalStorageService:getFromDisk. key: $key value: $value'); return value; } @@ -62,7 +62,7 @@ class StorageService with ChangeNotifier { void deleteKey(String key) { print( - '(TRACE) StorageService: deleteKey. key: $key value: ${_getFromDisk(key)}'); + '(TRACE) StorageService: deleteKey. key: $key value: ${getFromDisk(key)}'); _sharedPreferences!.remove(key); } @@ -84,4 +84,4 @@ class StorageService with ChangeNotifier { _sharedPreferences!.setStringList(key, content); } } -} +} \ No newline at end of file From 0e3e7d31cb6cf60773163caa15568e4137710d1d Mon Sep 17 00:00:00 2001 From: MuwalAbhi Date: Mon, 22 Apr 2024 23:56:19 +0530 Subject: [PATCH 4/4] AC-5 --- lib/Components/side_drawer2.dart | 3 +- lib/main.dart | 2 + .../SpacsAssistant/Homepage.dart | 111 +++++ .../browse_award_catalogue.dart | 0 .../SpacsConvener/browse_applications.dart | 39 ++ .../SpacsConvener/browse_award_catalogue.dart | 76 ++++ .../SpacsConvener/convener_homepage.dart | 131 ++++++ .../SpacsConvener/displaymedalcontent.dart | 116 ++++++ .../SpacsConvener/invite_applications.dart | 356 ++++++++++++++++ .../SpacsConvener/previous_winners.dart | 273 +++++++++++++ .../previous_winners_listpage.dart | 24 ++ .../SpacsConvener/spacs_member_details.dart | 110 +++++ .../Student/Catalogue.dart | 109 +++++ .../Student/application_data_provider.dart | 17 + .../Student/apply_for_convocationmedal.dart | 42 ++ .../Student/apply_for_mcm.dart | 33 ++ .../Student/applyforawards.dart | 185 +++++++++ .../Student/browseawardcatalogue.dart | 78 ++++ .../Student/convocation_medal_form.dart | 325 +++++++++++++++ .../Student/mcm_form.dart | 379 ++++++++++++++++++ .../Student/previous_winners.dart | 273 +++++++++++++ .../Student/previous_winners_listpage.dart | 24 ++ .../Student/spacs_members_details.dart | 110 +++++ .../Student/student_homepage.dart | 169 ++++++++ .../Student/view_application_status.dart | 37 ++ .../AwardsandScholarships/homepage.dart | 68 ++++ .../Profile/Menus/achievements_menu.dart | 2 +- lib/screens/Profile/Menus/education_menu.dart | 6 +- lib/screens/Profile/Menus/profile_menu.dart | 9 +- lib/screens/Profile/Menus/skills_menu.dart | 2 +- .../Profile/Menus/work_experiences_menu.dart | 6 +- lib/services/profile_service.dart | 1 + pubspec.yaml | 2 +- 33 files changed, 3107 insertions(+), 11 deletions(-) create mode 100644 lib/screens/AwardsandScholarships/SpacsAssistant/Homepage.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsAssistant/browse_award_catalogue.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsConvener/browse_applications.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsConvener/browse_award_catalogue.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsConvener/convener_homepage.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsConvener/displaymedalcontent.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsConvener/invite_applications.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsConvener/previous_winners.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsConvener/previous_winners_listpage.dart create mode 100644 lib/screens/AwardsandScholarships/SpacsConvener/spacs_member_details.dart create mode 100644 lib/screens/AwardsandScholarships/Student/Catalogue.dart create mode 100644 lib/screens/AwardsandScholarships/Student/application_data_provider.dart create mode 100644 lib/screens/AwardsandScholarships/Student/apply_for_convocationmedal.dart create mode 100644 lib/screens/AwardsandScholarships/Student/apply_for_mcm.dart create mode 100644 lib/screens/AwardsandScholarships/Student/applyforawards.dart create mode 100644 lib/screens/AwardsandScholarships/Student/browseawardcatalogue.dart create mode 100644 lib/screens/AwardsandScholarships/Student/convocation_medal_form.dart create mode 100644 lib/screens/AwardsandScholarships/Student/mcm_form.dart create mode 100644 lib/screens/AwardsandScholarships/Student/previous_winners.dart create mode 100644 lib/screens/AwardsandScholarships/Student/previous_winners_listpage.dart create mode 100644 lib/screens/AwardsandScholarships/Student/spacs_members_details.dart create mode 100644 lib/screens/AwardsandScholarships/Student/student_homepage.dart create mode 100644 lib/screens/AwardsandScholarships/Student/view_application_status.dart create mode 100644 lib/screens/AwardsandScholarships/homepage.dart diff --git a/lib/Components/side_drawer2.dart b/lib/Components/side_drawer2.dart index 97c80e8d..1d9dbc89 100644 --- a/lib/Components/side_drawer2.dart +++ b/lib/Components/side_drawer2.dart @@ -150,7 +150,8 @@ class _SideDrawerState extends State { cardLine: 'Library Module', pageMover: '/library_homepage'), if(type == "student" || widget.curr_desig== "spacsconvenor"|| widget.curr_desig== "spacsassistant") - ModulesCard(cardLine: 'Awards & Scholarship Module'), + ModulesCard(cardLine: 'Awards & Scholarship Module', + pageMover: '/scholarship_homepage',), ModulesCard(cardLine: 'Complaint Module', pageMover: '/complaint'), diff --git a/lib/main.dart b/lib/main.dart index 4cd5af87..a6da7daf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'dart:async'; import 'package:fusion/screens/Academic/Add_Drop_Courses/add_drop_courses.dart'; +import 'package:fusion/screens/AwardsandScholarships/homepage.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'; @@ -112,6 +113,7 @@ class MyApp extends StatelessWidget { '/programme_curriculum_home/courses_info': (context) => CoursesInfo(), '/establishment': (context) => Establishment(), '/gymkhana_homepage': (context) => GymkhanaHomepage(), + '/scholarship_homepage': (context) => SholarshipHomePage(), '/gymkhana_homepage/apply': (context) => Apply(), '/gymkhana_homepage/polls': (context) => Polls(), '/gymkhana_homepage/clubs': (context) => Club(), diff --git a/lib/screens/AwardsandScholarships/SpacsAssistant/Homepage.dart b/lib/screens/AwardsandScholarships/SpacsAssistant/Homepage.dart new file mode 100644 index 00000000..eca141e8 --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsAssistant/Homepage.dart @@ -0,0 +1,111 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/browse_applications.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/browse_award_catalogue.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/Components/appBar.dart'; + +class SpacsAssistantHomePage extends StatefulWidget { + const SpacsAssistantHomePage({super.key}); + + @override + State createState() => _SpacsAssistantHomePageState(); +} + +class _SpacsAssistantHomePageState extends State { + String? name; + String? depttype; + String? type; + @override + void initState() { + super.initState(); + var service = locator(); + name = service.profileData.user!["first_name"] + + " " + + service.profileData.user!["last_name"]; + } + + Widget build(BuildContext context) { + return Column( + children: [ + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 90.0, vertical: 30.0), + shadowColor: Colors.black, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 190.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( + 'Spacs Assistant', // Display Type of User + style: TextStyle(fontSize: 15.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ), + Column( + children: [ + SizedBox( + height: 30.0, + ), + // Container( + // height: 30, width: 130, + // ), + SizedBox( + width: 250, + child: ElevatedButton( + onPressed: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return BrowseAwardCatalogue(); + })); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.deepOrangeAccent, + ), + child: Text('Browse Catalogue')), + ), + + SizedBox( + width: 250, + child: ElevatedButton( + onPressed: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return BrowseApplications(); + })); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.deepOrangeAccent, + ), + child: Text('Browse Applications'), + ), + ), + ], + ), + ], + ); + } +} diff --git a/lib/screens/AwardsandScholarships/SpacsAssistant/browse_award_catalogue.dart b/lib/screens/AwardsandScholarships/SpacsAssistant/browse_award_catalogue.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/screens/AwardsandScholarships/SpacsConvener/browse_applications.dart b/lib/screens/AwardsandScholarships/SpacsConvener/browse_applications.dart new file mode 100644 index 00000000..a06d506d --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsConvener/browse_applications.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; + +class BrowseApplications extends StatefulWidget { + const BrowseApplications({super.key}); + + @override + State createState() => _BrowseApplicationsState(); +} + +class _BrowseApplicationsState extends State { + @override + Widget build(BuildContext context) { + + return Scaffold( + appBar: AppBar( + title: Text( + 'Browse Applications', + ), + backgroundColor: Colors.deepOrangeAccent, + ), + body: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: 2, + itemBuilder: (BuildContext context, int index) { + return ListTile( + leading: const Icon(Icons.list), + trailing: Text( + 'Review', + style: TextStyle(color: Colors.green, fontSize: 15), + ), + title: Row( + children: [ + Text("213432"), + ], + )); + }), + ); + } +} diff --git a/lib/screens/AwardsandScholarships/SpacsConvener/browse_award_catalogue.dart b/lib/screens/AwardsandScholarships/SpacsConvener/browse_award_catalogue.dart new file mode 100644 index 00000000..15338293 --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsConvener/browse_award_catalogue.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/api.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/displaymedalcontent.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/previous_winners.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/spacs_member_details.dart'; + +class BrowseAwardCatalogue extends StatefulWidget { + const BrowseAwardCatalogue({super.key}); + + @override + State createState() => _BrowseAwardCatalogueState(); +} + +class _BrowseAwardCatalogueState extends State { + + int currentIndex = 0; + final List buttonText = ['PreviousWinners','Catalogue','SpacsMembers']; + // List of pages + final List pages = [ + PreviousWinners(), + DisplayMedalContent(), + SpacsMembers(), + + ]; + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold(appBar: DefaultAppBar().buildAppBar(), + body: SingleChildScrollView( + child: Column( + children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: List.generate( + pages.length, + (index) => Padding( + padding: const EdgeInsets.all(4.0), + child: Column( + children:[ ElevatedButton( + onPressed: () { + setState(() { + currentIndex = index; + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + child: Text( + buttonText[index], + style: TextStyle( + color: currentIndex == index + ? Colors.deepOrangeAccent:Colors.black, + fontSize: 18, + ), + ), + ), + if(currentIndex==index) Container(width: 140, height: 2, color: Colors.deepOrangeAccent), + + ] + ), + + ), + ), + ), + ), + pages[currentIndex], + ], + ), + ),), + ); + } +} diff --git a/lib/screens/AwardsandScholarships/SpacsConvener/convener_homepage.dart b/lib/screens/AwardsandScholarships/SpacsConvener/convener_homepage.dart new file mode 100644 index 00000000..7c899e47 --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsConvener/convener_homepage.dart @@ -0,0 +1,131 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/browse_applications.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/browse_award_catalogue.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/invite_applications.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/service_locator.dart'; +class ConvenerHomePage extends StatefulWidget { + const ConvenerHomePage({super.key}); + + @override + State createState() => _ConvenerHomePageState(); +} + +class _ConvenerHomePageState extends State { + String? name; + String? depttype; + String? type; + @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']; + } + + Widget build(BuildContext context) { + return Column( + children: [ + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 90.0, vertical: 30.0), + shadowColor: Colors.black, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 190.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( + 'Spacs Convener', // Display Type of User + style: TextStyle(fontSize: 15.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ), + + + Column( + children: [ + SizedBox( + height: 30.0, + ), + // Container( + // height: 30, width: 130, + // ), + SizedBox( width: 250, + child: ElevatedButton( + onPressed: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return BrowseAwardCatalogue(); + })); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.deepOrangeAccent, + + ), + child: Text('Manage Catalogue')), + ), + SizedBox(width: 250, + child: ElevatedButton( + onPressed: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return InviteApplications(); + })); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.deepOrangeAccent, + ), + child: Text('Invite Applications'), + ), + ), + SizedBox(width: 250, + child: ElevatedButton( + onPressed: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return BrowseApplications(); + })); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.deepOrangeAccent, + ), + child: Text('Browse Applications'), + ), + ), + + + ], + ), + + ], + + ); + } +} \ No newline at end of file diff --git a/lib/screens/AwardsandScholarships/SpacsConvener/displaymedalcontent.dart b/lib/screens/AwardsandScholarships/SpacsConvener/displaymedalcontent.dart new file mode 100644 index 00000000..f21bea1d --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsConvener/displaymedalcontent.dart @@ -0,0 +1,116 @@ + +import 'package:flutter/material.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/browse_award_catalogue.dart'; +import 'package:fusion/api.dart'; +import 'package:http/http.dart' as http; +import 'dart:async'; +import 'dart:convert'; +class DisplayMedalContent extends StatefulWidget { + const DisplayMedalContent({super.key}); + + @override + State createState() => _DisplayMedalContentState(); +} + +class _DisplayMedalContentState extends State { + late Map displaySilver={}; + late Map displayGold={}; + void initState() { + super.initState(); + getApplications(); + } + + void getApplications() async{ + final String host = kserverLink + + + ; + final String path = "/spacs/getContent/"; + + String awardName = "Director's Silver Medal"; + + Map queryParams = { + 'award_name': awardName, + }; + Map queryParams2 = { + 'award_name': "Director's Gold Medal", + }; + Map headers = { + 'Content-Type': 'application/json; charset=UTF-8', + 'X-MOBILE-ENV': 'true', + 'Accept': "application/json", + }; + // Create URI with the encoded award_name parameter and query parameters + Uri uri = Uri.http(host, path, queryParams); + Uri urg = Uri.http(host, path, queryParams2); + var client = http.Client(); + + + try { + var response = await client.get(uri, headers: headers); + + if (response.statusCode == 200) { + // Successful response + setState(() { + displaySilver = jsonDecode(response.body); + }); + + print(displaySilver['content']); + } else { + // Handle error response + print('Error: ${response.statusCode}'); + print('Response body: ${response.body}'); + } + var response2 = await client.get(urg, headers: headers); + if (response2.statusCode == 200) { + // Successful response + setState(() { + displayGold = jsonDecode(response2.body); + }); + + print(displayGold['content']); + } else { + // Handle error response + print('Error: ${response2.statusCode}'); + print('Response body: ${response2.body}'); + } + } catch (e) { + // Handle exceptions + print('Error occurred: $e'); + } finally { + client.close(); + } + } + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + Text( + "Director's Gold Medal", + style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold), + ),Spacer(), + ElevatedButton(onPressed: (){}, child: Text('Edit')), + ], + ), + Row( + children: [Expanded(child: Text(displayGold['content']??''))], + ), + Row( + children: [ + Text( + "Director's Silver Medal", + style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold), + ),Spacer(), + ElevatedButton(onPressed: (){}, child: Text('Edit')), + ], + ), + Row( + children: [Expanded(child: Text(displaySilver['content']??'')), + ] + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/screens/AwardsandScholarships/SpacsConvener/invite_applications.dart b/lib/screens/AwardsandScholarships/SpacsConvener/invite_applications.dart new file mode 100644 index 00000000..920ffcd7 --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsConvener/invite_applications.dart @@ -0,0 +1,356 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:intl/intl.dart'; +import 'package:fusion/api.dart'; +import 'package:http/http.dart' as http; +import 'dart:async'; +import 'dart:convert'; + +class InviteApplications extends StatefulWidget { + const InviteApplications({super.key}); + + @override + State createState() => _InviteApplicationsState(); +} + +class _InviteApplicationsState extends State { + int currentIndex = 0; + final List buttonText = [ + ' Invite Applications', + ' Update Applications', + ]; + // List of pages + final List pages = [ + InvitedApplications(), + UpdateApplications(), + ]; + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: DefaultAppBar().buildAppBar(), + body: Column( + children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: List.generate( + pages.length, + (index) => Padding( + padding: const EdgeInsets.all(1.0), + child: Column( + children: [ + ElevatedButton( + onPressed: () { + setState(() { + currentIndex = index; + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.white, + elevation: 0.0, + ), + child: Text( + buttonText[index], + style: TextStyle( + color: currentIndex == index + ? Color.fromRGBO(249, 89, 53, 1) + : Colors.black, + fontSize: 18, + ), + ), + ), + Container( + width: 140, + height: 2, + color: currentIndex == index + ? Colors.deepOrangeAccent + : Colors.white, + ) + ], + )), + ), + ), + ), + pages[currentIndex], + ], + ), + ), + ); + } +} + +class InvitedApplications extends StatefulWidget { + const InvitedApplications({super.key}); + + @override + State createState() => _InvitedApplicationsState(); +} + +class _InvitedApplicationsState extends State { + void initState() { + super.initState(); + } + + void getapplication() async { + final String host = kserverLink; + final String path = "/spacs/convener_view/"; + Map headers = { + 'Content-Type': 'application/json; charset=UTF-8', + 'x-mobile-env': 'true', + 'Accept': "application/json", + }; + Map requestBody = { + 'Submit': 'true', + 'programme': programme, + 'batch': batch, + 'From': startdate, + 'To': enddate, + 'remarks': 'MCM is available.', + 'type': award + }; + // Create URI with the encoded award_name parameter and query parameters + Uri uri = Uri.http(host, path); + var client = http.Client(); + try { + var response = await client.post( + uri, + headers: headers, + body: jsonEncode(requestBody), + ); + + if (response.statusCode == 200) { + // Successful response + } else { + // Handle error response + print('Error: ${response.statusCode}'); + print('Response body: ${response.body}'); + } + } catch (e) { + // Handle exceptions + print('Error occurred: $e'); + } finally { + client.close(); + } + } + + late String award; + late String batch; + late String programme; + late String startdate; + late String enddate; + final List programmeItems = ['B.Tech', 'B.Des', 'M.Tech']; + final List BatchItems = ['2023', '2022', '2021', '2020', 'All']; + final List scholarshipsorAwardItems = [ + 'Merit-cum-Means Scholarship', + "Director's Gold Medal", + "Director's Silver Medal" + ]; + void handlestartdateSelection(String value){ + setState(() { + startdate=value; + }); + } + void handleenddateSelection(String value){ + setState(() { + enddate=value; + }); + } +void handleProgrammeSelection(String? value) { + setState(() { + programme = value ?? ''; + }); + } + void handleawardSelection(String? value) { + setState(() { + award = value ?? ''; + }); + } + + void handlebatchSelection(String? value) { + setState(() { + batch = value ?? ''; + }); + } + @override + Widget build(BuildContext context) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + DropdownMenu(label: 'Programme:', items: programmeItems,onChanged:handleProgrammeSelection), + DropdownMenu(label: 'Batch:', items: BatchItems,onChanged:handlebatchSelection), + ], + ), + + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + DropdownMenu( + label: 'Scholarship/Award:', items: scholarshipsorAwardItems,onChanged:handleawardSelection), + ], + ), + Row( + children: [ + Expanded(child: DatePicker(label: 'Starting Date',onDateSelected:handlestartdateSelection ,)), + Expanded( + child: DatePicker( + label: 'Ending Date', + onDateSelected:handleenddateSelection , + )) + ], + ), + + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ElevatedButton( + onPressed: () { + getapplication(); + print('Submit Button Pressed'); + }, + style: ElevatedButton.styleFrom( + disabledBackgroundColor: Color.fromRGBO(255, 255, 255, 1), + // backgroundColor: Color.fromRGBO(249, 89, 53, 1), + elevation: 0.0, + ), + child: Text('Invite Applications')) + ], + ), + + // + ], + ), + ); + } +} + +class UpdateApplications extends StatefulWidget { + const UpdateApplications({super.key}); + + @override + State createState() => _UpdateApplicationsState(); +} + +class _UpdateApplicationsState extends State { + @override + Widget build(BuildContext context) { + return Column( + children: [Text('invited')], + ); + } +} + +class DropdownMenu extends StatefulWidget { + final String label; + final List items; +final void Function(String?) onChanged; + DropdownMenu({required this.label, required this.items,required this.onChanged}); + + @override + _DropdownMenuState createState() => _DropdownMenuState(); +} + +class _DropdownMenuState extends State { + String? selectedItem; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.label, + style: TextStyle(fontSize: 17.0, fontWeight: FontWeight.bold), + ), + SizedBox(height: 2.0), + DropdownButton( + hint: Text('Select'), + value: selectedItem, + onChanged: widget.onChanged, + items: widget.items.map((item) { + return DropdownMenuItem( + value: item, + child: Text(item, + style: TextStyle( + fontSize: 12.0, + )), + ); + }).toList(), + ), + ], + ), + ); + } +} + +class DatePicker extends StatefulWidget { + final String label; + final void Function(String selectedDate) onDateSelected; + const DatePicker({required this.label,required this.onDateSelected}); + + @override + State createState() => _DatePickerState(); +} + +class _DatePickerState extends State { + TextEditingController dateInput = TextEditingController(); + + @override + void initState() { + dateInput.text = ""; //set the initial value of text field + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(15), + height: MediaQuery.of(context).size.width / 3, + child: Center( + child: TextField( + controller: dateInput, + + decoration: InputDecoration( + icon: Icon(Icons.calendar_today), + labelText: widget.label, //label text of field + ), + readOnly: true, + //set it true, so that user will not able to edit text + onTap: () async { + DateTime? pickedDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime.now(), + //DateTime.now() - not to allow to choose before today. + lastDate: DateTime(2100)); + + if (pickedDate != null) { + //pickedDate output format => 2021-03-10 00:00:00.000 + String formattedDate = + DateFormat('yyyy-MM-dd').format(pickedDate); + //formatted date output using intl package => 2021-03-16 + setState(() { + dateInput.text = + formattedDate; //set output date to TextField value. + }); + widget.onDateSelected(formattedDate); + } else {} + }, + ))); + } +} diff --git a/lib/screens/AwardsandScholarships/SpacsConvener/previous_winners.dart b/lib/screens/AwardsandScholarships/SpacsConvener/previous_winners.dart new file mode 100644 index 00000000..8a3da138 --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsConvener/previous_winners.dart @@ -0,0 +1,273 @@ +import 'dart:convert'; +// // import 'dart:html'; +// // import 'dart:ffi'; + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/api.dart'; +import 'package:fusion/services/profile_service.dart'; + +import 'dart:async'; + +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/models/profile.dart'; + +import 'package:http/http.dart' as http; + +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/previous_winners_listpage.dart'; + +class PreviousWinners extends StatefulWidget { + const PreviousWinners({super.key}); + + @override + State createState() => _PreviousWinnersState(); +} + +class _PreviousWinnersState extends State { + final List programmeItems = ['B.Tech', 'B.Des', 'M.Tech']; + final List academicYearItems = ['2016', '2017', '2018', '2019']; + final List scholarshipsorAwardItems = [ + 'MCM Scholarship', + "Director's Gold Medal", + "Director's Silver Medal" + ]; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data; + var service; + List displayData = []; + bool _loading1 = true; + + void initState() { + super.initState(); + _profileController = StreamController(); + profileService = ProfileService(); + service = locator(); + } + + late String award; + late String batch; + late String programme; + void getApplications() async { + final String host = kserverLink; + final String path = "/spacs/student_view/"; + // final String path = "/spacs/getContent/"; + + Uri uri = Uri.http(host, path); + + Map headers = { + 'Content-Type': 'application/json; charset=UTF-8', + 'X-MOBILE-ENV': 'true', + 'Accept': "application/json", + }; + + Map requestBody = { + 'PreviousWinnerAward': award, + 'PreviousWinnerAcadYear': batch, + 'PreviousWinnerProgramme': programme, + 'SubmitPreviousWinner': true, + }; + + var client = http.Client(); + + var response = await client.post( + uri, + headers: headers, + body: jsonEncode(requestBody), + ); + if (response.statusCode == 200) { + // Successful response + var responseData = jsonDecode(response.body); + displayData = responseData; + } else { + // Handle error response + + print('Error: ${response.statusCode}'); + print('Response body: ${response.body}'); + } + + client.close(); + Navigator.of(context).push(MaterialPageRoute(builder: (context) { + return PreviousYearWinnerPage( + displayData: displayData, + ); + })); + } + + void handleProgrammeSelection(String? value) { + setState(() { + programme = value ?? ''; + }); + } + + void handleawardSelection(String? value) { + setState(() { + award = value ?? ''; + }); + } + + void handlebatchSelection(String? value) { + setState(() { + batch = value ?? ''; + }); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + color: Colors.black, // Change this to your desired color + width: 2.0, // Change this to your desired border width + ), + borderRadius: BorderRadius.circular(10.0), + boxShadow: [ + BoxShadow( + color: Colors.grey + .withOpacity(0.2), // Adjust opacity for shadow intensity + spreadRadius: 2.0, // Adjusts how far the shadow spreads + blurRadius: 1.0, // Adjusts how blurry the shadow is + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Previous Winners', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + DropdownMenu( + label: 'Programme:', + items: programmeItems, + onChanged: handleProgrammeSelection), + DropdownMenu( + label: 'Academic Year:', + items: academicYearItems, + onChanged: handlebatchSelection, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + DropdownMenu( + label: 'Scholarship/Award:', + items: scholarshipsorAwardItems, + onChanged: handleawardSelection, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + onPressed: () { + getApplications(); + print(displayData[0]['id']); + }, + style: ElevatedButton.styleFrom( + disabledBackgroundColor: Color.fromRGBO(255, 255, 255, 1), + backgroundColor: Color.fromRGBO(249, 89, 53, 1), + elevation: 0.0, + ), + child: Text('Submit')) + ], + ) + // + ], + ), + ), + ); + } +} + +class DropdownMenu extends StatefulWidget { + final String label; + final List items; + final void Function(String?) onChanged; + DropdownMenu( + {required this.label, required this.items, required this.onChanged}); + + @override + State createState() => _DropdownMenuState(); +} + +class _DropdownMenuState extends State { + String? selectedItem; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.label, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), + ), + SizedBox(height: 14.0), + DropdownButton( + hint: Text('Select'), + value: selectedItem, + onChanged: widget.onChanged, + items: widget.items.map((item) { + return DropdownMenuItem( + value: item, + child: Text(item, + style: TextStyle( + fontSize: 12.0, + )), + ); + }).toList(), + ), + ], + ), + ); + } +} + +// class DropdownMenu extends StatelessWidget { +// final String label; +// final List items; +// final void Function(String?) +// onChanged; // Callback function to handle selection + +// DropdownMenu( +// {required this.label, required this.items, required this.onChanged}); + +// @override +// Widget build(BuildContext context) { +// return Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text(label), +// DropdownButton( +// onChanged: onChanged, // Pass the callback function here +// items: items.map>((String value) { +// return DropdownMenuItem( +// value: value, +// child: Text(value), +// ); +// }).toList(), +// ), +// ], +// ); +// } +// } diff --git a/lib/screens/AwardsandScholarships/SpacsConvener/previous_winners_listpage.dart b/lib/screens/AwardsandScholarships/SpacsConvener/previous_winners_listpage.dart new file mode 100644 index 00000000..212cca40 --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsConvener/previous_winners_listpage.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; + +class PreviousYearWinnerPage extends StatelessWidget { + final List displayData; + const PreviousYearWinnerPage({super.key, required this.displayData}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: DefaultAppBar().buildAppBar(), + body: ListView.builder( + itemCount: displayData.length, + itemBuilder: (context, index) { + final winner = displayData[index]; + return ListTile( + leading: Text('${winner['id']}'), + title: Text('${winner['student']}'), + ); + })), + ); + } +} diff --git a/lib/screens/AwardsandScholarships/SpacsConvener/spacs_member_details.dart b/lib/screens/AwardsandScholarships/SpacsConvener/spacs_member_details.dart new file mode 100644 index 00000000..d74471f1 --- /dev/null +++ b/lib/screens/AwardsandScholarships/SpacsConvener/spacs_member_details.dart @@ -0,0 +1,110 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/api.dart'; +import 'package:http/http.dart' as http; +import 'dart:async'; +import 'dart:convert'; +class SpacsMembers extends StatefulWidget { + const SpacsMembers({super.key}); + + @override + State createState() => _SpacsMembersState(); +} + +class _SpacsMembersState extends State { + void initState() { + super.initState(); + + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox( + height: 30, + ), + Text('SPACS Members Details', + style: Theme.of(context).textTheme.titleMedium,), + + SizedBox( + height: 30, + ), + Container( + height: 250, + width: 250, + decoration: BoxDecoration( + color: const Color.fromRGBO(245, 247, 249, 1), + borderRadius: BorderRadius.circular(10), + ), + + child: const Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.person), + Text('SPACS Convener', + + ), + Padding( + padding: EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.phone), + Text('+91-9090909090'), + ], + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.email), + Text('zahid@iiitdmj.ac.in'), + ], + ), + Divider( + color: Colors.grey, + thickness: 2, + indent: 20, + endIndent: 20, +), + ], + ), + ), + SizedBox( + height: 20, + ), + Container( + height: 250, + width: 250, + decoration: BoxDecoration( + color: const Color.fromRGBO(245, 247, 249, 1), + borderRadius: BorderRadius.circular(10), + ), + + child: const Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.person), + Text('SPACS Assistant', + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.phone), + Text('+91-9090898990'), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.email), + Text('rmishra@iiitdmj.ac.in'), + ], + ) + ], + ), + ) + ], + ); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/Catalogue.dart b/lib/screens/AwardsandScholarships/Student/Catalogue.dart new file mode 100644 index 00000000..e7b3a5ee --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/Catalogue.dart @@ -0,0 +1,109 @@ +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/api.dart'; + +class Catalogue extends StatefulWidget { + const Catalogue({super.key}); + + @override + State createState() => _CatalogueState(); +} + +class _CatalogueState extends State { + Map displaySilver={}; + Map displayGold={}; + void initState() { + super.initState(); + getApplications(); + } + + void getApplications() async { + final String host = kserverLink; + final String path = "/spacs/getContent/"; + + String awardName = "Director's Silver Medal"; + + Map queryParams = { + 'award_name': awardName, + }; + Map queryParams2 = { + 'award_name': "Director's Gold Medal", + }; + Map headers = { + 'Content-Type': 'application/json; charset=UTF-8', + 'X-MOBILE-ENV': 'true', + 'Accept': "application/json", + }; + // Create URI with the encoded award_name parameter and query parameters + Uri uri = Uri.http(host, path, queryParams); + Uri urg = Uri.http(host, path, queryParams2); + var client = http.Client(); + + try { + var response = await client.get(uri, headers: headers); + + if (response.statusCode == 200) { + // Successful response + + setState(() { + displaySilver = jsonDecode(response.body); + }); + print(displaySilver['content']); + } else { + // Handle error response + print('Error: ${response.statusCode}'); + print('Response body: ${response.body}'); + } + var response2 = await client.get(urg, headers: headers); + if (response2.statusCode == 200) { + // Successful response + setState(() { + displayGold = jsonDecode(response2.body); + }); + + print(displayGold['content']); + } else { + // Handle error response + print('Error: ${response2.statusCode}'); + print('Response body: ${response2.body}'); + } + } catch (e) { + // Handle exceptions + print('Error occurred: $e'); + } finally { + client.close(); + } + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + Text( + "Director's Gold Medal", + style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold), + ) + ], + ), + Row( + children: [Expanded(child: Text(displayGold['content']??''))], + ), + Row( + children: [ + Text( + "Director's Silver Medal", + style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold), + ) + ], + ), + Row( + children: [Expanded(child: Text(displaySilver['content']??''))], + ), + ], + ); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/application_data_provider.dart b/lib/screens/AwardsandScholarships/Student/application_data_provider.dart new file mode 100644 index 00000000..51ee7baa --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/application_data_provider.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; + +class ApplicationDataProvider extends ChangeNotifier { + final List> submittedapplications = [ + + ]; + + void addApplication(Map application) { + submittedapplications.add(application); + notifyListeners(); + } + + void removeApplication(Mapapplication) { + submittedapplications.remove(application); + notifyListeners(); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/apply_for_convocationmedal.dart b/lib/screens/AwardsandScholarships/Student/apply_for_convocationmedal.dart new file mode 100644 index 00000000..bfa9276f --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/apply_for_convocationmedal.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/convocation_medal_form.dart'; + +class ApplyforConvocation extends StatefulWidget { + const ApplyforConvocation({super.key}); + + @override + State createState() => _ApplyforConvocationState(); +} + +class _ApplyforConvocationState extends State { + String available = 'yes'; + @override + Widget build(BuildContext context) { + return Column( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + + children: [ + + SizedBox( + height: 30, + ), + available == 'yes' + ? GestureDetector( + onTap: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return ConvocationMedalForm(); + })); + }, + child: Text( + ' Fill Convocation Medal Form ', + style: + TextStyle(color: Colors.lightBlueAccent, fontSize: 30), + )) + : Text( + 'Currently MCM is not Available', + style: TextStyle(fontSize: 30), + ) + ]); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/apply_for_mcm.dart b/lib/screens/AwardsandScholarships/Student/apply_for_mcm.dart new file mode 100644 index 00000000..24e0f2e3 --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/apply_for_mcm.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/mcm_form.dart'; + +class ApplyForMcm extends StatefulWidget { + const ApplyForMcm({super.key}); + + @override + State createState() => _ApplyForMcmState(); +} + +class _ApplyForMcmState extends State { + + String available = 'yes'; + @override + Widget build(BuildContext context) { + return Column( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + + children: [ + SizedBox( + height: 30, + ), + available=='yes'?GestureDetector(onTap:(){ + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return McmForm(); + })); + }, + child: Text('Fill MCM Form',style: TextStyle(color: Colors.lightBlueAccent,fontSize: 30),)):Text('Currently MCM is not Available',style: TextStyle(fontSize: 30),) + + ]); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/applyforawards.dart b/lib/screens/AwardsandScholarships/Student/applyforawards.dart new file mode 100644 index 00000000..2e33837f --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/applyforawards.dart @@ -0,0 +1,185 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/apply_for_convocationmedal.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/apply_for_mcm.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/convocation_medal_form.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/mcm_form.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/view_application_status.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/application_data_provider.dart'; +import 'package:provider/provider.dart'; + +class ApplyForAwards extends StatefulWidget { + const ApplyForAwards({Key? key}) : super(key: key); + + @override + State createState() => _ApplyForAwardsState(); +} + +class _ApplyForAwardsState extends State { + int currentIndex = 0; + final List buttonText = [ + ' MCM', + ' Application Status', + ' Convocation Medal', + ]; + // List of pages + final List pages = [ + ApplyForMcm(), + ViewApplicationStatus(), + ApplyforConvocation(), + ]; + + @override + Widget build(BuildContext context) { +// return MaterialApp( +// home: Scaffold( +// appBar: DefaultAppBar().buildAppBar(), +// body: Column( +// children: [ + +// SingleChildScrollView( +// scrollDirection: Axis.horizontal, +// child: Row( +// // mainAxisAlignment: MainAxisAlignment.spaceAround, +// children: List.generate( +// pages.length, + +// (index) => Padding( +// padding: const EdgeInsets.all(1.0), +// child: Column( +// children: [ +// ElevatedButton( +// onPressed: () { +// setState(() { +// (currentIndex==1)? Navigator.of(context) +// .push(MaterialPageRoute(builder: (context) { +// return ViewApplicationStatus(); +// })):currentIndex = index; +// }); +// }, +// style: ElevatedButton.styleFrom( +// backgroundColor: Colors.white, +// elevation: 0.0, +// ), +// child: Text( +// buttonText[index], +// style: TextStyle( +// color: currentIndex == index +// ? Color.fromRGBO(249, 89, 53, 1) +// : Colors.black, +// fontSize: 18, +// ), +// ), +// ), +// Container( +// width: 140, +// height: 2, +// color: currentIndex==index? Colors.deepOrangeAccent:Colors.white, +// ) +// ], +// )), +// ), +// ), +// ), +// pages[currentIndex] + +// ], +// ), +// ), +// ); + return MaterialApp( + home: Scaffold(appBar: AppBar(title: Text('Apply For Awards'),backgroundColor: Colors.deepOrangeAccent,), + body: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + + children: [ + SizedBox(height: 60,), + + SizedBox( + width: 300,height: 40, + child: ElevatedButton( + onPressed: () { + + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return McmForm(); + }) + ); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.blueAccent, + elevation: 0.0, + ), + child: Text( + 'Apply For MCM', + style: TextStyle( + color: + Colors.white, + + fontSize: 18, + ), + ), + ), + ), SizedBox(height: 20,), + SizedBox(width: 300,height: 40, + child: ElevatedButton( + onPressed: () { + + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return ConvocationMedalForm(); + }) + ); + + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.blueAccent, + elevation: 0.0, + ), + child: Text( + 'Apply For Convocation Medal', + style: TextStyle( + color: + Colors.white, + + fontSize: 18, + ), + ), + ), + ), SizedBox(height: 20,), + SizedBox(width: 300,height: 40, + child: ElevatedButton( + onPressed: () { + + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return ViewApplicationStatus(); + }) + ); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.blueAccent, + elevation: 0.0, + + ), + child: Text( + 'Application Status', + style: TextStyle( + color: + Colors.white, + + fontSize: 18, + ), + ), + ), + ), + ], + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/browseawardcatalogue.dart b/lib/screens/AwardsandScholarships/Student/browseawardcatalogue.dart new file mode 100644 index 00000000..ec9da33a --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/browseawardcatalogue.dart @@ -0,0 +1,78 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/Catalogue.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/previous_winners.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/spacs_members_details.dart'; +class BrowseAwardCatalogue extends StatefulWidget { + const BrowseAwardCatalogue({super.key}); + + @override + State createState() => _BrowseAwardCatalogueState(); +} + +class _BrowseAwardCatalogueState extends State { + int currentIndex = 0; + final List buttonText = ['PreviousWinners','Catalogue','SpacsMembers']; + // List of pages + final List pages = [ + PreviousWinners(), + Catalogue(), + SpacsMembers(), + + ]; + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold(appBar: DefaultAppBar().buildAppBar(), + body: SingleChildScrollView( + child: Column( + children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: List.generate( + pages.length, + (index) => Padding( + padding: const EdgeInsets.all(4.0), + child: Column( + children:[ ElevatedButton( + onPressed: () { + setState(() { + currentIndex = index; + }); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.transparent, + elevation: 0.0, + ), + child: Text( + buttonText[index], + style: TextStyle( + color: currentIndex == index + ? Colors.deepOrangeAccent:Colors.black, + fontSize: 18, + ), + ), + ), + if(currentIndex==index) Container(width: 140, height: 2, color: Colors.deepOrangeAccent), + // Container( + // width: 140, + // height: 2, + // color: currentIndex==index? Colors.deepOrangeAccent:Colors.white, + // ) + + ] + ), + + ), + ), + ), + ), + pages[currentIndex], + ], + ), + ),), + ); + } +} \ No newline at end of file diff --git a/lib/screens/AwardsandScholarships/Student/convocation_medal_form.dart b/lib/screens/AwardsandScholarships/Student/convocation_medal_form.dart new file mode 100644 index 00000000..9153c9d1 --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/convocation_medal_form.dart @@ -0,0 +1,325 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/application_data_provider.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/student_homepage.dart'; +import 'package:provider/provider.dart'; + +class ConvocationMedalForm extends StatefulWidget { + const ConvocationMedalForm({super.key}); + + @override + State createState() => _ConvocationMedalFormState(); +} + +class _ConvocationMedalFormState extends State { + var formKey = GlobalKey(); + var nameController = TextEditingController(); + var rollnoController = TextEditingController(); + var categoryController = TextEditingController(); + var hallNoController = TextEditingController(); + var roomNOController = TextEditingController(); + + var fatherNameController = TextEditingController(); + var motherNameController = TextEditingController(); + var brotherOccupationController = TextEditingController(); + var addressController = TextEditingController(); + var cpiController = TextEditingController(); + + void onTap() { + Provider.of(context, listen: false) + .addApplication({ + 'id': formKey, + 'type': 'Convocation', + 'name': nameController.text, + 'room_no': roomNOController.text, + 'roll_no': rollnoController.text, + 'father_name': fatherNameController.text, + 'mother_name': motherNameController.text, + 'cpi': cpiController, + 'category': categoryController, + 'address': addressController, + 'status': 'Under Process', + }); + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) => StudentHomePage()), + ); + ScaffoldMessenger.of(context).showSnackBar(const SnackBar( + content: Text('Application Submitted'), + )); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar(title: Text('Apply For Awards'),backgroundColor: Colors.deepOrangeAccent,), + body: Column(children: [ + SizedBox(height: 15), + Form( + key: formKey, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 380, + child: Expanded( + child: TextField( + controller: nameController, + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: 'Username', + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your username', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + )), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 380, + child: Expanded( + child: TextField( + controller: rollnoController, + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: 'Roll No', + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your Roll No', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + )), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Spacer(), + Container( + width: 170, + child: Expanded( + child: TextField( + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: 'Room No', + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your Room No', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + ), + ), + ), + Spacer(), + Container( + width: 170, + child: Expanded( + child: TextField( + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: 'Hall No', + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your Hall No', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + )), + ), + Spacer(), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Spacer(), + Container( + width: 170, + child: Expanded( + child: TextField( + controller: cpiController, + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: 'CPI', + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your CPI', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + ), + ), + ), + Spacer(), + Container( + width: 170, + child: Expanded( + child: TextField( + controller: categoryController, + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: 'Category', + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your Category', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + )), + ), + Spacer(), + ], + ), + SizedBox( + height: 10, + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 380, + child: Expanded( + child: TextField( + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: 'Fathers Name', + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your FatherName', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + )), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 380, + child: Expanded( + // + child: TextField( + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: "Mother's Name", + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your Mother Name', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + )), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 380, + child: Expanded( + child: TextField( + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.green, width: 2.0), + borderRadius: BorderRadius.circular(10.0), + ), + filled: true, + fillColor: Colors.white70, + labelText: 'Permanant Address:', + labelStyle: TextStyle(color: Colors.grey), + hintText: 'Enter your Permanant Address', + hintStyle: TextStyle(color: Colors.grey[300]), + ), + )), + ), + ], + ), + SizedBox( + height: 10, + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Spacer(), + ElevatedButton( + onPressed: () { + onTap(); + }, + child: Text('Submit')), + Spacer(), + ], + ) + ], + )) + ]), + )); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/mcm_form.dart b/lib/screens/AwardsandScholarships/Student/mcm_form.dart new file mode 100644 index 00000000..2e91f352 --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/mcm_form.dart @@ -0,0 +1,379 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/student_homepage.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:http/http.dart' as http; +import 'package:fusion/models/profile.dart'; +import 'dart:convert'; +import 'package:fusion/services/profile_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/api.dart'; + +class McmForm extends StatefulWidget { + @override + _McmFormState createState() => _McmFormState(); +} + +class _McmFormState extends State { + TextEditingController fatherOccupationController = TextEditingController(); + TextEditingController motherOccupationController = TextEditingController(); + TextEditingController brotherNameController = TextEditingController(); + TextEditingController sisterNameController = TextEditingController(); + TextEditingController brotherOccupationController = TextEditingController(); + TextEditingController sisterOccupationController = TextEditingController(); + TextEditingController fatherIncomeController = TextEditingController(); + TextEditingController motherIncomeController = TextEditingController(); + TextEditingController otherIncomeController = TextEditingController(); + TextEditingController fatherOccDescController = TextEditingController(); + TextEditingController motherOccDescController = TextEditingController(); + TextEditingController fourwheelerController = TextEditingController(); + TextEditingController fourWheelerDescController = TextEditingController(); + TextEditingController twowheelerController = TextEditingController(); + TextEditingController twoWheelerDescController = TextEditingController(); + TextEditingController houseController = TextEditingController(); + TextEditingController plotAreaController = TextEditingController(); + TextEditingController constructedAreaController = TextEditingController(); + TextEditingController schoolFeeController = TextEditingController(); + TextEditingController schoolNameController = TextEditingController(); + TextEditingController collegeFeeController = TextEditingController(); + TextEditingController collegeNameController = TextEditingController(); + TextEditingController loanAmountController = TextEditingController(); + TextEditingController bankNameController = TextEditingController(); + + bool _isValid = true; + + void _validateForm() { + setState(() { + // Check if any of the required fields are empty + _isValid = _validateField(fatherOccupationController) && + _validateField(motherOccupationController) && + _validateField(brotherNameController) && + _validateField(sisterNameController) && + _validateField(brotherOccupationController) && + _validateField(sisterOccupationController) && + _validateField(fatherIncomeController) && + _validateField(motherIncomeController) && + _validateField(otherIncomeController) && + _validateField(fatherOccDescController) && + _validateField(motherOccDescController) && + _validateField(fourwheelerController) && + _validateField(fourWheelerDescController) && + _validateField(twowheelerController) && + _validateField(twoWheelerDescController) && + _validateField(houseController) && + _validateField(plotAreaController) && + _validateField(constructedAreaController) && + _validateField(schoolFeeController) && + _validateField(schoolNameController) && + _validateField(collegeFeeController) && + _validateField(collegeNameController) && + _validateField(loanAmountController) && + _validateField(bankNameController); + }); + } + + bool _validateField(TextEditingController controller) { + return controller.text.isNotEmpty; + } + + void postFormData() async { + final String host = kserverLink; + final String path = "/spacs/student_view/"; + Uri uri = Uri.http(host, path); + + Map headers = { + 'Content-Type': 'application/json; charset=UTF-8', + 'X-MOBILE-ENV': 'true', + 'Accept': "application/json", + }; + + Map requestBody = { + 'Submit_MCM': 'true', + 'father_occ': fatherOccupationController.text, + 'mother_occ': motherOccupationController.text, + 'brother_name': brotherNameController.text, + 'sister_name': sisterNameController.text, + 'brother_occupation': brotherOccupationController.text, + 'sister_occupation': sisterOccupationController.text, + 'income_father': fatherIncomeController.text, + 'income_mother': motherIncomeController.text, + 'income_other': otherIncomeController.text, + 'father_occ_desc': fatherOccDescController.text, + 'mother_occ_desc': motherOccDescController.text, + 'four_wheeler': fourwheelerController.text, + 'four_wheeler_desc': fourWheelerDescController.text, + 'two_wheeler_desc': twowheelerController.text, + 'two_wheeler': twoWheelerDescController.text, + 'house': houseController.text, + 'plot_area': plotAreaController.text, + 'constructed_area': constructedAreaController.text, + 'school_fee': schoolFeeController.text, + 'school_name': schoolNameController.text, + 'college_fee': collegeFeeController.text, + 'college_name': collegeNameController.text, + 'loan_amount': loanAmountController.text, + 'bank_name': bankNameController.text, + }; + + var client = http.Client(); +_clearTextFields(); + try { + var response = await client.post( + uri, + headers: headers, + body: jsonEncode(requestBody), + ); + if (response.statusCode == 200) { + // Successful response + print("Form submitted successfully"); + // Clear text fields after successful submission + _clearTextFields(); + } else { + // Handle error response + print('Error: ${response.statusCode}'); + print('Response body: ${response.body}'); + } + } catch (e) { + // Handle exception + print('Error occurred: $e'); + } finally { + client.close(); + } + } + + void _clearTextFields() { + // Clear all text fields + fatherOccupationController.clear(); + motherOccupationController.clear(); + brotherNameController.clear(); + sisterNameController.clear(); + brotherOccupationController.clear(); + sisterOccupationController.clear(); + fatherIncomeController.clear(); + motherIncomeController.clear(); + otherIncomeController.clear(); + fatherOccDescController.clear(); + motherOccDescController.clear(); + fourwheelerController.clear(); + fourWheelerDescController.clear(); + twowheelerController.clear(); + twoWheelerDescController.clear(); + houseController.clear(); + plotAreaController.clear(); + constructedAreaController.clear(); + schoolFeeController.clear(); + schoolNameController.clear(); + collegeFeeController.clear(); + collegeNameController.clear(); + loanAmountController.clear(); + bankNameController.clear(); + } + + _launchChrome(String url) async { + if (await canLaunchUrl(Uri.parse(url))) { + final bool opened = await launchUrl( + Uri.parse(url), + // Disabling WebView on Android + // Optional, enable JS in the opened browser + ); + if (!opened) { + // Handle cases where Chrome cannot open the link + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Could not open link in Chrome.'), + ), + ); + } + } + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: Text('Apply For Awards'), + backgroundColor: Colors.deepOrangeAccent, + ), + body: Padding( + padding: const EdgeInsets.all(16.0), + child: ListView(children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton.icon( + onPressed: () { + _launchChrome('https://www.google.com/'); + }, + icon: Icon( + Icons.download_rounded, + color: Colors.white, + ), + label: Text( + "Form A", + style: TextStyle(fontSize: 8, color: Colors.white), + ), + style: ElevatedButton.styleFrom( + backgroundColor: Color.fromARGB(255, 3, 133, 194), + fixedSize: const Size(90, 20), + ), + ), + SizedBox( + width: 5, + ), + ElevatedButton.icon( + onPressed: () { + _launchChrome('https://www.google.com/'); + }, + icon: Icon( + Icons.download_rounded, + color: Colors.white, + ), + label: Text( + "Form B", + style: TextStyle(fontSize: 8, color: Colors.white), + ), + style: ElevatedButton.styleFrom( + backgroundColor: Color.fromARGB(255, 3, 133, 194), + fixedSize: const Size(90, 20), + ), + ), + SizedBox( + width: 5, + ), + ElevatedButton.icon( + onPressed: () { + _launchChrome('https://www.google.com/'); + }, + icon: Icon( + Icons.download_rounded, + color: Colors.white, + ), + label: Text( + "Form C", + style: TextStyle(fontSize: 8, color: Colors.white), + ), + style: ElevatedButton.styleFrom( + backgroundColor: Color.fromARGB(255, 3, 133, 194), + fixedSize: const Size(90, 20), + ), + ), + ], + ), + TextField( + controller: fatherOccupationController, + decoration: InputDecoration(labelText: 'Father Occupation'), + ), + TextField( + controller: fatherOccDescController, + decoration: InputDecoration( + labelText: 'Father Occupation Description'), + ), + TextField( + controller: motherOccupationController, + decoration: InputDecoration(labelText: 'Mother Occupation'), + ), + TextField( + controller: motherOccDescController, + decoration: InputDecoration( + labelText: 'Mother Occupation Description'), + ), + TextField( + controller: brotherNameController, + decoration: InputDecoration(labelText: 'Brother Name'), + ), + TextField( + controller: sisterNameController, + decoration: InputDecoration(labelText: 'Sister Name'), + ), + TextField( + controller: brotherOccupationController, + decoration: InputDecoration(labelText: 'Brother Occupation'), + ), + TextField( + controller: sisterOccupationController, + decoration: InputDecoration(labelText: 'Sister Occupation'), + ), + TextField( + controller: fatherIncomeController, + decoration: InputDecoration(labelText: 'Father Income'), + keyboardType: TextInputType.number, + ), + TextField( + controller: fatherIncomeController, + decoration: InputDecoration(labelText: 'Father Income'), + ), + TextField( + controller: motherIncomeController, + decoration: InputDecoration(labelText: 'Mother Income'), + ), + TextField( + controller: otherIncomeController, + decoration: InputDecoration(labelText: 'Other Income'), + ), + TextField( + controller: fourwheelerController, + decoration: InputDecoration(labelText: 'Total FourWheelers:'), + ), + TextField( + controller: fourWheelerDescController, + decoration: + InputDecoration(labelText: ' FourWheelers Description:'), + ), + TextField( + controller: twowheelerController, + decoration: InputDecoration(labelText: 'Total TwoWheelers:'), + ), + TextField( + controller: twoWheelerDescController, + decoration: + InputDecoration(labelText: ' TwoWheelers Description:'), + ), + TextField( + controller: houseController, + decoration: InputDecoration(labelText: 'Total Houses:'), + ), + TextField( + controller: plotAreaController, + decoration: InputDecoration(labelText: 'Plot Area:'), + ), + TextField( + controller: constructedAreaController, + decoration: InputDecoration(labelText: 'Constructed Area:'), + ), + TextField( + controller: schoolFeeController, + decoration: InputDecoration(labelText: 'School Fees:'), + ), + TextField( + controller: schoolNameController, + decoration: InputDecoration(labelText: 'School Name'), + ), + TextField( + controller: collegeFeeController, + decoration: InputDecoration(labelText: 'College Fees:'), + ), + TextField( + controller: collegeNameController, + decoration: InputDecoration(labelText: 'College Name'), + ), + TextField( + controller: loanAmountController, + decoration: InputDecoration(labelText: 'Loan Amount:'), + ), + TextField( + controller: bankNameController, + decoration: InputDecoration(labelText: 'Bank Name:'), + ), + ElevatedButton( + onPressed: () { + _validateForm(); + if (_isValid) { + postFormData(); + } else + print('type something'); + }, + child: Text('Submit')), + ]), + ))); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/previous_winners.dart b/lib/screens/AwardsandScholarships/Student/previous_winners.dart new file mode 100644 index 00000000..1b1106c3 --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/previous_winners.dart @@ -0,0 +1,273 @@ +import 'dart:convert'; +// // import 'dart:html'; +// // import 'dart:ffi'; + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/api.dart'; +import 'package:fusion/services/profile_service.dart'; + +import 'dart:async'; + +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/models/profile.dart'; + +import 'package:http/http.dart' as http; + +import 'package:fusion/screens/AwardsandScholarships/Student/previous_winners_listpage.dart'; + +class PreviousWinners extends StatefulWidget { + const PreviousWinners({super.key}); + + @override + State createState() => _PreviousWinnersState(); +} + +class _PreviousWinnersState extends State { + final List programmeItems = ['B.Tech', 'B.Des', 'M.Tech']; + final List academicYearItems = ['2016', '2017', '2018', '2019']; + final List scholarshipsorAwardItems = [ + 'MCM Scholarship', + "Director's Gold Medal", + "Director's Silver Medal" + ]; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data; + var service; + List displayData = []; + bool _loading1 = true; + + void initState() { + super.initState(); + _profileController = StreamController(); + profileService = ProfileService(); + service = locator(); + } + + late String award; + late String batch; + late String programme; + void getApplications() async { + final String host = kserverLink; + final String path = "/spacs/student_view/"; + // final String path = "/spacs/getContent/"; + + Uri uri = Uri.http(host, path); + + Map headers = { + 'Content-Type': 'application/json; charset=UTF-8', + 'X-MOBILE-ENV': 'true', + 'Accept': "application/json", + }; + + Map requestBody = { + 'PreviousWinnerAward': award, + 'PreviousWinnerAcadYear': batch, + 'PreviousWinnerProgramme': programme, + 'SubmitPreviousWinner': true, + }; + + var client = http.Client(); + + var response = await client.post( + uri, + headers: headers, + body: jsonEncode(requestBody), + ); + if (response.statusCode == 200) { + // Successful response + var responseData = jsonDecode(response.body); + displayData = responseData; + } else { + // Handle error response + + print('Error: ${response.statusCode}'); + print('Response body: ${response.body}'); + } + + client.close(); + Navigator.of(context).push(MaterialPageRoute(builder: (context) { + return PreviousYearWinnerPage( + displayData: displayData, + ); + })); + } + + void handleProgrammeSelection(String? value) { + setState(() { + programme = value ?? ''; + }); + } + + void handleawardSelection(String? value) { + setState(() { + award = value ?? ''; + }); + } + + void handlebatchSelection(String? value) { + setState(() { + batch = value ?? ''; + }); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + color: Colors.black, // Change this to your desired color + width: 2.0, // Change this to your desired border width + ), + borderRadius: BorderRadius.circular(10.0), + boxShadow: [ + BoxShadow( + color: Colors.grey + .withOpacity(0.2), // Adjust opacity for shadow intensity + spreadRadius: 2.0, // Adjusts how far the shadow spreads + blurRadius: 1.0, // Adjusts how blurry the shadow is + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Previous Winners', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + DropdownMenu( + label: 'Programme:', + items: programmeItems, + onChanged: handleProgrammeSelection), + DropdownMenu( + label: 'Academic Year:', + items: academicYearItems, + onChanged: handlebatchSelection, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + DropdownMenu( + label: 'Scholarship/Award:', + items: scholarshipsorAwardItems, + onChanged: handleawardSelection, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + onPressed: () { + getApplications(); + print(displayData[0]['id']); + }, + style: ElevatedButton.styleFrom( + disabledBackgroundColor: Color.fromRGBO(255, 255, 255, 1), + backgroundColor: Color.fromRGBO(249, 89, 53, 1), + elevation: 0.0, + ), + child: Text('Submit')) + ], + ) + // + ], + ), + ), + ); + } +} + +class DropdownMenu extends StatefulWidget { + final String label; + final List items; + final void Function(String?) onChanged; + DropdownMenu( + {required this.label, required this.items, required this.onChanged}); + + @override + State createState() => _DropdownMenuState(); +} + +class _DropdownMenuState extends State { + String? selectedItem; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.label, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), + ), + SizedBox(height: 14.0), + DropdownButton( + hint: Text('Select'), + value: selectedItem, + onChanged: widget.onChanged, + items: widget.items.map((item) { + return DropdownMenuItem( + value: item, + child: Text(item, + style: TextStyle( + fontSize: 12.0, + )), + ); + }).toList(), + ), + ], + ), + ); + } +} + +// class DropdownMenu extends StatelessWidget { +// final String label; +// final List items; +// final void Function(String?) +// onChanged; // Callback function to handle selection + +// DropdownMenu( +// {required this.label, required this.items, required this.onChanged}); + +// @override +// Widget build(BuildContext context) { +// return Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text(label), +// DropdownButton( +// onChanged: onChanged, // Pass the callback function here +// items: items.map>((String value) { +// return DropdownMenuItem( +// value: value, +// child: Text(value), +// ); +// }).toList(), +// ), +// ], +// ); +// } +// } diff --git a/lib/screens/AwardsandScholarships/Student/previous_winners_listpage.dart b/lib/screens/AwardsandScholarships/Student/previous_winners_listpage.dart new file mode 100644 index 00000000..212cca40 --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/previous_winners_listpage.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; + +class PreviousYearWinnerPage extends StatelessWidget { + final List displayData; + const PreviousYearWinnerPage({super.key, required this.displayData}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: DefaultAppBar().buildAppBar(), + body: ListView.builder( + itemCount: displayData.length, + itemBuilder: (context, index) { + final winner = displayData[index]; + return ListTile( + leading: Text('${winner['id']}'), + title: Text('${winner['student']}'), + ); + })), + ); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/spacs_members_details.dart b/lib/screens/AwardsandScholarships/Student/spacs_members_details.dart new file mode 100644 index 00000000..847e9900 --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/spacs_members_details.dart @@ -0,0 +1,110 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/api.dart'; +import 'package:http/http.dart' as http; +import 'dart:async'; +import 'dart:convert'; +class SpacsMembers extends StatefulWidget { + const SpacsMembers({super.key}); + + @override + State createState() => _SpacsMembersState(); +} + +class _SpacsMembersState extends State { + void initState() { + super.initState(); + + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox( + height: 30, + ), + Text('SPACS Members Details', + style: Theme.of(context).textTheme.titleMedium,), + + SizedBox( + height: 30, + ), + Container( + height: 250, + width: 250, + decoration: BoxDecoration( + color: const Color.fromRGBO(245, 247, 249, 1), + borderRadius: BorderRadius.circular(10), + ), + + child: const Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.person), + Text('SPACS Convener', + + ), + Padding( + padding: EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.phone), + Text('+91-9090909090'), + ], + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.email), + Text('spacconvener@gmail.com'), + ], + ), + Divider( + color: Colors.grey, + thickness: 2, + indent: 20, + endIndent: 20, +), + ], + ), + ), + SizedBox( + height: 20, + ), + Container( + height: 250, + width: 250, + decoration: BoxDecoration( + color: const Color.fromRGBO(245, 247, 249, 1), + borderRadius: BorderRadius.circular(10), + ), + + child: const Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.person), + Text('SPACS Assistant', + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.phone), + Text('+91-9090898990'), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.email), + Text('spacassistant@gmail.com'), + ], + ) + ], + ), + ) + ], + ); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/student_homepage.dart b/lib/screens/AwardsandScholarships/Student/student_homepage.dart new file mode 100644 index 00000000..e6b767ea --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/student_homepage.dart @@ -0,0 +1,169 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/applyforawards.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/browseawardcatalogue.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/service_locator.dart'; + +class StudentHomePage extends StatefulWidget { + const StudentHomePage({Key? key}) : super(key: key); + + @override + State createState() => _StudentHomePageState(); +} + +class _StudentHomePageState extends State { + String? name; + String? depttype; + String? type; + @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']; + + type = service.profileData.profile!['user_type']; + } + + Widget build(BuildContext context) { + return Column( + children: [ + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 90.0, vertical: 30.0), + shadowColor: Colors.black, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 190.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, + ), + Text(type!), + ], + ), + ), + + + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 80.0, vertical: 30.0), + shadowColor: Colors.black, + child: SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: 30.0, + ), + ElevatedButton( + onPressed: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return ApplyForAwards(); + })); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.deepOrangeAccent, + ), + child: Row( + children: [ + Text('Apply For Awards'),Spacer(),Icon(Icons.arrow_forward), + ], + ), + ), + ElevatedButton( + onPressed: () { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { + return BrowseAwardCatalogue(); + })); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.deepOrangeAccent, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text('Browse Award Catalogue'), + Icon(Icons.arrow_forward), + ], + )), + Container( + margin: EdgeInsets.only(top: 20.0), + width: 250.0, + height: 10.0, + ), + Text( + "Catalogue", //Display name of User + style: TextStyle(fontSize: 13.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + Text( + "Previous Winners", // Display Type of User + style: TextStyle(fontSize: 13.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + Text( + "SPACS Members", // Display Type of User + style: TextStyle(fontSize: 13.0, color: Colors.black), + ), + ], + ), + ), + ), + // Card( + // elevation: 2.0, + // margin: EdgeInsets.symmetric(horizontal: 90.0, vertical: 30.0), + // shadowColor: Colors.black, + // child: Column( + // children: [ + // SizedBox( + // height: 30.0, + // ), + + // Container( + // margin: EdgeInsets.only(top: 20.0), + // width: 250.0, + // height: 10.0, + // ), + // ], + // ), + // ), + ], + + ); + } +} diff --git a/lib/screens/AwardsandScholarships/Student/view_application_status.dart b/lib/screens/AwardsandScholarships/Student/view_application_status.dart new file mode 100644 index 00000000..48d9a583 --- /dev/null +++ b/lib/screens/AwardsandScholarships/Student/view_application_status.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/application_data_provider.dart'; +import 'package:provider/provider.dart'; + +class ViewApplicationStatus extends StatelessWidget { + const ViewApplicationStatus({super.key}); + + @override + Widget build(BuildContext context) { + + final submittedapplications = + context.watch().submittedapplications; + + return Scaffold( + appBar: AppBar(title: Text('Application Status',),backgroundColor: Colors.deepOrangeAccent,), + body: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: submittedapplications.length, + itemBuilder: (BuildContext context, int index) { + return ListTile( + leading: const Icon(Icons.list), + trailing: Text( + 'Under Process', + style: TextStyle(color: Colors.green, fontSize: 15), + ), + title: Row( + children: [ + + Text(submittedapplications[index]['type']), + + ], + )); + }), + ); + + } +} diff --git a/lib/screens/AwardsandScholarships/homepage.dart b/lib/screens/AwardsandScholarships/homepage.dart new file mode 100644 index 00000000..f5fad191 --- /dev/null +++ b/lib/screens/AwardsandScholarships/homepage.dart @@ -0,0 +1,68 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsAssistant/Homepage.dart'; +import 'package:fusion/screens/AwardsandScholarships/SpacsConvener/convener_homepage.dart'; +import 'package:fusion/screens/AwardsandScholarships/Student/student_homepage.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/service_locator.dart'; + +class SholarshipHomePage extends StatefulWidget { + const SholarshipHomePage({Key? key}) : super(key: key); + + @override + State createState() => _SholarshipHomePageState(); +} + +class _SholarshipHomePageState extends State { + String? name; + String? depttype; + String? type; + late String curr_desig = ""; + final List pages = [ + StudentHomePage(), + ConvenerHomePage(), + SpacsAssistantHomePage() + ]; + @override + void initState() { + super.initState(); + var service = locator(); + curr_desig = service.getFromDisk("Current_designation"); + name = service.profileData.user!["first_name"] + + " " + + service.profileData.user!["last_name"]; + depttype = service.profileData.profile!['department']!['name'] + + " " + + service.profileData.profile!['user_type']; + + type = service.profileData.profile!['user_type']; + + } + + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "Awards & Scholarships", + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + }, + ), // This is default app bar used in all modules + // drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: MyBottomNavigationBar(), + body: Column( + children: [ + if (curr_desig == 'spacsconvenor') pages[1], + if (curr_desig== 'spacsassistant') pages[2], + if (type == 'student') pages[0] + ], + ), + ), + ); + } +} diff --git a/lib/screens/Profile/Menus/achievements_menu.dart b/lib/screens/Profile/Menus/achievements_menu.dart index e52a613c..d0cfaef2 100644 --- a/lib/screens/Profile/Menus/achievements_menu.dart +++ b/lib/screens/Profile/Menus/achievements_menu.dart @@ -238,7 +238,7 @@ class AchievementsMenu extends StatelessWidget { //Edit Function }, style: ElevatedButton.styleFrom( - primary: Colors.red, + backgroundColor: Colors.red, ), ), ], diff --git a/lib/screens/Profile/Menus/education_menu.dart b/lib/screens/Profile/Menus/education_menu.dart index 6d3e42d0..a39d2ba5 100644 --- a/lib/screens/Profile/Menus/education_menu.dart +++ b/lib/screens/Profile/Menus/education_menu.dart @@ -402,7 +402,8 @@ class EducationMenu extends StatelessWidget { onPressed: () => { //Edit Function }, - style: ElevatedButton.styleFrom(primary: Colors.red), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red), ), ], ), @@ -722,7 +723,8 @@ class EducationMenu extends StatelessWidget { onPressed: () => { //Edit Function }, - style: ElevatedButton.styleFrom(primary: Colors.red), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red), ), ], ), diff --git a/lib/screens/Profile/Menus/profile_menu.dart b/lib/screens/Profile/Menus/profile_menu.dart index b7a94404..13fafcfc 100644 --- a/lib/screens/Profile/Menus/profile_menu.dart +++ b/lib/screens/Profile/Menus/profile_menu.dart @@ -37,7 +37,8 @@ class ProfileMenu extends StatelessWidget { onPressed: () => { //Edit Function }, - style: ElevatedButton.styleFrom(primary: Colors.red)), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red)), ], ), ), @@ -90,7 +91,8 @@ class ProfileMenu extends StatelessWidget { onPressed: () => { //Edit Function }, - style: ElevatedButton.styleFrom(primary: Colors.red), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red), ), ], ), @@ -226,7 +228,8 @@ class ProfileMenu extends StatelessWidget { onPressed: () => { //Edit Function }, - style: ElevatedButton.styleFrom(primary: Colors.red), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red), ), ], ), diff --git a/lib/screens/Profile/Menus/skills_menu.dart b/lib/screens/Profile/Menus/skills_menu.dart index 4f9ab448..9101a792 100644 --- a/lib/screens/Profile/Menus/skills_menu.dart +++ b/lib/screens/Profile/Menus/skills_menu.dart @@ -172,7 +172,7 @@ class SkillsMenu extends StatelessWidget { //Edit Function }, style: ElevatedButton.styleFrom( - primary: Colors.red, + backgroundColor: Colors.red, ), ), ], diff --git a/lib/screens/Profile/Menus/work_experiences_menu.dart b/lib/screens/Profile/Menus/work_experiences_menu.dart index 02f5a801..16a1a091 100644 --- a/lib/screens/Profile/Menus/work_experiences_menu.dart +++ b/lib/screens/Profile/Menus/work_experiences_menu.dart @@ -440,7 +440,8 @@ class WorkExperiencesMenu extends StatelessWidget { onPressed: () => { //Edit Function }, - style: ElevatedButton.styleFrom(primary: Colors.red), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red), ), ], ), @@ -805,7 +806,8 @@ class WorkExperiencesMenu extends StatelessWidget { onPressed: () => { //Edit Function }, - style: ElevatedButton.styleFrom(primary: Colors.red), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red), ), ], ), diff --git a/lib/services/profile_service.dart b/lib/services/profile_service.dart index 7214af5a..2cef9eca 100644 --- a/lib/services/profile_service.dart +++ b/lib/services/profile_service.dart @@ -25,6 +25,7 @@ class ProfileService { ), headers: headers, ); + print(response); if (response.statusCode == 200) { print("successfully fetched profile"); storage_service diff --git a/pubspec.yaml b/pubspec.yaml index 49030f0b..c7ea6b91 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.17.0 <4.0.0' dependencies: flutter: