travel_agent_remarks_access

This commit is contained in:
venbaittech 2025-10-29 12:34:19 +05:30
parent 816d8b1bf1
commit 08ac38a64b
3 changed files with 87 additions and 57 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -578,6 +578,15 @@ class TemplateForexState extends State<TemplateForex> {
if (pickedFile != null && kIsWeb) {
try {
final allowedExtensions = ['jpg', 'jpeg', 'png'];
final fileExtension = pickedFile.name.split('.').last.toLowerCase();
if (!allowedExtensions.contains(fileExtension)) {
print('❌ Invalid file type. Please select a JPG or PNG image.');
return;
}
final bytes = await pickedFile.readAsBytes();
print('✅ Image loaded, size: ${bytes.length} bytes');
setState(() {
@ -796,7 +805,7 @@ class TemplateForexState extends State<TemplateForex> {
// color: Color(0xFF575A74),
// ),
// ),
const SizedBox(height: 10),
// const SizedBox(height: 10),
Container(
color: Color(0xFFFFFEF0),
width: isDesktop ? MediaQuery.of(context).size.width * 0.8 : null,
@ -950,54 +959,74 @@ class TemplateForexState extends State<TemplateForex> {
),
),
),
SizedBox(height: 4),
SizedBox(height: 2),
Container(
child: Row(
// mainAxisAlignment: MainAxisAlignment.end,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Upload Signature",
style: GoogleFonts.poppins(fontSize: 11.5),
),
SizedBox(width: 5),
GestureDetector(
onTap: _pickImage,
Row(
// mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
"Upload Signature",
style: GoogleFonts.poppins(fontSize: 11.5),
),
SizedBox(width: 5),
GestureDetector(
onTap: _pickImage,
child:
_imageBytes != null
? ClipOval(
child: Image.memory(
_imageBytes!,
// width: 50,
// height: 50,
width: 50, // Use responsive width
height: 50,
fit: BoxFit.cover,
),
)
: selectedOrglogo != null
? ClipRect(
child: Image.network(
selectedOrglogo!,
width: 50, // Use responsive width
height: 50,
// width: 250,
// height: 55,
fit: BoxFit.contain,
errorBuilder: (context, error, stackTrace) {
return const CircleAvatar(
radius: 20,
backgroundColor: Colors.redAccent,
child: Icon(Icons.error, size: 10),
);
},
),
)
: const CircleAvatar(
radius: 20,
backgroundColor: Colors.amber,
child: Icon(Icons.add_a_photo, size: 10),
),
child:
_imageBytes != null
? ClipOval(
child: Image.memory(
_imageBytes!,
// width: 50,
// height: 50,
width: 50, // Use responsive width
height: 50,
fit: BoxFit.cover,
),
)
: selectedOrglogo != null
? ClipRect(
child: Image.network(
selectedOrglogo!,
width: 50, // Use responsive width
height: 50,
// width: 250,
// height: 55,
fit: BoxFit.contain,
errorBuilder: (context, error, stackTrace) {
return const CircleAvatar(
radius: 20,
backgroundColor: Colors.redAccent,
child: Icon(Icons.error, size: 10),
);
},
),
)
: const CircleAvatar(
radius: 20,
backgroundColor: Colors.amber,
child: Icon(Icons.add_a_photo, size: 10),
),
),
],
),
SizedBox(
// width: 200,
child: Text(
"* Allow types jpg, jpeg, png",
// maxLines: 2,
// softWrap: true,
style: GoogleFonts.poppins(
fontSize: 9,
fontWeight: FontWeight.w400,
color: Colors.grey,
),
),
),
],
),

View File

@ -77,25 +77,26 @@ class CommentModalState extends State<CommentModal> {
role = await getRoleUser();
print("Role - $role");
print("RoleuserId - $userId");
userId = int.tryParse(userIdString);
if (userId == null) {
throw Exception('Invalid user ID format.');
}
if (role != null && (role == 'Org Admin' || role == 'Travel Admin')) {
final data = await getRemarks(userId);
// if (role != null && (role == 'Org Admin' || role == 'Travel Admin' || role == )) {
final data = await getRemarks(userId);
setState(() {
remarksData = data;
setState(() {
remarksData = data;
isLoading = false;
});
print("Remarks -");
print("Remarks - ${jsonEncode(remarksData)}");
} else {
apiService.logout(context);
}
isLoading = false;
});
print("Remarks -");
print("Remarks - ${jsonEncode(remarksData)}");
// } else {
// apiService.logout(context);
// }
} catch (e) {
setState(() {
errorMessage = e.toString();