.env changes
This commit is contained in:
parent
78537e78e0
commit
48e338be0a
@ -1,4 +0,0 @@
|
||||
API_URL=https://venbait.in/enrollment/employeeRest/
|
||||
API_URL_POST=https://venbait.in/nhance/dev/employeeRest/
|
||||
BASE_HREF=/nhance/hr/dev/
|
||||
ENV=development
|
||||
@ -1,4 +0,0 @@
|
||||
API_URL=https://app.nhanceindia.in/enrolment/employeeRest/
|
||||
API_URL_POST=https://app.nhanceindia.in/zenith/employeeRest/
|
||||
BASE_HREF=/hr/
|
||||
ENV=production
|
||||
@ -1,4 +0,0 @@
|
||||
API_URL=https://app.nhanceindia.in/enrolment/employeeRest/
|
||||
API_URL_POST=https://app.nhanceindia.in/zenith/employeeRest/
|
||||
BASE_HREF=/hr/
|
||||
ENV=production
|
||||
4
.env.uat
4
.env.uat
@ -1,4 +0,0 @@
|
||||
API_URL=https://app.nhanceindia.in/enrolment/employeeRest/
|
||||
API_URL_POST=https://app.nhanceindia.in/zenith/employeeRest/
|
||||
BASE_HREF=/hr/
|
||||
ENV=production
|
||||
@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the path to the .env.development file
|
||||
ENV_FILE_PATH=".env.development"
|
||||
|
||||
# Check if the .env.development file exists
|
||||
if [ ! -f $ENV_FILE_PATH ]; then
|
||||
echo "$ENV_FILE_PATH does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the .env.development 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 development with base href
|
||||
flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=development
|
||||
|
||||
# Check if the build was successful
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Flutter dev build failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Flutter dev build succeeded"
|
||||
@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the path to the .env.production file
|
||||
ENV_FILE_PATH=".env.production"
|
||||
|
||||
# Check if the .env.production file exists
|
||||
if [ ! -f $ENV_FILE_PATH ]; then
|
||||
echo "$ENV_FILE_PATH does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the .env.production 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 production with 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 production build failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Flutter production build succeeded"
|
||||
@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the path to the .env.test file
|
||||
ENV_FILE_PATH=".env.test"
|
||||
|
||||
# Check if the .env.test file exists
|
||||
if [ ! -f $ENV_FILE_PATH ]; then
|
||||
echo "$ENV_FILE_PATH does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the .env.test 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 the test environment with base href
|
||||
flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=test
|
||||
|
||||
# Check if the build was successful
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Flutter test build failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Flutter test build succeeded"
|
||||
@ -1,42 +0,0 @@
|
||||
#!/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"
|
||||
@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@ -12,7 +12,6 @@ import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
|
||||
import '../../models/environment.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
import 'customAppBar/customAppBar.dart';
|
||||
|
||||
47
lib/config/environment.dart
Normal file
47
lib/config/environment.dart
Normal file
@ -0,0 +1,47 @@
|
||||
// lib/environment.dart
|
||||
enum Flavor { dev, uat, prod, prod1}
|
||||
|
||||
class Environment {
|
||||
static Flavor flavor = Flavor.dev; // overwritten by each main_*.dart
|
||||
|
||||
static bool get isProd => flavor == Flavor.prod || flavor == Flavor.prod1;
|
||||
|
||||
static String get apiUrl {
|
||||
switch (flavor) {
|
||||
case Flavor.dev:
|
||||
return "https://venbait.in/enrollment/employeeRest/";
|
||||
case Flavor.uat:
|
||||
return "https://appstage.nhanceindia.in/apex/employeeRest/";
|
||||
case Flavor.prod:
|
||||
return "https://app.nhanceindia.in/enrolment/employeeRest/";
|
||||
case Flavor.prod1:
|
||||
return "https://app.nhanceindia.in/enrolment/employeeRest/";
|
||||
}
|
||||
}
|
||||
|
||||
static String get apiUrlPost {
|
||||
switch (flavor) {
|
||||
case Flavor.dev:
|
||||
return "https://venbait.in/nhance/dev/employeeRest/";
|
||||
case Flavor.uat:
|
||||
return "https://appstage.nhanceindia.in/nexus/employeeRest/";
|
||||
case Flavor.prod:
|
||||
return "https://app.nhanceindia.in/zenith/employeeRest/";
|
||||
case Flavor.prod1:
|
||||
return "https://app.nhanceindia.in/zenith/employeeRest/";
|
||||
}
|
||||
}
|
||||
|
||||
static String get baseHref {
|
||||
switch (flavor) {
|
||||
case Flavor.dev:
|
||||
return "/nhance/hr/dev/";
|
||||
case Flavor.uat:
|
||||
return "/";
|
||||
case Flavor.prod:
|
||||
return "/hr/";
|
||||
case Flavor.prod1:
|
||||
return "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
9
lib/config/main_dev.dart
Normal file
9
lib/config/main_dev.dart
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
import '../main.dart';
|
||||
import 'environment.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
Environment.flavor = Flavor.dev;
|
||||
await startApp();
|
||||
}
|
||||
|
||||
10
lib/config/main_prod.dart
Normal file
10
lib/config/main_prod.dart
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
import '../main.dart';
|
||||
import 'environment.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
Environment.flavor = Flavor.prod;
|
||||
await startApp();
|
||||
}
|
||||
|
||||
10
lib/config/main_prod1.dart
Normal file
10
lib/config/main_prod1.dart
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
import '../main.dart';
|
||||
import 'environment.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
Environment.flavor = Flavor.prod1;
|
||||
await startApp();
|
||||
}
|
||||
|
||||
10
lib/config/main_uat.dart
Normal file
10
lib/config/main_uat.dart
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
import '../main.dart';
|
||||
import 'environment.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
Environment.flavor = Flavor.uat;
|
||||
await startApp();
|
||||
}
|
||||
|
||||
@ -157,6 +157,58 @@ class ToastHelper {
|
||||
// _showToast(context, message, Colors.red);
|
||||
}
|
||||
|
||||
static void showErrorToast2(BuildContext context, String message,String decmessage) {
|
||||
toastification.show(
|
||||
context: context,
|
||||
type: ToastificationType.error,
|
||||
style: ToastificationStyle.flatColored,
|
||||
autoCloseDuration: const Duration(seconds: 2),
|
||||
title: Text(message),
|
||||
// you can also use RichText widget for title and description parameters
|
||||
description: RichText(
|
||||
text: TextSpan(text: decmessage)),
|
||||
alignment: Alignment.topRight,
|
||||
direction: TextDirection.ltr,
|
||||
animationDuration: const Duration(milliseconds: 100),
|
||||
animationBuilder: (context, animation, alignment, child) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.error),
|
||||
primaryColor: Colors.redAccent,
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.black,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x07000000),
|
||||
blurRadius: 16,
|
||||
offset: Offset(0, 16),
|
||||
spreadRadius: 0,
|
||||
)
|
||||
],
|
||||
showProgressBar: true,
|
||||
closeButtonShowType: CloseButtonShowType.onHover,
|
||||
closeOnClick: false,
|
||||
pauseOnHover: true,
|
||||
dragToClose: true,
|
||||
applyBlurEffect: true,
|
||||
callbacks: ToastificationCallbacks(
|
||||
onTap: (toastItem) => print('Toast ${toastItem.id} tapped'),
|
||||
onCloseButtonTap: (toastItem) =>
|
||||
print('Toast ${toastItem.id} close button tapped'),
|
||||
onAutoCompleteCompleted: (toastItem) =>
|
||||
print('Toast ${toastItem.id} auto complete completed'),
|
||||
onDismissed: (toastItem) => print('Toast ${toastItem.id} dismissed'),
|
||||
),
|
||||
);
|
||||
// _showToast(context, message, Colors.red);
|
||||
}
|
||||
|
||||
static void showInfoToast(BuildContext context, String message) {
|
||||
toastification.show(
|
||||
context: context,
|
||||
|
||||
@ -15,10 +15,10 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
|
||||
import '../customAppBar/toastHelper.dart';
|
||||
import '../models/environment.dart';
|
||||
import '../models/platform_helper_mobile.dart'
|
||||
if (dart.library.html) '../models/platform_helper_other.dart';
|
||||
import 'branch/branch_selection_page.dart';
|
||||
import 'config/environment.dart';
|
||||
|
||||
// import 'dart:html' as html;
|
||||
|
||||
@ -106,6 +106,7 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
||||
Uri.parse(Environment.apiUrl + 'getVerifiedHrData'),
|
||||
body: json.encode(payload),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
HttpHeaders.contentTypeHeader: 'application/json',
|
||||
},
|
||||
);
|
||||
@ -263,7 +264,7 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
||||
final _postToken = prefs.getString('_postToken');
|
||||
|
||||
if (_postToken != null && _postToken.isNotEmpty) {
|
||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||
ToastHelper.showSuccessToast(context, 'Successfully Logged In');
|
||||
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
||||
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||
// } else {
|
||||
@ -304,7 +305,7 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
||||
final enrollToken = prefs.getString('enrollToken');
|
||||
|
||||
if (enrollToken != null && enrollToken.isNotEmpty) {
|
||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||
ToastHelper.showSuccessToast(context, 'Successfully Logged In');
|
||||
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
||||
// Navigator.pushReplacementNamed(context, 'home');
|
||||
// } else {
|
||||
@ -337,6 +338,7 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
||||
Uri.parse(apiEndpoint),
|
||||
body: json.encode(payload),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
HttpHeaders.contentTypeHeader: 'application/json',
|
||||
},
|
||||
);
|
||||
@ -369,6 +371,7 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization':
|
||||
'Bearer $token', // Add token to the Authorization header
|
||||
},
|
||||
|
||||
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:nhancepolicy/customAppBar/customAppBar.dart';
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@ -18,6 +17,7 @@ import 'dart:async';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'config/environment.dart';
|
||||
import 'customAppBar/customFooter.dart';
|
||||
|
||||
class empDetails extends StatefulWidget {
|
||||
@ -161,6 +161,7 @@ class _empDetailsState extends State<empDetails> {
|
||||
'employee_id': empID
|
||||
}),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
HttpHeaders.contentTypeHeader: 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@ -9,7 +9,6 @@ import 'dart:async';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/hrPolicyDetails.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
@ -22,6 +21,7 @@ import 'package:csv/csv.dart';
|
||||
import 'package:spreadsheet_decoder/spreadsheet_decoder.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'config/environment.dart';
|
||||
import 'customAppBar/customFooter.dart';
|
||||
|
||||
class excelVerify extends StatefulWidget {
|
||||
@ -448,6 +448,7 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
print('else');
|
||||
// Attach the file to the request
|
||||
// Set authorization token in headers
|
||||
request.headers['APP-SIGNATURE'] = 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y';
|
||||
request.headers['Authorization'] = 'Bearer $_token';
|
||||
// request.files.add(http.MultipartFile.fromBytes('file', fileBytes,
|
||||
// filename: fileName));
|
||||
@ -499,7 +500,8 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
ToastHelper.showErrorToast(context, data['message']);
|
||||
ToastHelper.showErrorToast2(context,"",data['message']);
|
||||
// ToastHelper.showErrorToast(context, data['message']);
|
||||
print('Table');
|
||||
|
||||
setState(() {
|
||||
|
||||
@ -4,7 +4,6 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:nhancepolicy/customAppBar/customAppBar.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
@ -13,6 +12,8 @@ import 'package:jwt_decode/jwt_decode.dart';
|
||||
// import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
|
||||
import 'config/environment.dart';
|
||||
|
||||
// void main() {
|
||||
// runApp(MaterialApp(
|
||||
// home: MyApp(),
|
||||
@ -135,6 +136,7 @@ class _MyAppState extends State<MyApp> {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization':
|
||||
'Bearer $_token', // Add token to the Authorization header
|
||||
},
|
||||
@ -211,6 +213,7 @@ class _MyAppState extends State<MyApp> {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization':
|
||||
'Bearer $_token', // Add token to the Authorization header
|
||||
},
|
||||
@ -474,6 +477,7 @@ class _MyAppState extends State<MyApp> {
|
||||
url,
|
||||
body: jsonEncode(requestBody),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Content-Type': 'application/json',
|
||||
// Add authorization header if needed
|
||||
'Authorization': 'Bearer $_token',
|
||||
@ -504,6 +508,7 @@ class _MyAppState extends State<MyApp> {
|
||||
final response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization':
|
||||
'Bearer $_token', // Add token to the Authorization header
|
||||
},
|
||||
@ -555,6 +560,7 @@ class _MyAppState extends State<MyApp> {
|
||||
final response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization':
|
||||
'Bearer $_token', // Add token to the Authorization header // Add your authorization token here
|
||||
@ -627,6 +633,7 @@ class _MyAppState extends State<MyApp> {
|
||||
url,
|
||||
body: jsonEncode(updatedNewData),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization':
|
||||
'Bearer $_token', // Add token to the Authorization header
|
||||
@ -686,6 +693,7 @@ class _MyAppState extends State<MyApp> {
|
||||
url,
|
||||
body: jsonEncode(jsonData),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization':
|
||||
'Bearer $_token', // Add token to the Authorization header
|
||||
@ -768,6 +776,7 @@ class _MyAppState extends State<MyApp> {
|
||||
url,
|
||||
body: jsonEncode(jsonData),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization':
|
||||
'Bearer $_token', // Add token to the Authorization header
|
||||
|
||||
@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:nhancepolicy/service/hrDashboardTabs/activePolicies.dart';
|
||||
@ -15,6 +14,7 @@ import 'package:nhancepolicy/service/hrDashboardTabs/preEnrollment.dart';
|
||||
import 'package:nhancepolicy/service/token_storage_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'config/environment.dart';
|
||||
import 'customAppBar/customAppBar.dart';
|
||||
import 'customAppBar/customFooter.dart';
|
||||
import 'customAppBar/toastHelper.dart';
|
||||
@ -370,6 +370,7 @@ class _hrDashboardState extends State<hrDashboard>
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization':
|
||||
'Bearer $token', // Add token to the Authorization header
|
||||
},
|
||||
@ -461,6 +462,7 @@ class _hrDashboardState extends State<hrDashboard>
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization': 'Bearer $_token',
|
||||
},
|
||||
);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nhancepolicy/customAppBar/customAppBar.dart';
|
||||
import 'package:nhancepolicy/excel_verification.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'dart:convert';
|
||||
@ -18,6 +17,8 @@ import 'package:excel/excel.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import 'config/environment.dart';
|
||||
|
||||
class MyHrHome extends StatefulWidget {
|
||||
const MyHrHome({Key? key}) : super(key: key);
|
||||
|
||||
@ -94,6 +95,7 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization': 'Bearer $_token',
|
||||
},
|
||||
);
|
||||
@ -171,6 +173,7 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization': 'Bearer $_token',
|
||||
},
|
||||
);
|
||||
@ -214,6 +217,7 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization': 'Bearer $_token',
|
||||
},
|
||||
);
|
||||
@ -255,6 +259,7 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization': 'Bearer $_token',
|
||||
},
|
||||
);
|
||||
@ -298,6 +303,7 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
url,
|
||||
headers: {
|
||||
'Authorization': 'Bearer $_token',
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
@ -437,6 +443,7 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization': 'Bearer $_token',
|
||||
},
|
||||
);
|
||||
|
||||
@ -6,7 +6,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/hrVerify.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
@ -14,6 +13,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:flutter_animated_button/flutter_animated_button.dart';
|
||||
|
||||
import 'config/environment.dart';
|
||||
import 'email_verify.dart';
|
||||
|
||||
class MyHrLogin extends StatefulWidget {
|
||||
@ -105,6 +105,7 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
Uri.parse(apiEndpoint),
|
||||
body: json.encode(payload),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
HttpHeaders.contentTypeHeader: 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:nhancepolicy/customAppBar/customAppBar.dart';
|
||||
import 'package:nhancepolicy/excel_verification.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/postFileUpload.dart';
|
||||
import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:nhancepolicy/service/hrDashboardTabs/claims.dart';
|
||||
|
||||
@ -8,7 +8,6 @@ import 'package:nhancepolicy/empDetails.dart';
|
||||
import 'package:nhancepolicy/excel_verification.dart';
|
||||
import 'package:nhancepolicy/hrHome.dart';
|
||||
import 'package:nhancepolicy/hrVerify.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/phone.dart';
|
||||
import 'package:nhancepolicy/postFileUpload.dart';
|
||||
import 'package:nhancepolicy/service/token_storage_service.dart';
|
||||
@ -22,9 +21,10 @@ import 'package:nhancepolicy/oldPolicy.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
|
||||
import 'cdTransactionDetails.dart';
|
||||
import 'config/environment.dart';
|
||||
import 'email_verify.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
Future<void> startApp() async {
|
||||
// html.window.onBeforeUnload.listen((event) {
|
||||
// print('Local Storage cleared by window');
|
||||
// html.window.localStorage.clear();
|
||||
@ -52,7 +52,7 @@ Future<void> main() async {
|
||||
appId: '1:1084115316849:web:ce28f12a426f285d6c6bd0',
|
||||
messagingSenderId: '1084115316849',
|
||||
projectId: 'nhance-ee8d1'));
|
||||
await dotenv.load(fileName: Environment.fileName);
|
||||
// await dotenv.load(fileName: Environment.fileName);
|
||||
|
||||
runApp(MaterialApp(
|
||||
initialRoute: 'hrLogin',
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
import '../home.dart';
|
||||
|
||||
class Environment {
|
||||
static String get fileName {
|
||||
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';
|
||||
}
|
||||
}
|
||||
|
||||
static String get apiUrl {
|
||||
return dotenv.env['API_URL'] ?? 'API_URL not found!';
|
||||
}
|
||||
|
||||
static String get apiUrlPost {
|
||||
return dotenv.env['API_URL_POST'] ?? 'API_URL not found!';
|
||||
}
|
||||
|
||||
static String get baseHref {
|
||||
return dotenv.env['BASE_HREF'] ?? 'BASE_HREF not found!';
|
||||
}
|
||||
|
||||
static String get env {
|
||||
return dotenv.env['ENV'] ?? 'ENV not found!';
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
await dotenv.load(fileName: Environment.fileName);
|
||||
runApp(MyApp());
|
||||
}
|
||||
@ -5,10 +5,10 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'config/environment.dart';
|
||||
import 'customAppBar/customAppBar.dart';
|
||||
import 'customAppBar/toastHelper.dart';
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
@ -13,6 +12,8 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:flutter_animated_button/flutter_animated_button.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import 'config/environment.dart';
|
||||
|
||||
class MyPhone extends StatefulWidget {
|
||||
const MyPhone({Key? key});
|
||||
|
||||
@ -61,6 +62,7 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
Uri.parse(Environment.apiUrl + 'verifyEmployeeNumber'),
|
||||
body: json.encode({'mobile_number': enteredMobileNumber}),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
HttpHeaders.contentTypeHeader: 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
@ -9,7 +9,6 @@ import 'dart:async';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/hrPolicyDetails.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
@ -21,6 +20,7 @@ import 'package:csv/csv.dart';
|
||||
import 'package:spreadsheet_decoder/spreadsheet_decoder.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'config/environment.dart';
|
||||
import 'customAppBar/customFooter.dart';
|
||||
|
||||
class postFileUpload extends StatefulWidget {
|
||||
@ -244,6 +244,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
final response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization': 'Bearer $token',
|
||||
'Content-Type': 'application/json',
|
||||
// 'app-signature': 'ts-traveltool-2025-signature-123456',
|
||||
@ -389,6 +390,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
print('else');
|
||||
// Attach the file to the request
|
||||
// Set authorization token in headers
|
||||
request.headers['APP-SIGNATURE'] = 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y';
|
||||
request.headers['Authorization'] = 'Bearer $_token';
|
||||
// request.files.add(http.MultipartFile.fromBytes('file', fileBytes,
|
||||
// filename: fileName));
|
||||
|
||||
@ -3,8 +3,8 @@ import 'package:http/http.dart' as http;
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import '../config/environment.dart';
|
||||
import '../customAppBar/toastHelper.dart';
|
||||
import '../models/environment.dart';
|
||||
|
||||
class ApiService {
|
||||
final BuildContext context;
|
||||
@ -595,6 +595,7 @@ class ApiService {
|
||||
final url = Uri.parse('${Environment.apiUrlPost}claimsSearch');
|
||||
|
||||
final headers = {
|
||||
'APP-SIGNATURE' :'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization': 'Bearer $token',
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
@ -779,19 +780,21 @@ class ApiService {
|
||||
|
||||
Future<Map<String, dynamic>> _makePostRequestWithoutFormData(
|
||||
Uri url, String body, Map<String, String> headers) async {
|
||||
|
||||
headers['APP-SIGNATURE'] = 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y';
|
||||
final response = await http.post(url, headers: headers, body: body);
|
||||
return _handleResponse(response);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> _makeGetRequest(
|
||||
Uri url, Map<String, String> headers) async {
|
||||
headers['APP-SIGNATURE'] = 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y';
|
||||
final response = await http.get(url, headers: headers);
|
||||
return _handleResponse(response);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> _makePostRequest(
|
||||
Uri url, String body, Map<String, String> headers) async {
|
||||
headers['APP-SIGNATURE'] = 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y';
|
||||
final response = await http.post(url, headers: headers, body: body);
|
||||
return _handleResponse(response);
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
|
||||
import '../../cdTransactionDetails.dart';
|
||||
import '../../models/environment.dart';
|
||||
import '../api_service.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@ import 'package:collection/collection.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
|
||||
import '../../claimshistory.dart';
|
||||
import '../../models/environment.dart';
|
||||
import '../api_service.dart';
|
||||
|
||||
class ClaimsPolicies extends StatefulWidget {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import 'dart:async';
|
||||
import 'package:flutter/gestures.dart';
|
||||
@ -13,6 +12,8 @@ import 'package:nhancepolicy/responsive.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
|
||||
import 'config/environment.dart';
|
||||
|
||||
class MyVerify extends StatefulWidget {
|
||||
final String verificationId;
|
||||
final String mobileNumber;
|
||||
@ -111,6 +112,7 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
Uri.parse(Environment.apiUrl + 'verifyEmployeeNumber'),
|
||||
body: json.encode({'mobile_number': mobileNumber}),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
HttpHeaders.contentTypeHeader: 'application/json',
|
||||
},
|
||||
);
|
||||
@ -142,6 +144,7 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
'otp_verification': otpVerifyStatus
|
||||
}),
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
HttpHeaders.contentTypeHeader: 'application/json',
|
||||
},
|
||||
);
|
||||
@ -257,6 +260,7 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'APP-SIGNATURE': 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||
'Authorization':
|
||||
'Bearer $_token', // Add token to the Authorization header
|
||||
},
|
||||
|
||||
@ -90,11 +90,6 @@ flutter:
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
assets:
|
||||
- assets/
|
||||
- .env
|
||||
- .env.development
|
||||
- .env.production
|
||||
- .env.uat
|
||||
- .env.test
|
||||
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
@ -18,18 +18,18 @@
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
<meta name="description" content="A new Flutter project.">
|
||||
<meta name="description" content="Nhance HR">
|
||||
|
||||
<!-- iOS meta tags & icons -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="nhancepolicy">
|
||||
<meta name="apple-mobile-web-app-title" content="nhance_hr">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
|
||||
<title>nhancepolicy</title>
|
||||
<title>Nhance HR</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
<style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user