This commit is contained in:
Venba 2024-07-16 17:37:24 +05:30
parent ce018606ea
commit 4565440151
11 changed files with 111 additions and 25 deletions

View File

@ -1,3 +1,3 @@
API_URL=https://dev.venbait.in/nhance/uat/employeeRest/
BASE_HREF=/nhance/app/uat/
ENV=production
API_URL=https://venbait.in/nhance/dev/employeeRest/
BASE_HREF=/nhance/app/dev/
ENV=development

View File

@ -1,3 +1,3 @@
API_URL=https://dev.venbait.in/nhance/uat/employeeRest/
BASE_HREF=/nhance/app/uat/
ENV=production
API_URL=https://venbait.in/nhance/test/employeeRest/
BASE_HREF=/nhance/app/test/
ENV=test

3
.env.uat Normal file
View File

@ -0,0 +1,3 @@
API_URL=https://dev.venbait.in/nhance/uat/employeeRest/
BASE_HREF=/nhance/app/uat/
ENV=uat

View File

@ -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

View File

@ -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"

View File

@ -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

42
build_web_uat.sh Executable file
View File

@ -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"

View File

@ -1326,6 +1326,10 @@ class _addOnsDetailsState extends State<addOnsDetails> {
}
Future<void> sendAddOnAPI() async {
setState(() {
isLoading = true;
});
print('sendAddOnAPI');
if (gpaDataIsEmpty != 0) {
iAgreeForAddOn.add(int.parse(gpaClintPolicyId));
@ -1357,14 +1361,25 @@ class _addOnsDetailsState extends State<addOnsDetails> {
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');
}

View File

@ -626,6 +626,9 @@ class _empReviewDetailsState extends State<empReviewDetails> {
}
Future<void> 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<empReviewDetails> {
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');
}

View File

@ -139,7 +139,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
Future<void> getEmployeeAndDependence(clintID, getPolicyNo) async {
// setState(() {
// _isLoading = true;
isLoading = true;
// });
try {
final response = await apiService.getEmployeeAndDependenceToApi(
@ -338,8 +338,10 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
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<hrPolicyDetails>
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<hrPolicyDetails>
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)),
],
);
}

View File

@ -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';
}
}