From 042b97905f51d5a68cc8c1b511067e6705f4b5d8 Mon Sep 17 00:00:00 2001 From: Atharva Date: Sat, 13 Jul 2024 18:43:09 +0530 Subject: [PATCH] some changes railway --- .../railway_screen/railway_screen.dart | 106 +++++++++--------- .../screens/railway_screen/railwayform.dart | 10 +- 2 files changed, 64 insertions(+), 52 deletions(-) diff --git a/lib/new_ui/screens/railway_screen/railway_screen.dart b/lib/new_ui/screens/railway_screen/railway_screen.dart index 724a128c..7e48a6a0 100644 --- a/lib/new_ui/screens/railway_screen/railway_screen.dart +++ b/lib/new_ui/screens/railway_screen/railway_screen.dart @@ -203,7 +203,9 @@ class _RailwayConcessionScreenState List genderList = ['Male', 'Female']; File? idCardPhoto; + File? idCardPhoto2; File? idCardPhotoTemp; + File? idCardPhotoTemp2; File? previousPassPhoto; File? previousPassPhotoTemp; @@ -260,6 +262,8 @@ class _RailwayConcessionScreenState idCardPhotoTemp = null; } else if (type == 'Previous Pass Photo') { previousPassPhotoTemp = null; + }else if(type == 'ID Card Back'){ + idCardPhotoTemp2 = null; } }); } @@ -336,56 +340,58 @@ class _RailwayConcessionScreenState ref.read(railwayConcessionOpenProvider.state).state = false; } - Future saveChanges(WidgetRef ref) async { - StudentModel student = ref.watch(userModelProvider)!.studentModel!; - - ConcessionDetailsModel details = ConcessionDetailsModel( - status: ConcessionStatus.unserviced, - statusMessage: "", - ageMonths: int.parse(_ageMonths), - ageYears: int.parse(_ageYears), - duration: duration ?? "Monthly", - branch: student.branch, - gender: gender ?? "Male", - firstName: firstNameController.text, - gradyear: student.gradyear, - middleName: middleNameController.text, - lastName: lastNameController.text, - idCardURL: idCardURL, - previousPassURL: previousPassURL, - from: homeStation, - to: toStation, - lastPassIssued: null, - address: addressController.text, - dob: _selectedDate ?? DateTime.now(), - phoneNum: int.parse(phoneNumController.text), - travelLane: travelLane ?? "Central", - type: travelClass ?? "I", - ); - - if (_formKey.currentState!.validate() && - idCardPhotoTemp != null && - previousPassPhotoTemp != null) { - idCardPhoto = idCardPhotoTemp; - previousPassPhoto = previousPassPhotoTemp; - - ref.read(railwayConcessionOpenProvider.state).state = false; - // await ref - // .watch(concessionProvider.notifier) - // .applyConcession(details, idCardPhoto!, previousPassPhoto!, context); - } else if (idCardPhotoTemp == null) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text("Please add the photo of your ID card")), - ); - } else if (previousPassPhotoTemp == null) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text("Please add the photo of your previous pass")), - ); - } - - ref.read(concessionProvider.notifier).getConcessionData(); - ref.read(concessionRequestProvider.notifier).getConcessionRequestData(); - } + // Future saveChanges(WidgetRef ref) async { + // StudentModel student = ref.watch(userModelProvider)!.studentModel!; + // + // ConcessionDetailsModel details = ConcessionDetailsModel( + // status: ConcessionStatus.unserviced, + // statusMessage: "", + // ageMonths: int.parse(_ageMonths), + // ageYears: int.parse(_ageYears), + // duration: duration ?? "Monthly", + // branch: student.branch, + // gender: gender ?? "Male", + // firstName: firstNameController.text, + // gradyear: student.gradyear, + // middleName: middleNameController.text, + // lastName: lastNameController.text, + // idCardURL: idCardURL, + // previousPassURL: previousPassURL, + // from: homeStation, + // to: toStation, + // lastPassIssued: null, + // address: addressController.text, + // dob: _selectedDate ?? DateTime.now(), + // phoneNum: int.parse(phoneNumController.text), + // travelLane: travelLane ?? "Central", + // type: travelClass ?? "I", + // ); + // + // if (_formKey.currentState!.validate() && + // idCardPhotoTemp != null && + // idCardPhotoTemp2 != null && + // previousPassPhotoTemp != null) + // { + // idCardPhoto = idCardPhotoTemp; + // previousPassPhoto = previousPassPhotoTemp; + // + // ref.read(railwayConcessionOpenProvider.state).state = false; + // // await ref + // // .watch(concessionProvider.notifier) + // // .applyConcession(details, idCardPhoto!, previousPassPhoto!, context); + // } else if (idCardPhotoTemp == null) { + // ScaffoldMessenger.of(context).showSnackBar( + // SnackBar(content: Text("Please add the photo of your ID card")), + // ); + // } else if (previousPassPhotoTemp == null) { + // ScaffoldMessenger.of(context).showSnackBar( + // SnackBar(content: Text("Please add the photo of your previous pass")), + // ); + // } + // + // ref.read(concessionProvider.notifier).getConcessionData(); + // ref.read(concessionRequestProvider.notifier).getConcessionRequestData(); + // } Widget buildImagePicker(String type, File? selectedPhoto, bool editMode) { // File? selectedFile = diff --git a/lib/new_ui/screens/railway_screen/railwayform.dart b/lib/new_ui/screens/railway_screen/railwayform.dart index 36605679..d0665636 100644 --- a/lib/new_ui/screens/railway_screen/railwayform.dart +++ b/lib/new_ui/screens/railway_screen/railwayform.dart @@ -356,7 +356,8 @@ class _RailwayForm extends ConsumerState { if (_formKey.currentState!.validate() && idCardPhotoTemp != null && idCardPhotoTemp2 != null && - previousPassPhotoTemp != null) { + previousPassPhotoTemp != null) + { idCardPhoto = idCardPhotoTemp; previousPassPhoto = previousPassPhotoTemp; @@ -370,7 +371,12 @@ class _RailwayForm extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text("Please add the photo of your ID card")), ); - } else if (previousPassPhotoTemp == null) { + } else if (idCardPhotoTemp2 == null) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text("Please add the BACK photo of your ID card")), + ); + } + else if (previousPassPhotoTemp == null) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text("Please add the photo of your previous pass")), );