minor issues fixes 3
This commit is contained in:
parent
534c8213d9
commit
0d0b2a4799
@ -489,38 +489,38 @@ class HotelsDataState extends State<HotelsData> {
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -465,7 +465,7 @@ class ForexDataState extends State<ForexData> {
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search ...",
|
||||
hintStyle: GoogleFonts.poppins(fontSize: 11),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 4),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 3,vertical: 3),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -46,6 +46,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
||||
int itemsPerPage2 = 10;
|
||||
late TabController _tabController;
|
||||
String selectedTabName = 'domestic';
|
||||
int dataAvailableDomesticFlag = 0;
|
||||
int dataAvailableInternationFlag = 0;
|
||||
Map<String, FocusNode> focusNodes = {};
|
||||
Map<String, bool> focusStates = {};
|
||||
Map<String, TextEditingController> textControllers = {};
|
||||
@ -306,7 +308,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
||||
: [],
|
||||
);
|
||||
filteredInternational = internationalData;
|
||||
|
||||
dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0;
|
||||
dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0;
|
||||
loaderFlag = false;
|
||||
});
|
||||
} catch (e) {
|
||||
@ -315,6 +318,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
||||
loaderFlag = false;
|
||||
domesticData = [];
|
||||
internationalData = [];
|
||||
dataAvailableDomesticFlag = 0;
|
||||
dataAvailableInternationFlag = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -351,15 +356,36 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
||||
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<String, dynamic> 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<AdvancePurchase>
|
||||
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<AdvancePurchase>
|
||||
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<AdvancePurchase>
|
||||
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<AdvancePurchase>
|
||||
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<AdvancePurchase>
|
||||
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<AdvancePurchase>
|
||||
),
|
||||
DataCell(
|
||||
Text(
|
||||
'${entry['created_on']}',
|
||||
// '${entry['created_on']}',
|
||||
FromDate,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
12,
|
||||
@ -1053,7 +1144,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
||||
),
|
||||
DataCell(
|
||||
Text(
|
||||
'${entry['FirstTravelDt']}',
|
||||
// '${entry['FirstTravelDt']}',
|
||||
ToDate,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
12,
|
||||
@ -1546,6 +1638,22 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
||||
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<AdvancePurchase>
|
||||
),
|
||||
DataCell(
|
||||
Text(
|
||||
'${entry['created_on']}',
|
||||
// '${entry['created_on']}',
|
||||
FromDate,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
12,
|
||||
@ -1613,7 +1722,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
||||
),
|
||||
DataCell(
|
||||
Text(
|
||||
'${entry['FirstTravelDt']}',
|
||||
// '${entry['FirstTravelDt']}',
|
||||
ToDate,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
12,
|
||||
|
||||
@ -45,6 +45,8 @@ class _MISairState extends State<MISair> with SingleTickerProviderStateMixin {
|
||||
int itemsPerPage2 = 10;
|
||||
late TabController _tabController;
|
||||
String selectedTabName = 'domestic';
|
||||
int dataAvailableDomesticFlag = 0;
|
||||
int dataAvailableInternationFlag = 0;
|
||||
Map<String, FocusNode> focusNodes = {};
|
||||
Map<String, bool> focusStates = {};
|
||||
Map<String, TextEditingController> textControllers = {};
|
||||
@ -284,6 +286,8 @@ class _MISairState extends State<MISair> 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<MISair> with SingleTickerProviderStateMixin {
|
||||
loaderFlag = false;
|
||||
domesticData = [];
|
||||
internationalData = [];
|
||||
dataAvailableDomesticFlag = 0;
|
||||
dataAvailableInternationFlag = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -329,15 +335,34 @@ class _MISairState extends State<MISair> 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<String, dynamic> 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;
|
||||
|
||||
@ -43,6 +43,7 @@ class _MISforexState extends State<MISforex>
|
||||
int currentPage = 0;
|
||||
int itemsPerPage = 10;
|
||||
String selectedTabName = 'international';
|
||||
int dataAvailableInternationFlag = 0;
|
||||
Map<String, FocusNode> focusNodes = {};
|
||||
Map<String, bool> focusStates = {};
|
||||
Map<String, TextEditingController> textControllers = {};
|
||||
@ -246,12 +247,14 @@ class _MISforexState extends State<MISforex>
|
||||
);
|
||||
|
||||
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<MISforex>
|
||||
'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<String, dynamic> 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;
|
||||
|
||||
@ -46,6 +46,8 @@ class _MIShotelState extends State<MIShotel>
|
||||
int itemsPerPage2 = 10;
|
||||
late TabController _tabController;
|
||||
String selectedTabName = 'domestic';
|
||||
int dataAvailableDomesticFlag = 0;
|
||||
int dataAvailableInternationFlag = 0;
|
||||
Map<String, FocusNode> focusNodes = {};
|
||||
Map<String, bool> focusStates = {};
|
||||
Map<String, TextEditingController> textControllers = {};
|
||||
@ -286,6 +288,8 @@ class _MIShotelState extends State<MIShotel>
|
||||
|
||||
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<MIShotel>
|
||||
loaderFlag = false;
|
||||
domesticData = [];
|
||||
internationalData = [];
|
||||
dataAvailableDomesticFlag = 0;
|
||||
dataAvailableInternationFlag = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -330,15 +336,33 @@ class _MIShotelState extends State<MIShotel>
|
||||
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<String, dynamic> 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;
|
||||
|
||||
@ -46,6 +46,8 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
||||
int itemsPerPage2 = 10;
|
||||
late TabController _tabController;
|
||||
String selectedTabName = 'domestic';
|
||||
int dataAvailableDomesticFlag = 0;
|
||||
int dataAvailableInternationFlag = 0;
|
||||
Map<String, FocusNode> focusNodes = {};
|
||||
Map<String, bool> focusStates = {};
|
||||
Map<String, TextEditingController> textControllers = {};
|
||||
@ -224,6 +226,8 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
||||
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<ServicesAnalysis>
|
||||
|
||||
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<ServicesAnalysis>
|
||||
loaderFlag = false;
|
||||
domesticData = [];
|
||||
internationalData = [];
|
||||
dataAvailableDomesticFlag = 0;
|
||||
dataAvailableInternationFlag = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -312,7 +322,6 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
||||
fontSize: 18.0,
|
||||
webBgColor: "linear-gradient(to right, '#dc1c13', '#dc1c13')",
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -329,18 +338,38 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
||||
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<String, dynamic> 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;
|
||||
|
||||
|
||||
@ -1276,7 +1276,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search Country...",
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 10),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 3,vertical: 3),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -1378,11 +1378,11 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -231,7 +231,11 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
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<UserListScreen> {
|
||||
// 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,
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -1571,6 +1571,7 @@ class ApiService {
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
|
||||
try {
|
||||
print("report XL Dowloaded");
|
||||
print(excelName);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user