diff --git a/lib/Screens/hotels/hotelsDetails.dart b/lib/Screens/hotels/hotelsDetails.dart index 77d0e0d..80182f5 100644 --- a/lib/Screens/hotels/hotelsDetails.dart +++ b/lib/Screens/hotels/hotelsDetails.dart @@ -489,38 +489,38 @@ class HotelsDataState extends State { constraints: BoxConstraints(maxHeight: 200), itemBuilder: (context, item, isSelected) { - print("contryItem - $item"); - final match = RegExp(r'^(.*)\s\((.*)\)$',).firstMatch(item); - final countryName = match?.group(1) ?? ''; - final countryCode = match?.group(2) ?? ''; - return Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0, - vertical: 6.0, - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - countryName, - style: GoogleFonts.poppins(fontSize: 11.5), - ), - Text( - countryCode, - style: GoogleFonts.poppins(fontSize: 11.5,color:Colors.grey), + print("contryItem - $item"); + final match = RegExp(r'^(.*)\s\((.*)\)$',).firstMatch(item); + final countryName = match?.group(1) ?? ''; + final countryCode = match?.group(2) ?? ''; + return Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0, + vertical: 6.0, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + countryName, + style: GoogleFonts.poppins(fontSize: 11.5), + ), + Text( + countryCode, + style: GoogleFonts.poppins(fontSize: 11.5,color:Colors.grey), - ), - ], - ), + ), + ], ), - );}, + ), + );}, searchFieldProps: TextFieldProps( decoration: InputDecoration( hintText: "Search ...", hintStyle: GoogleFonts.poppins(fontSize: 11), - contentPadding: EdgeInsets.symmetric(horizontal: 4), + contentPadding: EdgeInsets.symmetric(horizontal: 1,vertical: 1), ), ), ), diff --git a/lib/Screens/perdiem_amount/forexDetails.dart b/lib/Screens/perdiem_amount/forexDetails.dart index 1a0d05c..f53ed2b 100644 --- a/lib/Screens/perdiem_amount/forexDetails.dart +++ b/lib/Screens/perdiem_amount/forexDetails.dart @@ -465,7 +465,7 @@ class ForexDataState extends State { decoration: InputDecoration( hintText: "Search ...", hintStyle: GoogleFonts.poppins(fontSize: 11), - contentPadding: EdgeInsets.symmetric(horizontal: 4), + contentPadding: EdgeInsets.symmetric(horizontal: 3,vertical: 3), ), ), ), diff --git a/lib/Screens/reports/advancePurchase.dart b/lib/Screens/reports/advancePurchase.dart index f6eb16b..0ee36fc 100644 --- a/lib/Screens/reports/advancePurchase.dart +++ b/lib/Screens/reports/advancePurchase.dart @@ -46,6 +46,8 @@ class _AdvancePurchaseState extends State int itemsPerPage2 = 10; late TabController _tabController; String selectedTabName = 'domestic'; + int dataAvailableDomesticFlag = 0; + int dataAvailableInternationFlag = 0; Map focusNodes = {}; Map focusStates = {}; Map textControllers = {}; @@ -306,7 +308,8 @@ class _AdvancePurchaseState extends State : [], ); filteredInternational = internationalData; - + dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0; + dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0; loaderFlag = false; }); } catch (e) { @@ -315,6 +318,8 @@ class _AdvancePurchaseState extends State loaderFlag = false; domesticData = []; internationalData = []; + dataAvailableDomesticFlag = 0; + dataAvailableInternationFlag = 0; }); } } @@ -351,15 +356,36 @@ class _AdvancePurchaseState extends State final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), ''); final excelName = '$safeName'; - final result = await apiService.reportExcelDownload( - 'advancePurchaseReport', - jsonEncode({ - "fromDate": formattedFromDate, - "toDate": formattedToDate, - "export": selectedTabName, - }), - excelName, - ); + + + Map result = { + "status": false, + "message": "Data Not Found", + }; + + if (selectedTabName == 'domestic' && dataAvailableDomesticFlag == 1) { + result = await apiService.reportExcelDownload( + 'advancePurchaseReport', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } + if (selectedTabName == 'international' && dataAvailableInternationFlag == 1) { + result = await apiService.reportExcelDownload( + 'advancePurchaseReport', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } + final String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13'; final Color displayColor = result['status'] ? Colors.green : Colors.redAccent; @@ -383,6 +409,32 @@ class _AdvancePurchaseState extends State setState(() { filteredDomestic = domesticData.where((object) { + final fromDateRaw = object['created_on']; + String newFromDate = ''; + + if (fromDateRaw != null && fromDateRaw is String) { + try { + final parsedDate = DateTime.parse(fromDateRaw); + newFromDate = + '${parsedDate.day.toString().padLeft(2, '0')}-${parsedDate.month.toString().padLeft(2, '0')}-${parsedDate.year}'; + } catch (e) { + // fallback if date is not parsable + newFromDate = fromDateRaw; + } + } + final toDateRaw = object['FirstTravelDt']; + String newToDate = ''; + + if (toDateRaw != null && toDateRaw is String) { + try { + final parsedDate = DateTime.parse(fromDateRaw); + newToDate = + '${parsedDate.day.toString().padLeft(2, '0')}-${parsedDate.month.toString().padLeft(2, '0')}-${parsedDate.year}'; + } catch (e) { + // fallback if date is not parsable + newToDate = toDateRaw; + } + } return (object['plan_id']?.toLowerCase().contains(lowerQuery) ?? false) || (object['employee_code']?.toLowerCase().contains(lowerQuery) ?? @@ -397,10 +449,8 @@ class _AdvancePurchaseState extends State false) || (object['Service']?.toLowerCase().contains(lowerQuery) ?? false) || - (object['created_on']?.toLowerCase().contains(lowerQuery) ?? - false) || - (object['FirstTravelDt']?.toLowerCase().contains(lowerQuery) ?? - false) || + (newFromDate.toLowerCase().contains(lowerQuery)) || + (newToDate.toLowerCase().contains(lowerQuery)) || (object['AdvPurch']?.toLowerCase().contains(lowerQuery)); }).toList(); currentPage1 = 0; @@ -415,6 +465,32 @@ class _AdvancePurchaseState extends State setState(() { filteredInternational = internationalData.where((object) { + final fromDateRaw = object['created_on']; + String newFromDate = ''; + + if (fromDateRaw != null && fromDateRaw is String) { + try { + final parsedDate = DateTime.parse(fromDateRaw); + newFromDate = + '${parsedDate.day.toString().padLeft(2, '0')}-${parsedDate.month.toString().padLeft(2, '0')}-${parsedDate.year}'; + } catch (e) { + // fallback if date is not parsable + newFromDate = fromDateRaw; + } + } + final toDateRaw = object['FirstTravelDt']; + String newToDate = ''; + + if (toDateRaw != null && toDateRaw is String) { + try { + final parsedDate = DateTime.parse(fromDateRaw); + newToDate = + '${parsedDate.day.toString().padLeft(2, '0')}-${parsedDate.month.toString().padLeft(2, '0')}-${parsedDate.year}'; + } catch (e) { + // fallback if date is not parsable + newToDate = toDateRaw; + } + } return (object['plan_id']?.toLowerCase().contains(lowerQuery) ?? false) || (object['employee_code']?.toLowerCase().contains(lowerQuery) ?? @@ -429,10 +505,8 @@ class _AdvancePurchaseState extends State false) || (object['Service']?.toLowerCase().contains(lowerQuery) ?? false) || - (object['created_on']?.toLowerCase().contains(lowerQuery) ?? - false) || - (object['FirstTravelDt']?.toLowerCase().contains(lowerQuery) ?? - false) || + (newFromDate.toLowerCase().contains(lowerQuery)) || + (newToDate.toLowerCase().contains(lowerQuery)) || (object['AdvPurch']?.toLowerCase().contains(lowerQuery)); }).toList(); currentPage2 = 0; @@ -986,6 +1060,22 @@ class _AdvancePurchaseState extends State paginatedDomestic.map(( entry, ) { + final FromDate = + DateFormat( + 'dd-MM-yyyy', + ).format( + DateTime.parse( + entry['created_on'], + ), + ); + final ToDate = + DateFormat( + 'dd-MM-yyyy', + ).format( + DateTime.parse( + entry['FirstTravelDt'], + ), + ); return DataRow( cells: [ DataCell( @@ -1044,7 +1134,8 @@ class _AdvancePurchaseState extends State ), DataCell( Text( - '${entry['created_on']}', + // '${entry['created_on']}', + FromDate, style: GoogleFonts.poppins( fontSize: 12, @@ -1053,7 +1144,8 @@ class _AdvancePurchaseState extends State ), DataCell( Text( - '${entry['FirstTravelDt']}', + // '${entry['FirstTravelDt']}', + ToDate, style: GoogleFonts.poppins( fontSize: 12, @@ -1546,6 +1638,22 @@ class _AdvancePurchaseState extends State paginatedInternational.map(( entry, ) { + final FromDate = + DateFormat( + 'dd-MM-yyyy', + ).format( + DateTime.parse( + entry['created_on'], + ), + ); + final ToDate = + DateFormat( + 'dd-MM-yyyy', + ).format( + DateTime.parse( + entry['FirstTravelDt'], + ), + ); return DataRow( cells: [ DataCell( @@ -1604,7 +1712,8 @@ class _AdvancePurchaseState extends State ), DataCell( Text( - '${entry['created_on']}', + // '${entry['created_on']}', + FromDate, style: GoogleFonts.poppins( fontSize: 12, @@ -1613,7 +1722,8 @@ class _AdvancePurchaseState extends State ), DataCell( Text( - '${entry['FirstTravelDt']}', + // '${entry['FirstTravelDt']}', + ToDate, style: GoogleFonts.poppins( fontSize: 12, diff --git a/lib/Screens/reports/misAir.dart b/lib/Screens/reports/misAir.dart index 88ec957..49909dc 100644 --- a/lib/Screens/reports/misAir.dart +++ b/lib/Screens/reports/misAir.dart @@ -45,6 +45,8 @@ class _MISairState extends State with SingleTickerProviderStateMixin { int itemsPerPage2 = 10; late TabController _tabController; String selectedTabName = 'domestic'; + int dataAvailableDomesticFlag = 0; + int dataAvailableInternationFlag = 0; Map focusNodes = {}; Map focusStates = {}; Map textControllers = {}; @@ -284,6 +286,8 @@ class _MISairState extends State with SingleTickerProviderStateMixin { filteredDomestic = domesticData; filteredInternational = internationalData; + dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0; + dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0; loaderFlag = false; }); @@ -293,6 +297,8 @@ class _MISairState extends State with SingleTickerProviderStateMixin { loaderFlag = false; domesticData = []; internationalData = []; + dataAvailableDomesticFlag = 0; + dataAvailableInternationFlag = 0; }); } } @@ -329,15 +335,34 @@ class _MISairState extends State with SingleTickerProviderStateMixin { final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), ''); final excelName = '$safeName'; - final result = await apiService.reportExcelDownload( - 'misAirReport', - jsonEncode({ - "fromDate": formattedFromDate, - "toDate": formattedToDate, - "export": selectedTabName, - }), - excelName, - ); + + Map result = { + "status": false, + "message": "Data Not Found", + }; + + if (selectedTabName == 'domestic' && dataAvailableDomesticFlag == 1) { + result = await apiService.reportExcelDownload( + 'misAirReport', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } + if (selectedTabName == 'international' && dataAvailableInternationFlag == 1) { + result = await apiService.reportExcelDownload( + 'misAirReport', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } final String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13'; final Color displayColor = result['status'] ? Colors.green : Colors.redAccent; diff --git a/lib/Screens/reports/misForex.dart b/lib/Screens/reports/misForex.dart index 62c3fe5..c6ecf6f 100644 --- a/lib/Screens/reports/misForex.dart +++ b/lib/Screens/reports/misForex.dart @@ -43,6 +43,7 @@ class _MISforexState extends State int currentPage = 0; int itemsPerPage = 10; String selectedTabName = 'international'; + int dataAvailableInternationFlag = 0; Map focusNodes = {}; Map focusStates = {}; Map textControllers = {}; @@ -246,12 +247,14 @@ class _MISforexState extends State ); filteredInternational = internationalData; + dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0; loaderFlag = false; }); } catch (e) { // handle error setState(() { loaderFlag = false; + dataAvailableInternationFlag = 0; // domesticData = []; internationalData = []; }); @@ -288,16 +291,23 @@ class _MISforexState extends State 'MIS Forex - International Report (From: ${textControllers["from_date"]?.text} To: ${textControllers["to_date"]?.text})'; final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), ''); final excelName = '$safeName'; + Map result = { + "status": false, + "message": "Data Not Found", + }; + + if (selectedTabName == 'international' && dataAvailableInternationFlag == 1) { + result = await apiService.reportExcelDownload( + 'misForexReport', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } - final result = await apiService.reportExcelDownload( - 'misForexReport', - jsonEncode({ - "fromDate": formattedFromDate, - "toDate": formattedToDate, - "export": selectedTabName, - }), - excelName, - ); final String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13'; final Color displayColor = result['status'] ? Colors.green : Colors.redAccent; diff --git a/lib/Screens/reports/misHotel.dart b/lib/Screens/reports/misHotel.dart index 18da2f4..41f315b 100644 --- a/lib/Screens/reports/misHotel.dart +++ b/lib/Screens/reports/misHotel.dart @@ -46,6 +46,8 @@ class _MIShotelState extends State int itemsPerPage2 = 10; late TabController _tabController; String selectedTabName = 'domestic'; + int dataAvailableDomesticFlag = 0; + int dataAvailableInternationFlag = 0; Map focusNodes = {}; Map focusStates = {}; Map textControllers = {}; @@ -286,6 +288,8 @@ class _MIShotelState extends State filteredDomestic = domesticData; filteredInternational = internationalData; + dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0; + dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0; loaderFlag = false; }); } catch (e) { @@ -294,6 +298,8 @@ class _MIShotelState extends State loaderFlag = false; domesticData = []; internationalData = []; + dataAvailableDomesticFlag = 0; + dataAvailableInternationFlag = 0; }); } } @@ -330,15 +336,33 @@ class _MIShotelState extends State final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), ''); final excelName = '$safeName'; - final result = await apiService.reportExcelDownload( - 'misHotelReport', - jsonEncode({ - "fromDate": formattedFromDate, - "toDate": formattedToDate, - "export": selectedTabName, - }), - excelName, - ); + Map result = { + "status": false, + "message": "Data Not Found", + }; + + if (selectedTabName == 'domestic' && dataAvailableDomesticFlag == 1) { + result = await apiService.reportExcelDownload( + 'misHotelReport', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } + if (selectedTabName == 'international' && dataAvailableInternationFlag == 1) { + result = await apiService.reportExcelDownload( + 'misHotelReport', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } final String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13'; final Color displayColor = result['status'] ? Colors.green : Colors.redAccent; diff --git a/lib/Screens/reports/servicesAnalysis.dart b/lib/Screens/reports/servicesAnalysis.dart index 5f6dfe8..1f80455 100644 --- a/lib/Screens/reports/servicesAnalysis.dart +++ b/lib/Screens/reports/servicesAnalysis.dart @@ -46,6 +46,8 @@ class _ServicesAnalysisState extends State int itemsPerPage2 = 10; late TabController _tabController; String selectedTabName = 'domestic'; + int dataAvailableDomesticFlag = 0; + int dataAvailableInternationFlag = 0; Map focusNodes = {}; Map focusStates = {}; Map textControllers = {}; @@ -224,6 +226,8 @@ class _ServicesAnalysisState extends State itemsPerPage1 = 10; currentPage2 = 0; itemsPerPage2 = 10; + // dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0; + // dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0; }); final fromDateText = textControllers["from_date"]?.text; final toDateText = textControllers["to_date"]?.text; @@ -285,6 +289,10 @@ class _ServicesAnalysisState extends State filteredDomestic = domesticData; filteredInternational = internationalData; + + dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0; + dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0; + loaderFlag = false; }); } catch (e) { @@ -293,6 +301,8 @@ class _ServicesAnalysisState extends State loaderFlag = false; domesticData = []; internationalData = []; + dataAvailableDomesticFlag = 0; + dataAvailableInternationFlag = 0; }); } } @@ -312,7 +322,6 @@ class _ServicesAnalysisState extends State fontSize: 18.0, webBgColor: "linear-gradient(to right, '#dc1c13', '#dc1c13')", ); - return; } @@ -329,18 +338,38 @@ class _ServicesAnalysisState extends State final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), ''); final excelName = '$safeName'; - final result = await apiService.reportExcelDownload( - 'misServicesAnalysis', - jsonEncode({ - "fromDate": formattedFromDate, - "toDate": formattedToDate, - "export": selectedTabName, - }), - excelName, - ); + Map result = { + "status": false, + "message": "Data Not Found", + }; + + if (selectedTabName == 'domestic' && dataAvailableDomesticFlag == 1) { + result = await apiService.reportExcelDownload( + 'misServicesAnalysis', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } + if (selectedTabName == 'international' && dataAvailableInternationFlag == 1) { + result = await apiService.reportExcelDownload( + 'misServicesAnalysis', + jsonEncode({ + "fromDate": formattedFromDate, + "toDate": formattedToDate, + "export": selectedTabName, + }), + excelName, + ); + } + + // Now you can safely access result final String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13'; - final Color displayColor = result['status'] ? Colors.green : Colors.redAccent; + final Color displayColor = result['status'] ? Colors.green : Colors.redAccent; final String displayMessage = result['message']; // final bool status = result['status'] == true; diff --git a/lib/Screens/userManagement/create_traveller_agent/personalDetailsTravelAgent.dart b/lib/Screens/userManagement/create_traveller_agent/personalDetailsTravelAgent.dart index 11f5234..b32da26 100644 --- a/lib/Screens/userManagement/create_traveller_agent/personalDetailsTravelAgent.dart +++ b/lib/Screens/userManagement/create_traveller_agent/personalDetailsTravelAgent.dart @@ -1276,7 +1276,7 @@ class PersonalDetailsState extends State { searchFieldProps: TextFieldProps( decoration: InputDecoration( hintText: "Search Country...", - contentPadding: EdgeInsets.symmetric(horizontal: 10), + contentPadding: EdgeInsets.symmetric(horizontal: 3,vertical: 3), ), ), ), diff --git a/lib/Screens/userManagement/create_user/personal_details.dart b/lib/Screens/userManagement/create_user/personal_details.dart index 6f49b7a..745bd38 100644 --- a/lib/Screens/userManagement/create_user/personal_details.dart +++ b/lib/Screens/userManagement/create_user/personal_details.dart @@ -1378,11 +1378,11 @@ class PersonalDetailsState extends State { style: GoogleFonts.poppins(fontSize: 11.5), ), ), - constraints: BoxConstraints(maxHeight: 200), + constraints: BoxConstraints(maxHeight: 180), searchFieldProps: TextFieldProps( decoration: InputDecoration( hintText: "Search Country...", - contentPadding: EdgeInsets.symmetric(horizontal: 10), + contentPadding: EdgeInsets.symmetric(horizontal: 3,vertical: 3), ), ), ), diff --git a/lib/Screens/userManagement/user_List.dart b/lib/Screens/userManagement/user_List.dart index 25d4079..b976a0a 100644 --- a/lib/Screens/userManagement/user_List.dart +++ b/lib/Screens/userManagement/user_List.dart @@ -231,7 +231,11 @@ class _UserListScreenState extends State { context: context, builder: (context) => AlertDialog( // title: Text("User Details"), - title: Text("Upload Status - $subtitle", style: TextStyle(fontWeight: FontWeight.bold)), + title: Text("Upload Status - $subtitle", style: GoogleFonts.poppins( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Colors.black, + ), overflow: TextOverflow.ellipsis), content: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -239,22 +243,167 @@ class _UserListScreenState extends State { // Text(subtitle, style: TextStyle(fontWeight: FontWeight.bold)), // // SizedBox(height: 12), - Text("Success Report :", style: TextStyle(fontWeight: FontWeight.bold)), - if (successList.isNotEmpty) - ...successList.asMap().entries.map((entry) => Text("${entry.key + 1}) ${entry.value} created.")) - else - Text("-- no data. --"), + Text("Success Report :", style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + )), + // if (successList.isNotEmpty) + // ...successList.asMap().entries.map((entry) => Text("${entry.key + 1}) ${entry.value} created.")) + if (successList.isNotEmpty) + SizedBox( + height: 250, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: DataTable( + columns: [ + DataColumn( + label: Text( + 'S.No', + style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.black, + ), + ), + ), + DataColumn( + label: Text( + 'Data', + style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.black, + ), + ), + ) + ], + rows: successList.asMap().entries.map((entry) { + final newIndex = entry.key + 1; + final data = entry.value?.toString().trim().isNotEmpty == true + ? entry.value.toString() + : '-'; + return DataRow( + cells: [ + DataCell( + Text( + '$newIndex', + style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + ), + ), + ), + DataCell( + SizedBox( + width: 460, + child: Text( + data, + style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ), + ], + ); + }).toList(), + ), + ), + ), + ) + else + Text("-- no data. --",style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w200, + color: Colors.black, + )), SizedBox(height: 12), - Text("Failed Report :", style: TextStyle(fontWeight: FontWeight.bold)), + // Text("Failed Report :", style: TextStyle(fontWeight: FontWeight.bold)), + Text("Failed Report :", style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + )), + // if (failedList.isNotEmpty) + // ...failedList.asMap().entries.map((entry) { + // final data = entry.value["data"] ?? "-"; + // final reason = entry.value["reason"] ?? "Unknown error"; + // return Text("${entry.key + 1}) $data - unable to create due to \"$reason\"."); + // }) + if (failedList.isNotEmpty) - ...failedList.asMap().entries.map((entry) { - final data = entry.value["data"] ?? "-"; - final reason = entry.value["reason"] ?? "Unknown error"; - return Text("${entry.key + 1}) $data - unable to create due to \"$reason\"."); - }) + SizedBox( + height: 250, // Vertical scroll height + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, // Enable horizontal scrolling + child: SingleChildScrollView( + scrollDirection: Axis.vertical, // Enable vertical scrolling + child: DataTable( + columns: [ + DataColumn(label: Text('S.No', style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.black, + ))), + DataColumn(label: Text('Data', style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.black, + ))), + DataColumn(label: Text('Reason', style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.black, + ))), + ], + rows: failedList.asMap().entries.map((entry) { + final index = entry.key + 1; + final rawData = entry.value['data']; + final data = (rawData == null || rawData.toString().trim().isEmpty) ? '-' : rawData.toString(); + final reason = entry.value['reason'] ?? 'Unknown error'; + + return DataRow(cells: [ + DataCell(Text('$index',style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + ))), + DataCell(SizedBox( + width: 180, + child: Text(data, style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + ), overflow: TextOverflow.ellipsis), + )), + DataCell(SizedBox( + width: 280, + child: Text(reason, style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + ),overflow: TextOverflow.ellipsis), + )), + ]); + }).toList(), + ), + ), + ), + ) else - Text("-- no data. --"), + Text("-- no data. --",style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w200, + color: Colors.black, + )), ], ), ), diff --git a/lib/services/apiService.dart b/lib/services/apiService.dart index 664c5c1..64f034d 100644 --- a/lib/services/apiService.dart +++ b/lib/services/apiService.dart @@ -1571,6 +1571,7 @@ class ApiService { ); if (response.statusCode == 200) { + try { print("report XL Dowloaded"); print(excelName);