login
This commit is contained in:
parent
454c07b04a
commit
8c828b1dac
@ -95,7 +95,7 @@ class _LoginWidgetState extends State<LoginWidget> {
|
|||||||
print("userData12 - $userRole");
|
print("userData12 - $userRole");
|
||||||
}
|
}
|
||||||
|
|
||||||
apiService.getOrganizationData();
|
await apiService.getOrganizationData();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error decoding token: $e');
|
print('Error decoding token: $e');
|
||||||
}
|
}
|
||||||
@ -313,14 +313,6 @@ class _LoginWidgetState extends State<LoginWidget> {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
// image: DecorationImage(
|
|
||||||
// image: AssetImage(
|
|
||||||
// 'assets/images/login/login_travel.png',
|
|
||||||
// ),
|
|
||||||
// // fit: BoxFit.fill
|
|
||||||
// fit: BoxFit.contain
|
|
||||||
// // fit: BoxFit.cover, // or BoxFit.contain, BoxFit.fill, etc.
|
|
||||||
// ),
|
|
||||||
color: Color(0xFFE6F0FA),
|
color: Color(0xFFE6F0FA),
|
||||||
// color: Color(0xFFF0F7FF),
|
// color: Color(0xFFF0F7FF),
|
||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
@ -401,18 +393,12 @@ class _LoginWidgetState extends State<LoginWidget> {
|
|||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
// width: width,
|
// width: width,
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
// mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
// children: [
|
||||||
Image.asset(
|
//
|
||||||
'assets/images/login/logoNew.jpg',
|
// ],
|
||||||
width: 180, // Optional: control size
|
// ),
|
||||||
height: 70,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -428,6 +414,12 @@ class _LoginWidgetState extends State<LoginWidget> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/login/logoNew.jpg',
|
||||||
|
width: 180, // Optional: control size
|
||||||
|
height: 70,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
Text(
|
Text(
|
||||||
"Sign In",
|
"Sign In",
|
||||||
|
|||||||
@ -334,8 +334,8 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
|||||||
await updateOrgDataWithNewValues(orgList);
|
await updateOrgDataWithNewValues(orgList);
|
||||||
print("📨 Response Organizt Update:");
|
print("📨 Response Organizt Update:");
|
||||||
// return orgList;
|
// return orgList;
|
||||||
|
context.go('/OrganizationSettings');
|
||||||
context.go('/listPlan');
|
// context.go('/listPlan');
|
||||||
} else {
|
} else {
|
||||||
print("❌ Submission failed. Status: ${response.statusCode}");
|
print("❌ Submission failed. Status: ${response.statusCode}");
|
||||||
print("📨 Body: ${response.body}");
|
print("📨 Body: ${response.body}");
|
||||||
@ -353,6 +353,16 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
|||||||
if (orgDataString != null) {
|
if (orgDataString != null) {
|
||||||
try {
|
try {
|
||||||
orgData = jsonDecode(orgDataString);
|
orgData = jsonDecode(orgDataString);
|
||||||
|
|
||||||
|
layoutColor =
|
||||||
|
orgData['layout_color'] != null
|
||||||
|
? Color(
|
||||||
|
int.parse(
|
||||||
|
orgData['layout_color'].toString().replaceFirst('0x', ''),
|
||||||
|
radix: 16,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Colors.white;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('❌ Failed to decode org_data: $e');
|
print('❌ Failed to decode org_data: $e');
|
||||||
}
|
}
|
||||||
@ -363,6 +373,8 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
|||||||
|
|
||||||
// Save back
|
// Save back
|
||||||
await prefs.setString('org_data', jsonEncode(orgData));
|
await prefs.setString('org_data', jsonEncode(orgData));
|
||||||
|
await prefs.setString('layout_color', orgData['layout_color']);
|
||||||
|
|
||||||
print("✅ Updated org_data saved.");
|
print("✅ Updated org_data saved.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,6 +483,18 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildOrgLayout(bool isDesktop) {
|
Widget buildOrgLayout(bool isDesktop) {
|
||||||
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
|
final screenHeight = MediaQuery.of(context).size.height;
|
||||||
|
|
||||||
|
final double responsiveLogoWidth =
|
||||||
|
screenWidth * 0.15; // 15% of screen width
|
||||||
|
final double responsiveLogoHeight =
|
||||||
|
screenHeight * 0.07; // 7% of screen height
|
||||||
|
|
||||||
|
final double largeResponsiveLogoWidth =
|
||||||
|
screenWidth * 0.6; // 60% of screen width
|
||||||
|
final double largeResponsiveLogoHeight = screenHeight * 0.15;
|
||||||
|
|
||||||
Future<void> _pickImage() async {
|
Future<void> _pickImage() async {
|
||||||
final picker = ImagePicker();
|
final picker = ImagePicker();
|
||||||
final XFile? pickedFile = await picker.pickImage(
|
final XFile? pickedFile = await picker.pickImage(
|
||||||
@ -500,6 +524,7 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
|||||||
isDesktop
|
isDesktop
|
||||||
? MediaQuery.of(context).size.height * 0.98
|
? MediaQuery.of(context).size.height * 0.98
|
||||||
: MediaQuery.of(context).size.height,
|
: MediaQuery.of(context).size.height,
|
||||||
|
|
||||||
// decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
// border: isDesktop
|
// border: isDesktop
|
||||||
// ? Border.all(
|
// ? Border.all(
|
||||||
@ -594,23 +619,29 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: _pickImage,
|
onTap: _pickImage,
|
||||||
|
|
||||||
child:
|
child:
|
||||||
_imageBytes != null
|
_imageBytes != null
|
||||||
? ClipOval(
|
? ClipOval(
|
||||||
child: Image.memory(
|
child: Image.memory(
|
||||||
_imageBytes!,
|
_imageBytes!,
|
||||||
width: 50,
|
// width: 50,
|
||||||
height: 50,
|
// height: 50,
|
||||||
fit: BoxFit.cover,
|
width:
|
||||||
|
responsiveLogoWidth, // Use responsive width
|
||||||
|
height: responsiveLogoHeight,
|
||||||
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: selectedOrg?['logo'] != null
|
: selectedOrg?['logo'] != null
|
||||||
? ClipRect(
|
? ClipRect(
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
selectedOrg!['logo'],
|
selectedOrg!['logo'],
|
||||||
width: 250, // increased
|
width:
|
||||||
height: 75, // increased
|
responsiveLogoWidth, // Use responsive width
|
||||||
|
height: responsiveLogoHeight,
|
||||||
|
// width: 250,
|
||||||
|
// height: 55,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
errorBuilder: (
|
errorBuilder: (
|
||||||
context,
|
context,
|
||||||
|
|||||||
@ -57,35 +57,38 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
|
|||||||
children: [
|
children: [
|
||||||
// Layout Color Picker
|
// Layout Color Picker
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => _showColorPickerDialog(
|
onTap:
|
||||||
title: "Choose Layout Color",
|
() => _showColorPickerDialog(
|
||||||
colors: layoutThemeColors,
|
title: "Choose Layout Color",
|
||||||
onColorSelected: (color) {
|
colors: layoutThemeColors,
|
||||||
setState(() {
|
onColorSelected: (color) {
|
||||||
selectedLayoutColor = color;
|
setState(() {
|
||||||
});
|
selectedLayoutColor = color;
|
||||||
widget.onLayoutColorSelected(color);
|
});
|
||||||
},
|
widget.onLayoutColorSelected(color);
|
||||||
),
|
},
|
||||||
|
),
|
||||||
child: _buildColorBox(
|
child: _buildColorBox(
|
||||||
selectedLayoutColor ?? Colors.grey.shade300, Icons.palette),
|
selectedLayoutColor ?? Colors.grey.shade300,
|
||||||
),
|
Icons.palette,
|
||||||
SizedBox(width: 15),
|
|
||||||
// Body Color Picker
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () => _showColorPickerDialog(
|
|
||||||
title: "Choose Body Color",
|
|
||||||
colors: bodyThemeColors,
|
|
||||||
onColorSelected: (color) {
|
|
||||||
setState(() {
|
|
||||||
selectedBodyColor = color; // low opacity
|
|
||||||
});
|
|
||||||
widget.onBodyColorSelected(selectedBodyColor!);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
child: _buildColorBox(
|
|
||||||
selectedBodyColor ?? Colors.grey.shade300, Icons.opacity),
|
|
||||||
),
|
),
|
||||||
|
// SizedBox(width: 15),
|
||||||
|
// // Body Color Picker
|
||||||
|
// GestureDetector(
|
||||||
|
// onTap: () => _showColorPickerDialog(
|
||||||
|
// title: "Choose Body Color",
|
||||||
|
// colors: bodyThemeColors,
|
||||||
|
// onColorSelected: (color) {
|
||||||
|
// setState(() {
|
||||||
|
// selectedBodyColor = color; // low opacity
|
||||||
|
// });
|
||||||
|
// widget.onBodyColorSelected(selectedBodyColor!);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// child: _buildColorBox(
|
||||||
|
// selectedBodyColor ?? Colors.grey.shade300, Icons.opacity),
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -110,30 +113,32 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
|
|||||||
}) {
|
}) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder:
|
||||||
title: Text(title),
|
(context) => AlertDialog(
|
||||||
content: Wrap(
|
title: Text(title),
|
||||||
spacing: 10,
|
content: Wrap(
|
||||||
runSpacing: 10,
|
spacing: 10,
|
||||||
children: colors.map((color) {
|
runSpacing: 10,
|
||||||
return GestureDetector(
|
children:
|
||||||
onTap: () {
|
colors.map((color) {
|
||||||
onColorSelected(color);
|
return GestureDetector(
|
||||||
Navigator.of(context).pop();
|
onTap: () {
|
||||||
},
|
onColorSelected(color);
|
||||||
child: Container(
|
Navigator.of(context).pop();
|
||||||
width: 30,
|
},
|
||||||
height: 30,
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
width: 30,
|
||||||
color: color,
|
height: 30,
|
||||||
shape: BoxShape.circle,
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: Colors.black26),
|
color: color,
|
||||||
),
|
shape: BoxShape.circle,
|
||||||
),
|
border: Border.all(color: Colors.black26),
|
||||||
);
|
),
|
||||||
}).toList(),
|
),
|
||||||
),
|
);
|
||||||
),
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
//api url
|
//api url
|
||||||
// const String apiUrl = 'http://apitest.tripapprovaltool.com';
|
const String apiUrl = 'http://apitest.tripapprovaltool.com';
|
||||||
const String apiUrl = 'https://uat.tripapprovaltool.com';
|
// const String apiUrl = 'https://uat.tripapprovaltool.com';
|
||||||
|
|||||||
@ -55,6 +55,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
initializeData();
|
initializeData();
|
||||||
getOrganizationData();
|
getOrganizationData();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (userData?["role"] == "Org Admin" ||
|
if (userData?["role"] == "Org Admin" ||
|
||||||
userData?["role"] == "Travel Admin") {
|
userData?["role"] == "Travel Admin") {
|
||||||
selectedTab = TabSelection.dashboard;
|
selectedTab = TabSelection.dashboard;
|
||||||
@ -147,7 +148,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
layoutColor =
|
layoutColor =
|
||||||
selectedOrg?['layout_color'] != null
|
selectedOrg?['layout_color'] != null
|
||||||
? Color(int.parse(selectedOrg!['layout_color']))
|
? Color(int.parse(selectedOrg!['layout_color']))
|
||||||
: Colors.white;
|
: Colors.black;
|
||||||
|
|
||||||
bodyColor =
|
bodyColor =
|
||||||
selectedOrg?['color'] != null
|
selectedOrg?['color'] != null
|
||||||
@ -309,7 +310,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
child:
|
child:
|
||||||
selectedOrg?['logo'] != null
|
selectedOrg?['logo'] != null
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
height: 60,
|
height: 50,
|
||||||
child: ClipRect(
|
child: ClipRect(
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
selectedOrg!['logo'],
|
selectedOrg!['logo'],
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:google_fonts/google_fonts.dart';
|
|||||||
import 'package:responsive_builder/responsive_builder.dart';
|
import 'package:responsive_builder/responsive_builder.dart';
|
||||||
|
|
||||||
import '../services/apiService.dart';
|
import '../services/apiService.dart';
|
||||||
|
import '../utils/auth_utils.dart';
|
||||||
import 'custom_appBar.dart';
|
import 'custom_appBar.dart';
|
||||||
import 'custom_drawer.dart';
|
import 'custom_drawer.dart';
|
||||||
|
|
||||||
@ -17,6 +18,29 @@ class OrganizationSetting extends StatefulWidget {
|
|||||||
|
|
||||||
class OrganizationSettingState extends State<OrganizationSetting> {
|
class OrganizationSettingState extends State<OrganizationSetting> {
|
||||||
final ApiService apiService = ApiService();
|
final ApiService apiService = ApiService();
|
||||||
|
Color? layoutColor;
|
||||||
|
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
loadInitialData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadInitialData() async {
|
||||||
|
String? layoutString = await getLayoutColor();
|
||||||
|
// String? bodyStringColor = await getBodyColor();
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
layoutColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(layoutString))
|
||||||
|
: Colors.redAccent;
|
||||||
|
|
||||||
|
// bodyColor =
|
||||||
|
// bodyStringColor != null
|
||||||
|
// ? Color(int.parse(bodyStringColor))
|
||||||
|
// : Colors.white;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -270,7 +294,8 @@ class OrganizationSettingState extends State<OrganizationSetting> {
|
|||||||
Icon(
|
Icon(
|
||||||
item['icon'],
|
item['icon'],
|
||||||
size: 40,
|
size: 40,
|
||||||
color: Color(0xFF114D8B),
|
color: layoutColor,
|
||||||
|
// color: Color(0xFF114D8B),
|
||||||
),
|
),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user