Merge branch 'main' of bitbucket.org:venbainformationtechnology/ts-tat
This commit is contained in:
commit
77e0ba054c
@ -520,7 +520,7 @@ class HotelsDataState extends State<HotelsData> {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search ...",
|
hintText: "Search ...",
|
||||||
hintStyle: GoogleFonts.poppins(fontSize: 11),
|
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(
|
decoration: InputDecoration(
|
||||||
hintText: "Search ...",
|
hintText: "Search ...",
|
||||||
hintStyle: GoogleFonts.poppins(fontSize: 11),
|
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;
|
int itemsPerPage2 = 10;
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
String selectedTabName = 'domestic';
|
String selectedTabName = 'domestic';
|
||||||
|
int dataAvailableDomesticFlag = 0;
|
||||||
|
int dataAvailableInternationFlag = 0;
|
||||||
Map<String, FocusNode> focusNodes = {};
|
Map<String, FocusNode> focusNodes = {};
|
||||||
Map<String, bool> focusStates = {};
|
Map<String, bool> focusStates = {};
|
||||||
Map<String, TextEditingController> textControllers = {};
|
Map<String, TextEditingController> textControllers = {};
|
||||||
@ -306,7 +308,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
: [],
|
: [],
|
||||||
);
|
);
|
||||||
filteredInternational = internationalData;
|
filteredInternational = internationalData;
|
||||||
|
dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0;
|
||||||
|
dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0;
|
||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -315,6 +318,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
domesticData = [];
|
domesticData = [];
|
||||||
internationalData = [];
|
internationalData = [];
|
||||||
|
dataAvailableDomesticFlag = 0;
|
||||||
|
dataAvailableInternationFlag = 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,7 +356,15 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
||||||
final excelName = '$safeName';
|
final excelName = '$safeName';
|
||||||
|
|
||||||
final result = await apiService.reportExcelDownload(
|
|
||||||
|
|
||||||
|
Map<String, dynamic> result = {
|
||||||
|
"status": false,
|
||||||
|
"message": "Data Not Found",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (selectedTabName == 'domestic' && dataAvailableDomesticFlag == 1) {
|
||||||
|
result = await apiService.reportExcelDownload(
|
||||||
'advancePurchaseReport',
|
'advancePurchaseReport',
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"fromDate": formattedFromDate,
|
"fromDate": formattedFromDate,
|
||||||
@ -360,6 +373,19 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
}),
|
}),
|
||||||
excelName,
|
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 String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13';
|
||||||
final Color displayColor = result['status'] ? Colors.green : Colors.redAccent;
|
final Color displayColor = result['status'] ? Colors.green : Colors.redAccent;
|
||||||
@ -383,6 +409,32 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
setState(() {
|
setState(() {
|
||||||
filteredDomestic =
|
filteredDomestic =
|
||||||
domesticData.where((object) {
|
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) ??
|
return (object['plan_id']?.toLowerCase().contains(lowerQuery) ??
|
||||||
false) ||
|
false) ||
|
||||||
(object['employee_code']?.toLowerCase().contains(lowerQuery) ??
|
(object['employee_code']?.toLowerCase().contains(lowerQuery) ??
|
||||||
@ -397,10 +449,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
false) ||
|
false) ||
|
||||||
(object['Service']?.toLowerCase().contains(lowerQuery) ??
|
(object['Service']?.toLowerCase().contains(lowerQuery) ??
|
||||||
false) ||
|
false) ||
|
||||||
(object['created_on']?.toLowerCase().contains(lowerQuery) ??
|
(newFromDate.toLowerCase().contains(lowerQuery)) ||
|
||||||
false) ||
|
(newToDate.toLowerCase().contains(lowerQuery)) ||
|
||||||
(object['FirstTravelDt']?.toLowerCase().contains(lowerQuery) ??
|
|
||||||
false) ||
|
|
||||||
(object['AdvPurch']?.toLowerCase().contains(lowerQuery));
|
(object['AdvPurch']?.toLowerCase().contains(lowerQuery));
|
||||||
}).toList();
|
}).toList();
|
||||||
currentPage1 = 0;
|
currentPage1 = 0;
|
||||||
@ -415,6 +465,32 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
setState(() {
|
setState(() {
|
||||||
filteredInternational =
|
filteredInternational =
|
||||||
internationalData.where((object) {
|
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) ??
|
return (object['plan_id']?.toLowerCase().contains(lowerQuery) ??
|
||||||
false) ||
|
false) ||
|
||||||
(object['employee_code']?.toLowerCase().contains(lowerQuery) ??
|
(object['employee_code']?.toLowerCase().contains(lowerQuery) ??
|
||||||
@ -429,10 +505,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
false) ||
|
false) ||
|
||||||
(object['Service']?.toLowerCase().contains(lowerQuery) ??
|
(object['Service']?.toLowerCase().contains(lowerQuery) ??
|
||||||
false) ||
|
false) ||
|
||||||
(object['created_on']?.toLowerCase().contains(lowerQuery) ??
|
(newFromDate.toLowerCase().contains(lowerQuery)) ||
|
||||||
false) ||
|
(newToDate.toLowerCase().contains(lowerQuery)) ||
|
||||||
(object['FirstTravelDt']?.toLowerCase().contains(lowerQuery) ??
|
|
||||||
false) ||
|
|
||||||
(object['AdvPurch']?.toLowerCase().contains(lowerQuery));
|
(object['AdvPurch']?.toLowerCase().contains(lowerQuery));
|
||||||
}).toList();
|
}).toList();
|
||||||
currentPage2 = 0;
|
currentPage2 = 0;
|
||||||
@ -986,6 +1060,22 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
paginatedDomestic.map((
|
paginatedDomestic.map((
|
||||||
entry,
|
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(
|
return DataRow(
|
||||||
cells: [
|
cells: [
|
||||||
DataCell(
|
DataCell(
|
||||||
@ -1044,7 +1134,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text(
|
Text(
|
||||||
'${entry['created_on']}',
|
// '${entry['created_on']}',
|
||||||
|
FromDate,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize:
|
fontSize:
|
||||||
12,
|
12,
|
||||||
@ -1053,7 +1144,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text(
|
Text(
|
||||||
'${entry['FirstTravelDt']}',
|
// '${entry['FirstTravelDt']}',
|
||||||
|
ToDate,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize:
|
fontSize:
|
||||||
12,
|
12,
|
||||||
@ -1546,6 +1638,22 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
paginatedInternational.map((
|
paginatedInternational.map((
|
||||||
entry,
|
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(
|
return DataRow(
|
||||||
cells: [
|
cells: [
|
||||||
DataCell(
|
DataCell(
|
||||||
@ -1604,7 +1712,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text(
|
Text(
|
||||||
'${entry['created_on']}',
|
// '${entry['created_on']}',
|
||||||
|
FromDate,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize:
|
fontSize:
|
||||||
12,
|
12,
|
||||||
@ -1613,7 +1722,8 @@ class _AdvancePurchaseState extends State<AdvancePurchase>
|
|||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text(
|
Text(
|
||||||
'${entry['FirstTravelDt']}',
|
// '${entry['FirstTravelDt']}',
|
||||||
|
ToDate,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize:
|
fontSize:
|
||||||
12,
|
12,
|
||||||
|
|||||||
@ -45,6 +45,8 @@ class _MISairState extends State<MISair> with SingleTickerProviderStateMixin {
|
|||||||
int itemsPerPage2 = 10;
|
int itemsPerPage2 = 10;
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
String selectedTabName = 'domestic';
|
String selectedTabName = 'domestic';
|
||||||
|
int dataAvailableDomesticFlag = 0;
|
||||||
|
int dataAvailableInternationFlag = 0;
|
||||||
Map<String, FocusNode> focusNodes = {};
|
Map<String, FocusNode> focusNodes = {};
|
||||||
Map<String, bool> focusStates = {};
|
Map<String, bool> focusStates = {};
|
||||||
Map<String, TextEditingController> textControllers = {};
|
Map<String, TextEditingController> textControllers = {};
|
||||||
@ -284,6 +286,8 @@ class _MISairState extends State<MISair> with SingleTickerProviderStateMixin {
|
|||||||
|
|
||||||
filteredDomestic = domesticData;
|
filteredDomestic = domesticData;
|
||||||
filteredInternational = internationalData;
|
filteredInternational = internationalData;
|
||||||
|
dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0;
|
||||||
|
dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0;
|
||||||
|
|
||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
});
|
});
|
||||||
@ -293,6 +297,8 @@ class _MISairState extends State<MISair> with SingleTickerProviderStateMixin {
|
|||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
domesticData = [];
|
domesticData = [];
|
||||||
internationalData = [];
|
internationalData = [];
|
||||||
|
dataAvailableDomesticFlag = 0;
|
||||||
|
dataAvailableInternationFlag = 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -329,7 +335,14 @@ class _MISairState extends State<MISair> with SingleTickerProviderStateMixin {
|
|||||||
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
||||||
final excelName = '$safeName';
|
final excelName = '$safeName';
|
||||||
|
|
||||||
final result = await apiService.reportExcelDownload(
|
|
||||||
|
Map<String, dynamic> result = {
|
||||||
|
"status": false,
|
||||||
|
"message": "Data Not Found",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (selectedTabName == 'domestic' && dataAvailableDomesticFlag == 1) {
|
||||||
|
result = await apiService.reportExcelDownload(
|
||||||
'misAirReport',
|
'misAirReport',
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"fromDate": formattedFromDate,
|
"fromDate": formattedFromDate,
|
||||||
@ -338,6 +351,18 @@ class _MISairState extends State<MISair> with SingleTickerProviderStateMixin {
|
|||||||
}),
|
}),
|
||||||
excelName,
|
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 String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13';
|
||||||
final Color displayColor = result['status'] ? Colors.green : Colors.redAccent;
|
final Color displayColor = result['status'] ? Colors.green : Colors.redAccent;
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class _MISforexState extends State<MISforex>
|
|||||||
int currentPage = 0;
|
int currentPage = 0;
|
||||||
int itemsPerPage = 10;
|
int itemsPerPage = 10;
|
||||||
String selectedTabName = 'international';
|
String selectedTabName = 'international';
|
||||||
|
int dataAvailableInternationFlag = 0;
|
||||||
Map<String, FocusNode> focusNodes = {};
|
Map<String, FocusNode> focusNodes = {};
|
||||||
Map<String, bool> focusStates = {};
|
Map<String, bool> focusStates = {};
|
||||||
Map<String, TextEditingController> textControllers = {};
|
Map<String, TextEditingController> textControllers = {};
|
||||||
@ -246,12 +247,14 @@ class _MISforexState extends State<MISforex>
|
|||||||
);
|
);
|
||||||
|
|
||||||
filteredInternational = internationalData;
|
filteredInternational = internationalData;
|
||||||
|
dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0;
|
||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// handle error
|
// handle error
|
||||||
setState(() {
|
setState(() {
|
||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
|
dataAvailableInternationFlag = 0;
|
||||||
// domesticData = [];
|
// domesticData = [];
|
||||||
internationalData = [];
|
internationalData = [];
|
||||||
});
|
});
|
||||||
@ -288,8 +291,13 @@ class _MISforexState extends State<MISforex>
|
|||||||
'MIS Forex - International Report (From: ${textControllers["from_date"]?.text} To: ${textControllers["to_date"]?.text})';
|
'MIS Forex - International Report (From: ${textControllers["from_date"]?.text} To: ${textControllers["to_date"]?.text})';
|
||||||
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
||||||
final excelName = '$safeName';
|
final excelName = '$safeName';
|
||||||
|
Map<String, dynamic> result = {
|
||||||
|
"status": false,
|
||||||
|
"message": "Data Not Found",
|
||||||
|
};
|
||||||
|
|
||||||
final result = await apiService.reportExcelDownload(
|
if (selectedTabName == 'international' && dataAvailableInternationFlag == 1) {
|
||||||
|
result = await apiService.reportExcelDownload(
|
||||||
'misForexReport',
|
'misForexReport',
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"fromDate": formattedFromDate,
|
"fromDate": formattedFromDate,
|
||||||
@ -298,6 +306,8 @@ class _MISforexState extends State<MISforex>
|
|||||||
}),
|
}),
|
||||||
excelName,
|
excelName,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
final String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13';
|
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;
|
||||||
|
|||||||
@ -46,6 +46,8 @@ class _MIShotelState extends State<MIShotel>
|
|||||||
int itemsPerPage2 = 10;
|
int itemsPerPage2 = 10;
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
String selectedTabName = 'domestic';
|
String selectedTabName = 'domestic';
|
||||||
|
int dataAvailableDomesticFlag = 0;
|
||||||
|
int dataAvailableInternationFlag = 0;
|
||||||
Map<String, FocusNode> focusNodes = {};
|
Map<String, FocusNode> focusNodes = {};
|
||||||
Map<String, bool> focusStates = {};
|
Map<String, bool> focusStates = {};
|
||||||
Map<String, TextEditingController> textControllers = {};
|
Map<String, TextEditingController> textControllers = {};
|
||||||
@ -286,6 +288,8 @@ class _MIShotelState extends State<MIShotel>
|
|||||||
|
|
||||||
filteredDomestic = domesticData;
|
filteredDomestic = domesticData;
|
||||||
filteredInternational = internationalData;
|
filteredInternational = internationalData;
|
||||||
|
dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0;
|
||||||
|
dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0;
|
||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -294,6 +298,8 @@ class _MIShotelState extends State<MIShotel>
|
|||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
domesticData = [];
|
domesticData = [];
|
||||||
internationalData = [];
|
internationalData = [];
|
||||||
|
dataAvailableDomesticFlag = 0;
|
||||||
|
dataAvailableInternationFlag = 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,7 +336,13 @@ class _MIShotelState extends State<MIShotel>
|
|||||||
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
||||||
final excelName = '$safeName';
|
final excelName = '$safeName';
|
||||||
|
|
||||||
final result = await apiService.reportExcelDownload(
|
Map<String, dynamic> result = {
|
||||||
|
"status": false,
|
||||||
|
"message": "Data Not Found",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (selectedTabName == 'domestic' && dataAvailableDomesticFlag == 1) {
|
||||||
|
result = await apiService.reportExcelDownload(
|
||||||
'misHotelReport',
|
'misHotelReport',
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"fromDate": formattedFromDate,
|
"fromDate": formattedFromDate,
|
||||||
@ -339,6 +351,18 @@ class _MIShotelState extends State<MIShotel>
|
|||||||
}),
|
}),
|
||||||
excelName,
|
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 String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13';
|
||||||
final Color displayColor = result['status'] ? Colors.green : Colors.redAccent;
|
final Color displayColor = result['status'] ? Colors.green : Colors.redAccent;
|
||||||
|
|||||||
@ -46,6 +46,8 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
|||||||
int itemsPerPage2 = 10;
|
int itemsPerPage2 = 10;
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
String selectedTabName = 'domestic';
|
String selectedTabName = 'domestic';
|
||||||
|
int dataAvailableDomesticFlag = 0;
|
||||||
|
int dataAvailableInternationFlag = 0;
|
||||||
Map<String, FocusNode> focusNodes = {};
|
Map<String, FocusNode> focusNodes = {};
|
||||||
Map<String, bool> focusStates = {};
|
Map<String, bool> focusStates = {};
|
||||||
Map<String, TextEditingController> textControllers = {};
|
Map<String, TextEditingController> textControllers = {};
|
||||||
@ -224,6 +226,8 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
|||||||
itemsPerPage1 = 10;
|
itemsPerPage1 = 10;
|
||||||
currentPage2 = 0;
|
currentPage2 = 0;
|
||||||
itemsPerPage2 = 10;
|
itemsPerPage2 = 10;
|
||||||
|
// dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0;
|
||||||
|
// dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0;
|
||||||
});
|
});
|
||||||
final fromDateText = textControllers["from_date"]?.text;
|
final fromDateText = textControllers["from_date"]?.text;
|
||||||
final toDateText = textControllers["to_date"]?.text;
|
final toDateText = textControllers["to_date"]?.text;
|
||||||
@ -285,6 +289,10 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
|||||||
|
|
||||||
filteredDomestic = domesticData;
|
filteredDomestic = domesticData;
|
||||||
filteredInternational = internationalData;
|
filteredInternational = internationalData;
|
||||||
|
|
||||||
|
dataAvailableDomesticFlag = domesticData.isNotEmpty ? 1 : 0;
|
||||||
|
dataAvailableInternationFlag = internationalData.isNotEmpty ? 1 : 0;
|
||||||
|
|
||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -293,6 +301,8 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
|||||||
loaderFlag = false;
|
loaderFlag = false;
|
||||||
domesticData = [];
|
domesticData = [];
|
||||||
internationalData = [];
|
internationalData = [];
|
||||||
|
dataAvailableDomesticFlag = 0;
|
||||||
|
dataAvailableInternationFlag = 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,7 +322,6 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
|||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
webBgColor: "linear-gradient(to right, '#dc1c13', '#dc1c13')",
|
webBgColor: "linear-gradient(to right, '#dc1c13', '#dc1c13')",
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +338,14 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
|||||||
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
final safeName = name.replaceAll(RegExp(r'[^\w\s-]'), '');
|
||||||
final excelName = '$safeName';
|
final excelName = '$safeName';
|
||||||
|
|
||||||
final result = await apiService.reportExcelDownload(
|
|
||||||
|
Map<String, dynamic> result = {
|
||||||
|
"status": false,
|
||||||
|
"message": "Data Not Found",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (selectedTabName == 'domestic' && dataAvailableDomesticFlag == 1) {
|
||||||
|
result = await apiService.reportExcelDownload(
|
||||||
'misServicesAnalysis',
|
'misServicesAnalysis',
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"fromDate": formattedFromDate,
|
"fromDate": formattedFromDate,
|
||||||
@ -338,7 +354,20 @@ class _ServicesAnalysisState extends State<ServicesAnalysis>
|
|||||||
}),
|
}),
|
||||||
excelName,
|
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 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 String displayMessage = result['message'];
|
||||||
|
|||||||
@ -1291,7 +1291,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search Country...",
|
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),
|
style: GoogleFonts.poppins(fontSize: 11.5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
constraints: BoxConstraints(maxHeight: 200),
|
constraints: BoxConstraints(maxHeight: 180),
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search Country...",
|
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,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
// title: Text("User Details"),
|
// 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(
|
content: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -239,22 +243,167 @@ class _UserListScreenState extends State<UserListScreen> {
|
|||||||
// Text(subtitle, style: TextStyle(fontWeight: FontWeight.bold)),
|
// Text(subtitle, style: TextStyle(fontWeight: FontWeight.bold)),
|
||||||
//
|
//
|
||||||
// SizedBox(height: 12),
|
// SizedBox(height: 12),
|
||||||
Text("Success Report :", style: TextStyle(fontWeight: FontWeight.bold)),
|
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)
|
if (successList.isNotEmpty)
|
||||||
...successList.asMap().entries.map((entry) => Text("${entry.key + 1}) ${entry.value} created."))
|
SizedBox(
|
||||||
else
|
height: 250,
|
||||||
Text("-- no data. --"),
|
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()
|
||||||
|
: '-';
|
||||||
|
|
||||||
SizedBox(height: 12),
|
return DataRow(
|
||||||
Text("Failed Report :", style: TextStyle(fontWeight: FontWeight.bold)),
|
cells: [
|
||||||
if (failedList.isNotEmpty)
|
DataCell(
|
||||||
...failedList.asMap().entries.map((entry) {
|
Text(
|
||||||
final data = entry.value["data"] ?? "-";
|
'$newIndex',
|
||||||
final reason = entry.value["reason"] ?? "Unknown error";
|
style: GoogleFonts.poppins(
|
||||||
return Text("${entry.key + 1}) $data - unable to create due to \"$reason\".");
|
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
|
else
|
||||||
Text("-- no data. --"),
|
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: 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)
|
||||||
|
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. --",style: GoogleFonts.poppins(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w200,
|
||||||
|
color: Colors.black,
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1571,6 +1571,7 @@ class ApiService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
print("report XL Dowloaded");
|
print("report XL Dowloaded");
|
||||||
print(excelName);
|
print(excelName);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user