Skip to content
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
4 changes: 3 additions & 1 deletion lib/data/constants/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class AppConstants {
static const String USER_NOT_AUTHORIZED_TO_FETCH_USER =
'You are not authorized to fetch this User';
static const String USER_NOT_FOUND = 'No User Found';
static const String USER_NOT_REGISTERED =
'You are not registered. Kindly contact MDGSpace.';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDG Space (observe the space)


/// MENU CONSTANTS
static const String MENU_NOT_FOUND = 'No Menu Found';
Expand Down Expand Up @@ -46,7 +48,7 @@ class AppConstants {
static const TEMPORARY_USER_API_STATUS = "Temporary";

/// api error messages
static const MENU_NOT_UPLOADED = 'Menu not uploaded yet';
static const MENU_NOT_UPLOADED = 'Menu not uploaded yet.\nKindly contact your mess secretary.';

// Storage Keys
static const FCM_TOKEN = 'fcm_token';
Expand Down
4 changes: 2 additions & 2 deletions lib/data/constants/env_config.dart
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change mess.iitr.ac.in back to appetizer.onrender.com

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class EnvironmentConfig {
static const String BASE_URL = String.fromEnvironment(
'BASE_URL',
defaultValue: 'https://appetizer.onrender.com',
defaultValue: 'https://mess.iitr.ac.in',
);

static const String OAUTH_CLIENT_ID = String.fromEnvironment(
Expand All @@ -11,7 +11,7 @@ class EnvironmentConfig {

static const String OAUTH_REDIRECT_URI = String.fromEnvironment(
'OAUTH_REDIRECT_URI',
defaultValue: 'https://appetizer.onrender.com/api/user/oauth/redirect/',
defaultValue: 'https://mess.iitr.ac.in/api/user/oauth/redirect/',
);

static const String SENTRY_DSN = String.fromEnvironment('SENTRY_DSN');
Expand Down
1 change: 1 addition & 0 deletions lib/presentation/components/no_data_found_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class NoDataFoundContainer extends StatelessWidget {
),
Text(
title,
textAlign: TextAlign.center,
style: TextStyle(
color: const Color(0xFF111111),
fontSize: 18.toAutoScaledFont,
Expand Down
45 changes: 34 additions & 11 deletions lib/presentation/leaves_and_rebate/components/monthly_rebates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:appetizer/domain/models/transaction/paginated_yearly_rebate.dart
import 'package:appetizer/presentation/leaves_and_rebate/components/custom_divider.dart';
import 'package:appetizer/presentation/components/shadow_container.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:appetizer/domain/repositories/transaction_repositroy.dart';
import 'package:month_picker_dialog/month_picker_dialog.dart';

class MonthlyRebates extends StatefulWidget {
Expand Down Expand Up @@ -39,6 +41,26 @@ class _MonthlyRebatesState extends State<MonthlyRebates> {
// super.initState();
// }

@override
void initState() {
super.initState();
year = DateTime.now().year;
_currMonthIndex = widget.currMonthIndex;
paginatedYearlyRebate = widget.paginatedYearlyRebate;
}

void _rebuildMonthlyMap() {
_totalRebate = 0;
_monthlyRebateMap.clear();
if (paginatedYearlyRebate != null) {
for (YearlyRebate yr in paginatedYearlyRebate!.results) {
_monthlyRebateMap[_monthList[yr.monthId]] = yr.rebate;
_totalRebate += yr.rebate;
}
}
_monthlyRebateMap["All"] = _totalRebate;
}

final _monthList = [
'All',
'January',
Expand All @@ -56,16 +78,10 @@ class _MonthlyRebatesState extends State<MonthlyRebates> {
];
@override
Widget build(BuildContext context) {
_totalRebate = 0;
_currMonthIndex ??= widget.currMonthIndex;
_currMonthName = _monthList[_currMonthIndex!];
paginatedYearlyRebate ??= widget.paginatedYearlyRebate;
for (YearlyRebate yr in paginatedYearlyRebate!.results) {
_monthlyRebateMap[_monthList[yr.monthId]] = yr.rebate;
_totalRebate += yr.rebate;
}
_monthlyRebateMap["All"] = _totalRebate;
year = DateTime.now().year;
_rebuildMonthlyMap();
return ShadowContainer(
width: 312.toAutoScaledWidth,
offset: 2,
Expand Down Expand Up @@ -112,10 +128,17 @@ class _MonthlyRebatesState extends State<MonthlyRebates> {
initialDate: DateTime(year, _currMonthIndex!),
lastDate: DateTime.now(),
);
// TODO: rebates for prev year are blocked
if (newDateTime != null &&
newDateTime.year == year &&
newDateTime.month != _currMonthIndex) {
if (newDateTime == null) return;
if (newDateTime.year != year) {
final repo = context.read<TransactionRepository>();
final data = await repo.getYearlyRebates(newDateTime.year);
setState(() {
year = newDateTime.year;
paginatedYearlyRebate = data;
_currMonthIndex = newDateTime.month;
_rebuildMonthlyMap();
});
} else if (newDateTime.month != _currMonthIndex) {
setState(() {
_currMonthIndex = newDateTime.month;
});
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/login/bloc/login_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
try {
isOldUser = await userRepository.userIsOldUser(event.enrollmentNo);
} catch (e) {
emit(const LoginInitial(error: AppConstants.GENERIC_FAILURE));
emit(const LoginInitial(error: AppConstants.USER_NOT_REGISTERED));
}
if (isOldUser) {
emit(EnterPassword(enrollmentNo: event.enrollmentNo));
Expand Down
36 changes: 18 additions & 18 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -713,26 +713,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
url: "https://pub.dev"
source: hosted
version: "11.0.2"
version: "10.0.9"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
url: "https://pub.dev"
source: hosted
version: "3.0.10"
version: "3.0.9"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.1"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -1017,10 +1017,10 @@ packages:
dependency: transitive
description:
name: shared_preferences_android
sha256: "0b0f98d535319cb5cdd4f65783c2a54ee6d417a2f093dbb18be3e36e4c3d181f"
sha256: bd14436108211b0d4ee5038689a56d4ae3620fd72fd6036e113bf1345bc74d9e
url: "https://pub.dev"
source: hosted
version: "2.4.14"
version: "2.4.13"
shared_preferences_foundation:
dependency: transitive
description:
Expand Down Expand Up @@ -1158,10 +1158,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
url: "https://pub.dev"
source: hosted
version: "0.7.6"
version: "0.7.4"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -1206,10 +1206,10 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256: c0fb544b9ac7efa10254efaf00a951615c362d1ea1877472f8f6c0fa00fcf15b
sha256: "81777b08c498a292d93ff2feead633174c386291e35612f8da438d6e92c4447e"
url: "https://pub.dev"
source: hosted
version: "6.3.23"
version: "6.3.20"
url_launcher_ios:
dependency: transitive
description:
Expand Down Expand Up @@ -1294,18 +1294,18 @@ packages:
dependency: transitive
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
url: "https://pub.dev"
source: hosted
version: "15.0.2"
version: "15.0.0"
watcher:
dependency: transitive
description:
Expand Down Expand Up @@ -1371,5 +1371,5 @@ packages:
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.9.0 <4.0.0"
flutter: ">=3.35.0"
dart: ">=3.8.0 <4.0.0"
flutter: ">=3.29.0"
Loading