diff --git a/lib-jun6-9:03.zip b/lib-jun6-9:03.zip new file mode 100644 index 0000000..c5dc669 Binary files /dev/null and b/lib-jun6-9:03.zip differ diff --git a/lib/Screens/allTrips/list_all_plans.dart b/lib/Screens/allTrips/list_all_plans.dart index 0744446..536b13f 100644 --- a/lib/Screens/allTrips/list_all_plans.dart +++ b/lib/Screens/allTrips/list_all_plans.dart @@ -208,6 +208,7 @@ class _ListAllPlansState extends State { if (response.statusCode == 200) { final data = json.decode(response.body); + // List plansJson = []; List plansJson = data['data']; return plansJson.map((json) => Plan.fromJson(json)).toList(); } else { @@ -580,6 +581,8 @@ class _ListAllPlansState extends State { } else if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) { + final adjHgt = MediaQuery.of(context).size.height; + return Center( child: Padding( padding: const EdgeInsets.all(16.0), @@ -597,25 +600,16 @@ class _ListAllPlansState extends State { // color: Colors.redAccent), // // ), - const SizedBox(height: 15), + SizedBox(height: adjHgt / 4), Text( - "No Trips", + " No Trips Found", textAlign: TextAlign.center, style: GoogleFonts.poppins( fontSize: 20, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w500, color: Colors.black54, ), ), - const SizedBox(height: 10), - Text( - "Please Create Trip", - textAlign: TextAlign.center, - style: GoogleFonts.poppins( - fontSize: 12, - color: Colors.grey, - ), - ), ], ), ), diff --git a/lib/Screens/approvals/approval_list.dart b/lib/Screens/approvals/approval_list.dart index 98c217a..0c464b4 100644 --- a/lib/Screens/approvals/approval_list.dart +++ b/lib/Screens/approvals/approval_list.dart @@ -43,8 +43,6 @@ class _ApprovalListState extends State { List filteredPlans = []; TextEditingController searchController = TextEditingController(); - late List plansJson; - @override void initState() { super.initState(); @@ -188,7 +186,7 @@ class _ApprovalListState extends State { if (response.statusCode == 200) { final data = json.decode(response.body); - plansJson = data['data']; + List plansJson = data['data']; return plansJson.map((json) => Plan.fromJson(json)).toList(); } else { throw Exception('Failed to load plans'); @@ -608,7 +606,7 @@ class _ApprovalListState extends State { style: GoogleFonts.poppins( fontSize: 20, // fontFamily: "Inter", - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w500, color: Colors.black54, ), ), diff --git a/lib/Screens/plans/create_plans.dart b/lib/Screens/plans/create_plans.dart index cb5bc4e..3c6fb9e 100644 --- a/lib/Screens/plans/create_plans.dart +++ b/lib/Screens/plans/create_plans.dart @@ -881,7 +881,7 @@ class CreateNewPlansState extends State { if (response.statusCode == 200) { try { final data = json.decode(response.body); - print(data); + print("CostCenterdropdoen - $data"); if (!data.containsKey('data') || data['data'] is! List) { throw Exception( @@ -905,13 +905,13 @@ class CreateNewPlansState extends State { apiCostData = plansJson; costCenterMap = { for (var item in apiCostData!) - item['department_id'].toString(): item['name'].toString(), + item['cost_center_id'].toString(): item['name'].toString(), }; costCenterIds = costCenterMap.keys.toList(); // Optionally auto-select the first item if not already selected - // selectedCostCenterId ??= - // costCenterIds.isNotEmpty ? costCenterIds.first : null; + selectedCostCenterId ??= + costCenterIds.isNotEmpty ? costCenterIds.first : null; }); print('plansJSON'); @@ -1630,18 +1630,13 @@ class CreateNewPlansState extends State { ); } - String? getSelectedCostCenterName() { - if (selectedCostCenterId == null || apiCostData == null) return null; - return apiCostData!.firstWhere( - (item) => item['department_id'] == selectedCostCenterId, - orElse: () => null, - )?['name']; - } - - /// Extracted helper function - /// - /// - /// + // String? getSelectedCostCenterName() { + // if (selectedCostCenterId == null || apiCostData == null) return null; + // return apiCostData!.firstWhere( + // (item) => item['department_id'] == selectedCostCenterId, + // orElse: () => null, + // )?['name']; + // } final List> allTripTypes = [ {"dropdown_key": "1", "dropdown_value": "Domestic"}, diff --git a/lib/app.dart b/lib/app.dart index 988c9f1..ff0f116 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -2,7 +2,7 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; +// import 'package:flutter/rendering.dart'; import 'dart:html' as html; import 'package:frontend/config/apiUrl.dart'; // 1 newly added import 'package:frontend/services/apiService.dart'; @@ -31,7 +31,7 @@ class _MyAppState extends State { @override void initState() { super.initState(); - SemanticsBinding.instance.ensureSemantics(); // ✅ Safe here + // SemanticsBinding.instance.ensureSemantics(); // ✅ Safe here if (kIsWeb) { final uri = Uri.parse(html.window.location.href); if (uri.path == '/authredirection' &&