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:async';
import 'dart:io'; import 'dart:io';
import 'dart:math' as math;
import 'package:camera/camera.dart'; import 'package:camera/camera.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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 'package:permission_handler/permission_handler.dart';
import '../Utils/commonServices.dart'; import '../Utils/commonServices.dart';
...@@ -48,12 +51,12 @@ class _CheckOutScreenState extends State<FrontCameraCapture> { ...@@ -48,12 +51,12 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
Future<void> _getavailableCameras() async { Future<void> _getavailableCameras() async {
try { try {
_cameras = await availableCameras(); _cameras = await availableCameras();
//
final frontCamera = _cameras.firstWhere( final frontCamera = _cameras.firstWhere(
(camera) => camera.lensDirection == CameraLensDirection.front, (camera) => camera.lensDirection == CameraLensDirection.front,
); );
// final frontCamera = CameraLensDirection.front;
cam_controller = CameraController(frontCamera, ResolutionPreset.max); cam_controller = CameraController(frontCamera, ResolutionPreset.max,);
await cam_controller.initialize(); await cam_controller.initialize();
...@@ -78,46 +81,59 @@ class _CheckOutScreenState extends State<FrontCameraCapture> { ...@@ -78,46 +81,59 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
Size size = MediaQuery.of(context).size; Size size = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
appBar: AppBar( // appBar: AppBar(automaticallyImplyLeading: false),
automaticallyImplyLeading: false,
),
body: SafeArea( body: SafeArea(
child: isLoading child:
? Center(child: CircularProgressIndicator()) isLoading
: Column( ? Center(child: CircularProgressIndicator())
crossAxisAlignment: CrossAxisAlignment.stretch, : Row(
children: [ children: [
Container( Expanded(
height: size.height * 0.8, child: SizedBox(
child: cam_controller.value.isInitialized height: double.infinity,
? CameraPreview(cam_controller) child:
: Center(child: Text("Camera not ready")), cam_controller.value.isInitialized
), ? Transform(
Container( alignment: Alignment.center,
height: size.height * 0.1, transform: Matrix4.rotationY(math.pi),
padding: EdgeInsets.all(10), child: CameraPreview(
child: Center( cam_controller,
child: TextButton( child: Align(
style: ButtonStyle( alignment: Alignment.bottomCenter,
backgroundColor: MaterialStatePropertyAll(Colors.white70), child: GestureDetector(
overlayColor: MaterialStatePropertyAll(Colors.white70), onTap: () async {
), if (!cam_controller
onPressed: () async { .value
if (!cam_controller.value.isInitialized) return; .isInitialized)
final image = await cam_controller.takePicture(); return;
_image = File(image.path); final image =
Navigator.pop(context, _image); await cam_controller
}, .takePicture();
child: Icon( _image = File(image.path);
CupertinoIcons.camera_circle_fill, Navigator.pop(context, _image);
size: 50,
color: Colors.black, },
), 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'; ...@@ -13,6 +13,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:location/location.dart' as loc; import 'package:location/location.dart' as loc;
import '../Utils/app_colors.dart'; import '../Utils/app_colors.dart';
import 'inventory/InventoryScreen.dart'; import 'inventory/InventoryScreen.dart';
import 'package:auto_size_text/auto_size_text.dart';
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
const MyHomePage({super.key}); const MyHomePage({super.key});
...@@ -110,41 +111,41 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -110,41 +111,41 @@ class _MyHomePageState extends State<MyHomePage> {
// Define the original data // Define the original data
final names = [ final names = [
"Attendance", "Attendance",
"Finance",
// "CRM",
"Orders",
"ERP", "ERP",
"Gen Tracker",
"Service Engineer", "Service Engineer",
"Nearby", "Gen Tracker",
// "Nearby",
"Inventory", "Inventory",
"Whizzdom", "Whizzdom",
"Common", // "Common",
"Finance",
// "Orders",
// "CRM",
]; ];
final icons = [ final icons = [
"assets/svg/home_icons_1.svg", "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_2.svg",
"assets/svg/home_icons_31.svg",
"assets/svg/home_icons_4.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_6.svg",
"assets/svg/home_icons_81.svg", "assets/svg/home_icons_81.svg",
"assets/svg/home_icons_9.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",
]; ];
final requiredRoles = [ final requiredRoles = [
"430",
"430",
// "430",
"430", "430",
"431", "431",
"434",
"433",
"433", "433",
"434",
// "433",
"432", "432",
"431", "431",
"430",
"430",
// "430",
// "430", // "430",
]; ];
...@@ -275,22 +276,44 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -275,22 +276,44 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
children: [ children: [
Text( // Text(
"${profile.employeeName}", // "${profile.employeeName}",
style: TextStyle( // maxLines: 1,
color: AppColors.app_blue, // style: TextStyle(
fontFamily: "JakartaSemiBold", // color: AppColors.app_blue,
fontSize: 18, // fontFamily: "JakartaSemiBold",
// fontSize: 18,
// ),
// ),
AutoSizeText(
'${profile.employeeName}',
maxFontSize: 18,
minFontSize: 12,
style: TextStyle(fontSize: 18,
color: AppColors.app_blue,
fontFamily: "JakartaRegular"
), ),
maxLines: 2,
), ),
Text( AutoSizeText(
"${profile.designation}", '(${profile.designation})',
style: TextStyle( maxFontSize: 14,
color: AppColors.semi_black, minFontSize: 10,
fontFamily: "JakartaRegular", style: TextStyle(fontSize: 14,
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( Text(
"${profile.employeeeID}", "${profile.employeeeID}",
style: TextStyle( style: TextStyle(
...@@ -369,6 +392,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -369,6 +392,7 @@ class _MyHomePageState extends State<MyHomePage> {
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => AttendanceScreen(), (context) => AttendanceScreen(),
settings: RouteSettings(arguments: 'AttendanceScreen'),
), ),
); );
break; break;
...@@ -410,6 +434,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -410,6 +434,7 @@ class _MyHomePageState extends State<MyHomePage> {
builder: builder:
(context) => (context) =>
Gentrackerdashboard(), Gentrackerdashboard(),
settings: RouteSettings(arguments: 'Gentrackerdashboard'),
), ),
); );
break; break;
...@@ -471,12 +496,16 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -471,12 +496,16 @@ class _MyHomePageState extends State<MyHomePage> {
); );
break; break;
case "Finance": case "Finance":
res = await Navigator.push( res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => Financedashboard(), (context) => Financedashboard(),
settings: RouteSettings(arguments: 'Financedashboard'),
), ),
); );
break; break;
case "Orders": case "Orders":
...@@ -494,6 +523,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -494,6 +523,7 @@ class _MyHomePageState extends State<MyHomePage> {
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => CrmdashboardScreen(), (context) => CrmdashboardScreen(),
settings: RouteSettings(name: 'CrmdashboardScreen')
), ),
); );
default: default:
......
...@@ -344,7 +344,7 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -344,7 +344,7 @@ class _LoginScreenState extends State<LoginScreen>
//contentPadding: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 10.0), //contentPadding: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 10.0),
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
hintText: 'Enter Your Email', hintText: 'Enter Your ID',
), ),
), ),
), ),
...@@ -477,8 +477,9 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -477,8 +477,9 @@ class _LoginScreenState extends State<LoginScreen>
], ],
Container( Container(
child: InkWell( child: InkWell(
onTap: () { onTap:loginProv.isLoading?null: () {
// LoginApiFunction(); // LoginApiFunction();
loginProv.isLoading = true;
loginProv.LoginApiFunction( loginProv.LoginApiFunction(
context, context,
email.text, email.text,
...@@ -510,7 +511,9 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -510,7 +511,9 @@ class _LoginScreenState extends State<LoginScreen>
), ),
), ),
child: Center( child: Center(
child: Text( child:loginProv.isLoading?CircularProgressIndicator.adaptive(
padding: EdgeInsets.all(5),
valueColor: AlwaysStoppedAnimation(Colors.white),): Text(
"Login", "Login",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
...@@ -639,7 +642,9 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -639,7 +642,9 @@ class _LoginScreenState extends State<LoginScreen>
), ),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Share.share("${loginProv.deviceId}"); // Share.share("${loginProv.deviceId}");
Share.share("Your device ID is: ${loginProv.deviceId}");
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/svg/share_ic.svg", "assets/svg/share_ic.svg",
......
...@@ -86,7 +86,7 @@ class _WebERPIOSState extends State<WebERPIOS> { ...@@ -86,7 +86,7 @@ class _WebERPIOSState extends State<WebERPIOS> {
return true; // Allow default back button behavior return true; // Allow default back button behavior
}, },
child: Scaffold( child: Scaffold(
appBar: appbar(context, "Web ERP"), appBar: appbar(context, "ERP"),
body: SafeArea( body: SafeArea(
child: Container( child: Container(
child: Column( child: Column(
......
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
...@@ -18,6 +19,8 @@ import 'dart:math'; ...@@ -18,6 +19,8 @@ import 'dart:math';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../services/api_calling.dart';
// const MAX_PROGRESS = 100; // const MAX_PROGRESS = 100;
Future runErpScreenApp() async { Future runErpScreenApp() async {
...@@ -29,6 +32,7 @@ Future runErpScreenApp() async { ...@@ -29,6 +32,7 @@ Future runErpScreenApp() async {
class WebErpScreen extends StatefulWidget { class WebErpScreen extends StatefulWidget {
final String erp_url; final String erp_url;
const WebErpScreen({super.key, required this.erp_url}); const WebErpScreen({super.key, required this.erp_url});
@override @override
...@@ -53,6 +57,7 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -53,6 +57,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
final GlobalKey webViewKey = GlobalKey(); final GlobalKey webViewKey = GlobalKey();
var dl = DownloadManager(); var dl = DownloadManager();
@override @override
void initState() { void initState() {
// loadData(); // loadData();
...@@ -116,7 +121,7 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -116,7 +121,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
}, },
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: appbar(context, "Web ERP"), appBar: appbar(context, "ERP"),
body: SafeArea( body: SafeArea(
child: Container( child: Container(
child: Column( child: Column(
...@@ -148,13 +153,16 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -148,13 +153,16 @@ class _WebErpScreenState extends State<WebErpScreen> {
allowContentAccess: true, allowContentAccess: true,
geolocationEnabled: true, geolocationEnabled: true,
allowFileAccess: true, allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database databaseEnabled: true,
domStorageEnabled: true, // Enables DOM storage // Enables the WebView database
builtInZoomControls: domStorageEnabled: true,
true, // Enables the built-in zoom controls // Enables DOM storage
displayZoomControls: builtInZoomControls: true,
false, // Disables displaying zoom controls // Enables the built-in zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing displayZoomControls: false,
// Disables displaying zoom controls
safeBrowsingEnabled: true,
// Enables Safe Browsing
clearSessionCache: true, clearSessionCache: true,
loadsImagesAutomatically: true, loadsImagesAutomatically: true,
thirdPartyCookiesEnabled: true, thirdPartyCookiesEnabled: true,
...@@ -162,10 +170,9 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -162,10 +170,9 @@ class _WebErpScreenState extends State<WebErpScreen> {
supportMultipleWindows: true, supportMultipleWindows: true,
blockNetworkLoads: false, blockNetworkLoads: false,
networkAvailable: true, networkAvailable: true,
useShouldInterceptRequest:true, useShouldInterceptRequest: true,
hardwareAcceleration: true hardwareAcceleration: true,
// Enable camera access // Enable camera access
), ),
ios: IOSInAppWebViewOptions( ios: IOSInAppWebViewOptions(
...@@ -181,7 +188,7 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -181,7 +188,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
mediaPlaybackRequiresUserGesture: true, mediaPlaybackRequiresUserGesture: true,
), ),
), ),
androidOnPermissionRequest: ( androidOnPermissionRequest: (
InAppWebViewController controller, InAppWebViewController controller,
String origin, String origin,
...@@ -199,9 +206,22 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -199,9 +206,22 @@ class _WebErpScreenState extends State<WebErpScreen> {
); );
}, },
keepAlive: InAppWebViewKeepAlive(), keepAlive: InAppWebViewKeepAlive(),
onWebViewCreated: (controller) { onWebViewCreated: (controller) {
_webViewController = controller; _webViewController = controller;
_controller.complete(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( _webViewController!.addJavaScriptHandler(
handlerName: 'MobileAppJavascriptInterface', handlerName: 'MobileAppJavascriptInterface',
callback: (args) { callback: (args) {
...@@ -221,6 +241,7 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -221,6 +241,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
'', '',
'application/octet-stream', 'application/octet-stream',
'', '',
// controller,context
); );
} }
}, },
...@@ -257,26 +278,36 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -257,26 +278,36 @@ class _WebErpScreenState extends State<WebErpScreen> {
geolocationEnabled: true, geolocationEnabled: true,
useOnDownloadStart: true, useOnDownloadStart: true,
allowsLinkPreview: true, allowsLinkPreview: true,
databaseEnabled: true, // Enables the WebView database databaseEnabled: true,
// Enables the WebView database
clearSessionCache: true, clearSessionCache: true,
mediaType: "image/*,application/pdf", mediaType: "image/*,application/pdf",
useShouldInterceptRequest:true, useShouldInterceptRequest: true,
hardwareAcceleration: true hardwareAcceleration: true,
), ),
shouldInterceptRequest: (controller, request) async { shouldInterceptRequest: (controller, request) async {
final url = request.url.toString(); final url = request.url.toString();
print('Intercepting request: $url, Headers: ${request.headers}'); print(
'Intercepting request: $url, Headers: ${request.headers}',
);
if (url.endsWith('.pdf')) { if (url.endsWith('.pdf')) {
final response = await http.get(Uri.parse(url), headers: { final response = await http.get(
'Accept': 'application/pdf', Uri.parse(url),
}); headers: {'Accept': 'application/pdf'},
if (response.statusCode == 200 && response.headers['content-type']?.contains('application/pdf') == true) { );
if (response.statusCode == 200 &&
response.headers['content-type']?.contains(
'application/pdf',
) ==
true) {
return WebResourceResponse( return WebResourceResponse(
contentType: 'application/pdf', contentType: 'application/pdf',
data: response.bodyBytes, data: response.bodyBytes,
); );
} else { } 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; return null;
...@@ -289,11 +320,19 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -289,11 +320,19 @@ class _WebErpScreenState extends State<WebErpScreen> {
print("urib scgefes"); print("urib scgefes");
print(uri); print(uri);
print(uri.scheme); print(uri.scheme);
if (uri.toString().contains('file_viewer_n ame.php') && uri.toString().contains('.pdf')) { if (uri.toString().contains(
final pdfPath = Uri.parse(uri.toString()).queryParameters['file_path']; 'file_viewer_n ame.php',
) &&
uri.toString().contains('.pdf')) {
final pdfPath =
Uri.parse(
uri.toString(),
).queryParameters['file_path'];
if (pdfPath != null) { if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath'; 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; return NavigationActionPolicy.CANCEL;
} }
} }
...@@ -328,14 +367,16 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -328,14 +367,16 @@ class _WebErpScreenState extends State<WebErpScreen> {
// } // }
return NavigationActionPolicy.ALLOW; return NavigationActionPolicy.ALLOW;
}, },
onLoadStop: (controller, url) async { 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 uri = Uri.parse(url.toString());
final pdfPath = uri.queryParameters['file_path']; final pdfPath = uri.queryParameters['file_path'];
if (pdfPath != null) { if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath'; final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
await controller.evaluateJavascript(source: ''' await controller.evaluateJavascript(
source: '''
var pdfjsLib = window.pdfjsLib || document.createElement('script'); var pdfjsLib = window.pdfjsLib || document.createElement('script');
pdfjsLib.src = 'https://mozilla.github.io/pdf.js/build/pdf.js'; pdfjsLib.src = 'https://mozilla.github.io/pdf.js/build/pdf.js';
document.head.appendChild(pdfjsLib); document.head.appendChild(pdfjsLib);
...@@ -357,7 +398,8 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -357,7 +398,8 @@ class _WebErpScreenState extends State<WebErpScreen> {
console.error('PDF.js error: ' + error); console.error('PDF.js error: ' + error);
}); });
}; };
'''); ''',
);
} }
} }
pullToRefreshController?.endRefreshing(); pullToRefreshController?.endRefreshing();
...@@ -390,21 +432,33 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -390,21 +432,33 @@ class _WebErpScreenState extends State<WebErpScreen> {
// .then((data) => {debugPrint(data)}); // .then((data) => {debugPrint(data)});
// //
// }, // },
onDownloadStartRequest: ( onDownloadStartRequest: (
controller, controller,
downloadStartRequest, downloadStartRequest,
) async { ) 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) { if (Platform.isAndroid) {
await _handleDownload( await _handleDownload(
downloadStartRequest.url.toString(), downloadStartRequest.url.toString(),
downloadStartRequest.suggestedFilename!, downloadStartRequest.suggestedFilename!,
downloadStartRequest.mimeType ?? downloadStartRequest.mimeType!,
'application/octet-stream',
downloadStartRequest.suggestedFilename ?? '', downloadStartRequest.suggestedFilename ?? '',
// controller,context
); );
} }
}, },
), ),
if (isLoading) ...[ if (isLoading) ...[
Container( Container(
...@@ -433,7 +487,7 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -433,7 +487,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
), ),
), ),
), ),
// SvgPicture.asset("/assets/images/NutsLoader.gif") // SvgPicture.asset("/assets/images/NutsLoader.gif")
], ],
), ),
...@@ -449,13 +503,150 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -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( Future<void> _handleDownload(
String url, String url,
String contentDisposition, String contentDisposition,
String mimeType, String mimeType,
String suggestedFilename, String suggestedFilename,
) async { ) async {
print("mimeType4: $mimeType");
print("mimeType4: $suggestedFilename");
// Request notification permission for Android 13+ // Request notification permission for Android 13+
if (Platform.isIOS) { if (Platform.isIOS) {
_handleIOSDownload(url, suggestedFilename); _handleIOSDownload(url, suggestedFilename);
......
import 'package:auto_size_text/auto_size_text.dart';
import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
...@@ -54,7 +55,46 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -54,7 +55,46 @@ class _AccountledgerState extends State<Accountledger> {
totalDebit += debit; totalDebit += debit;
} }
overallBalance = totalDebit - totalCredit; overallBalance = totalDebit - totalCredit;
var headings = [
"Name",
"Address",
"Account Holder Name",
"Account Number",
];
var headings2 = [
"Bank Name",
"Bank Branch Name",
"Bank IFSC Code",
"Bank UPI ID",
"State",
"District",
"Sub Locality"
];
var values = [
provider.acDetails.name,
provider.acDetails.address,
provider.acDetails.bankAccountHolderName,
provider.acDetails.bankAccountNumber,
];
var values2 = [
provider.acDetails.bankName,
provider.acDetails.bankBranchName,
provider.acDetails.bankIfscCode,
provider.acDetails.bankUpiId,
provider.acDetails.state,
provider.acDetails.district,
provider.acDetails.subLocality,
];
var totalHeadings = [...headings];
var totalValues = [...values];
if (provider.showMoreDetails) {
totalHeadings = [...headings, ...headings2];
totalValues = [...values, ...values2];
}
return WillPopScope( return WillPopScope(
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
...@@ -76,7 +116,7 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -76,7 +116,7 @@ class _AccountledgerState extends State<Accountledger> {
children: [ children: [
SvgPicture.asset("assets/svg/fin_ic.svg",height: 12,), SvgPicture.asset("assets/svg/fin_ic.svg",height: 12,),
SizedBox(width: 5,), SizedBox(width: 5,),
Text("${overallBalance.toString()}"??"-",style: TextStyle( Text("${provider.balanceDetails.balance.toString()}"??"-",style: TextStyle(
fontSize: 12, fontSize: 12,
),) ),)
], ],
...@@ -85,11 +125,13 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -85,11 +125,13 @@ class _AccountledgerState extends State<Accountledger> {
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5), padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5),
child: InkResponse( child: GestureDetector(
onTap: () { onTap: () {
print("Tapped");
_showFilterSheet(context); _showFilterSheet(context);
}, },
child: SvgPicture.asset("assets/svg/filter_ic.svg", height: 25), child: SvgPicture.asset("assets/svg/search_ic.svg", height: 25),
), ),
), ),
], ],
...@@ -105,101 +147,189 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -105,101 +147,189 @@ class _AccountledgerState extends State<Accountledger> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container(
decoration: BoxDecoration( Padding(
color: Colors.white, padding: const EdgeInsets.all(8.0),
borderRadius: BorderRadius.circular(16), child: Text("${provider.selectedAcVal??""}" +" "+ "Account Ledger List"),
), ),
child: Row( if(provider.ledgerList.isEmpty)...[
children: [ Emptywidget(context),
Expanded( ]else...[
child: Container( Container(
padding: EdgeInsets.symmetric( decoration: BoxDecoration(
horizontal: 10, color: Colors.white,
vertical: 15, borderRadius: BorderRadius.circular(16),
), ),
margin: EdgeInsets.symmetric( child: Row(
horizontal: 10, children: [
vertical: 15, Expanded(
), child: Container(
decoration: BoxDecoration( padding: EdgeInsets.symmetric(
color: Color(0xFFFFEFEF), horizontal: 10,
borderRadius: BorderRadius.circular(16), vertical: 15,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
decoration: BoxDecoration(
color: Color(0xFFFFEFEF),
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AutoSizeText(
"${provider.balanceDetails.totalCredit}",
style: TextStyle(
color: Color(0xFFED3424),
fontFamily: "JakartaRegular",
fontSize: 20,
),
minFontSize: 20,
maxFontSize: 25,
),
Text(
"credit",
style: TextStyle(color: Color(0xFF818181)),
),
],
),
), ),
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, Expanded(
children: [ child: Container(
RichText( padding: EdgeInsets.symmetric(
text: TextSpan( horizontal: 10,
children: [ vertical: 15,
TextSpan( ),
text: "₹${totalCredit}", margin: EdgeInsets.symmetric(
style: TextStyle( horizontal: 10,
color: Color(0xFFED3424), vertical: 15,
fontFamily: "JakartaRegular", ),
fontSize: 25, decoration: BoxDecoration(
), color: Color(0xFFFFEFEF),
), borderRadius: BorderRadius.circular(16),
], ),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AutoSizeText(
"${provider.balanceDetails.totalDebit}",
style: TextStyle(
color: Color(0xFFED3424),
fontFamily: "JakartaRegular",
fontSize: 20,
),
minFontSize: 20,
maxFontSize: 25,
), ),
), Text(
Text( "debit",
"credit", style: TextStyle(color: Color(0xFF818181)),
style: TextStyle(color: Color(0xFF818181)), ),
), ],
], ),
), ),
), ),
],
),
),
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
child: Text(
"Account Details",
style: TextStyle(
fontFamily: "JakartaMedium",
color: Color(0xFF818181),
), ),
Expanded( ),
child: Container( ),
padding: EdgeInsets.symmetric( Container(
horizontal: 10, padding: EdgeInsets.symmetric(
vertical: 15, horizontal: 10,
), vertical: 10,
margin: EdgeInsets.symmetric( ),
horizontal: 10, margin: EdgeInsets.symmetric(
vertical: 15, horizontal: 10,
), vertical: 10,
decoration: BoxDecoration( ),
color: Color(0xFFFFEFEF), decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), color: Colors.white,
), borderRadius: BorderRadius.circular(16),
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.center,
RichText( children: [
text: TextSpan(
children: [ ...List.generate(totalHeadings.length, (index) {
TextSpan(
text: "₹${totalDebit}",
style: TextStyle( return Container(
color: Color(0xFFED3424), padding: EdgeInsets.symmetric(
fontFamily: "JakartaRegular", horizontal: 10,
fontSize: 25, vertical: 5,
), ),
child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
"${totalHeadings[index]}",
style: TextStyle(
fontFamily: "JakartaMedium",
), ),
], ),
), ),
),
Text( Expanded(
"debit", child: Text(
style: TextStyle(color: Color(0xFF818181)), "${totalValues[index]}",
),
], style: TextStyle(
color: Color(0xFF818181),
),
),
),
],
),
);
}),
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,
),
),
],
),
), ),
), ),
), ],
], ),
), ),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("${provider.selectedAcVal??""}" +" "+ "Account Ledger List"),
),
if(provider.ledgerList.isEmpty)...[
Emptywidget(context),
]else...[
ListView.builder( ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
...@@ -352,30 +482,30 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -352,30 +482,30 @@ class _AccountledgerState extends State<Accountledger> {
thickness: 0.5, thickness: 0.5,
color: Color(0xFFd7d7d7), color: Color(0xFFd7d7d7),
), ),
Row( // Row(
children: [ // children: [
Expanded( // Expanded(
child: Text( // child: Text(
"Balance", // "Balance",
style: TextStyle( // style: TextStyle(
fontSize: 13, // fontSize: 13,
color: Color(0xFF2d2d2d), // color: Color(0xFF2d2d2d),
), // ),
), // ),
), // ),
Expanded( // Expanded(
child: Text( // child: Text(
textAlign: TextAlign.right, // textAlign: TextAlign.right,
"₹${running_balance.toString()}" ?? // "₹${running_balance.toString()}" ??
"-", // "-",
style: TextStyle( // style: TextStyle(
color: Color(0xFF818181), // color: Color(0xFF818181),
fontSize: 13, // fontSize: 13,
), // ),
), // ),
), // ),
], // ],
), // ),
InkResponse( InkResponse(
onTap: () async { onTap: () async {
Navigator.push( Navigator.push(
...@@ -457,6 +587,7 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -457,6 +587,7 @@ class _AccountledgerState extends State<Accountledger> {
child: Consumer<Accountledgerprovider>( child: Consumer<Accountledgerprovider>(
builder: (context, provider, child) { builder: (context, provider, child) {
return Container( return Container(
height: MediaQuery.of(context).size.height*0.35,
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom, bottom: MediaQuery.of(context).viewInsets.bottom,
), ),
...@@ -532,8 +663,9 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -532,8 +663,9 @@ class _AccountledgerState extends State<Accountledger> {
provider.selectedAcId provider.selectedAcId
.toString(), .toString(),
); );
Navigator.pop(context);
provider.ledgerlistAPI(context); provider.ledgerlistAPI(context);
Navigator.pop(context);
} }
} }
}, },
......
...@@ -335,6 +335,7 @@ class _AccountslistState extends State<Accountslist> { ...@@ -335,6 +335,7 @@ class _AccountslistState extends State<Accountslist> {
context, context,
provider.companyNameController, provider.companyNameController,
"Company Name", "Company Name",
"Enter Company Name",
(p0) {}, (p0) {},
TextInputType.text, TextInputType.text,
false, false,
...@@ -347,6 +348,7 @@ class _AccountslistState extends State<Accountslist> { ...@@ -347,6 +348,7 @@ class _AccountslistState extends State<Accountslist> {
context, context,
provider.mobileNumberController, provider.mobileNumberController,
"Mobile Number", "Mobile Number",
"Enter Mobile Number",
(p0) {}, (p0) {},
TextInputType.number, TextInputType.number,
false, false,
......
...@@ -11,7 +11,7 @@ import '../../Models/commonModels/commonAccountdetailsResponse.dart'; ...@@ -11,7 +11,7 @@ import '../../Models/commonModels/commonAccountdetailsResponse.dart';
class Accountslistdetails extends StatefulWidget { class Accountslistdetails extends StatefulWidget {
final accountID; final accountID;
const Accountslistdetails({super.key, this.accountID}); const Accountslistdetails({super.key,required this.accountID});
@override @override
State<Accountslistdetails> createState() => _AccountslistdetailsState(); State<Accountslistdetails> createState() => _AccountslistdetailsState();
...@@ -244,7 +244,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> { ...@@ -244,7 +244,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
SizedBox(width: 15), SizedBox(width: 15),
Expanded( Expanded(
child: Text( child: Text(
subHeadings[j] ?? "-", subHeadings[j]==""?"-": subHeadings[j] ?? "-",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
fontSize: 14, fontSize: 14,
......
...@@ -14,7 +14,8 @@ import 'package:generp/Models/commonModels/SubLocationsResponse.dart'; ...@@ -14,7 +14,8 @@ import 'package:generp/Models/commonModels/SubLocationsResponse.dart';
import '../../Models/commonModels/commonAddAccountsViewResponse.dart'; import '../../Models/commonModels/commonAddAccountsViewResponse.dart';
class Addcommonpayment extends StatefulWidget { class Addcommonpayment extends StatefulWidget {
const Addcommonpayment({super.key}); final from;
const Addcommonpayment({super.key,required this.from});
@override @override
State<Addcommonpayment> createState() => _AddcommonpaymentState(); State<Addcommonpayment> createState() => _AddcommonpaymentState();
...@@ -158,6 +159,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -158,6 +159,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
textControllerWidget( textControllerWidget(
context, context,
provider.nameController, provider.nameController,
"Name",
"Enter Name", "Enter Name",
(p0) { (p0) {
provider.updateName(p0); provider.updateName(p0);
...@@ -178,6 +180,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -178,6 +180,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
textControllerWidget( textControllerWidget(
context, context,
provider.mobileController, provider.mobileController,
"Mobile Number",
"Enter Mobile", "Enter Mobile",
(p0) { (p0) {
provider.updateMobile(p0); provider.updateMobile(p0);
...@@ -196,7 +199,22 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -196,7 +199,22 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
10, 10,
), ),
errorWidget(context, provider.mobileError), errorWidget(context, provider.mobileError),
textControllerWidget(
context,
provider.contactPersonController,
"Contact Person Name",
"Enter Contact Person Name",
provider.updateContactPerson,
TextInputType.text,
false,
null,
focusNodes[12],
focusNodes[13],TextInputAction.next
),
errorWidget(
context,
provider.contactPersonError,
),
], ],
), ),
), ),
...@@ -240,387 +258,389 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -240,387 +258,389 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text("State"),
DropdownButtonHideUnderline( Container(
child: Row( margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Text("State"),
child: DropdownButton2<States>( DropdownButtonHideUnderline(
focusNode: focusNodes[2], child: Row(
autofocus: focusNodes[2].hasFocus?true:false, children: [
isExpanded: true, Expanded(
hint: Text( child: DropdownButton2<States>(
'Select State', focusNode: focusNodes[2],
style: TextStyle(fontSize: 14), autofocus: focusNodes[2].hasFocus?true:false,
overflow: TextOverflow.ellipsis, isExpanded: true,
), hint: Text(
items: 'Select State',
provider.states style: TextStyle(fontSize: 14),
.map( overflow: TextOverflow.ellipsis,
(states) =>
DropdownMenuItem<States>(
value: states,
child: Text(
states.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
), ),
) items:
.toList(), provider.states
value: .map(
provider.states.contains( (states) =>
provider.selectedState, DropdownMenuItem<States>(
) value: states,
? provider.selectedState child: Text(
: null, states.name ?? '',
// value: provider.selectedState, style: const TextStyle(
onChanged: (States? value) { fontSize: 14,
if (value != null) { ),
if (provider.states.isNotEmpty) { overflow:
provider.selectedState = value; TextOverflow
print( .ellipsis,
"Selected Complaint Type: ${value.name}, ID: ${value.id}", ),
); ),
provider.selectedStateID = )
value.id!; .toList(),
print( value:
"hfjkshfg" + provider.states.contains(
provider.selectedStateID provider.selectedState,
.toString(), )
); ? provider.selectedState
if (provider.selectedDistricts != : null,
null) { // value: provider.selectedState,
provider.selectedDistricts = null; onChanged: (States? value) {
provider.selectedDistrictId = if (value != null) {
null; if (provider.states.isNotEmpty) {
provider.selectedDistrictValue = provider.selectedState = value;
null; print(
} "Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.selectedStateID =
value.id!;
print(
"hfjkshfg" +
provider.selectedStateID
.toString(),
);
if (provider.selectedDistricts !=
null) {
provider.selectedDistricts = null;
provider.selectedDistrictId =
null;
provider.selectedDistrictValue =
null;
}
provider.getDistrictAPI( provider.getDistrictAPI(
context, context,
provider.selectedStateID, provider.selectedStateID,
); );
} }
} }
}, },
dropdownSearchData: DropdownSearchData( dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50, searchInnerWidgetHeight: 50,
searchController: searchController:
provider.stateSearchController, provider.stateSearchController,
searchInnerWidget: Padding( searchInnerWidget: Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: TextFormField( child: TextFormField(
controller: controller:
provider.stateSearchController, provider.stateSearchController,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
contentPadding: contentPadding:
const EdgeInsets.symmetric( const EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
vertical: 8, vertical: 8,
), ),
hintText: 'Search States...', hintText: 'Search States...',
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: borderRadius:
BorderRadius.circular(8), BorderRadius.circular(8),
),
),
),
), ),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
), ),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.stateSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
searchMatchFn: (item, searchValue) { ],
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.stateSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], errorWidget(context, provider.stateError),
), Text("District"),
), DropdownButtonHideUnderline(
errorWidget(context, provider.stateError), child: Row(
Text("District"), children: [
DropdownButtonHideUnderline( Expanded(
child: Row( child: DropdownButton2<Districts>(
children: [ focusNode: focusNodes[3],
Expanded( isExpanded: true,
child: DropdownButton2<Districts>( hint: Text(
focusNode: focusNodes[3], 'Select District',
isExpanded: true, style: TextStyle(fontSize: 14),
hint: Text( overflow: TextOverflow.ellipsis,
'Select District',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.districts
.map(
(dist) =>
DropdownMenuItem<Districts>(
value: dist,
child: Text(
dist.district ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
), ),
) items:
.toList(), provider.districts
value: .map(
provider.districts.contains( (dist) =>
provider.selectedDistricts, DropdownMenuItem<Districts>(
) value: dist,
? provider.selectedDistricts child: Text(
: null, dist.district ?? '',
// value: provider.selectedDistricts, style: const TextStyle(
onChanged: (Districts? value) { fontSize: 14,
if (value != null) { ),
if (provider.districts.isNotEmpty) { overflow:
provider.selectedDistricts = value; TextOverflow
print("Selected ID: ${value.id}"); .ellipsis,
provider.selectedDistrictId = ),
value.id!; ),
provider.selectedDistrictValue = )
value.district!; .toList(),
print( value:
"hfjkshfg" + provider.districts.contains(
provider.selectedDistrictId provider.selectedDistricts,
.toString(), )
); ? provider.selectedDistricts
if (provider.selectedSubLocations != : null,
null) { // value: provider.selectedDistricts,
provider.selectedSubLocations = onChanged: (Districts? value) {
null; if (value != null) {
provider.selectedSubLocID = null; if (provider.districts.isNotEmpty) {
provider.selectedSubLocValue = provider.selectedDistricts = value;
null; print("Selected ID: ${value.id}");
} provider.selectedDistrictId =
provider.getSubLocationAPI( value.id!;
context, provider.selectedDistrictValue =
provider.selectedDistrictId, value.district!;
); print(
} "hfjkshfg" +
} provider.selectedDistrictId
}, .toString(),
dropdownSearchData: DropdownSearchData( );
searchInnerWidgetHeight: 50, if (provider.selectedSubLocations !=
searchController: null) {
provider.districtSearchController, provider.selectedSubLocations =
searchInnerWidget: Padding( null;
padding: const EdgeInsets.all(8), provider.selectedSubLocID = null;
child: TextFormField( provider.selectedSubLocValue =
controller: null;
provider }
.districtSearchController, provider.getSubLocationAPI(
decoration: InputDecoration( context,
isDense: true, provider.selectedDistrictId,
contentPadding: );
const EdgeInsets.symmetric( }
horizontal: 10, }
vertical: 8, },
), dropdownSearchData: DropdownSearchData(
hintText: 'Search Districts...', searchInnerWidgetHeight: 50,
border: OutlineInputBorder( searchController:
borderRadius: provider.districtSearchController,
BorderRadius.circular(8), searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.districtSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search Districts...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
),
),
),
), ),
searchMatchFn: (item, searchValue) {
return item.value?.district
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
), ),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.districtSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
searchMatchFn: (item, searchValue) { ],
return item.value?.district
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.districtSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], errorWidget(context, provider.districtError),
), Text("Sub Locality"),
), DropdownButtonHideUnderline(
errorWidget(context, provider.districtError), child: Row(
Text("Sub Locality"), children: [
DropdownButtonHideUnderline( Expanded(
child: Row( child: DropdownButton2<SubLocations>(
children: [ focusNode: focusNodes[4],
Expanded( isExpanded: true,
child: DropdownButton2<SubLocations>( hint: Text(
focusNode: focusNodes[4], 'Select Sub Locality',
isExpanded: true, style: TextStyle(fontSize: 14),
hint: Text( overflow: TextOverflow.ellipsis,
'Select Sub Locality',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.subLocations
.map(
(subloc) => DropdownMenuItem<
SubLocations
>(
value: subloc,
child: Text(
subloc.subLocality ?? '',
style: const TextStyle(
fontSize: 14,
), ),
overflow: items:
TextOverflow.ellipsis, provider.subLocations
), .map(
), (subloc) => DropdownMenuItem<
) SubLocations
.toList(), >(
// value: provider.selectedSubLocations, value: subloc,
value: child: Text(
provider.subLocations.contains( subloc.subLocality ?? '',
provider.selectedSubLocations, style: const TextStyle(
) fontSize: 14,
? provider.selectedSubLocations ),
: null, overflow:
onChanged: (SubLocations? value) { TextOverflow.ellipsis,
if (value != null) { ),
if (provider
.subLocations
.isNotEmpty) {
provider.selectedSubLocations =
value;
print("Selected ID: ${value.id}");
provider.selectedSubLocID =
value.id!;
provider.selectedSubLocValue =
value.subLocality!;
print(
"hfjkshfg" +
provider.selectedSubLocID
.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.subLocSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider.subLocSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
), ),
hintText: )
'Search Sub Locality...', .toList(),
border: OutlineInputBorder( // value: provider.selectedSubLocations,
borderRadius: value:
BorderRadius.circular(8), provider.subLocations.contains(
provider.selectedSubLocations,
)
? provider.selectedSubLocations
: null,
onChanged: (SubLocations? value) {
if (value != null) {
if (provider
.subLocations
.isNotEmpty) {
provider.selectedSubLocations =
value;
print("Selected ID: ${value.id}");
provider.selectedSubLocID =
value.id!;
provider.selectedSubLocValue =
value.subLocality!;
print(
"hfjkshfg" +
provider.selectedSubLocID
.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.subLocSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider.subLocSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText:
'Search Sub Locality...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
),
),
),
), ),
searchMatchFn: (item, searchValue) {
return item.value?.subLocality
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
), ),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.subLocSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
searchMatchFn: (item, searchValue) { ],
return item.value?.subLocality
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.subLocSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], errorWidget(context, provider.localityError),
), textControllerWidget(
), context,
errorWidget(context, provider.localityError), provider.addressController,
textControllerWidget( "Address",
context, "Enter Address",
provider.addressController, provider.updateAddress,
"Enter Address", TextInputType.text,
provider.updateAddress, false,
TextInputType.text, null,
false, focusNodes[5],
null, null,
focusNodes[5], TextInputAction.done,
null,
TextInputAction.done,
), ),
errorWidget(context, provider.addressError), errorWidget(context, provider.addressError),
Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text( Text(
"Bank Details", "Bank Details",
style: TextStyle( style: TextStyle(
...@@ -633,6 +653,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -633,6 +653,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.bankNameController, provider.bankNameController,
"Bank Name", "Bank Name",
"Enter Bank Name",
provider.updateBankName, provider.updateBankName,
TextInputType.text, TextInputType.text,
false, false,
...@@ -649,6 +670,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -649,6 +670,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.branchNameController, provider.branchNameController,
"Bank Branch", "Bank Branch",
"Enter Bank Branch",
provider.updateBankBranch, provider.updateBankBranch,
TextInputType.text, TextInputType.text,
false, false,
...@@ -663,6 +685,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -663,6 +685,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.bankIfscCotroller, provider.bankIfscCotroller,
"Bank IFSC", "Bank IFSC",
"Enter Bank IFSC",
provider.updateIFSC, provider.updateIFSC,
TextInputType.text, TextInputType.text,
false, false,
...@@ -678,6 +701,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -678,6 +701,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.bankHolderNameController, provider.bankHolderNameController,
"Bank Holder Name", "Bank Holder Name",
"Enter Bank Holder Name",
provider.updateHolder, provider.updateHolder,
TextInputType.text, TextInputType.text,
false, false,
...@@ -693,6 +717,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -693,6 +717,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.bankAcNumberController, provider.bankAcNumberController,
"Bank Account Number", "Bank Account Number",
"Enter Bank Account Number",
provider.updateNumber, provider.updateNumber,
TextInputType.number, TextInputType.number,
false, false,
...@@ -708,6 +733,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -708,6 +733,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.bankUpiController, provider.bankUpiController,
"Bank UPI ID", "Bank UPI ID",
"Enter Bank UPI ID",
provider.updateUPI, provider.updateUPI,
TextInputType.text, TextInputType.text,
false, false,
...@@ -745,26 +771,13 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -745,26 +771,13 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
), ),
), ),
textControllerWidget(
context,
provider.contactPersonController,
"Contact Person Name",
provider.updateContactPerson,
TextInputType.text,
false,
null,
focusNodes[12],
focusNodes[13],TextInputAction.next
),
errorWidget(
context,
provider.contactPersonError,
),
textControllerWidget( textControllerWidget(
context, context,
provider provider
.contectPersonDesignationController, .contectPersonDesignationController,
"Contact Person Designation", "Contact Person Designation",
"Enter Contact Person Designation",
provider.updateDesignation, provider.updateDesignation,
TextInputType.text, TextInputType.text,
false, false,
...@@ -780,6 +793,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -780,6 +793,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.contectPersonAltMobController, provider.contectPersonAltMobController,
"Alternative Mobile Number", "Alternative Mobile Number",
"Enter Alternative Mobile Number",
(p0) { (p0) {
provider.updateAltMobile(p0); provider.updateAltMobile(p0);
provider.checkInputsAPI( provider.checkInputsAPI(
...@@ -805,6 +819,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -805,6 +819,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.contectPersonTeleController, provider.contectPersonTeleController,
"Telephone Number", "Telephone Number",
"Enter Telephone Number",
provider.updateTeleMobile, provider.updateTeleMobile,
TextInputType.number, TextInputType.number,
false, false,
...@@ -817,6 +832,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -817,6 +832,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
context, context,
provider.contectPersonMailController, provider.contectPersonMailController,
"Customer Mail ID", "Customer Mail ID",
"Enter Customer Mail ID",
provider.updateMail, provider.updateMail,
TextInputType.text, TextInputType.text,
false, false,
...@@ -845,7 +861,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{ ...@@ -845,7 +861,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment>{
? null ? null
: () { : () {
provider.submitClickced = true; provider.submitClickced = true;
provider.submitCommonAccountsAPI(context); provider.submitCommonAccountsAPI(context,widget.from);
}, },
child: Container( child: Container(
height: 45, height: 45,
......
...@@ -96,7 +96,7 @@ class _CommondashboardState extends State<Commondashboard> { ...@@ -96,7 +96,7 @@ class _CommondashboardState extends State<Commondashboard> {
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => Addcommonpayment()), MaterialPageRoute(builder: (context) => Addcommonpayment(from: "Dashboard",)),
); );
}, },
child: Container( child: Container(
......
...@@ -36,7 +36,7 @@ Dropdowntheme ddtheme = Dropdowntheme(); ...@@ -36,7 +36,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
TextWidget(context, "Appointment Details"), // TextWidget(context, "Appointment Details"),
ListView.builder( ListView.builder(
itemCount: quotationDetails.length, itemCount: quotationDetails.length,
shrinkWrap: true, shrinkWrap: true,
...@@ -304,6 +304,7 @@ Dropdowntheme ddtheme = Dropdowntheme(); ...@@ -304,6 +304,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
textControllerWidget( textControllerWidget(
context, context,
provider.noteController, provider.noteController,
"Note",
"Enter Note", "Enter Note",
provider.onChangeNote, provider.onChangeNote,
TextInputType.text, TextInputType.text,
......
...@@ -31,7 +31,7 @@ class _FollowUpDetailsState extends State<FollowUpDetails> { ...@@ -31,7 +31,7 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
TextWidget(context, "Followup Details"), // TextWidget(context, "Followup Details"),
ListView.builder( ListView.builder(
itemCount: followupDetails.length, itemCount: followupDetails.length,
shrinkWrap: true, shrinkWrap: true,
...@@ -53,23 +53,17 @@ class _FollowUpDetailsState extends State<FollowUpDetails> { ...@@ -53,23 +53,17 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
...List.generate(7, (j) { ...List.generate(4, (j) {
final textheads = [ final textheads = [
"Employee Name", "Employee Name",
"Date", "Date and Time",
"Type", "Type",
"In Time",
"Out Time",
"Status",
"Feedback", "Feedback",
]; ];
final textSubheads = [ final textSubheads = [
followupDetails[index].ename ?? "-", followupDetails[index].ename ?? "-",
followupDetails[index].fdate ?? "-", "${followupDetails[index].fdate ?? "-"}, ${followupDetails[index].finTime ?? "-"}",
followupDetails[index].ftype ?? "-", followupDetails[index].ftype ?? "-",
followupDetails[index].finTime ?? "-",
followupDetails[index].foutTime ?? "-",
followupDetails[index].fstatus ?? "-",
followupDetails[index].ffeedback ?? "-", followupDetails[index].ffeedback ?? "-",
]; ];
return Container( return Container(
...@@ -114,33 +108,7 @@ class _FollowUpDetailsState extends State<FollowUpDetails> { ...@@ -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> { ...@@ -49,6 +49,55 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
builder: (context, provider, child) { builder: (context, provider, child) {
var leadDetails = provider.leadDetails; 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( return WillPopScope(
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
...@@ -145,7 +194,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -145,7 +194,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
], ],
), ),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)), Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) { ...List.generate(totalSubHeadings.length, (j) {
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 7), padding: EdgeInsets.symmetric(vertical: 7),
child: Row( child: Row(
...@@ -153,7 +202,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -153,7 +202,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
provider.Headings[j], totalHeadings[j],
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
fontSize: 14, fontSize: 14,
...@@ -164,16 +213,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -164,16 +213,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded( Expanded(
child: InkResponse( child: InkResponse(
child: child:
provider.Headings[j] == "Lead Age" totalHeadings[j] == "Lead Age"
? Tooltip( ? Tooltip(
triggerMode: TooltipTriggerMode.tap, triggerMode: TooltipTriggerMode.tap,
message: message:
"${provider.leadDetails.createdDatetime}", "${provider.leadDetails.createdDatetime}",
child: Text( child: Text(
provider.subHeadings[j] == "" totalSubHeadings[j] == ""
? "-" ? "-"
: provider.subHeadings[j], : totalSubHeadings[j],
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF818181), color: Color(0xFF818181),
...@@ -185,9 +234,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -185,9 +234,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
) )
: Text( : Text(
provider.subHeadings[j] == "" totalSubHeadings[j] == ""
? "-" ? "-"
: provider.subHeadings[j], : totalSubHeadings[j],
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF818181), color: Color(0xFF818181),
...@@ -199,6 +248,33 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -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> { ...@@ -229,6 +305,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return SafeArea( return SafeArea(
child: Consumer<crmLeadDetailsProvider>( child: Consumer<crmLeadDetailsProvider>(
builder: (context, provider, child) { 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( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
bottom: 15, bottom: 15,
...@@ -243,21 +335,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -243,21 +335,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [ children: [
SizedBox(height: 15), SizedBox(height: 15),
...List.generate(5, (index) { ...List.generate(assetnames.length, (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",
];
return ListTile( return ListTile(
onTap: () { onTap: () {
switch (index) { switch (index) {
...@@ -309,6 +388,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -309,6 +388,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
builder: builder:
(context) => QuotationDetails( (context) => QuotationDetails(
leadID: provider.leadDetails.id, leadID: provider.leadDetails.id,
mode: widget.mode,
), ),
), ),
); );
...@@ -328,6 +408,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -328,6 +408,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
); );
}), }),
], ],
), ),
), ),
......
...@@ -19,8 +19,14 @@ import '../commonDateRangeFilter.dart'; ...@@ -19,8 +19,14 @@ import '../commonDateRangeFilter.dart';
class Leadlistbymode extends StatefulWidget { class Leadlistbymode extends StatefulWidget {
final pageTitleName; final pageTitleName;
final mode; final mode;
final filter;
const Leadlistbymode({super.key, this.pageTitleName, this.mode}); const Leadlistbymode({
super.key,
required this.pageTitleName,
required this.mode,
this.filter,
});
@override @override
State<Leadlistbymode> createState() => _LeadlistbymodeState(); State<Leadlistbymode> createState() => _LeadlistbymodeState();
...@@ -28,6 +34,7 @@ class Leadlistbymode extends StatefulWidget { ...@@ -28,6 +34,7 @@ class Leadlistbymode extends StatefulWidget {
class _LeadlistbymodeState extends State<Leadlistbymode> { class _LeadlistbymodeState extends State<Leadlistbymode> {
Dropdowntheme ddtheme = Dropdowntheme(); Dropdowntheme ddtheme = Dropdowntheme();
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
...@@ -35,27 +42,42 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -35,27 +42,42 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<Leadlistprovider>(context, listen: false); final provider = Provider.of<Leadlistprovider>(context, listen: false);
provider.crmLeadListViewAPIFunction(context, widget.mode); provider.crmLeadListViewAPIFunction(context, widget.mode);
provider.crmLeadListAPIFunction( if (widget.filter != null) {
context, provider.crmLeadListAPIFunction(
widget.mode, context,
"", widget.mode,
"", "",
"", widget.filter!.status,
"", widget.filter!.openStatus,
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
); "",
);
} else {
provider.crmLeadListAPIFunction(
context,
widget.mode,
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
);
}
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<Leadlistprovider>( return Consumer<Leadlistprovider>(
builder: (context, provider, child) { builder: (context, provider, child) {
final crmLists = provider.crmLeadList; final crmLists = provider.crmLeadList;
...@@ -228,7 +250,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -228,7 +250,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
Expanded( Expanded(
child: Text( child: Text(
subHeadings[j]??"-", subHeadings[j] ?? "-",
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF818181), color: Color(0xFF818181),
...@@ -245,13 +267,14 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -245,13 +267,14 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => (context) => LeadDetailsByMode(
LeadDetailsByMode(
pageTitleName: pageTitleName:
widget widget.pageTitleName,
.pageTitleName,
mode: widget.mode, mode: widget.mode,
leadId:provider.crmLeadList[index].leadid, leadId:
provider
.crmLeadList[index]
.leadid,
), ),
), ),
); );
...@@ -289,8 +312,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -289,8 +312,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
), ),
) )
: : Emptywidget(context),
Emptywidget(context),) ),
), ),
); );
}, },
...@@ -319,7 +342,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -319,7 +342,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
right: 15, right: 15,
top: 10, top: 10,
), ),
padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom,), padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -343,64 +368,78 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -343,64 +368,78 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
context, context,
provider.sLeadIDController, provider.sLeadIDController,
"Lead ID", "Lead ID",
"Enter Lead ID",
provider.onChangedLeadId, provider.onChangedLeadId,
TextInputType.text, TextInputType.text,
false, false,
null, null,
), ),
if(widget.mode!="executive")...[ if (widget.mode != "executive") ...[
TextWidget(context, "Employee"), TextWidget(context, "Employee"),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: DropdownButton2<Employees>( child: DropdownButton2<Employees>(
hint: Text( hint: Text(
"Select Source", "Select Source",
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.employeesList provider.employeesList
.map( .map(
(slist) => (slist) =>
DropdownMenuItem<Employees>( DropdownMenuItem<Employees>(
value: slist, value: slist,
child: Text( child: Text(
slist.name!, slist.name!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value:provider.employeesList.contains(provider.selectedEmployees) value:
? provider.selectedEmployees provider.employeesList.contains(
: null, provider.selectedEmployees,
)
? provider.selectedEmployees
: null,
// value: provider.selectedEmployees, // value: provider.selectedEmployees,
onChanged: (Employees? value) { onChanged: (Employees? value) {
if (value != null) { if (value != null) {
if(provider.employeesList.isNotEmpty){ if (provider
provider.selectedEmployees = value; .employeesList
provider.selectedEmployeeId = value!.id!; .isNotEmpty) {
provider.selectedEmployeeValue = value!.name!; provider.selectedEmployees = value;
provider.crmLeadListSourceOnReferenceAPIFunction(context, widget.mode, provider.selectedSourceId); provider.selectedEmployeeId =
value!.id!;
provider.selectedEmployeeValue =
value!.name!;
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
widget.mode,
provider.selectedSourceId,
);
}
} }
},
} isExpanded: true,
}, buttonStyleData: ddtheme.buttonStyleData,
isExpanded: true, iconStyleData: ddtheme.iconStyleData,
buttonStyleData: ddtheme.buttonStyleData, menuItemStyleData:
iconStyleData: ddtheme.iconStyleData, ddtheme.menuItemStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, dropdownStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.dropdownStyleData,
),
), ),
), ],
], ),
), ),
), ],
],
TextWidget(context, "Lead Status"), TextWidget(context, "Lead Status"),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: Row( child: Row(
...@@ -412,20 +451,20 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -412,20 +451,20 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.leadStatusList provider.leadStatusList
.map( .map(
(leadStatus) => (leadStatus) =>
DropdownMenuItem<String>( DropdownMenuItem<String>(
value: leadStatus, value: leadStatus,
child: Text( child: Text(
leadStatus!, leadStatus!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value: provider.selectedLeadStatus, value: provider.selectedLeadStatus,
onChanged: (String? value) { onChanged: (String? value) {
if (value != null) { if (value != null) {
...@@ -435,8 +474,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -435,8 +474,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -454,20 +495,20 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -454,20 +495,20 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.openStatusList provider.openStatusList
.map( .map(
(leadStatus) => (leadStatus) =>
DropdownMenuItem<String>( DropdownMenuItem<String>(
value: leadStatus, value: leadStatus,
child: Text( child: Text(
leadStatus!, leadStatus!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value: provider.selectedOpenStatus, value: provider.selectedOpenStatus,
onChanged: (String? value) { onChanged: (String? value) {
if (value != null) { if (value != null) {
...@@ -477,8 +518,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -477,8 +518,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -488,6 +531,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -488,6 +531,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
context, context,
provider.mobileNumberController, provider.mobileNumberController,
"Mobile Number", "Mobile Number",
"Enter Mobile Number",
provider.onChangedMobileNum, provider.onChangedMobileNum,
TextInputType.number, TextInputType.number,
false, false,
...@@ -497,6 +541,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -497,6 +541,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
context, context,
provider.companyNameController, provider.companyNameController,
"Company Name", "Company Name",
"Enter Company Name",
provider.onChangedCompanyName, provider.onChangedCompanyName,
TextInputType.text, TextInputType.text,
false, false,
...@@ -514,37 +559,45 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -514,37 +559,45 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.sourcesList provider.sourcesList
.map( .map(
(slist) => (slist) =>
DropdownMenuItem<Sources>( DropdownMenuItem<Sources>(
value: slist, value: slist,
child: Text( child: Text(
slist.name!, slist.name!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value: provider.selectedSources, value: provider.selectedSources,
onChanged: (Sources? value) { onChanged: (Sources? value) {
if (value != null) { if (value != null) {
if(provider.sourcesList.isNotEmpty){ if (provider.sourcesList.isNotEmpty) {
provider.selectedSources = value; provider.selectedSources = value;
provider.selectedSourceId = value!.id!; provider.selectedSourceId =
provider.selectedSourceValue = value!.name!; value!.id!;
provider.crmLeadListSourceOnReferenceAPIFunction(context, widget.mode, provider.selectedSourceId); provider.selectedSourceValue =
value!.name!;
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
widget.mode,
provider.selectedSourceId,
);
} }
} }
}, },
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -562,36 +615,41 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -562,36 +615,41 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.referencesList provider.referencesList
.map( .map(
(slist) => (slist) =>
DropdownMenuItem<References>( DropdownMenuItem<References>(
value: slist, value: slist,
child: Text( child: Text(
slist.name!, slist.name!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value: provider.selectedReferences, value: provider.selectedReferences,
onChanged: (References? value) { onChanged: (References? value) {
if (value != null) { if (value != null) {
if(provider.referencesList.isNotEmpty){ if (provider
.referencesList
.isNotEmpty) {
provider.selectedReferences = value; provider.selectedReferences = value;
provider.selectedReferenceId = value!.id!; provider.selectedReferenceId =
provider.selectedReferenceValue = value!.name!; value!.id!;
provider.selectedReferenceValue =
value!.name!;
} }
} }
}, },
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -609,37 +667,44 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -609,37 +667,44 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.teamsList provider.teamsList
.map( .map(
(slist) => (slist) =>
DropdownMenuItem<Teams>( DropdownMenuItem<Teams>(
value: slist, value: slist,
child: Text( child: Text(
slist.name!, slist.name!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value: provider.selectedTeams, value: provider.selectedTeams,
onChanged: (Teams? value) { onChanged: (Teams? value) {
if (value != null) { if (value != null) {
if(provider.teamsList.isNotEmpty){ if (provider.teamsList.isNotEmpty) {
provider.selectedTeams = value; provider.selectedTeams = value;
provider.selectedTeamId = value!.id!; provider.selectedTeamId = value!.id!;
provider.selectedTeamValue = value!.name!; provider.selectedTeamValue =
provider.crmLeadListSegmentOnTeamAPIFunction(context, widget.mode, provider.selectedTeamId); value!.name!;
provider
.crmLeadListSegmentOnTeamAPIFunction(
context,
widget.mode,
provider.selectedTeamId,
);
} }
} }
}, },
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -657,36 +722,39 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -657,36 +722,39 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.segmentsList provider.segmentsList
.map( .map(
(slist) => (slist) =>
DropdownMenuItem<Segments>( DropdownMenuItem<Segments>(
value: slist, value: slist,
child: Text( child: Text(
slist.name!, slist.name!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value: provider.selectedSegments, value: provider.selectedSegments,
onChanged: (Segments? value) { onChanged: (Segments? value) {
if (value != null) { if (value != null) {
if(provider.segmentsList.isNotEmpty){ if (provider.segmentsList.isNotEmpty) {
provider.selectedSegments = value; provider.selectedSegments = value;
provider.selectedSegmentId = value!.id!; provider.selectedSegmentId =
provider.selectedSegmentValue = value!.name!; value!.id!;
provider.selectedSegmentValue =
value!.name!;
} }
} }
}, },
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -704,43 +772,52 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -704,43 +772,52 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.statesList provider.statesList
.map( .map(
(slist) => (slist) =>
DropdownMenuItem<States>( DropdownMenuItem<States>(
value: slist, value: slist,
child: Text( child: Text(
slist.name!, slist.name!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value: provider.selectedStates, value: provider.selectedStates,
onChanged: (States? value) { onChanged: (States? value) {
if (value != null) { if (value != null) {
if(provider.statesList.isNotEmpty){ if (provider.statesList.isNotEmpty) {
provider.selectedStates = value; provider.selectedStates = value;
provider.selectedStateId = value!.id!; provider.selectedStateId = value!.id!;
provider.selectedStateValue = value!.name!; provider.selectedStateValue =
if (provider.districtsList.isNotEmpty) { value!.name!;
if (provider
.districtsList
.isNotEmpty) {
provider.districtsList.clear(); provider.districtsList.clear();
provider.selectedDistricts = null; provider.selectedDistricts = null;
provider.selectedDistrictId = null; provider.selectedDistrictId = null;
provider.selectedDistrictValue = ""; provider.selectedDistrictValue = "";
} }
provider.crmLeadListDistrictsOnStateAPIFunction(context, widget.mode, provider.selectedStateId); provider
.crmLeadListDistrictsOnStateAPIFunction(
context,
widget.mode,
provider.selectedStateId,
);
} }
} }
}, },
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -758,46 +835,56 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -758,46 +835,56 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.districtsList provider.districtsList
.map( .map(
(slist) => (slist) =>
DropdownMenuItem<Districts>( DropdownMenuItem<Districts>(
value: slist, value: slist,
child: Text( child: Text(
slist.district!, slist.district!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), ),
) )
.toList(), .toList(),
value: provider.selectedDistricts, value: provider.selectedDistricts,
onChanged: (Districts? value) { onChanged: (Districts? value) {
if (value != null) { if (value != null) {
if(provider.districtsList.isNotEmpty){ if (provider.districtsList.isNotEmpty) {
provider.selectedDistricts = value; provider.selectedDistricts = value;
provider.selectedDistrictId = value!.id!; provider.selectedDistrictId =
provider.selectedDistrictValue = value!.district!; value!.id!;
provider.selectedDistrictValue =
value!.district!;
if (provider if (provider
.subLocationsList .subLocationsList
.isNotEmpty) { .isNotEmpty) {
provider.subLocationsList.clear(); provider.subLocationsList.clear();
provider.selectedSubLocations = provider.selectedSubLocations =
null; null;
provider.selectedSubLocationId = null; provider.selectedSubLocationId =
provider.selectedSubLocationValue = ""; null;
provider.selectedSubLocationValue =
"";
} }
provider.crmLeadListSubLocOnDistrictAPIFunction(context, widget.mode, provider.selectedDistrictId); provider
.crmLeadListSubLocOnDistrictAPIFunction(
context,
widget.mode,
provider.selectedDistrictId,
);
} }
} }
}, },
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -815,36 +902,42 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -815,36 +902,42 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.subLocationsList provider.subLocationsList
.map( .map(
(slist) => (slist) => DropdownMenuItem<
DropdownMenuItem<SubLocations>( SubLocations
value: slist, >(
child: Text( value: slist,
slist.subLocality!, child: Text(
style: TextStyle( slist.subLocality!,
fontSize: 14, style: TextStyle(
fontSize: 14,
),
),
), ),
), )
), .toList(),
)
.toList(),
value: provider.selectedSubLocations, value: provider.selectedSubLocations,
onChanged: (SubLocations? value) { onChanged: (SubLocations? value) {
if (value != null) { if (value != null) {
if(provider.subLocationsList.isNotEmpty){ if (provider
.subLocationsList
.isNotEmpty) {
provider.selectedSubLocations = value; provider.selectedSubLocations = value;
provider.selectedSubLocationId = value!.id!; provider.selectedSubLocationId =
provider.selectedSubLocationValue = value!.subLocality!; value!.id!;
provider.selectedSubLocationValue =
value!.subLocality!;
} }
} }
}, },
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -853,16 +946,30 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -853,16 +946,30 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
InkResponse( InkResponse(
onTap: () { onTap: () {
provider.crmLeadListAPIFunction(context, widget.mode, provider.selectedEmployeeId, provider.crmLeadListAPIFunction(
provider.selectedLeadStatus, provider.selectedOpenStatus, provider.selectedSourceId, provider.selectedReferenceId, context,
provider.selectedTeamId, provider.selectedSegmentId, provider.selectedStateId, provider.selectedDistrictId, provider.selectedSubLocationId); widget.mode,
provider.selectedEmployeeId,
provider.selectedLeadStatus,
provider.selectedOpenStatus,
provider.selectedSourceId,
provider.selectedReferenceId,
provider.selectedTeamId,
provider.selectedSegmentId,
provider.selectedStateId,
provider.selectedDistrictId,
provider.selectedSubLocationId,
);
Navigator.pop(context); Navigator.pop(context);
}, },
child: Container( child: Container(
height: 45, height: 45,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10), margin: EdgeInsets.symmetric(horizontal: 10),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.app_blue, color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
...@@ -876,7 +983,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -876,7 +983,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
), ),
), ),
) ),
], ],
), ),
), ),
......
...@@ -114,7 +114,7 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -114,7 +114,7 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
return StatefulBuilder( return StatefulBuilder(
builder: (context, setState) { builder: (context, setState) {
return SafeArea( return SafeArea(
child: Consumer<Nearbygeneratorsprovider>( child: Consumer<crmNearbyOpenLeadsProvider>(
builder: (context,provider,child) { builder: (context,provider,child) {
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
...@@ -231,31 +231,31 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -231,31 +231,31 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
onChanged: (value) { onChanged: (value) {
provider.currentValue = value; provider.currentValue = value;
provider.debounce(() { 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)); }, 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), SizedBox(height: 30.0),
Container( Container(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
provider.debounce(() { provider.debounce(() {
provider.LoadNearbyGeneratorsAPI(context); provider.LoadNearbyOpenLeadsAPI(context);
Navigator.pop(context); Navigator.pop(context);
}, Duration(milliseconds: 500)); }, Duration(milliseconds: 500));
}, },
......
...@@ -634,6 +634,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -634,6 +634,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
textControllerWidget( textControllerWidget(
context, context,
provider.editCompanyNameController, provider.editCompanyNameController,
"Company Name",
"Enter Company Name", "Enter Company Name",
provider.onChangeCompanyName, provider.onChangeCompanyName,
TextInputType.text, TextInputType.text,
...@@ -847,6 +848,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -847,6 +848,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
context, context,
provider.pincodeController, provider.pincodeController,
"Pincode", "Pincode",
"Enter Pincode",
provider.onChangePincode, provider.onChangePincode,
TextInputType.number, TextInputType.number,
false, false,
...@@ -856,6 +858,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -856,6 +858,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
textControllerWidget( textControllerWidget(
context, context,
provider.addressController, provider.addressController,
"Address",
"Enter Address", "Enter Address",
provider.onChangeAddress, provider.onChangeAddress,
TextInputType.text, TextInputType.text,
......
...@@ -405,6 +405,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> { ...@@ -405,6 +405,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
context, context,
provider.mobileNumberController, provider.mobileNumberController,
"Mobile Number", "Mobile Number",
"Enter Mobile Number",
provider.onChangedMobileNum, provider.onChangedMobileNum,
TextInputType.number, TextInputType.number,
false, false,
...@@ -414,6 +415,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> { ...@@ -414,6 +415,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
context, context,
provider.companyNameController, provider.companyNameController,
"Company Name", "Company Name",
"Enter Company Name",
provider.onChangedCompanyName, provider.onChangedCompanyName,
TextInputType.text, TextInputType.text,
false, false,
......
...@@ -7,7 +7,8 @@ import '../../Utils/commonWidgets.dart'; ...@@ -7,7 +7,8 @@ import '../../Utils/commonWidgets.dart';
class QuotationDetails extends StatefulWidget { class QuotationDetails extends StatefulWidget {
final leadID; final leadID;
const QuotationDetails({super.key,required this.leadID}); final mode;
const QuotationDetails({super.key,required this.leadID,required this.mode});
@override @override
State<QuotationDetails> createState() => _QuotationDetailsState(); State<QuotationDetails> createState() => _QuotationDetailsState();
...@@ -31,7 +32,7 @@ class _QuotationDetailsState extends State<QuotationDetails> { ...@@ -31,7 +32,7 @@ class _QuotationDetailsState extends State<QuotationDetails> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
TextWidget(context, "Quotation Details"), // TextWidget(context, "Quotation Details"),
ListView.builder( ListView.builder(
itemCount: quotationDetails.length, itemCount: quotationDetails.length,
shrinkWrap: true, shrinkWrap: true,
...@@ -112,8 +113,7 @@ class _QuotationDetailsState extends State<QuotationDetails> { ...@@ -112,8 +113,7 @@ class _QuotationDetailsState extends State<QuotationDetails> {
); );
}, },
), ),
SizedBox(height: 150),
SizedBox(height: 75),
], ],
), ),
), ),
...@@ -122,8 +122,8 @@ class _QuotationDetailsState extends State<QuotationDetails> { ...@@ -122,8 +122,8 @@ class _QuotationDetailsState extends State<QuotationDetails> {
floatingActionButton: Align( floatingActionButton: Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: InkWell( child: InkWell(
onTap: () { onTap: () async {
Navigator.push( var res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
...@@ -131,6 +131,9 @@ class _QuotationDetailsState extends State<QuotationDetails> { ...@@ -131,6 +131,9 @@ class _QuotationDetailsState extends State<QuotationDetails> {
Generatequotationscreen(leadId: widget.leadID), Generatequotationscreen(leadId: widget.leadID),
), ),
); );
if(res==true){
provider.crmLeadDetailsAPIFunction(context, widget.leadID, widget.mode);
}
}, },
child: Container( child: Container(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
......
...@@ -256,6 +256,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> { ...@@ -256,6 +256,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> {
child: textControllerWidget( child: textControllerWidget(
context, context,
editProvider.editProductPriceControllers[j], editProvider.editProductPriceControllers[j],
"Product Price",
"Enter Product Price", "Enter Product Price",
(value) => editProvider.updateTotalAmount(j), (value) => editProvider.updateTotalAmount(j),
TextInputType.number, TextInputType.number,
...@@ -273,6 +274,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> { ...@@ -273,6 +274,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> {
child: textControllerWidget( child: textControllerWidget(
context, context,
editProvider.editQuantityControllers[j], editProvider.editQuantityControllers[j],
"Quantity",
"Enter Quantity", "Enter Quantity",
(value) => editProvider.updateTotalAmount(j), (value) => editProvider.updateTotalAmount(j),
TextInputType.number, TextInputType.number,
...@@ -291,6 +293,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> { ...@@ -291,6 +293,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> {
context, context,
editProvider.editTotalAmountControllers[j], editProvider.editTotalAmountControllers[j],
"Total Amount", "Total Amount",
"Enter Total Amount",
(_) {}, (_) {},
TextInputType.number, TextInputType.number,
true, true,
......
...@@ -33,7 +33,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -33,7 +33,7 @@ class _ContactdetailsState extends State<Contactdetails> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
TextWidget(context, "Contact Details"), // TextWidget(context, "Contact Details"),
ListView.builder( ListView.builder(
itemCount: customerDetails.length, itemCount: customerDetails.length,
shrinkWrap: true, shrinkWrap: true,
...@@ -262,6 +262,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -262,6 +262,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.nameController, provider.nameController,
"Name",
"Enter Name", "Enter Name",
provider.onChangeName, provider.onChangeName,
TextInputType.number, TextInputType.number,
...@@ -272,6 +273,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -272,6 +273,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.designationController, provider.designationController,
"Designation",
"Enter Designation", "Enter Designation",
provider.onChangeDesignation, provider.onChangeDesignation,
TextInputType.number, TextInputType.number,
...@@ -282,6 +284,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -282,6 +284,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.mobileNumberController, provider.mobileNumberController,
"Mobile Number",
"Enter Mobile Number", "Enter Mobile Number",
provider.onChangeMobile, provider.onChangeMobile,
TextInputType.number, TextInputType.number,
...@@ -292,6 +295,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -292,6 +295,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.alternativeMobileController, provider.alternativeMobileController,
"Alternative Mobile Number",
"Enter Alternative Mobile Number", "Enter Alternative Mobile Number",
provider.onChangeAltMobile, provider.onChangeAltMobile,
TextInputType.number, TextInputType.number,
...@@ -302,6 +306,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -302,6 +306,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.telephoneController, provider.telephoneController,
"Telephone Number",
"Enter Telephone Number", "Enter Telephone Number",
provider.onChangeTelephone, provider.onChangeTelephone,
TextInputType.number, TextInputType.number,
...@@ -312,7 +317,8 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -312,7 +317,8 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.emailController, provider.emailController,
"Enter EmailID", "Email ID",
"Enter Email ID",
provider.onChangeEmailId, provider.onChangeEmailId,
TextInputType.number, TextInputType.number,
false, false,
...@@ -402,6 +408,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -402,6 +408,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.editNameController, provider.editNameController,
"Name",
"Enter Name", "Enter Name",
provider.onChangeEditName, provider.onChangeEditName,
TextInputType.number, TextInputType.number,
...@@ -412,6 +419,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -412,6 +419,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.editDesignationController, provider.editDesignationController,
"Designation",
"Enter Designation", "Enter Designation",
provider.onChangeEditDesignation, provider.onChangeEditDesignation,
TextInputType.number, TextInputType.number,
...@@ -422,6 +430,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -422,6 +430,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.editMobileNumberController, provider.editMobileNumberController,
"Mobile Number",
"Enter Mobile Number", "Enter Mobile Number",
provider.onChangeEditMobile, provider.onChangeEditMobile,
TextInputType.number, TextInputType.number,
...@@ -433,6 +442,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -433,6 +442,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.editAlternativeMobileController, provider.editAlternativeMobileController,
"Alternative Mobile Number",
"Enter Alternative Mobile Number", "Enter Alternative Mobile Number",
provider.onChangeEditAltMobile, provider.onChangeEditAltMobile,
TextInputType.number, TextInputType.number,
...@@ -443,6 +453,7 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -443,6 +453,7 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.editTelephoneController, provider.editTelephoneController,
"Telephone Number",
"Enter Telephone Number", "Enter Telephone Number",
provider.onChangeEditTelephone, provider.onChangeEditTelephone,
TextInputType.number, TextInputType.number,
...@@ -454,7 +465,8 @@ class _ContactdetailsState extends State<Contactdetails> { ...@@ -454,7 +465,8 @@ class _ContactdetailsState extends State<Contactdetails> {
textControllerWidget( textControllerWidget(
context, context,
provider.editEmailController, provider.editEmailController,
"Enter EmailID", "Email ID",
"Enter Email ID",
provider.onChangeEditEmailId, provider.onChangeEditEmailId,
TextInputType.number, TextInputType.number,
false, false,
......
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