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) { if (pickedFile != null && kIsWeb) {
try { 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(); final bytes = await pickedFile.readAsBytes();
print('✅ Image loaded, size: ${bytes.length} bytes'); print('✅ Image loaded, size: ${bytes.length} bytes');
setState(() { setState(() {
@ -796,7 +805,7 @@ class TemplateForexState extends State<TemplateForex> {
// color: Color(0xFF575A74), // color: Color(0xFF575A74),
// ), // ),
// ), // ),
const SizedBox(height: 10), // const SizedBox(height: 10),
Container( Container(
color: Color(0xFFFFFEF0), color: Color(0xFFFFFEF0),
width: isDesktop ? MediaQuery.of(context).size.width * 0.8 : null, 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( Container(
child: Row( child: Column(
// mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Row(
"Upload Signature", // mainAxisAlignment: MainAxisAlignment.end,
style: GoogleFonts.poppins(fontSize: 11.5), children: [
), Text(
SizedBox(width: 5), "Upload Signature",
GestureDetector( style: GoogleFonts.poppins(fontSize: 11.5),
onTap: _pickImage, ),
SizedBox(width: 5),
GestureDetector(
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,
width: 50, // Use responsive width width: 50, // Use responsive width
height: 50, height: 50,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
) )
: selectedOrglogo != null : selectedOrglogo != null
? ClipRect( ? ClipRect(
child: Image.network( child: Image.network(
selectedOrglogo!, selectedOrglogo!,
width: 50, // Use responsive width width: 50, // Use responsive width
height: 50, height: 50,
// width: 250, // width: 250,
// height: 55, // height: 55,
fit: BoxFit.contain, fit: BoxFit.contain,
errorBuilder: (context, error, stackTrace) { errorBuilder: (context, error, stackTrace) {
return const CircleAvatar( return const CircleAvatar(
radius: 20, radius: 20,
backgroundColor: Colors.redAccent, backgroundColor: Colors.redAccent,
child: Icon(Icons.error, size: 10), child: Icon(Icons.error, size: 10),
); );
}, },
), ),
) )
: const CircleAvatar( : const CircleAvatar(
radius: 20, radius: 20,
backgroundColor: Colors.amber, backgroundColor: Colors.amber,
child: Icon(Icons.add_a_photo, size: 10), 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(); role = await getRoleUser();
print("Role - $role"); print("Role - $role");
print("RoleuserId - $userId");
userId = int.tryParse(userIdString); userId = int.tryParse(userIdString);
if (userId == null) { if (userId == null) {
throw Exception('Invalid user ID format.'); throw Exception('Invalid user ID format.');
} }
if (role != null && (role == 'Org Admin' || role == 'Travel Admin')) { // if (role != null && (role == 'Org Admin' || role == 'Travel Admin' || role == )) {
final data = await getRemarks(userId); final data = await getRemarks(userId);
setState(() { setState(() {
remarksData = data; remarksData = data;
isLoading = false; isLoading = false;
}); });
print("Remarks -"); print("Remarks -");
print("Remarks - ${jsonEncode(remarksData)}"); print("Remarks - ${jsonEncode(remarksData)}");
} else { // } else {
apiService.logout(context); // apiService.logout(context);
} // }
} catch (e) { } catch (e) {
setState(() { setState(() {
errorMessage = e.toString(); errorMessage = e.toString();