Commit 56ca3566 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

30-07-2025 By Sai Srinivas

CRM Module
parent 8cdaca01
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="38" viewBox="0 0 2 38" fill="none">
<line x1="1.14062" y1="0.600586" x2="1.14062" y2="37.1543" stroke="black" stroke-width="0.5"/>
<line x1="1.14062" y1="0.600586" x2="1.14062" y2="37.1543" stroke="#D2D2D2" stroke-width="0.5"/>
</svg>
\ No newline at end of file
class crmDownloadGenQuoteResponse {
String? error;
String? quoteFilepath;
String? message;
int? sessionExists;
crmDownloadGenQuoteResponse(
{this.error, this.quoteFilepath, this.message, this.sessionExists});
crmDownloadGenQuoteResponse.fromJson(Map<String, dynamic> json) {
error = json['error'];
quoteFilepath = json['quote_filepath'];
message = json['message'];
sessionExists = json['session_exists'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['quote_filepath'] = this.quoteFilepath;
data['message'] = this.message;
data['session_exists'] = this.sessionExists;
return data;
}
}
class crmNewLeadsProspectsViewResponse { class crmNewLeadsProspectsViewResponse {
String? error;
String? message;
int? sessionExists;
List<Employees>? employees; List<Employees>? employees;
List<Sources>? sources; List<Sources>? sources;
List<Teams>? teams; List<Teams>? teams;
List<States>? states; List<States>? states;
List<Products>? products; List<Products>? products;
List<String>? salutation; List<String>? salutation;
String? error;
String? message;
int? sessionExists;
crmNewLeadsProspectsViewResponse({ crmNewLeadsProspectsViewResponse(
this.error, {this.employees,
this.message, this.sources,
this.sessionExists, this.teams,
this.employees, this.states,
this.sources, this.products,
this.teams, this.salutation,
this.states, this.error,
this.products, this.message,
this.salutation, this.sessionExists});
});
crmNewLeadsProspectsViewResponse.fromJson(Map<String, dynamic> json) { crmNewLeadsProspectsViewResponse.fromJson(Map<String, dynamic> json) {
json['error'] = error;
json['message'] = message;
json['session_exists'] = sessionExists;
if (json['employees'] != null) { if (json['employees'] != null) {
employees = <Employees>[]; employees = <Employees>[];
json['employees'].forEach((v) { json['employees'].forEach((v) {
...@@ -57,13 +52,13 @@ class crmNewLeadsProspectsViewResponse { ...@@ -57,13 +52,13 @@ class crmNewLeadsProspectsViewResponse {
}); });
} }
salutation = json['salutation'].cast<String>(); salutation = json['salutation'].cast<String>();
error = json['error'];
message = json['message'];
sessionExists = json['session_exists'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
data['session_exists'] = this.sessionExists;
if (this.employees != null) { if (this.employees != null) {
data['employees'] = this.employees!.map((v) => v.toJson()).toList(); data['employees'] = this.employees!.map((v) => v.toJson()).toList();
} }
...@@ -80,6 +75,9 @@ class crmNewLeadsProspectsViewResponse { ...@@ -80,6 +75,9 @@ class crmNewLeadsProspectsViewResponse {
data['products'] = this.products!.map((v) => v.toJson()).toList(); data['products'] = this.products!.map((v) => v.toJson()).toList();
} }
data['salutation'] = this.salutation; data['salutation'] = this.salutation;
data['error'] = this.error;
data['message'] = this.message;
data['session_exists'] = this.sessionExists;
return data; return data;
} }
} }
...@@ -102,7 +100,6 @@ class Employees { ...@@ -102,7 +100,6 @@ class Employees {
return data; return data;
} }
} }
class Sources { class Sources {
String? id; String? id;
String? name; String? name;
...@@ -178,7 +175,3 @@ class Products { ...@@ -178,7 +175,3 @@ class Products {
return data; return data;
} }
} }
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
...@@ -5,6 +6,7 @@ import 'package:flutter/material.dart'; ...@@ -5,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_download_manager/flutter_download_manager.dart'; import 'package:flutter_download_manager/flutter_download_manager.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart';
import 'package:generp/screens/LoginScreen.dart'; import 'package:generp/screens/LoginScreen.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
...@@ -49,6 +51,8 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -49,6 +51,8 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
List<Map<String, dynamic>> _productRows = []; // For backend List<Map<String, dynamic>> _productRows = []; // For backend
List<Map<String, dynamic>> get productRows => _productRows; List<Map<String, dynamic>> get productRows => _productRows;
ProductsData? _selectedProductsDeatilsData;
List<Employees> _employeesList = []; List<Employees> _employeesList = [];
List<Sources> _sourcesList = []; List<Sources> _sourcesList = [];
List<Teams> _teamsList = []; List<Teams> _teamsList = [];
...@@ -77,25 +81,24 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -77,25 +81,24 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
String? _selectedProductsId; String? _selectedProductsId;
String? _selectedProductsValue; String? _selectedProductsValue;
String? _selectedSalutation; String? _selectedSalutation;
Districts? _selectedDistricts; Districts? _selectedDistricts;
SubLocations? _selectedSubLocations; SubLocations? _selectedSubLocations;
References? _selectedReferences; References? _selectedReferences;
Segments? _selectedSegments; Segments? _selectedSegments;
String? _selectedDistrictId; String? _selectedDistrictId;
String? _selectedDistrictValue; String? _selectedDistrictValue;
String? _selectedSubLocationId; String? _selectedSubLocationId;
String? _selectedSubLocationValue; String? _selectedSubLocationValue;
String? _selectedReferenceId; String? _selectedReferenceId;
String? _selectedReferenceValue; String? _selectedReferenceValue;
String? _selectedSegmentId; String? _selectedSegmentId;
String? _selectedSegmentValue; String? _selectedSegmentValue;
String? _selectedLeadStatus; String? _selectedLeadStatus;
ProductsData? get selectedProductsDetailsData => _selectedProductsDeatilsData;
String? get selectedLeadStatus => _selectedLeadStatus; String? get selectedLeadStatus => _selectedLeadStatus;
List<Employees> get employeesList => _employeesList; List<Employees> get employeesList => _employeesList;
...@@ -176,6 +179,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -176,6 +179,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
set selectedLeadStatus(String? value) { set selectedLeadStatus(String? value) {
_selectedLeadStatus = value; _selectedLeadStatus = value;
leadStatusError = null;
notifyListeners(); notifyListeners();
} }
...@@ -200,6 +204,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -200,6 +204,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedSources = value; _selectedSources = value;
_selectedSourcesId = value!.id; _selectedSourcesId = value!.id;
_selectedSourcesValue = value!.name; _selectedSourcesValue = value!.name;
sourceError = null;
notifyListeners(); notifyListeners();
} }
...@@ -217,6 +222,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -217,6 +222,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedTeams = value; _selectedTeams = value;
_selectedTeamsId = value!.id; _selectedTeamsId = value!.id;
_selectedTeamsValue = value!.name; _selectedTeamsValue = value!.name;
teamsError = null;
notifyListeners(); notifyListeners();
} }
...@@ -234,6 +240,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -234,6 +240,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedStates = value; _selectedStates = value;
_selectedStatesId = value!.id; _selectedStatesId = value!.id;
_selectedStatesValue = value!.name; _selectedStatesValue = value!.name;
statesError = null;
notifyListeners(); notifyListeners();
} }
...@@ -249,8 +256,11 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -249,8 +256,11 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
set selectedProducts(Products? value) { set selectedProducts(Products? value) {
_selectedProducts = value; _selectedProducts = value;
_selectedProductsId = value!.id; if(value!=null){
_selectedProductsValue = value!.name; _selectedProductsId = value!.id;
_selectedProductsValue = value!.name;
}
notifyListeners(); notifyListeners();
} }
...@@ -266,6 +276,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -266,6 +276,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
set selectedSalutation(String? value) { set selectedSalutation(String? value) {
_selectedSalutation = value; _selectedSalutation = value;
salutationError = null;
notifyListeners(); notifyListeners();
} }
...@@ -273,6 +284,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -273,6 +284,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedDistricts = value; _selectedDistricts = value;
_selectedDistrictId = value!.id!; _selectedDistrictId = value!.id!;
_selectedDistrictValue = value.district; _selectedDistrictValue = value.district;
districtsError = null;
notifyListeners(); notifyListeners();
} }
...@@ -280,6 +292,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -280,6 +292,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedSubLocations = value; _selectedSubLocations = value;
_selectedSubLocationId = value!.id!; _selectedSubLocationId = value!.id!;
_selectedSubLocationValue = value.subLocality; _selectedSubLocationValue = value.subLocality;
subLocError = null;
notifyListeners(); notifyListeners();
} }
...@@ -307,6 +320,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -307,6 +320,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedReferences = value; _selectedReferences = value;
_selectedReferenceId = value!.id!; _selectedReferenceId = value!.id!;
_selectedReferenceValue = value.name; _selectedReferenceValue = value.name;
referenceError = null;
notifyListeners(); notifyListeners();
} }
...@@ -314,6 +328,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -314,6 +328,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedSegments = value; _selectedSegments = value;
_selectedSegmentId = value!.id!; _selectedSegmentId = value!.id!;
_selectedSegmentValue = value.name; _selectedSegmentValue = value.name;
segmentsError = null;
notifyListeners(); notifyListeners();
} }
...@@ -342,6 +357,10 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -342,6 +357,10 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
String getJsonEncodedProducts() {
return jsonEncode(productRows);
}
String? mailIdError = ""; String? mailIdError = "";
String? companynameError = ""; String? companynameError = "";
String? salutationError = ""; String? salutationError = "";
...@@ -375,6 +394,36 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -375,6 +394,36 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_submitLoading = value; _submitLoading = value;
notifyListeners(); notifyListeners();
} }
// New method to update an existing product
void updateProduct(int index, Map<String, dynamic> updatedProduct) {
productRows[index] = updatedProduct;
notifyListeners();
}
// provider.productRows.add({
// "product_id": provider.selectedProductsId!,
// "price": provider.addProductPriceController.text,
// "qty": provider.addQuantityController.text,
// "net_price": provider.addTotalAmountController.text,
// });
// Existing method to add a new product
void addProduct(Map<String, dynamic> product) {
productRows.add(product);
notifyListeners();
}
void prefillProductForEdit(int index) {
final product = productRows[index];
selectedProducts = productsList.firstWhere(
(p) => p.id == product['product_id'],
orElse: () => Products(id: '', name: 'Unknown'),
);
selectedProductsId = product['product_id'];
selectedProductsValue = selectedProducts?.name;
addProductPriceController.text = product['price'] ?? '';
addQuantityController.text = product['qty'] ?? '';
addTotalAmountController.text = product['net_price'] ?? '';
notifyListeners();
}
void addEditUpdateTotalAmount(value) { void addEditUpdateTotalAmount(value) {
final price = double.tryParse(addProductPriceController.text) ?? 0; final price = double.tryParse(addProductPriceController.text) ?? 0;
...@@ -395,25 +444,29 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -395,25 +444,29 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<void> crmAddLeadsView(context, mode) async { Future<void> crmAddLeadsView(context) async {
try { try {
final prov = Provider.of<HomescreenNotifier>(context, listen: false); final prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmNewLeadsProspectsViewAPI( final data = await ApiCalling.crmNewLeadsProspectsViewAPI(
prov.empId, prov.empId,
prov.session, prov.session,
mode,
); );
if (data != null) { if (data != null) {
if (data.error == "0") { if(data.sessionExists==1){
_employeesList = data.employees!; if (data.error == "0") {
_sourcesList = data.sources!; _employeesList = data.employees!;
_teamsList = data.teams!; _sourcesList = data.sources!;
_statesList = data.states!; _teamsList = data.teams!;
_productsList = data.products!; _statesList = data.states!;
_salutationList = data.salutation!; _productsList = data.products!;
notifyListeners(); _salutationList = data.salutation!;
notifyListeners();
} else {}
} else {} } else {}
} else {} }else{
sessionDoesNotExist(context);
}
} catch (e, s) {} } catch (e, s) {}
} }
...@@ -452,6 +505,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -452,6 +505,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
); );
if (data != null) { if (data != null) {
if (data.error == "0") { if (data.error == "0") {
print("Auto");
_subLocationsList = data.subLocations!; _subLocationsList = data.subLocations!;
notifyListeners(); notifyListeners();
} }
...@@ -555,6 +609,28 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -555,6 +609,28 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
} }
} }
Future<void> crmSelectedProductDetailsApiFunction(
BuildContext context,
String productId,
) async {
try {
final prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmSelectedProductDetailsApi(
prov.empId,
prov.session,
productId,
);
if (data != null && data.error == "0") {
_selectedProductsDeatilsData = data.productsData!;
addProductPriceController.text= data.productsData!.price!;
notifyListeners();
}
} catch (e, s) {
print("Error: $e, Stack: $s");
}
}
onChangemailId(value) { onChangemailId(value) {
mailIdError = ""; mailIdError = "";
notifyListeners(); notifyListeners();
...@@ -621,18 +697,126 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -621,18 +697,126 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
addProductPriceController.clear(); addProductPriceController.clear();
addQuantityController.clear(); addQuantityController.clear();
addTotalAmountController.clear(); addTotalAmountController.clear();
addTotalAmountController.clear();
addProductPriceController.clear();
addQuantityController.clear();
addTotalAmountController.clear();
companyNameController.clear();
contactPersonNameController.clear();
customerMailIdController.clear();
mobileController.clear();
alternateMobileController.clear();
telephoneController.clear();
designationController.clear();
addressController.clear();
taxesController.clear();
_productRows = [];
_selectedProductsDeatilsData = null;
_selectedEmployees = null;
_selectedEmployeesId = null;
_selectedEmployeesValue = null;
_selectedSources = null;
_selectedSourcesId = null;
_selectedSourcesValue = null;
_selectedTeams = null;
_selectedTeamsId = null;
_selectedTeamsValue = null;
_selectedStates = null;
_selectedStatesId = null;
_selectedStatesValue = null;
_selectedProducts = null;
_selectedProductsId = null;
_selectedProductsValue = null;
_selectedSalutation = null;
_selectedDistricts = null;
_selectedSubLocations = null;
_selectedReferences = null;
_selectedSegments = null;
_selectedDistrictId = null;
_selectedDistrictValue = null;
_selectedSubLocationId = null;
_selectedSubLocationValue = null;
_selectedReferenceId = null;
_selectedReferenceValue = null;
_selectedSegmentId = null;
_selectedSegmentValue = null;
_selectedLeadStatus = null;
mailIdError = "";
companynameError = "";
salutationError = "";
nameError = "";
AlternatemobileError = "";
TelephoneError = "";
mobileError = "";
addressError = "";
designationError = "";
taxesError = "";
SpecialNoteError = "";
forError = "";
paymentTermsError = "";
sourceError = "";
referenceError = "";
teamsError = "";
segmentsError = "";
statesError = "";
districtsError = "";
subLocError = "";
leadStatusError = "";
notifyListeners(); notifyListeners();
} }
void checkDropdownReset() { void checkDropdownReset() {
if (!_productsList.contains(_selectedProducts) &&
_selectedProducts != null) {
_selectedProductsId = null;
_selectedProductsValue = null;
}
if (!_employeesList.contains(_selectedEmployees) &&
_selectedEmployees != null) {
_selectedEmployeesId = null;
_selectedEmployeesValue = null;
}
if (!_sourcesList.contains(_selectedSources) && _selectedSources != null) {
_selectedSourcesId = null;
_selectedSourcesValue = null;
}
if (!_referencesList.contains(_selectedReferences) &&
_selectedReferences != null) {
_selectedReferenceId = null;
_selectedReferenceValue = null;
}
if (!_segmentsList.contains(_selectedSegments) &&
_selectedSegments != null) {
_selectedTeamsId = null;
_selectedTeamsValue = null;
}
if (!_teamsList.contains(_selectedTeams) && _selectedTeams != null) {
_selectedSegmentId = null;
_selectedSegmentValue = null;
}
if (!_districtsList.contains(_selectedDistricts) &&
_selectedDistricts != null) {
_selectedDistrictId = null;
_selectedDistrictValue = null;
}
if (!_statesList.contains(_selectedStates) && _selectedStates != null) {
_selectedStatesId = null;
_selectedStatesValue = null;
}
if (!_subLocationsList.contains(_selectedSubLocations) &&
_selectedSubLocations != null) {
_selectedSubLocationId = null;
_selectedSubLocationValue = null;
}
notifyListeners(); notifyListeners();
} }
bool validateStep1(){ bool validateStep1(){
bool isValid = true; bool isValid = true;
if(_selectedSalutation!=null||_selectedSalutation!=''){ if(_selectedSalutation==null||_selectedSalutation==''){
isValid = false; isValid = false;
salutationError = "Please Select Salutation"; salutationError = "Please Select Salutation";
} }
...@@ -675,19 +859,19 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -675,19 +859,19 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
// //
// } // }
if(_selectedSources!=null||_selectedSourcesId!.isEmpty){ if(_selectedSources==null||_selectedSourcesId!.isEmpty){
sourceError = "Please Select Source"; sourceError = "Please Select Source";
isValid = false; isValid = false;
} }
if(_selectedReferences!=null||_selectedReferenceId!.isEmpty){ if(_selectedReferences==null||_selectedReferenceId!.isEmpty){
referenceError = "Please Select Reference"; referenceError = "Please Select Reference";
isValid = false; isValid = false;
} }
if(_selectedTeams!=null||_selectedTeamsId!.isEmpty){ if(_selectedTeams==null||_selectedTeamsId!.isEmpty){
teamsError = "Please Select Team"; teamsError = "Please Select Team";
isValid = false; isValid = false;
} }
if(_selectedSegments!=null||_selectedSegmentId!.isEmpty){ if(_selectedSegments==null||_selectedSegmentId!.isEmpty){
segmentsError = "Please Select Segement"; segmentsError = "Please Select Segement";
isValid = false; isValid = false;
} }
...@@ -698,19 +882,19 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -698,19 +882,19 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
bool validateStep3(){ bool validateStep3(){
bool isValid = true; bool isValid = true;
if(_selectedStates!=null||_selectedStatesId!.isEmpty){ if(_selectedStates==null||_selectedStatesId!.isEmpty){
statesError = "Please Select State"; statesError = "Please Select State";
isValid = false; isValid = false;
} }
if(_selectedDistricts!=null||_selectedDistrictId!.isEmpty){ if(_selectedDistricts==null||_selectedDistrictId!.isEmpty){
districtsError = "Please Select District"; districtsError = "Please Select District";
isValid = false; isValid = false;
} }
if(_selectedSubLocations!=null||_selectedSubLocationId!.isEmpty){ // if(_selectedSubLocations==null||_selectedSubLocationId!.isEmpty){
subLocError = "Please Select Sub Location"; // subLocError = "Please Select Sub Location";
isValid = false; // isValid = false;
} // }
if(_selectedLeadStatus!=null||_selectedLeadStatus!.isEmpty){ if(_selectedLeadStatus==null||_selectedLeadStatus!.isEmpty){
leadStatusError = "Please Select Lead Status"; leadStatusError = "Please Select Lead Status";
isValid = false; isValid = false;
} }
......
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:generp/Utils/commonServices.dart'; import 'package:generp/Utils/commonServices.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
...@@ -419,6 +421,63 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -419,6 +421,63 @@ class crmLeadDetailsProvider extends ChangeNotifier {
); );
} }
List<List<dynamic>> prepareExportData() {
final headers = [
'Company Name:',
'Contact Person Name:',
'Mobile Number:',
'Alternate Mobile Number:',
'Email ID:',
'Address:',
'Product:',
'Lead Received Date:',
];
final rows =
[
leadDetails.name??"-",
leadDetails.contName??"-",
leadDetails.mob1??"-",
leadDetails.mob2??"-",
leadDetails.email??"-",
leadDetails.address??"-",
leadDetails.prod??"-",
leadDetails.createdDatetime??"-",
].toList();
return [headers, rows];
}
void copyToClipboard(BuildContext context) async {
try {
if (leadDetails == null) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("No data to copy")),
);
return;
}
final data = prepareExportData();
// if (data.isEmpty || data[1].every((element) => element == "-")) {
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text("No valid data to copy")),
// );
// return;
// }
String raw = data.map((row) => row.join('\t')).join('\n');
print('Clipboard data: $raw');
await Clipboard.setData(ClipboardData(text: raw));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Copied to Clipboard")),
);
} catch (e) {
print('Error copying to clipboard: $e');
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Failed to copy to clipboard")),
);
}
}
void onChangeName(value){ void onChangeName(value){
_nameError = ""; _nameError = "";
notifyListeners(); notifyListeners();
......
...@@ -30,22 +30,22 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async { ...@@ -30,22 +30,22 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
if (type == 'offline_reminder') { if (type == 'offline_reminder') {
FlutterRingtonePlayer().play( FlutterRingtonePlayer().play(
fromAsset: "assets/offline_reminder.mp3", // fromAsset: "assets/offline_reminder.mp3",
ios: IosSounds.glass, // Specify the iOS sound ios: IosSounds.glass, // Specify the iOS sound
); );
} else if (type == 'normal') { } else if (type == 'normal') {
FlutterRingtonePlayer().play( FlutterRingtonePlayer().play(
fromAsset: "assets/notification_sound.mp3", // fromAsset: "assets/notification_sound.mp3",
ios: IosSounds.glass, // Specify the iOS sound ios: IosSounds.glass, // Specify the iOS sound
); );
} else if (type == 'web_erp_notification') { } else if (type == 'web_erp_notification') {
FlutterRingtonePlayer().play( FlutterRingtonePlayer().play(
fromAsset: "assets/notification_sound.mp3", // fromAsset: "assets/notification_sound.mp3",
ios: IosSounds.glass, // Specify the iOS sound ios: IosSounds.glass, // Specify the iOS sound
); );
} else { } else {
FlutterRingtonePlayer().play( FlutterRingtonePlayer().play(
fromAsset: "assets/notification_sound.mp3", // fromAsset: "assets/notification_sound.mp3",
// will be the sound on Android // will be the sound on Android
ios: IosSounds.glass, // will be the sound on iOS ios: IosSounds.glass, // will be the sound on iOS
); );
......
...@@ -71,6 +71,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -71,6 +71,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
_connectivity.disposeStream(); _connectivity.disposeStream();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) { switch (_source.keys.toList()[0]) {
...@@ -150,21 +152,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -150,21 +152,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
var appointmentNotEmpty = provider.appointmentDetails.isNotEmpty; var appointmentNotEmpty = provider.appointmentDetails.isNotEmpty;
var quotationNotEmpty = provider.quotationsDetails.isNotEmpty; var quotationNotEmpty = provider.quotationsDetails.isNotEmpty;
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
// appBar: appbar2New(
// context,
// "Lead Details",
// provider.resetAll,
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_more.svg", height: 30),
// ),
// 0xFFFFFFFF
//
// ),
appBar: AppBar( appBar: AppBar(
// toolbarHeight: provider.showMoreDetails ? 25 : 40, // toolbarHeight: provider.showMoreDetails ? 25 : 40,
backgroundColor: Colors.white, backgroundColor: Colors.white,
...@@ -316,7 +307,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -316,7 +307,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded( Expanded(
flex: 1, flex: 1,
child: InkResponse( child: InkResponse(
onTap: () async {}, onTap: () async {
provider.copyToClipboard(context);
},
child: Container( child: Container(
height: 32, height: 32,
width: 30, width: 30,
...@@ -1494,7 +1487,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1494,7 +1487,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if (appointmentNotEmpty) ...[ if (appointmentNotEmpty) ...[
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 250, height: 255,
child: ListView.builder( child: ListView.builder(
physics: AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
...@@ -1506,7 +1499,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1506,7 +1499,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount: provider.appointmentDetails.length, itemCount: provider.appointmentDetails.length,
itemBuilder: (context, lp) { itemBuilder: (context, lp) {
return Container( return Container(
height: 250, height: 255,
width: MediaQuery.of(context).size.width * 0.95, width: MediaQuery.of(context).size.width * 0.95,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
...@@ -1597,7 +1590,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1597,7 +1590,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded( Expanded(
flex: 3, flex: 3,
child: Text( child: Text(
"Engagement", "Appointment",
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontFamily: "JakartaSemiBold", fontFamily: "JakartaSemiBold",
...@@ -1694,6 +1687,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1694,6 +1687,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex:1,
child: Text( child: Text(
textAlign: TextAlign.left, textAlign: TextAlign.left,
"Note", "Note",
...@@ -1705,6 +1699,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1705,6 +1699,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
Expanded( Expanded(
flex:5,
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
provider provider
...@@ -1719,6 +1714,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1719,6 +1714,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
maxLines: 2, maxLines: 2,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
height:1,
color: Color(0xFF818181), color: Color(0xFF818181),
), ),
), ),
......
...@@ -14,20 +14,15 @@ import '../../Utils/commonWidgets.dart'; ...@@ -14,20 +14,15 @@ import '../../Utils/commonWidgets.dart';
import '../../Utils/dropdownTheme.dart'; import '../../Utils/dropdownTheme.dart';
class Addleadproductscreen extends StatefulWidget { class Addleadproductscreen extends StatefulWidget {
final type;
final int? editIndex;
const Addleadproductscreen({ const Addleadproductscreen({super.key, this.type, this.editIndex});
super.key,
});
@override @override
State<Addleadproductscreen> createState() => State<Addleadproductscreen> createState() => _AddleadproductscreenState();
_AddleadproductscreenState();
} }
class _AddleadproductscreenState class _AddleadproductscreenState extends State<Addleadproductscreen> {
extends State<Addleadproductscreen> {
Map _source = {ConnectivityResult.mobile: true}; Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance; final MyConnectivity _connectivity = MyConnectivity.instance;
Dropdowntheme ddtheme = Dropdowntheme(); Dropdowntheme ddtheme = Dropdowntheme();
...@@ -45,10 +40,18 @@ class _AddleadproductscreenState ...@@ -45,10 +40,18 @@ class _AddleadproductscreenState
context, context,
listen: false, listen: false,
); );
if(widget.type == "Add"){
provider.selectedProducts = null;
provider.selectedProductsId = null;
provider.selectedProductsValue = null;
provider.addProductPriceController.clear();
provider.addQuantityController.clear();
provider.addTotalAmountController.clear();
}else{
provider.prefillProductForEdit(widget.editIndex!);
}
// provider.addEditInitializeForm(context);
// provider.addEditInitializeForm(context);
}); });
} }
...@@ -74,15 +77,15 @@ class _AddleadproductscreenState ...@@ -74,15 +77,15 @@ class _AddleadproductscreenState
} }
return (connection == "Online") return (connection == "Online")
? Platform.isAndroid ? Platform.isAndroid
? WillPopScope( ? WillPopScope(
onWillPop: () => onBackPressed(context), onWillPop: () => onBackPressed(context),
child: SafeArea( child: SafeArea(
top: false, top: false,
bottom: true, bottom: true,
child: _scaffold(context), child: _scaffold(context),
), ),
) )
: _scaffold(context) : _scaffold(context)
: NoNetwork(context); : NoNetwork(context);
} }
...@@ -127,22 +130,20 @@ class _AddleadproductscreenState ...@@ -127,22 +130,20 @@ class _AddleadproductscreenState
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
items: items:
provider.productsList provider.productsList
.map( .map(
( (ord) => DropdownMenuItem<Products>(
ord, value: ord,
) => DropdownMenuItem<Products>( child: Text(
value: ord, "(Product Name: ${ord.name})",
child: Text( style: const TextStyle(
"(Product Name: ${ord.name})", fontSize: 14,
style: const TextStyle( ),
fontSize: 14, overflow: TextOverflow.ellipsis,
), ),
overflow: TextOverflow.ellipsis, ),
), )
), .toList(),
)
.toList(),
// provider.selectedOrderIds[index] != null? // provider.selectedOrderIds[index] != null?
// provider // provider
// .orderList // .orderList
...@@ -154,22 +155,24 @@ class _AddleadproductscreenState ...@@ -154,22 +155,24 @@ class _AddleadproductscreenState
// .selectedOrderIds[index], // .selectedOrderIds[index],
// ) // )
value: value:
provider.selectedProducts != null provider.selectedProducts != null
? provider.productsList.firstWhere( ? provider.productsList.firstWhere(
(element) => (element) =>
element.id == element.id ==
provider provider.selectedProductsId,
.selectedProductsId, )
) : null,
: null,
onChanged: (Products? value) { onChanged: (Products? value) {
if (value != null) { if (value != null) {
provider.selectedProducts = value; provider.selectedProducts = value;
provider.selectedProductsId = provider.selectedProductsId = value!.id!;
value!.id!; provider.selectedProductsValue = value.name;
provider.selectedProductsValue =
value.name;
} }
provider.crmSelectedProductDetailsApiFunction(
context,
value!.id.toString(),
);
}, },
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
...@@ -213,7 +216,7 @@ class _AddleadproductscreenState ...@@ -213,7 +216,7 @@ class _AddleadproductscreenState
provider.addTotalAmountController, provider.addTotalAmountController,
"Amount", "Amount",
"Total Amount", "Total Amount",
(_) {}, (_) {},
TextInputType.number, TextInputType.number,
true, true,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
...@@ -236,20 +239,28 @@ class _AddleadproductscreenState ...@@ -236,20 +239,28 @@ class _AddleadproductscreenState
), ),
floatingActionButtonLocation: floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat, FloatingActionButtonLocation.centerFloat,
floatingActionButton: InkWell( floatingActionButton: InkWell(
onTap: () { onTap: () {
if (provider.selectedProducts != null) {
provider.productRows.add({ if (provider.selectedProducts != null) {
final productData = {
"product_id": provider.selectedProductsId!, "product_id": provider.selectedProductsId!,
"price": provider.addProductPriceController.text, "price": provider.addProductPriceController.text,
"qty": provider.addQuantityController.text, "qty": provider.addQuantityController.text,
"net_price": provider.addTotalAmountController.text, "net_price": provider.addTotalAmountController.text,
}); };
if (widget.editIndex != null) {
provider.updateProduct(widget.editIndex!, productData);
} else {
provider.addProduct(productData);
}
print(provider.getJsonEncodedProducts());
Navigator.pop(context, provider.getJsonEncodedProducts());
}
}
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
......
...@@ -226,7 +226,6 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -226,7 +226,6 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
); );
if (res != null) { if (res != null) {
print("result ${res}"); print("result ${res}");
} }
}, },
child: Container( child: Container(
...@@ -579,21 +578,22 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -579,21 +578,22 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
], ],
), ),
items: items:
<String>["Extra","Including"] <String>["Extra", "Including"]
.map( .map(
(value) => (value) =>
DropdownMenuItem<String>( DropdownMenuItem<String>(
value: value, value: value,
child: Text( child: Text(
value ?? '', value ?? '',
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
overflow: TextOverflow.ellipsis, overflow:
), TextOverflow.ellipsis,
), ),
) ),
.toList(), )
.toList(),
value: provider.selectedTaxes, value: provider.selectedTaxes,
onChanged: (String? newValue) { onChanged: (String? newValue) {
setState(() { setState(() {
...@@ -602,8 +602,10 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -602,8 +602,10 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
}, },
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
...@@ -656,14 +658,15 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -656,14 +658,15 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
floatingActionButtonLocation: floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat, FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: Material( bottomNavigationBar: Material(
elevation: 10, elevation: 2,
shadowColor: Colors.black54, shadowColor: Colors.black12,
child: Container( child: Container(
height: 80,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black26, color: Colors.white54,
blurRadius: 10, blurRadius: 10,
offset: Offset(0, -2), offset: Offset(0, -2),
), ),
...@@ -692,14 +695,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -692,14 +695,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
child: Container( child: Container(
height: 45, height: 45,
alignment: Alignment.center, alignment: Alignment.center,
margin: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration( decoration: BoxDecoration(
// color: AppColors.app_blue, // color: AppColors.app_blue,
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
...@@ -711,13 +707,26 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -711,13 +707,26 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
AppColors.app_blue, AppColors.app_blue,
), ),
) )
: SvgPicture.asset( : Row(
"assets/svg/download_quote.svg", mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
"assets/svg/crm/download_quote_ic.svg",
),
SizedBox(width: 10,),
Text(
"Download",
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaRegular",
),
),
],
), ),
), ),
), ),
), ),
SizedBox(width: 10), SvgPicture.asset("assets/svg/crm/vertical_line_ic.svg"),
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: onTap:
...@@ -737,14 +746,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -737,14 +746,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
child: Container( child: Container(
height: 45, height: 45,
alignment: Alignment.center, alignment: Alignment.center,
margin: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration( decoration: BoxDecoration(
// color: AppColors.app_blue, // color: AppColors.app_blue,
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
...@@ -756,13 +758,26 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -756,13 +758,26 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
AppColors.app_blue, AppColors.app_blue,
), ),
) )
: SvgPicture.asset( : Row(
"assets/svg/mail_quote.svg", mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
"assets/svg/crm/email_quote_ic.svg",
),
SizedBox(width: 10,),
Text(
"Email",
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaRegular",
),
),
],
), ),
), ),
), ),
), ),
SizedBox(width: 10), SvgPicture.asset("assets/svg/crm/vertical_line_ic.svg"),
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: onTap:
...@@ -782,59 +797,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -782,59 +797,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
child: Container( child: Container(
height: 45, height: 45,
alignment: Alignment.center, alignment: Alignment.center,
margin: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration(
// color: AppColors.app_blue,
borderRadius: BorderRadius.circular(10),
),
child:
provider.submitLoading
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
)
: SvgPicture.asset(
"assets/svg/whatsapp_quote.svg",
),
),
),
),
SizedBox(width: 10),
Expanded(
child: InkResponse(
onTap:
provider.submitLoading
? null
: () {
//genquotewhatsappbymynum,
final insertedData = provider.getFormData();
provider
.crmLeadDetailsGenerateQuoteSubmitAPIFunction(
context,
widget.leadId,
insertedData,
"genquotewhatsappbymynum",
);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration( decoration: BoxDecoration(
// color: AppColors.app_blue, // color: AppColors.app_blue,
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
...@@ -846,12 +809,69 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -846,12 +809,69 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
AppColors.app_blue, AppColors.app_blue,
), ),
) )
: SvgPicture.asset( : Row(
"assets/svg/whatsapp_quote_self.svg", mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
"assets/svg/crm/whatsapp_quote_ic.svg",
),
SizedBox(width: 10,),
Text(
"Whatsapp",
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaRegular",
),
),
],
), ),
), ),
), ),
), ),
// Expanded(
// child: InkResponse(
// onTap:
// provider.submitLoading
// ? null
// : () {
// //genquotewhatsappbymynum,
// final insertedData = provider.getFormData();
// provider
// .crmLeadDetailsGenerateQuoteSubmitAPIFunction(
// context,
// widget.leadId,
// insertedData,
// "genquotewhatsappbymynum",
// );
// },
// child: Container(
// height: 45,
// alignment: Alignment.center,
// margin: const EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 15,
// ),
// padding: const EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 5,
// ),
// decoration: BoxDecoration(
// // color: AppColors.app_blue,
// borderRadius: BorderRadius.circular(10),
// ),
// child:
// provider.submitLoading
// ? CircularProgressIndicator.adaptive(
// valueColor: AlwaysStoppedAnimation<Color>(
// AppColors.app_blue,
// ),
// )
// : SvgPicture.asset(
// "assets/svg/whatsapp_quote_self.svg",
// ),
// ),
// ),
// ),
], ],
), ),
), ),
......
...@@ -15,6 +15,7 @@ import 'package:generp/Models/crmModels/LeadListContactPopUpResponse.dart'; ...@@ -15,6 +15,7 @@ import 'package:generp/Models/crmModels/LeadListContactPopUpResponse.dart';
import 'package:generp/Models/crmModels/LeadListViewResponse.dart'; import 'package:generp/Models/crmModels/LeadListViewResponse.dart';
import 'package:generp/Models/crmModels/ProspectListViewResponse.dart'; import 'package:generp/Models/crmModels/ProspectListViewResponse.dart';
import 'package:generp/Models/crmModels/SubmitLeadListFilterResponse.dart'; import 'package:generp/Models/crmModels/SubmitLeadListFilterResponse.dart';
import 'package:generp/Models/crmModels/crmDownloadGenQuoteResponse.dart';
import 'package:generp/Models/crmModels/crmLeadDetailsGenerateQuotationSubmitResponse.dart'; import 'package:generp/Models/crmModels/crmLeadDetailsGenerateQuotationSubmitResponse.dart';
import 'package:generp/Models/crmModels/crmNewLeadsProspectsViewResponse.dart'; import 'package:generp/Models/crmModels/crmNewLeadsProspectsViewResponse.dart';
import 'package:generp/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart'; import 'package:generp/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart';
...@@ -3323,13 +3324,11 @@ class ApiCalling { ...@@ -3323,13 +3324,11 @@ class ApiCalling {
static Future<crmNewLeadsProspectsViewResponse?> crmNewLeadsProspectsViewAPI( static Future<crmNewLeadsProspectsViewResponse?> crmNewLeadsProspectsViewAPI(
empId, empId,
session, session,
mode,
) async { ) async {
try { try {
Map<String, String> data = { Map<String, String> data = {
'emp_id': (empId).toString(), 'emp_id': (empId).toString(),
'session_id': (session).toString(), 'session_id': (session).toString(),
'mode': (mode).toString(),
}; };
final res = await post(data, crmNewProspectLeadViewUrl, {}); final res = await post(data, crmNewProspectLeadViewUrl, {});
if (res != null) { if (res != null) {
...@@ -3367,7 +3366,6 @@ class ApiCalling { ...@@ -3367,7 +3366,6 @@ class ApiCalling {
tel, tel,
email, email,
designation, designation,
lead_status, lead_status,
products, products,
) async { ) async {
...@@ -4100,6 +4098,45 @@ class ApiCalling { ...@@ -4100,6 +4098,45 @@ class ApiCalling {
} }
} }
static Future<crmDownloadGenQuoteResponse?>
crmDownloadGenQuoteAPI(
emp_id,
session_id,
lead_id,
quote_id,
quotation_type,
) async {
try {
Map<String, String> data = {
'emp_id': emp_id.toString(),
'session_id': session_id.toString(),
'lead_id': lead_id.toString(),
'quote_id': quote_id.toString(),
'quotation_type': quotation_type.toString(),
};
final res = await post(
data,
crmDownloadGeneratedQuotationUrl,
{},
);
if (res != null) {
print("Filter: ${data}");
debugPrint(res.body);
return crmDownloadGenQuoteResponse.fromJson(
jsonDecode(res.body),
);
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint('hello bev=bug $e ');
return null;
}
}
static Future<ProspectListViewResponse?> crmProspectListViewAPI( static Future<ProspectListViewResponse?> crmProspectListViewAPI(
empId, empId,
session, session,
......
...@@ -148,6 +148,7 @@ const crmLeadDetailsEditContactUrl = "${baseUrl_test}crm_lead_details_edit_conta ...@@ -148,6 +148,7 @@ const crmLeadDetailsEditContactUrl = "${baseUrl_test}crm_lead_details_edit_conta
const crmLeadDetailsAddAppointmentUrl = "${baseUrl_test}crm_lead_details_add_appointment"; const crmLeadDetailsAddAppointmentUrl = "${baseUrl_test}crm_lead_details_add_appointment";
const crmLeadDetailsGenerateQuotationViewUrl = "${baseUrl_test}crm_lead_details_generate_quotation_view"; const crmLeadDetailsGenerateQuotationViewUrl = "${baseUrl_test}crm_lead_details_generate_quotation_view";
const crmLeadDetailsGenerateQuotationSubmitUrl = "${baseUrl_test}crm_lead_details_generate_quotation_submit"; const crmLeadDetailsGenerateQuotationSubmitUrl = "${baseUrl_test}crm_lead_details_generate_quotation_submit";
const crmDownloadGeneratedQuotationUrl = "${baseUrl_test}download_generated_quotation_file";
const crmProspectListViewUrl = "${baseUrl_test}crm_prospect_list_view"; const crmProspectListViewUrl = "${baseUrl_test}crm_prospect_list_view";
const crmProspectListFilterSubmitUrl = "${baseUrl_test}crm_prospect_list_filter_submit"; const crmProspectListFilterSubmitUrl = "${baseUrl_test}crm_prospect_list_filter_submit";
const crmProspectDetailsUrl = "${baseUrl_test}crm_prospect_details"; const crmProspectDetailsUrl = "${baseUrl_test}crm_prospect_details";
......
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