Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gymkhana - SA-3 #202

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/app/src/main/res/drawable/launch_background.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<item android:drawable="@android:colorBackground" />

<!-- You can insert your own image assets here -->
<!-- <item>
Expand Down
68 changes: 65 additions & 3 deletions lib/Components/side_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
import 'dart:async';
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:fusion/main.dart';
import 'package:fusion/screens/Gymkhana/gymkhana_counsellor.dart';
import 'package:fusion/screens/Gymkhana/gymkhana_convenor.dart';
import 'package:fusion/screens/Gymkhana/gymkhana_dean.dart';
import 'package:fusion/services/login_service.dart';
import 'package:fusion/services/service_locator.dart';
import 'package:fusion/services/storage_service.dart';
import 'package:fusion/screens/LoginandDashboard/dashboard.dart';
import 'package:http/http.dart';

import '../models/dashboard.dart';
import '../models/profile.dart';
import '../services/dashboard_service.dart';
import '../services/help.dart';
import '../services/profile_service.dart';

class SideDrawer extends StatefulWidget {
final String? designation;
// Accept designation as parameter
// Constructor with an optional parameter
SideDrawer({this.designation = ''});

@override
_SideDrawerState createState() => _SideDrawerState();
}
Expand All @@ -13,9 +33,17 @@ class _SideDrawerState extends State<SideDrawer> {
int count = 0;
String? name;
String? depttype;
late String yy = "";
late String designation = "";
late ProfileService profileService;
late StreamController _dashboardController;
late DashboardService dashboardService;
late DashboardData data;
@override
void initState() {
super.initState();
_initializeClubName();
profileService = ProfileService();
var service = locator<StorageService>();
name = service.profileData.user!["first_name"] +
" " +
Expand All @@ -25,6 +53,21 @@ class _SideDrawerState extends State<SideDrawer> {
service.profileData.profile!['user_type'];
}

Future<void> _initializeClubName() async {
yy = await DataFetcher().getClub(context);
Response response = await dashboardService.getDashboard();
if (response.statusCode == 200) {
data = DashboardData.fromJson(jsonDecode(response.body));
designation = data.designation![0];
print("hh");
print(designation);
} else {
throw Exception('Failed to load dashboard data: ${response.statusCode}');
}
print(yy);
setState(() {}); // Update the UI after getting the club name
}

@override
Widget build(BuildContext context) {
return SafeArea(
Expand Down Expand Up @@ -58,7 +101,7 @@ class _SideDrawerState extends State<SideDrawer> {
height: 10.0,
),
Text(
depttype!,
designation + " " + "-" + yy,
style: TextStyle(fontSize: 15.0, color: Colors.white),
),
Divider(
Expand Down Expand Up @@ -122,8 +165,11 @@ class _SideDrawerState extends State<SideDrawer> {
isActive: true,
),
ModulesPadding(
line: 'Gymkhana Module',
pageMover: '/gymkhana_homepage'),
line: 'Gymkhana Module',
pageMover: _getGymkhanaPage(),
isActive: true,
),

ModulesPadding(
line: 'Establishment Module',
pageMover: '/establishment'),
Expand Down Expand Up @@ -168,12 +214,28 @@ class _SideDrawerState extends State<SideDrawer> {
),
);
}

String _getGymkhanaPage() {
// Determine the pageMover based on designation
print(widget.designation);
if (widget.designation == 'co_ordinator') {
return '/gymkhana_coordinator';
} else if (widget.designation == 'Counsellor') {
return '/gymkhana_counsellor';
} else if (widget.designation == 'Convenor') {
return '/gymkhana_convenor';
} else if (widget.designation == 'Dean Academic') {
return '/gymkhana_dean';
} else
return '/gymkhana_homepage';
}
}

class ModulesPadding extends StatelessWidget {
final String? line;
final String? pageMover;
final bool isActive;

ModulesPadding({this.line, this.pageMover, this.isActive = false});
@override
Widget build(BuildContext context) {
Expand Down
118 changes: 70 additions & 48 deletions lib/Components/side_drawer2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:fusion/services/storage_service.dart';

class SideDrawer extends StatefulWidget {
final String curr_desig;

// final String designation;
const SideDrawer({
Key? key,
required this.curr_desig,
Expand Down Expand Up @@ -51,7 +51,7 @@ class _SideDrawerState extends State<SideDrawer> {
Card(
elevation: 2.0,
margin:
EdgeInsets.symmetric(horizontal: 12.0, vertical: 30.0),
EdgeInsets.symmetric(horizontal: 12.0, vertical: 30.0),
// shadowColor: Colors.black,
color: Colors.white,

Expand Down Expand Up @@ -100,78 +100,106 @@ class _SideDrawerState extends State<SideDrawer> {
),
ModulesCard(cardLine: 'DashBoard', pageMover: '/dashboard'),

if ((type != "staff" || widget.curr_desig=="acadmin"|| widget.curr_desig== "corelabcaretaker"))
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"))
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" )
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',
pageMover: _getGymkhanaPage(),
),

if ((type == "student" || widget.curr_desig== "mess_manager" || widget.curr_desig== "mess_warden"))
ModulesCard(cardLine: 'Central Mess Module',pageMover: '/central_mess_home'),

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: 'Leave Module'),

if ((type == "student" ))
ModulesCard(cardLine: 'Purchase and Store'),
if ((type == "student"))
ModulesCard(cardLine: 'Purchase and Store'),

if ((type == "student" ))
ModulesCard(cardLine: 'Human Resource'),
if ((type == "student")) ModulesCard(cardLine: 'Human Resource'),

if(type == "student"|| widget.curr_desig=="placement chairman" || widget.curr_desig=="placement officer")
ModulesCard(cardLine: 'Placement Module'),
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'),
ModulesCard(
cardLine: 'Visitors Hostel Module',
pageMover: '/visitor_hostel'),

if(type != "student")
ModulesCard(cardLine: 'File Tracking Module',pageMover: '/compose_file'),
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'),
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'),
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: 'Courses Module',
pageMover: '/registered_courses',
),
ModulesCard(
cardLine: 'HR Module',
pageMover: '/hr_homepage',
),

// ModulesCard(
// cardLine: 'Profile',
Expand All @@ -193,27 +221,21 @@ class _SideDrawerState extends State<SideDrawer> {
),
);
}

String _getGymkhanaPage() {

String _getGymkhanaPage() {
// Determine the pageMover based on designation
print(1);
print(widget.curr_desig);
if (widget.curr_desig == 'co-ordinator') {

return '/gymkhana_coordinator';
}
else if(widget.curr_desig == 'Counsellor'){
} else if (widget.curr_desig == 'Counsellor') {
return '/gymkhana_counsellor';
}
else if(widget.curr_desig == 'Convenor'){
} else if (widget.curr_desig == 'Convenor') {
return '/gymkhana_convenor';
}
else if(widget.curr_desig == 'Dean Academic'){
} else if (widget.curr_desig == 'Dean Academic') {
return '/gymkhana_dean';
}

else
return '/gymkhana_homepage';
} else
return '/gymkhana_homepage';
}
// ignore: must_be_immutable
}
Expand Down Expand Up @@ -261,4 +283,4 @@ class ModulesCard extends StatelessWidget {
},
);
}
}
}
35 changes: 31 additions & 4 deletions lib/api.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//Server and local links
String klocalLink = "127.0.0.1:8000";
String kserverLink = "172.27.16.214:8000";
// 172.27.16.214:8000

//Login Service
String kAuthUrl = "172.27.16.214:8000";
// Login Service
String kAuthUrl = "172.27.16.214:8000"; // Localhost
String kAuthLogin = "/api/auth/login/";
// String kAuthLogin = "/accounts/login";

//Profile Service
String kProfile = "/api/profile/";
Expand All @@ -21,12 +21,39 @@ String kComplaintRemove = "/complaint/api/removecomplain/";

//Dashboard
String kDashboard = "/api/dashboard/";
String kNotification = "/api/notification/";
String kNotificationRead = "/api/notification/read/";
const String kNotification = "/api/notification/";

//Gymkhana
const kGymkhanaClubDetails = '/api/gymkhana/club_details';
const kGymkhanaMemberRecords = '/api/gymkhana/members_record';
const kSessionDetailsPath = '/gymkhana/session_details';
const kClubDetailsPath = '/gymkhana/clubdetails';
const kViewEventDetailsPath = '/gymkhana/event_info/';
const kDeleteSessionpoint = '/gymkhana/api/delete_sessions/';
const kMembersRecordPath = '/gymkhana/api/members_records/';
const kNewSessionCreatePath = '/gymkhana/api/new_session/';
const kNewEventCreatePath = '/gymkhana/api/new_event/';
const kNewClubMemberPath = '/gymkhana/api/club_membership/';
const kDeleteEventPath = '/gymkhana/api/delete_event/';
const kApproveMemberPath = '/gymkhana/api/member_approve/';
const kRejectMemberPath = '/gymkhana/api/member_reject/';
const kCreatePollPath = '/gymkhana/api/create_poll/';
const kViewBudgetDeanPath = '/gymkhana/club_budgetinfo/';
const kUpdateBudgetPath = '/gymkhana/api/update_clubBudget/';
const kCreateBudgetPath = '/gymkhana/api/add_clubBudget/';
const kViewShowVotingPollsPath = '/gymkhana/voting_polls/';
const kViewShowVotingChoicesPath = '/gymkhana/api/show_voting_choices/';
const kDeleteBudgetEndpoint = '/gymkhana/api/delete_budget/';
const kUpdateSessionPath = '/gymkhana/api/edit_session/';
const kUpdateEventPath = '/gymkhana/api/edit_event/';
const kUpdateActivityCalendarPath = '/gymkhana/api/activity_calender/';
const kChangeClubPositionPath = '/gymkhana/api/update_coordinator/';
const kDeleteClubPath = '/gymkhana/api/delete_club/';
const kCreateClubPath = '/gymkhana/api/create_club/';
const kUpdateClubStatusPath = '/gymkhana/api/update_clubStatus/';
const kUpdateClubNamePath = '/gymkhana/api/updateClubName/';
const kApproveEventEndpoint = '/gymkhana/api/approve_event/';

//HealthCentre
String kHealthCentreStudent = "/healthcenter/api/student";
Expand Down
Loading