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);
......
This diff is collapsed.
...@@ -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,
......
This diff is collapsed.
...@@ -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> {
), ),
); );
}), }),
], ],
), ),
), ),
......
This diff is collapsed.
...@@ -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,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment