diff --git a/.env.development b/.env.development index a8e67cb..8902263 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,3 @@ -API_URL=https://dev.venbait.in/nhance/uat/employeeRest/ -BASE_HREF=/nhance/app/uat/ -ENV=production \ No newline at end of file +API_URL=https://venbait.in/nhance/dev/employeeRest/ +BASE_HREF=/nhance/app/dev/ +ENV=development \ No newline at end of file diff --git a/.env.test b/.env.test index a8e67cb..99da8dc 100644 --- a/.env.test +++ b/.env.test @@ -1,3 +1,3 @@ -API_URL=https://dev.venbait.in/nhance/uat/employeeRest/ -BASE_HREF=/nhance/app/uat/ -ENV=production \ No newline at end of file +API_URL=https://venbait.in/nhance/test/employeeRest/ +BASE_HREF=/nhance/app/test/ +ENV=test \ No newline at end of file diff --git a/.env.uat b/.env.uat new file mode 100644 index 0000000..c44c4c8 --- /dev/null +++ b/.env.uat @@ -0,0 +1,3 @@ +API_URL=https://dev.venbait.in/nhance/uat/employeeRest/ +BASE_HREF=/nhance/app/uat/ +ENV=uat \ No newline at end of file diff --git a/build_web_dev.sh b/build_web_dev.sh index 60b7729..3df3c30 100755 --- a/build_web_dev.sh +++ b/build_web_dev.sh @@ -31,7 +31,7 @@ echo "Loaded BASE_HREF: $BASE_HREF" echo "Loaded API_URL: $API_URL" # Build the web app for development with base href -flutter build web --release --base-href "$BASE_HREF" +flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=development # Check if the build was successful if [ $? -ne 0 ]; then diff --git a/build_web_production.sh b/build_web_production.sh index dd142ef..d30cd90 100755 --- a/build_web_production.sh +++ b/build_web_production.sh @@ -31,12 +31,12 @@ echo "Loaded BASE_HREF: $BASE_HREF" echo "Loaded API_URL: $API_URL" # Build the web app for production with base href -flutter build web --release --base-href "$BASE_HREF" +flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=production # Check if the build was successful if [ $? -ne 0 ]; then - echo "Flutter prod build failed" + echo "Flutter production build failed" exit 1 fi -echo "Flutter prod build succeeded" +echo "Flutter production build succeeded" diff --git a/build_web_test.sh b/build_web_test.sh index 16f4e32..e41b84f 100755 --- a/build_web_test.sh +++ b/build_web_test.sh @@ -31,7 +31,7 @@ echo "Loaded BASE_HREF: $BASE_HREF" echo "Loaded API_URL: $API_URL" # Build the web app for the test environment with base href -flutter build web --release --base-href "$BASE_HREF" +flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=test # Check if the build was successful if [ $? -ne 0 ]; then diff --git a/build_web_uat.sh b/build_web_uat.sh new file mode 100755 index 0000000..04e38fa --- /dev/null +++ b/build_web_uat.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Define the path to the .env.uat file +ENV_FILE_PATH=".env.uat" + +# Check if the .env.uat file exists +if [ ! -f $ENV_FILE_PATH ]; then + echo "$ENV_FILE_PATH does not exist" + exit 1 +fi + +# Copy the .env.uat file to .env +cp $ENV_FILE_PATH .env +echo "Copied $ENV_FILE_PATH to .env" + +# Verify .env file contains correct values +source .env + +if [ -z "$BASE_HREF" ]; then + echo "BASE_HREF value is empty" + exit 1 +fi + +if [ -z "$API_URL" ]; ]; then + echo "API_URL value is empty" + exit 1 +fi + +# Print loaded values for verification +echo "Loaded BASE_HREF: $BASE_HREF" +echo "Loaded API_URL: $API_URL" + +# Build the web app for UAT with base href +flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=uat + +# Check if the build was successful +if [ $? -ne 0 ]; then + echo "Flutter UAT build failed" + exit 1 +fi + +echo "Flutter UAT build succeeded" diff --git a/lib/addons.dart b/lib/addons.dart index 2c861f2..0c14376 100644 --- a/lib/addons.dart +++ b/lib/addons.dart @@ -1326,6 +1326,10 @@ class _addOnsDetailsState extends State { } Future sendAddOnAPI() async { + setState(() { + isLoading = true; + }); + print('sendAddOnAPI'); if (gpaDataIsEmpty != 0) { iAgreeForAddOn.add(int.parse(gpaClintPolicyId)); @@ -1357,14 +1361,25 @@ class _addOnsDetailsState extends State { final response = await apiService.sendAddOnToAPI(apiParams); if (response['status'] == 'success') { + setState(() { + isLoading = false; + isChecked = false; + }); + print('response.statusCode == 200'); ToastHelper.showSuccessToast(context, 'Saved Successfully...'); } else { + setState(() { + isLoading = false; + }); // Handle other status codes ToastHelper.showErrorToast(context, 'failed to save'); print('Request failed with status: ${response['code']}'); } } catch (e) { + setState(() { + isLoading = false; + }); // Handle exceptions print('Exception occurred: $e'); } diff --git a/lib/empReview.dart b/lib/empReview.dart index e1c9b07..888fed3 100644 --- a/lib/empReview.dart +++ b/lib/empReview.dart @@ -626,6 +626,9 @@ class _empReviewDetailsState extends State { } Future sendAddOnAPI() async { + setState(() { + isLoading = false; + }); if (addOnsDependentMappedFamilyFloatersArray != null) { dynamic getDependentTrueObjects = addOnsDependentMappedFamilyFloatersArray .where((element) => element['is_value_exist'] == true) @@ -697,14 +700,24 @@ class _empReviewDetailsState extends State { final response = await apiService.sendAddOnToAPI(apiParams); if (response['status'] == 'success') { + setState(() { + isLoading = false; + isChecked = false; + }); print('response.statusCode == 200'); ToastHelper.showSuccessToast(context, 'Saved Successfully...'); } else { + setState(() { + isLoading = false; + }); // Handle other status codes ToastHelper.showErrorToast(context, 'Failed to Save'); print('Request failed with status: ${response['code']}'); } } catch (e) { + setState(() { + isLoading = false; + }); // Handle exceptions print('Exception occurred: $e'); } diff --git a/lib/hrPolicyDetails.dart b/lib/hrPolicyDetails.dart index a7a521d..40b7fe9 100644 --- a/lib/hrPolicyDetails.dart +++ b/lib/hrPolicyDetails.dart @@ -139,7 +139,7 @@ class _HrPolicyDetailsState extends State Future getEmployeeAndDependence(clintID, getPolicyNo) async { // setState(() { - // _isLoading = true; + isLoading = true; // }); try { final response = await apiService.getEmployeeAndDependenceToApi( @@ -338,8 +338,10 @@ class _HrPolicyDetailsState extends State appBar: CustomAppBar(), body: Stack(children: [ Container( - padding: const EdgeInsets.all(20), + padding: const EdgeInsets.only( + top: 30, bottom: 70, left: 30, right: 30), color: Color(0xFFEFF3F6), + height: MediaQuery.of(context).size.height, child: Card( elevation: 0, color: Colors.white, @@ -714,7 +716,7 @@ class _HrPolicyDetailsState extends State elevation: 0, color: Colors.white, // Set elevation to 0 for no shadow child: PaginatedDataTable( - rowsPerPage: 25, // Adjust rows per page as needed + rowsPerPage: filteredData.length, // Adjust rows per page as needed columns: [ DataColumn(label: Text('Employee ID')), DataColumn(label: Text('Name')), @@ -722,6 +724,11 @@ class _HrPolicyDetailsState extends State DataColumn(label: Text('Date of Birth')), DataColumn(label: Text('Gender')), DataColumn(label: Text('Mobile No')), + DataColumn(label: Text('Date of Joining')), + DataColumn(label: Text('Email')), + DataColumn(label: Text('SI')), + DataColumn(label: Text('Grade')), + DataColumn(label: Text('Basic Pay')), ], source: _DependenceDataSource0(filteredData, context), ), @@ -749,6 +756,7 @@ class _DependenceDataSource0 extends DataTableSource { } // Format date of birth to "July 10, 1996" String dob = row['dob'] != null ? formatDateString(row['dob']) : 'N/A'; + String doj = row['doj'] != null ? formatDateString(row['doj']) : 'N/A'; return DataRow( color: MaterialStateColor.resolveWith( @@ -765,6 +773,11 @@ class _DependenceDataSource0 extends DataTableSource { DataCell(Text(dob, style: textStyle)), DataCell(Text(row['gender'] ?? 'N/A', style: textStyle)), DataCell(Text(row['mobile'] ?? 'N/A', style: textStyle)), + DataCell(Text(doj, style: textStyle)), + DataCell(Text(row['email_corporate'] ?? 'N/A', style: textStyle)), + DataCell(Text(row['basic_cover_si'] ?? 'N/A', style: textStyle)), + DataCell(Text(row['grade'] ?? 'N/A', style: textStyle)), + DataCell(Text(row['basic_pay'] ?? 'N/A', style: textStyle)), ], ); } diff --git a/lib/models/environment.dart b/lib/models/environment.dart index 08badee..e6331b2 100644 --- a/lib/models/environment.dart +++ b/lib/models/environment.dart @@ -1,21 +1,21 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import '../home.dart'; class Environment { static String get fileName { - const bool isProduction = - bool.fromEnvironment('dart.vm.product', defaultValue: false); - const bool isTest = bool.fromEnvironment('ENV', defaultValue: false); - - if (isProduction) { - return '.env.production'; - } else if (isTest) { - return '.env.test'; - } else { - return '.env.development'; + const String env = + String.fromEnvironment('ENV', defaultValue: 'development'); + switch (env) { + case 'test': + return '.env.test'; + case 'uat': + return '.env.uat'; + case 'production': + return '.env.production'; + default: + return '.env.development'; } }