Commit 2ccf19cc authored by Sai Srinivas's avatar Sai Srinivas
Browse files

04-07-2025 By Sai Srinivas

Test cases and Order Module, Crm Module.
parent 4b790bef
import 'dart:async';
import 'dart:io';
import 'dart:math' as math;
import 'package:camera/camera.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Utils/app_colors.dart';
import 'package:permission_handler/permission_handler.dart';
import '../Utils/commonServices.dart';
......@@ -48,12 +51,12 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
Future<void> _getavailableCameras() async {
try {
_cameras = await availableCameras();
//
final frontCamera = _cameras.firstWhere(
(camera) => camera.lensDirection == CameraLensDirection.front,
(camera) => camera.lensDirection == CameraLensDirection.front,
);
cam_controller = CameraController(frontCamera, ResolutionPreset.max);
// final frontCamera = CameraLensDirection.front;
cam_controller = CameraController(frontCamera, ResolutionPreset.max,);
await cam_controller.initialize();
......@@ -78,46 +81,59 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
Size size = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
),
// appBar: AppBar(automaticallyImplyLeading: false),
body: SafeArea(
child: isLoading
? Center(child: CircularProgressIndicator())
: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
height: size.height * 0.8,
child: cam_controller.value.isInitialized
? CameraPreview(cam_controller)
: Center(child: Text("Camera not ready")),
),
Container(
height: size.height * 0.1,
padding: EdgeInsets.all(10),
child: Center(
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.white70),
overlayColor: MaterialStatePropertyAll(Colors.white70),
),
onPressed: () async {
if (!cam_controller.value.isInitialized) return;
final image = await cam_controller.takePicture();
_image = File(image.path);
Navigator.pop(context, _image);
},
child: Icon(
CupertinoIcons.camera_circle_fill,
size: 50,
color: Colors.black,
),
child:
isLoading
? Center(child: CircularProgressIndicator())
: Row(
children: [
Expanded(
child: SizedBox(
height: double.infinity,
child:
cam_controller.value.isInitialized
? Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(math.pi),
child: CameraPreview(
cam_controller,
child: Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
onTap: () async {
if (!cam_controller
.value
.isInitialized)
return;
final image =
await cam_controller
.takePicture();
_image = File(image.path);
Navigator.pop(context, _image);
},
child: Container(
height: 100,
width: double.infinity,
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.black26
),
child: Center(
child: SvgPicture.asset("assets/svg/check_in_cam.svg",width: 50,height: 50,)
),
),
),
),
),
)
: Center(child: Text("Camera not ready")),
),
),
],
),
),
),
],
),
),
);
}
......
......@@ -13,6 +13,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:location/location.dart' as loc;
import '../Utils/app_colors.dart';
import 'inventory/InventoryScreen.dart';
import 'package:auto_size_text/auto_size_text.dart';
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
......@@ -110,41 +111,41 @@ class _MyHomePageState extends State<MyHomePage> {
// Define the original data
final names = [
"Attendance",
"Finance",
// "CRM",
"Orders",
"ERP",
"Gen Tracker",
"Service Engineer",
"Nearby",
"Gen Tracker",
// "Nearby",
"Inventory",
"Whizzdom",
"Common",
"Finance",
// "Orders",
// "CRM",
// "Common",
];
final icons = [
"assets/svg/home_icons_1.svg",
"assets/svg/home_icons_10.svg",
// "assets/svg/home_icons_12.svg",
"assets/svg/home_icons_11.svg",
"assets/svg/home_icons_2.svg",
"assets/svg/home_icons_31.svg",
"assets/svg/home_icons_4.svg",
"assets/svg/home_icons_5.svg",
"assets/svg/home_icons_31.svg",
// "assets/svg/home_icons_5.svg",
"assets/svg/home_icons_6.svg",
"assets/svg/home_icons_81.svg",
"assets/svg/home_icons_9.svg",
"assets/svg/home_icons_10.svg",
// "assets/svg/home_icons_11.svg",
// "assets/svg/home_icons_12.svg",
// "assets/svg/home_icons_9.svg",
];
final requiredRoles = [
"430",
"430",
// "430",
"430",
"431",
"434",
"433",
"433",
"434",
// "433",
"432",
"431",
"430",
"430",
// "430",
// "430",
];
......@@ -275,22 +276,44 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(
"${profile.employeeName}",
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold",
fontSize: 18,
// Text(
// "${profile.employeeName}",
// maxLines: 1,
// style: TextStyle(
// color: AppColors.app_blue,
// fontFamily: "JakartaSemiBold",
// fontSize: 18,
// ),
// ),
AutoSizeText(
'${profile.employeeName}',
maxFontSize: 18,
minFontSize: 12,
style: TextStyle(fontSize: 18,
color: AppColors.app_blue,
fontFamily: "JakartaRegular"
),
maxLines: 2,
),
Text(
"${profile.designation}",
style: TextStyle(
color: AppColors.semi_black,
fontFamily: "JakartaRegular",
fontSize: 14,
AutoSizeText(
'(${profile.designation})',
maxFontSize: 14,
minFontSize: 10,
style: TextStyle(fontSize: 14,
color: AppColors.semi_black,
fontFamily: "JakartaRegular"
),
maxLines: 1,
),
// Text(
// "${profile.designation}",
// maxLines: 1,
// style: TextStyle(
// color: AppColors.semi_black,
// fontFamily: "JakartaRegular",
// fontSize: 14,
// ),
// ),
Text(
"${profile.employeeeID}",
style: TextStyle(
......@@ -369,6 +392,7 @@ class _MyHomePageState extends State<MyHomePage> {
MaterialPageRoute(
builder:
(context) => AttendanceScreen(),
settings: RouteSettings(arguments: 'AttendanceScreen'),
),
);
break;
......@@ -410,6 +434,7 @@ class _MyHomePageState extends State<MyHomePage> {
builder:
(context) =>
Gentrackerdashboard(),
settings: RouteSettings(arguments: 'Gentrackerdashboard'),
),
);
break;
......@@ -471,12 +496,16 @@ class _MyHomePageState extends State<MyHomePage> {
);
break;
case "Finance":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Financedashboard(),
settings: RouteSettings(arguments: 'Financedashboard'),
),
);
break;
case "Orders":
......@@ -494,6 +523,7 @@ class _MyHomePageState extends State<MyHomePage> {
MaterialPageRoute(
builder:
(context) => CrmdashboardScreen(),
settings: RouteSettings(name: 'CrmdashboardScreen')
),
);
default:
......
......@@ -344,7 +344,7 @@ class _LoginScreenState extends State<LoginScreen>
//contentPadding: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 10.0),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
hintText: 'Enter Your Email',
hintText: 'Enter Your ID',
),
),
),
......@@ -477,8 +477,9 @@ class _LoginScreenState extends State<LoginScreen>
],
Container(
child: InkWell(
onTap: () {
onTap:loginProv.isLoading?null: () {
// LoginApiFunction();
loginProv.isLoading = true;
loginProv.LoginApiFunction(
context,
email.text,
......@@ -510,7 +511,9 @@ class _LoginScreenState extends State<LoginScreen>
),
),
child: Center(
child: Text(
child:loginProv.isLoading?CircularProgressIndicator.adaptive(
padding: EdgeInsets.all(5),
valueColor: AlwaysStoppedAnimation(Colors.white),): Text(
"Login",
textAlign: TextAlign.center,
style: TextStyle(
......@@ -639,7 +642,9 @@ class _LoginScreenState extends State<LoginScreen>
),
child: InkWell(
onTap: () {
Share.share("${loginProv.deviceId}");
// Share.share("${loginProv.deviceId}");
Share.share("Your device ID is: ${loginProv.deviceId}");
},
child: SvgPicture.asset(
"assets/svg/share_ic.svg",
......
......@@ -86,7 +86,7 @@ class _WebERPIOSState extends State<WebERPIOS> {
return true; // Allow default back button behavior
},
child: Scaffold(
appBar: appbar(context, "Web ERP"),
appBar: appbar(context, "ERP"),
body: SafeArea(
child: Container(
child: Column(
......
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
......@@ -18,6 +19,8 @@ import 'dart:math';
import 'package:flutter/widgets.dart';
import 'package:url_launcher/url_launcher.dart';
import '../services/api_calling.dart';
// const MAX_PROGRESS = 100;
Future runErpScreenApp() async {
......@@ -29,6 +32,7 @@ Future runErpScreenApp() async {
class WebErpScreen extends StatefulWidget {
final String erp_url;
const WebErpScreen({super.key, required this.erp_url});
@override
......@@ -53,6 +57,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
final GlobalKey webViewKey = GlobalKey();
var dl = DownloadManager();
@override
void initState() {
// loadData();
......@@ -116,7 +121,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
},
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Web ERP"),
appBar: appbar(context, "ERP"),
body: SafeArea(
child: Container(
child: Column(
......@@ -148,13 +153,16 @@ class _WebErpScreenState extends State<WebErpScreen> {
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
databaseEnabled: true,
// Enables the WebView database
domStorageEnabled: true,
// Enables DOM storage
builtInZoomControls: true,
// Enables the built-in zoom controls
displayZoomControls: false,
// Disables displaying zoom controls
safeBrowsingEnabled: true,
// Enables Safe Browsing
clearSessionCache: true,
loadsImagesAutomatically: true,
thirdPartyCookiesEnabled: true,
......@@ -162,10 +170,9 @@ class _WebErpScreenState extends State<WebErpScreen> {
supportMultipleWindows: true,
blockNetworkLoads: false,
networkAvailable: true,
useShouldInterceptRequest:true,
hardwareAcceleration: true
useShouldInterceptRequest: true,
hardwareAcceleration: true,
// Enable camera access
),
ios: IOSInAppWebViewOptions(
......@@ -181,7 +188,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
mediaPlaybackRequiresUserGesture: true,
),
),
androidOnPermissionRequest: (
InAppWebViewController controller,
String origin,
......@@ -199,9 +206,22 @@ class _WebErpScreenState extends State<WebErpScreen> {
);
},
keepAlive: InAppWebViewKeepAlive(),
onWebViewCreated: (controller) {
_webViewController = controller;
_controller.complete(controller);
// _webViewController!.addJavaScriptHandler(
// handlerName: 'downloadBlobHandler',
// callback: (args) async {
// String base64Data = args[0];
// String mimeType = args[1];
// String filename = args[2];
//
// // Save the file
// await saveBase64File(base64Data, filename, mimeType);
// },
// );
_webViewController!.addJavaScriptHandler(
handlerName: 'MobileAppJavascriptInterface',
callback: (args) {
......@@ -221,6 +241,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
'',
'application/octet-stream',
'',
// controller,context
);
}
},
......@@ -257,26 +278,36 @@ class _WebErpScreenState extends State<WebErpScreen> {
geolocationEnabled: true,
useOnDownloadStart: true,
allowsLinkPreview: true,
databaseEnabled: true, // Enables the WebView database
databaseEnabled: true,
// Enables the WebView database
clearSessionCache: true,
mediaType: "image/*,application/pdf",
useShouldInterceptRequest:true,
hardwareAcceleration: true
useShouldInterceptRequest: true,
hardwareAcceleration: true,
),
shouldInterceptRequest: (controller, request) async {
final url = request.url.toString();
print('Intercepting request: $url, Headers: ${request.headers}');
print(
'Intercepting request: $url, Headers: ${request.headers}',
);
if (url.endsWith('.pdf')) {
final response = await http.get(Uri.parse(url), headers: {
'Accept': 'application/pdf',
});
if (response.statusCode == 200 && response.headers['content-type']?.contains('application/pdf') == true) {
final response = await http.get(
Uri.parse(url),
headers: {'Accept': 'application/pdf'},
);
if (response.statusCode == 200 &&
response.headers['content-type']?.contains(
'application/pdf',
) ==
true) {
return WebResourceResponse(
contentType: 'application/pdf',
data: response.bodyBytes,
);
} else {
print('Failed to load PDF: Status ${response.statusCode}, Content-Type: ${response.headers['content-type']}');
print(
'Failed to load PDF: Status ${response.statusCode}, Content-Type: ${response.headers['content-type']}',
);
}
}
return null;
......@@ -289,11 +320,19 @@ class _WebErpScreenState extends State<WebErpScreen> {
print("urib scgefes");
print(uri);
print(uri.scheme);
if (uri.toString().contains('file_viewer_n ame.php') && uri.toString().contains('.pdf')) {
final pdfPath = Uri.parse(uri.toString()).queryParameters['file_path'];
if (uri.toString().contains(
'file_viewer_n ame.php',
) &&
uri.toString().contains('.pdf')) {
final pdfPath =
Uri.parse(
uri.toString(),
).queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
await controller.loadUrl(urlRequest: URLRequest(url: WebUri(pdfUrl)));
await controller.loadUrl(
urlRequest: URLRequest(url: WebUri(pdfUrl)),
);
return NavigationActionPolicy.CANCEL;
}
}
......@@ -328,14 +367,16 @@ class _WebErpScreenState extends State<WebErpScreen> {
// }
return NavigationActionPolicy.ALLOW;
},
onLoadStop: (controller, url) async {
if (url.toString().contains('file_viewer_name.php') && url.toString().contains('.pdf')) {
if (url.toString().contains('file_viewer_name.php') &&
url.toString().contains('.pdf')) {
final uri = Uri.parse(url.toString());
final pdfPath = uri.queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
await controller.evaluateJavascript(source: '''
await controller.evaluateJavascript(
source: '''
var pdfjsLib = window.pdfjsLib || document.createElement('script');
pdfjsLib.src = 'https://mozilla.github.io/pdf.js/build/pdf.js';
document.head.appendChild(pdfjsLib);
......@@ -357,7 +398,8 @@ class _WebErpScreenState extends State<WebErpScreen> {
console.error('PDF.js error: ' + error);
});
};
''');
''',
);
}
}
pullToRefreshController?.endRefreshing();
......@@ -390,21 +432,33 @@ class _WebErpScreenState extends State<WebErpScreen> {
// .then((data) => {debugPrint(data)});
//
// },
onDownloadStartRequest: (
controller,
downloadStartRequest,
) async {
// String url = downloadStartRequest.url.toString();
//
// // Use url_launcher or another plugin to handle the download externally
// if (await canLaunchUrl(Uri.parse(url))) {
// await launchUrl(
// Uri.parse(url),
// mode: LaunchMode.externalApplication,
// );
// } else {
// print("Could not launch $url");
// }
if (Platform.isAndroid) {
await _handleDownload(
downloadStartRequest.url.toString(),
downloadStartRequest.suggestedFilename!,
downloadStartRequest.mimeType ??
'application/octet-stream',
downloadStartRequest.mimeType!,
downloadStartRequest.suggestedFilename ?? '',
// controller,context
);
}
},
),
if (isLoading) ...[
Container(
......@@ -433,7 +487,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
),
),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
),
......@@ -449,13 +503,150 @@ class _WebErpScreenState extends State<WebErpScreen> {
),
);
}
// Future<void> saveBase64File(String base64Data, String filename, String mimeType) async {
// // Ask for permission
// if (await Permission.storage.request().isGranted) {
// final bytes = base64.decode(base64Data.split(',').last);
// final directory = await getExternalStorageDirectory(); // or getApplicationDocumentsDirectory()
// final path = "${directory!.path}/$filename";
// final file = File(path);
//
// await file.writeAsBytes(bytes);
// print("File saved to: $path");
// } else {
// print("Storage permission denied.");
// }
// }
// Future<void> _handleDownload(
// String url,
// String contentDisposition,
// String mimeType,
// String suggestedFilename,
// InAppWebViewController controller,
// BuildContext context, // Add context for toast
// ) async {
// print("URL: $url");
// print("MimeType: $mimeType");
// print("SuggestedFilename: $suggestedFilename");
// print("ContentDisposition: $contentDisposition");
//
// if (Platform.isAndroid) {
// if (await Permission.notification.request().isGranted) {
// try {
// final userAgent = 'Flutter InAppWebView';
// if (url.startsWith('blob:')) {
// print("Attempting to convert blob URL...");
// final blobContent = await _convertBlobToDataUrl(url, controller);
// if (blobContent != null) {
// print("Blob converted to data URL: ${blobContent.substring(0, 50)}..."); // Log first 50 chars
// await platform.invokeMethod('startDownload', {
// 'url': blobContent,
// 'userAgent': userAgent,
// 'contentDisposition': contentDisposition,
// 'mimeType': mimeType,
// 'suggestedFilename': suggestedFilename,
// 'isBase64': true,
// });
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text("Download started: $suggestedFilename")),
// );
// } else {
// print("Failed to convert blob URL");
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text("Failed to resolve blob URL")),
// );
// }
// } else {
// print("Handling non-blob URL");
// await platform.invokeMethod('startDownload', {
// 'url': url,
// 'userAgent': userAgent,
// 'contentDisposition': contentDisposition,
// 'mimeType': mimeType,
// 'suggestedFilename': suggestedFilename,
// 'isBase64': false,
// });
// }
// } catch (e, stackTrace) {
// print("Download Error: $e");
// print("StackTrace: $stackTrace");
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text("Download failed: $e")),
// );
// }
// } else {
// print("Notification Permission Denied");
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text("Notification Permission Denied")),
// );
// }
// } else if (Platform.isIOS) {
// _handleIOSDownload(url, suggestedFilename);
// }
// }
//
// Future<String?> _convertBlobToDataUrl(String blobUrl, InAppWebViewController controller) async {
// try {
// final result = await controller.evaluateJavascript(
// source: """
// (async function() {
// try {
// const response = await fetch('$blobUrl');
// if (!response.ok) {
// console.error('Fetch failed with status: ' + response.status);
// return null;
// }
// const blob = await response.blob();
// return new Promise((resolve) => {
// const reader = new FileReader();
// reader.onloadend = () => resolve(reader.result);
// reader.onerror = () => resolve(null);
// reader.readAsDataURL(blob);
// });
// } catch (e) {
// console.error('Blob conversion error: ' + e.message);
// return null;
// }
// })();
// """,
// );
// if (result != null && result.toString().startsWith('data:')) {
// print("Blob conversion successful, data URL length: ${result.toString().length}");
// return result.toString();
// } else {
// print("Blob conversion failed, result: $result");
// return null;
// }
// } catch (e, stackTrace) {
// print("Blob conversion error: $e");
// print("StackTrace: $stackTrace");
// return null;
// }
// }
void handleBlobDownload(String blobUrl, String filename) async {
final js = """
(async function() {
const blobUrl = "$blobUrl";
const response = await fetch(blobUrl);
const blob = await response.blob();
const reader = new FileReader();
reader.onloadend = function() {
window.flutter_inappwebview.callHandler('downloadBlobHandler', reader.result, blob.type, "$filename");
};
reader.readAsDataURL(blob);
})();
""";
_webViewController?.evaluateJavascript(source: js);
}
Future<void> _handleDownload(
String url,
String contentDisposition,
String mimeType,
String suggestedFilename,
) async {
print("mimeType4: $mimeType");
print("mimeType4: $suggestedFilename");
// Request notification permission for Android 13+
if (Platform.isIOS) {
_handleIOSDownload(url, suggestedFilename);
......
This diff is collapsed.
......@@ -335,6 +335,7 @@ class _AccountslistState extends State<Accountslist> {
context,
provider.companyNameController,
"Company Name",
"Enter Company Name",
(p0) {},
TextInputType.text,
false,
......@@ -347,6 +348,7 @@ class _AccountslistState extends State<Accountslist> {
context,
provider.mobileNumberController,
"Mobile Number",
"Enter Mobile Number",
(p0) {},
TextInputType.number,
false,
......
......@@ -11,7 +11,7 @@ import '../../Models/commonModels/commonAccountdetailsResponse.dart';
class Accountslistdetails extends StatefulWidget {
final accountID;
const Accountslistdetails({super.key, this.accountID});
const Accountslistdetails({super.key,required this.accountID});
@override
State<Accountslistdetails> createState() => _AccountslistdetailsState();
......@@ -244,7 +244,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
SizedBox(width: 15),
Expanded(
child: Text(
subHeadings[j] ?? "-",
subHeadings[j]==""?"-": subHeadings[j] ?? "-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
......
This diff is collapsed.
......@@ -96,7 +96,7 @@ class _CommondashboardState extends State<Commondashboard> {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Addcommonpayment()),
MaterialPageRoute(builder: (context) => Addcommonpayment(from: "Dashboard",)),
);
},
child: Container(
......
......@@ -36,7 +36,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Appointment Details"),
// TextWidget(context, "Appointment Details"),
ListView.builder(
itemCount: quotationDetails.length,
shrinkWrap: true,
......@@ -304,6 +304,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
textControllerWidget(
context,
provider.noteController,
"Note",
"Enter Note",
provider.onChangeNote,
TextInputType.text,
......
......@@ -31,7 +31,7 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Followup Details"),
// TextWidget(context, "Followup Details"),
ListView.builder(
itemCount: followupDetails.length,
shrinkWrap: true,
......@@ -53,23 +53,17 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...List.generate(7, (j) {
...List.generate(4, (j) {
final textheads = [
"Employee Name",
"Date",
"Date and Time",
"Type",
"In Time",
"Out Time",
"Status",
"Feedback",
];
final textSubheads = [
followupDetails[index].ename ?? "-",
followupDetails[index].fdate ?? "-",
"${followupDetails[index].fdate ?? "-"}, ${followupDetails[index].finTime ?? "-"}",
followupDetails[index].ftype ?? "-",
followupDetails[index].finTime ?? "-",
followupDetails[index].foutTime ?? "-",
followupDetails[index].fstatus ?? "-",
followupDetails[index].ffeedback ?? "-",
];
return Container(
......@@ -114,33 +108,7 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
),
),
),
floatingActionButton: Align(
alignment: Alignment.bottomCenter,
child: InkWell(
child: Container(
alignment: Alignment.bottomCenter,
height: 45,
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(14.0),
),
child: Center(
child: Text(
"Followup Details",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "JakartaMedium",
),
),
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
),
);
},
......
......@@ -49,6 +49,55 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
builder: (context, provider, child) {
var leadDetails = provider.leadDetails;
var headings1 = [
"Account Manager Name",
"Account Created By",
"Address",
"Lead Status",
];
var subHeadings1 = [
provider.accountDetails!.accManager??"-",
provider.accountDetails!.owner??"-",
provider.leadDetails!.address??"-",
provider.leadDetails!.status??"-",
];
var headings2 = [
"State",
"District",
"Sub Locality",
"Source",
"Reference",
"Team",
"Segment",
"Lead Age",
];
var subHeadings2 = [
provider.accountDetails!.state??"-",
provider.accountDetails!.district??"-",
provider.accountDetails!.subLocality??"-",
provider.accountDetails!.source??"-",
provider.accountDetails!.reference??"-",
provider.accountDetails!.team??"-",
provider.accountDetails!.segment??"-",
"${provider.leadDetails!.lage??"-"} days",
];
var totalHeadings = [...headings1];
var totalSubHeadings = [...subHeadings1];
if(provider.showMoreDetails){
totalHeadings = [...headings1,...headings2];
totalSubHeadings = [...subHeadings1,...subHeadings2];
}
return WillPopScope(
child: Scaffold(
resizeToAvoidBottomInset: true,
......@@ -145,7 +194,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) {
...List.generate(totalSubHeadings.length, (j) {
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
......@@ -153,7 +202,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [
Expanded(
child: Text(
provider.Headings[j],
totalHeadings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
......@@ -164,16 +213,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded(
child: InkResponse(
child:
provider.Headings[j] == "Lead Age"
totalHeadings[j] == "Lead Age"
? Tooltip(
triggerMode: TooltipTriggerMode.tap,
message:
"${provider.leadDetails.createdDatetime}",
child: Text(
provider.subHeadings[j] == ""
totalSubHeadings[j] == ""
? "-"
: provider.subHeadings[j],
: totalSubHeadings[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
......@@ -185,9 +234,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
)
: Text(
provider.subHeadings[j] == ""
totalSubHeadings[j] == ""
? "-"
: provider.subHeadings[j],
: totalSubHeadings[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
......@@ -199,6 +248,33 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
);
}),
InkResponse(
onTap: () async {
provider.showMoreDetails = !provider.showMoreDetails;
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(
provider.showMoreDetails?"- Show Less": "+ More Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
),
),
],
),
),
......@@ -229,6 +305,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return SafeArea(
child: Consumer<crmLeadDetailsProvider>(
builder: (context, provider, child) {
final assetnames = [
"crm_appoint_details",
"crm_cont_details",
"crm_follow_up_details",
"crm_prod_details",
"crm_quotation_details",
];
final Headingnames = [
"Product Details",
"Contact Details",
"Followup Details",
"Appointment Details",
"Quotation Details",
];
return Container(
margin: EdgeInsets.only(
bottom: 15,
......@@ -243,21 +335,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [
SizedBox(height: 15),
...List.generate(5, (index) {
final assetnames = [
"crm_appoint_details",
"crm_cont_details",
"crm_follow_up_details",
"crm_prod_details",
"crm_quotation_details",
];
final Headingnames = [
"Product Details",
"Contact Details",
"Followup Details",
"Appointment Details",
"Quotation Details",
];
...List.generate(assetnames.length, (index) {
return ListTile(
onTap: () {
switch (index) {
......@@ -309,6 +388,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
builder:
(context) => QuotationDetails(
leadID: provider.leadDetails.id,
mode: widget.mode,
),
),
);
......@@ -328,6 +408,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
);
}),
],
),
),
......
This diff is collapsed.
......@@ -114,7 +114,7 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer<Nearbygeneratorsprovider>(
child: Consumer<crmNearbyOpenLeadsProvider>(
builder: (context,provider,child) {
return Container(
margin: EdgeInsets.only(
......@@ -231,31 +231,31 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
onChanged: (value) {
provider.currentValue = value;
provider.debounce(() {
provider.LoadNearbyGeneratorsAPI(context);
provider.LoadNearbyOpenLeadsAPI(context);
}, Duration(milliseconds: 200));
},
),
Slider(
value: provider.currentValue,
max: 100,
divisions: 100,
label: provider.currentValue.toStringAsFixed(2),
inactiveColor: Color(0xFFD7D7D7),
activeColor: AppColors.cyan_blue,
onChanged: (value) {
provider.currentValue = value;
provider.debounce(() {
provider.LoadNearbyOpenLeadsAPI(context);
}, Duration(milliseconds: 200));
},
),
// Slider(
// value: provider.currentValue,
// max: 100,
// divisions: 100,
//
// label: provider.currentValue.toStringAsFixed(2),
// inactiveColor: Color(0xFFD7D7D7),
// activeColor: AppColors.cyan_blue,
// onChanged: (value) {
// provider.currentValue = value;
// provider.debounce(() {
// provider.LoadNearbyGeneratorsAPI(context);
// }, Duration(milliseconds: 200));
// },
// ),
SizedBox(height: 30.0),
Container(
child: InkWell(
onTap: () {
provider.debounce(() {
provider.LoadNearbyGeneratorsAPI(context);
provider.LoadNearbyOpenLeadsAPI(context);
Navigator.pop(context);
}, Duration(milliseconds: 500));
},
......
......@@ -634,6 +634,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
textControllerWidget(
context,
provider.editCompanyNameController,
"Company Name",
"Enter Company Name",
provider.onChangeCompanyName,
TextInputType.text,
......@@ -847,6 +848,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
context,
provider.pincodeController,
"Pincode",
"Enter Pincode",
provider.onChangePincode,
TextInputType.number,
false,
......@@ -856,6 +858,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
textControllerWidget(
context,
provider.addressController,
"Address",
"Enter Address",
provider.onChangeAddress,
TextInputType.text,
......
......@@ -405,6 +405,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
context,
provider.mobileNumberController,
"Mobile Number",
"Enter Mobile Number",
provider.onChangedMobileNum,
TextInputType.number,
false,
......@@ -414,6 +415,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
context,
provider.companyNameController,
"Company Name",
"Enter Company Name",
provider.onChangedCompanyName,
TextInputType.text,
false,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment