Skip to content

Commit

Permalink
Merge pull request #462 from YujithIsura/main
Browse files Browse the repository at this point in the history
bug fixed in enrollment
  • Loading branch information
YujithIsura authored Jan 2, 2025
2 parents d75d19e + a6ca5db commit 31a77c6
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,7 @@ class _StudentCreateState extends State<StudentCreate> {
Expanded(
flex: 6,
child: DropdownButtonFormField<int>(
value: userPerson.organization?.parent_organizations?.first.id ??
userPerson.organization_id,
value: selectedOrgId,
items: [
DropdownMenuItem<int>(
value: null, // Default item for when no selection is made
Expand All @@ -720,8 +719,8 @@ class _StudentCreateState extends State<StudentCreate> {
classes = await fetchClasses(newValue);
}
setState(() {
userPerson.organization_id =
newValue; // Update the organization ID
selectedOrgId = newValue;
userPerson.organization?.id = newValue;
});
},
decoration: InputDecoration(
Expand Down Expand Up @@ -955,7 +954,8 @@ class _StudentCreateState extends State<StudentCreate> {
onChanged: (value) {
setState(() {
selectedClassId = value;
userPerson.organization?.id = value;
userPerson.organization_id =
value; // Update the organization ID
});
},
decoration: const InputDecoration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class _StudentUpdateState extends State<StudentUpdate> {
}

selectedOrgId = userPerson.organization?.id ?? 0;
selectedClassId = classes.isNotEmpty ? classes.first.id : 0;
selectedClassId =
(userPerson.organization != null) ? userPerson.organization!.id : 0;

// Handling date of birth safely
String? dob = userPerson.date_of_birth;
Expand Down Expand Up @@ -446,8 +447,8 @@ class _StudentUpdateState extends State<StudentUpdate> {
return 'Phone number is required';
}
final phoneRegex = RegExp(r'^[0-9]+$');
if (!phoneRegex.hasMatch(value) || value.length < 10) {
return 'Enter a valid phone number (at least 10 digits)';
if (!phoneRegex.hasMatch(value) || value.length < 9) {
return 'Enter a valid phone number (at least 9 digits)';
}
return null;
}
Expand Down Expand Up @@ -682,6 +683,9 @@ class _StudentUpdateState extends State<StudentUpdate> {
);
}

// final parentOrganizationId =
// (userPerson.organization != null) ? userPerson.organization!.id : 0;

final parentOrganizationId =
(userPerson.organization?.parent_organizations != null &&
userPerson.organization!.parent_organizations!.isNotEmpty)
Expand All @@ -708,7 +712,7 @@ class _StudentUpdateState extends State<StudentUpdate> {
Expanded(
flex: 6,
child: DropdownButtonFormField<int>(
value: validParentOrganizationId,
value: validParentOrganizationId ?? userPerson.organization_id,
items: organizations
.where((org) =>
org.avinya_type?.id == 105 ||
Expand Down Expand Up @@ -945,13 +949,15 @@ class _StudentUpdateState extends State<StudentUpdate> {
flex: 6,
child: DropdownButtonFormField<int>(
value: isValidClass
? selectedClassId
: null, // Validate selectedClassId
? (userPerson.organization != null)
? userPerson.organization!.id
: 0
: selectedClassId, // Validate selectedClassId
items: _getClassOptions(),
onChanged: (value) {
setState(() {
selectedClassId = value;
userPerson.organization?.id = value;
userPerson.organization_id = value;
});
},
decoration: const InputDecoration(
Expand Down
13 changes: 2 additions & 11 deletions campus/frontend/lib/avinya/enrollment/lib/widgets/students.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import 'package:gallery/avinya/enrollment/lib/screens/student_create_screen.dart
import 'package:gallery/avinya/enrollment/lib/screens/student_update_screen.dart';
import 'person_data_excel_report.dart';

enum AvinyaTypeId { Empower, IT, CS, FutureEnrollees }
enum AvinyaTypeId { Empower, IT, CS }

const avinyaTypeId = {
AvinyaTypeId.Empower: 37,
AvinyaTypeId.IT: 10,
AvinyaTypeId.CS: 96,
AvinyaTypeId.FutureEnrollees: 103,
};

class Students extends StatefulWidget {
Expand All @@ -37,7 +36,6 @@ class _StudentsState extends State<Students> {
AvinyaTypeId.Empower,
AvinyaTypeId.IT,
AvinyaTypeId.CS,
AvinyaTypeId.FutureEnrollees
];

List<String?> columnNames = [];
Expand Down Expand Up @@ -75,19 +73,16 @@ class _StudentsState extends State<Students> {
AvinyaTypeId.Empower,
AvinyaTypeId.IT,
AvinyaTypeId.CS,
AvinyaTypeId.FutureEnrollees
];
} else {
filteredAvinyaTypeIdValues = [
AvinyaTypeId.Empower,
AvinyaTypeId.FutureEnrollees
];
}
} else {
// Default value if newValue is null or invalid
filteredAvinyaTypeIdValues = [
AvinyaTypeId.Empower,
AvinyaTypeId.FutureEnrollees
];
}

Expand Down Expand Up @@ -231,14 +226,12 @@ class _StudentsState extends State<Students> {
.isBefore(DateTime.parse('2024-03-01'))) {
filteredAvinyaTypeIdValues = [
AvinyaTypeId.Empower,
AvinyaTypeId.FutureEnrollees
];
} else {
filteredAvinyaTypeIdValues = [
AvinyaTypeId.Empower,
AvinyaTypeId.IT,
AvinyaTypeId.CS,
AvinyaTypeId.FutureEnrollees
];
}

Expand Down Expand Up @@ -308,9 +301,7 @@ class _StudentsState extends State<Students> {
return DropdownMenuItem<AvinyaTypeId>(
value: typeId,
child: Text(
typeId.name == 'FutureEnrollees'
? 'FUTURE ENROLLEES'
: typeId.name.toUpperCase(),
typeId.name.toUpperCase(),
),
);
}).toList(),
Expand Down
10 changes: 9 additions & 1 deletion campus/mobile/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
"request": "launch",
"type": "dart",
"flutterMode": "release"
}
},
{
"name": "debug android Tab",
"request": "launch",
"type": "dart",
"flutterMode": "debug",
"deviceId": "emulator-5556",
"runTestsOnDevice": false
},
]
}
8 changes: 4 additions & 4 deletions campus/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (keystorePropertiesFile.exists()) {


android {
namespace "com.avinyanew.mobile"
namespace "com.avinyav2.mobile"
compileSdkVersion 34
ndkVersion flutter.ndkVersion

Expand All @@ -50,12 +50,12 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.avinyanew.mobile"
applicationId "com.avinyav2.mobile"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 20
minSdkVersion 21
targetSdkVersion 34
versionCode 6
versionCode 8
versionName "1.0.2"
multiDexEnabled true
manifestPlaceholders += [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.avinyanew.mobile
package com.avinyav2.mobile

import io.flutter.embedding.android.FlutterActivity

Expand Down
12 changes: 6 additions & 6 deletions campus/mobile/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand All @@ -384,7 +384,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -402,7 +402,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
Expand All @@ -418,7 +418,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
Expand Down Expand Up @@ -545,7 +545,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -567,7 +567,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion campus/mobile/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(runner LANGUAGES CXX)
set(BINARY_NAME "Avinya Apps")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.avinyanew.mobile")
set(APPLICATION_ID "com.avinyav2.mobile")

# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
Expand Down
6 changes: 3 additions & 3 deletions campus/mobile/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mobile.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mobile";
Expand All @@ -398,7 +398,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mobile.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mobile";
Expand All @@ -412,7 +412,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mobile.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mobile";
Expand Down
2 changes: 1 addition & 1 deletion campus/mobile/macos/Runner/Configs/AppInfo.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
PRODUCT_NAME = Avinya Apps;

// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.avinyanew.mobile;
PRODUCT_BUNDLE_IDENTIFIER = com.avinyav2.mobile;

// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2023 com.avinya. All rights reserved.

0 comments on commit 31a77c6

Please sign in to comment.