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 {
String? error;
String? message;
int? sessionExists;
List<Employees>? employees;
List<Sources>? sources;
List<Teams>? teams;
List<States>? states;
List<Products>? products;
List<String>? salutation;
String? error;
String? message;
int? sessionExists;
crmNewLeadsProspectsViewResponse({
this.error,
this.message,
this.sessionExists,
this.employees,
crmNewLeadsProspectsViewResponse(
{this.employees,
this.sources,
this.teams,
this.states,
this.products,
this.salutation,
});
this.error,
this.message,
this.sessionExists});
crmNewLeadsProspectsViewResponse.fromJson(Map<String, dynamic> json) {
json['error'] = error;
json['message'] = message;
json['session_exists'] = sessionExists;
if (json['employees'] != null) {
employees = <Employees>[];
json['employees'].forEach((v) {
......@@ -57,13 +52,13 @@ class crmNewLeadsProspectsViewResponse {
});
}
salutation = json['salutation'].cast<String>();
error = json['error'];
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['message'] = this.message;
data['session_exists'] = this.sessionExists;
if (this.employees != null) {
data['employees'] = this.employees!.map((v) => v.toJson()).toList();
}
......@@ -80,6 +75,9 @@ class crmNewLeadsProspectsViewResponse {
data['products'] = this.products!.map((v) => v.toJson()).toList();
}
data['salutation'] = this.salutation;
data['error'] = this.error;
data['message'] = this.message;
data['session_exists'] = this.sessionExists;
return data;
}
}
......@@ -102,7 +100,6 @@ class Employees {
return data;
}
}
class Sources {
String? id;
String? name;
......@@ -178,7 +175,3 @@ class Products {
return data;
}
}
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
......@@ -5,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_download_manager/flutter_download_manager.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:http/http.dart' as http;
import 'package:intl/intl.dart';
......@@ -49,6 +51,8 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
List<Map<String, dynamic>> _productRows = []; // For backend
List<Map<String, dynamic>> get productRows => _productRows;
ProductsData? _selectedProductsDeatilsData;
List<Employees> _employeesList = [];
List<Sources> _sourcesList = [];
List<Teams> _teamsList = [];
......@@ -77,25 +81,24 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
String? _selectedProductsId;
String? _selectedProductsValue;
String? _selectedSalutation;
Districts? _selectedDistricts;
SubLocations? _selectedSubLocations;
References? _selectedReferences;
Segments? _selectedSegments;
String? _selectedDistrictId;
String? _selectedDistrictValue;
String? _selectedSubLocationId;
String? _selectedSubLocationValue;
String? _selectedReferenceId;
String? _selectedReferenceValue;
String? _selectedSegmentId;
String? _selectedSegmentValue;
String? _selectedLeadStatus;
ProductsData? get selectedProductsDetailsData => _selectedProductsDeatilsData;
String? get selectedLeadStatus => _selectedLeadStatus;
List<Employees> get employeesList => _employeesList;
......@@ -176,6 +179,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
set selectedLeadStatus(String? value) {
_selectedLeadStatus = value;
leadStatusError = null;
notifyListeners();
}
......@@ -200,6 +204,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedSources = value;
_selectedSourcesId = value!.id;
_selectedSourcesValue = value!.name;
sourceError = null;
notifyListeners();
}
......@@ -217,6 +222,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedTeams = value;
_selectedTeamsId = value!.id;
_selectedTeamsValue = value!.name;
teamsError = null;
notifyListeners();
}
......@@ -234,6 +240,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedStates = value;
_selectedStatesId = value!.id;
_selectedStatesValue = value!.name;
statesError = null;
notifyListeners();
}
......@@ -249,8 +256,11 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
set selectedProducts(Products? value) {
_selectedProducts = value;
if(value!=null){
_selectedProductsId = value!.id;
_selectedProductsValue = value!.name;
}
notifyListeners();
}
......@@ -266,6 +276,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
set selectedSalutation(String? value) {
_selectedSalutation = value;
salutationError = null;
notifyListeners();
}
......@@ -273,6 +284,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedDistricts = value;
_selectedDistrictId = value!.id!;
_selectedDistrictValue = value.district;
districtsError = null;
notifyListeners();
}
......@@ -280,6 +292,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedSubLocations = value;
_selectedSubLocationId = value!.id!;
_selectedSubLocationValue = value.subLocality;
subLocError = null;
notifyListeners();
}
......@@ -307,6 +320,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedReferences = value;
_selectedReferenceId = value!.id!;
_selectedReferenceValue = value.name;
referenceError = null;
notifyListeners();
}
......@@ -314,6 +328,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedSegments = value;
_selectedSegmentId = value!.id!;
_selectedSegmentValue = value.name;
segmentsError = null;
notifyListeners();
}
......@@ -342,6 +357,10 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
notifyListeners();
}
String getJsonEncodedProducts() {
return jsonEncode(productRows);
}
String? mailIdError = "";
String? companynameError = "";
String? salutationError = "";
......@@ -375,6 +394,36 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_submitLoading = value;
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) {
final price = double.tryParse(addProductPriceController.text) ?? 0;
......@@ -395,15 +444,15 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
notifyListeners();
}
Future<void> crmAddLeadsView(context, mode) async {
Future<void> crmAddLeadsView(context) async {
try {
final prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmNewLeadsProspectsViewAPI(
prov.empId,
prov.session,
mode,
);
if (data != null) {
if(data.sessionExists==1){
if (data.error == "0") {
_employeesList = data.employees!;
_sourcesList = data.sources!;
......@@ -414,6 +463,10 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
notifyListeners();
} else {}
} else {}
}else{
sessionDoesNotExist(context);
}
} catch (e, s) {}
}
......@@ -452,6 +505,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
);
if (data != null) {
if (data.error == "0") {
print("Auto");
_subLocationsList = data.subLocations!;
notifyListeners();
}
......@@ -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) {
mailIdError = "";
notifyListeners();
......@@ -621,18 +697,126 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
addProductPriceController.clear();
addQuantityController.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();
}
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();
}
bool validateStep1(){
bool isValid = true;
if(_selectedSalutation!=null||_selectedSalutation!=''){
if(_selectedSalutation==null||_selectedSalutation==''){
isValid = false;
salutationError = "Please Select Salutation";
}
......@@ -675,19 +859,19 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
//
// }
if(_selectedSources!=null||_selectedSourcesId!.isEmpty){
if(_selectedSources==null||_selectedSourcesId!.isEmpty){
sourceError = "Please Select Source";
isValid = false;
}
if(_selectedReferences!=null||_selectedReferenceId!.isEmpty){
if(_selectedReferences==null||_selectedReferenceId!.isEmpty){
referenceError = "Please Select Reference";
isValid = false;
}
if(_selectedTeams!=null||_selectedTeamsId!.isEmpty){
if(_selectedTeams==null||_selectedTeamsId!.isEmpty){
teamsError = "Please Select Team";
isValid = false;
}
if(_selectedSegments!=null||_selectedSegmentId!.isEmpty){
if(_selectedSegments==null||_selectedSegmentId!.isEmpty){
segmentsError = "Please Select Segement";
isValid = false;
}
......@@ -698,19 +882,19 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
bool validateStep3(){
bool isValid = true;
if(_selectedStates!=null||_selectedStatesId!.isEmpty){
if(_selectedStates==null||_selectedStatesId!.isEmpty){
statesError = "Please Select State";
isValid = false;
}
if(_selectedDistricts!=null||_selectedDistrictId!.isEmpty){
if(_selectedDistricts==null||_selectedDistrictId!.isEmpty){
districtsError = "Please Select District";
isValid = false;
}
if(_selectedSubLocations!=null||_selectedSubLocationId!.isEmpty){
subLocError = "Please Select Sub Location";
isValid = false;
}
if(_selectedLeadStatus!=null||_selectedLeadStatus!.isEmpty){
// if(_selectedSubLocations==null||_selectedSubLocationId!.isEmpty){
// subLocError = "Please Select Sub Location";
// isValid = false;
// }
if(_selectedLeadStatus==null||_selectedLeadStatus!.isEmpty){
leadStatusError = "Please Select Lead Status";
isValid = false;
}
......
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:generp/Utils/commonServices.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
......@@ -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){
_nameError = "";
notifyListeners();
......
......@@ -30,22 +30,22 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
if (type == 'offline_reminder') {
FlutterRingtonePlayer().play(
fromAsset: "assets/offline_reminder.mp3",
// fromAsset: "assets/offline_reminder.mp3",
ios: IosSounds.glass, // Specify the iOS sound
);
} else if (type == 'normal') {
FlutterRingtonePlayer().play(
fromAsset: "assets/notification_sound.mp3",
// fromAsset: "assets/notification_sound.mp3",
ios: IosSounds.glass, // Specify the iOS sound
);
} else if (type == 'web_erp_notification') {
FlutterRingtonePlayer().play(
fromAsset: "assets/notification_sound.mp3",
// fromAsset: "assets/notification_sound.mp3",
ios: IosSounds.glass, // Specify the iOS sound
);
} else {
FlutterRingtonePlayer().play(
fromAsset: "assets/notification_sound.mp3",
// fromAsset: "assets/notification_sound.mp3",
// will be the sound on Android
ios: IosSounds.glass, // will be the sound on iOS
);
......
......@@ -71,6 +71,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
......@@ -150,21 +152,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
var appointmentNotEmpty = provider.appointmentDetails.isNotEmpty;
var quotationNotEmpty = provider.quotationsDetails.isNotEmpty;
return Scaffold(
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(
// toolbarHeight: provider.showMoreDetails ? 25 : 40,
backgroundColor: Colors.white,
......@@ -316,7 +307,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded(
flex: 1,
child: InkResponse(
onTap: () async {},
onTap: () async {
provider.copyToClipboard(context);
},
child: Container(
height: 32,
width: 30,
......@@ -1494,7 +1487,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if (appointmentNotEmpty) ...[
SizedBox(
width: double.infinity,
height: 250,
height: 255,
child: ListView.builder(
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
......@@ -1506,7 +1499,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount: provider.appointmentDetails.length,
itemBuilder: (context, lp) {
return Container(
height: 250,
height: 255,
width: MediaQuery.of(context).size.width * 0.95,
decoration: BoxDecoration(
color: Colors.white,
......@@ -1597,7 +1590,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded(
flex: 3,
child: Text(
"Engagement",
"Appointment",
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaSemiBold",
......@@ -1694,6 +1687,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
CrossAxisAlignment.start,
children: [
Expanded(
flex:1,
child: Text(
textAlign: TextAlign.left,
"Note",
......@@ -1705,6 +1699,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
Expanded(
flex:5,
child: Text(
textAlign: TextAlign.right,
provider
......@@ -1719,6 +1714,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
maxLines: 2,
style: TextStyle(
fontSize: 14,
height:1,
color: Color(0xFF818181),
),
),
......
......@@ -14,20 +14,15 @@ import '../../Utils/commonWidgets.dart';
import '../../Utils/dropdownTheme.dart';
class Addleadproductscreen extends StatefulWidget {
const Addleadproductscreen({
super.key,
});
final type;
final int? editIndex;
const Addleadproductscreen({super.key, this.type, this.editIndex});
@override
State<Addleadproductscreen> createState() =>
_AddleadproductscreenState();
State<Addleadproductscreen> createState() => _AddleadproductscreenState();
}
class _AddleadproductscreenState
extends State<Addleadproductscreen> {
class _AddleadproductscreenState extends State<Addleadproductscreen> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
Dropdowntheme ddtheme = Dropdowntheme();
......@@ -45,10 +40,18 @@ class _AddleadproductscreenState
context,
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);
});
}
......@@ -129,9 +132,7 @@ class _AddleadproductscreenState
items:
provider.productsList
.map(
(
ord,
) => DropdownMenuItem<Products>(
(ord) => DropdownMenuItem<Products>(
value: ord,
child: Text(
"(Product Name: ${ord.name})",
......@@ -158,18 +159,20 @@ class _AddleadproductscreenState
? provider.productsList.firstWhere(
(element) =>
element.id ==
provider
.selectedProductsId,
provider.selectedProductsId,
)
: null,
onChanged: (Products? value) {
if (value != null) {
provider.selectedProducts = value;
provider.selectedProductsId =
value!.id!;
provider.selectedProductsValue =
value.name;
provider.selectedProductsId = value!.id!;
provider.selectedProductsValue = value.name;
}
provider.crmSelectedProductDetailsApiFunction(
context,
value!.id.toString(),
);
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
......@@ -239,17 +242,25 @@ class _AddleadproductscreenState
FloatingActionButtonLocation.centerFloat,
floatingActionButton: InkWell(
onTap: () {
if (provider.selectedProducts != null) {
provider.productRows.add({
final productData = {
"product_id": provider.selectedProductsId!,
"price": provider.addProductPriceController.text,
"qty": provider.addQuantityController.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(
alignment: Alignment.center,
......
import 'dart:io';
import 'package:dotted_line/dotted_line.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart';
import 'package:generp/Utils/app_colors.dart';
import 'package:generp/Utils/commonWidgets.dart';
......@@ -82,7 +84,8 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
context,
listen: false,
);
provider.crmAddLeadsView(context, "team");
provider.resetForm();
provider.crmAddLeadsView(context);
});
}
......@@ -119,25 +122,59 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
onStepCancel: _previousStep,
onStepTapped: (value) {
print(value);
// setState(() {
//
// if(value==0){
// _currentStep = value;
// }
// if(_currentStep==1 && value==0){
// _currentStep = value;
// }
// if(_currentStep==2 && value == 1){
// _currentStep = value;
// }
// if (value == 1) {
// if(provider.validateStep1()){
// _currentStep = value;
// }
//
// } else if (value == 2) {
// if(provider.validateStep2()){
// _currentStep = value;
// }
//
// }
// else {
// _currentStep = value;
// }
// });
setState(() {
if (value == 1 && !provider.validateStep1()) {
return;
}
if (value == 2 && !provider.validateStep2()) {
return;
}
if (value < _currentStep) {
_currentStep = value;
} else if (value > _currentStep) {
_currentStep = value;
}
});
},
connectorColor: WidgetStatePropertyAll(AppColors.app_blue),
stepIconBuilder: (stepIndex, stepState) {
return CircleAvatar(
radius: 12,
backgroundColor: stepIndex <= _currentStep
backgroundColor:
stepIndex <= _currentStep
? AppColors.app_blue
: Colors.grey[300],
);
},
steps: [
Step(
label: Text("Step 1",style: TextStyle(
fontSize: 12
)),
label: Text("Step 1", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 0,
content: Container(
......@@ -183,7 +220,8 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
TextOverflow
.ellipsis,
),
),
)
......@@ -192,6 +230,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
onChanged: (value) {
if (value != null) {
provider.selectedSalutation = value;
provider.salutationError = null;
}
},
buttonStyleData: ddtheme.buttonStyleData,
......@@ -240,11 +279,13 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.done,
10,
),
errorWidget(context, provider.mobileError),
textControllerWidget(
context,
provider.customerMailIdController,
......@@ -257,7 +298,6 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
errorWidget(context, provider.mailIdError),
textControllerWidget(
context,
provider.designationController,
......@@ -274,9 +314,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
),
Step(
label: Text("Step 2",style: TextStyle(
fontSize: 12
)),
label: Text("Step 2", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 1,
content: Container(
......@@ -301,6 +339,10 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.done,
10,
),
errorWidget(context, provider.AlternatemobileError),
......@@ -385,8 +427,9 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
items:
provider.referencesList
.map(
(slist) =>
DropdownMenuItem<References>(
(slist) => DropdownMenuItem<
References
>(
value: slist,
child: Text(
slist.name!,
......@@ -454,7 +497,8 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
if (value != null) {
if (provider.teamsList.isNotEmpty) {
provider.selectedTeams = value;
provider.selectedTeamsId = value!.id!;
provider.selectedTeamsId =
value!.id!;
provider.selectedTeamsValue =
value!.name!;
provider
......@@ -507,7 +551,9 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
value: provider.selectedSegment,
onChanged: (Segments? value) {
if (value != null) {
if (provider.segmentsList.isNotEmpty) {
if (provider
.segmentsList
.isNotEmpty) {
provider.selectedSegment = value;
provider.selectedSegmentId =
value!.id!;
......@@ -534,9 +580,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
),
Step(
label: Text("Step 3",style: TextStyle(
fontSize: 12
),),
label: Text("Step 3", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 2,
content: Column(
......@@ -560,18 +604,17 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
context,
MaterialPageRoute(
builder:
(context) =>
Addleadproductscreen(
(context) => Addleadproductscreen(
type: "Add",
),
settings: RouteSettings(
name: 'Generatequotationaddeditproduct',
name:
'Generatequotationaddeditproduct',
),
),
);
if (res != null) {
print("result ${res}");
}
},
child: Container(
......@@ -579,10 +622,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
vertical: 10,
),
height: 45,
width: MediaQuery
.of(context)
.size
.width,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: const Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
......@@ -602,6 +642,197 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
),
),
if (provider.productRows.isNotEmpty) ...[
const SizedBox(height: 10),
SizedBox(
height: 125,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: provider.productRows.length,
itemBuilder: (context, index) {
final product =
provider.productRows[index];
final productName =
provider.productsList
.firstWhere(
(p) =>
p.id ==
product['product_id'],
orElse:
() => Products(
id: '',
name: 'Unknown',
),
)
.name;
final prodPrice =
product['price'] ?? '-';
final prodQty = product['qty'] ?? '-';
final totalPrice =
product['net_price'] ?? '-';
return InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Addleadproductscreen(
type: "Edit",
editIndex: index,
),
settings: RouteSettings(
name:
'Generatequotationaddeditproduct',
),
),
);
if (res != null) {
print("result ${res}");
}
},
child: Container(
width:
MediaQuery.of(
context,
).size.width *
0.8,
margin: EdgeInsets.only(
left: index == 0 ? 10 : 5,
right:
index ==
provider
.productRows
.length -
1
? 10
: 5,
bottom: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius:
BorderRadius.circular(14),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/crm/product_details_ic.svg",
),
),
SizedBox(width: 10),
Expanded(
flex: 6,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Row(
children: [
Expanded(
flex: 4,
child: Text(
productName ??
"-",
maxLines: 2,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
),
Expanded(
flex: 3,
child: Text(
textAlign:
TextAlign
.right,
"₹$prodPrice",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
),
],
),
Text(
"x $prodQty",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.grey_semi,
),
),
SizedBox(height: 5),
DottedLine(
dashGapLength: 4,
dashGapColor:
Colors.white,
dashColor:
AppColors.grey_semi,
dashLength: 2,
lineThickness: 0.5,
),
SizedBox(height: 5),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
"₹$totalPrice",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
],
),
],
),
),
],
),
),
);
},
),
),
],
],
),
),
......@@ -632,8 +863,9 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
items:
provider.statesList
.map(
(slist) =>
DropdownMenuItem<States>(
(slist) => DropdownMenuItem<
States
>(
value: slist,
child: Text(
slist.name!,
......@@ -644,7 +876,24 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
)
.toList(),
value: provider.selectedStates,
// value: provider.selectedStates,
value:
provider.statesList.isNotEmpty
? provider.selectedStates !=
null
? provider.statesList!.firstWhere(
(ord) =>
ord.id ==
provider
.selectedStatesId,
orElse:
() =>
provider
.statesList![0]!,
)
: null
: null,
onChanged: (States? value) {
if (value != null) {
if (provider
......@@ -655,22 +904,28 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
value!.id!;
provider.selectedStatesValue =
value!.name!;
provider
.crmLeadListDistrictsOnStateAPIFunction(
context,
"",
value!.id!,
);
if (provider
.districtsList
.isNotEmpty) {
provider.districtsList.clear();
provider.districtsList
.clear();
provider.subLocationsList.clear();
// provider.selectedDistricts = null;
provider.selectedDistrictId =
null;
provider.selectedDistrictValue =
"";
provider.selectedSubLocationId = null;
provider.selectedSubLocationValue = "";
}
provider
.crmLeadListDistrictsOnStateAPIFunction(
context,
"",
provider.selectedStatesId,
);
}
}
},
......@@ -701,8 +956,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
items:
provider.districtsList
.map(
(slist) =>
DropdownMenuItem<
(slist) => DropdownMenuItem<
Districts
>(
value: slist,
......@@ -715,7 +969,25 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
)
.toList(),
value: provider.selectedDistricts,
// value: provider.selectedDistricts,
value:
provider.districtsList.isNotEmpty
? provider.selectedDistricts !=
null
? provider.districtsList!
.firstWhere(
(ord) =>
ord.id ==
provider
.selectedDistrictId,
orElse:
() =>
provider
.districtsList![0]!,
)
: null
: null,
onChanged: (Districts? value) {
if (value != null) {
if (provider
......@@ -727,6 +999,12 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
value!.id!;
provider.selectedDistrictValue =
value!.district!;
provider
.crmLeadListSubLocOnDistrictAPIFunction(
context,
"",
value!.id!,
);
if (provider
.subLocationsList
.isNotEmpty) {
......@@ -736,16 +1014,10 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
// null;
provider.selectedSubLocationId =
null;
provider
.selectedSubLocationValue =
provider.selectedSubLocationValue =
"";
}
provider
.crmLeadListSubLocOnDistrictAPIFunction(
context,
"",
provider.selectedDistrictId,
);
}
}
},
......@@ -776,8 +1048,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
items:
provider.subLocationsList
.map(
(slist) =>
DropdownMenuItem<
(slist) => DropdownMenuItem<
SubLocations
>(
value: slist,
......@@ -790,7 +1061,28 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
)
.toList(),
value: provider.selectedSubLocations,
// value: provider.selectedSubLocations,
value:
provider
.subLocationsList
.isNotEmpty
? provider.selectedSubLocations !=
null
? provider
.subLocationsList!
.firstWhere(
(ord) =>
ord.id ==
provider
.selectedSubLocationId,
orElse:
() =>
provider
.subLocationsList![0]!,
)
: null
: null,
onChanged: (SubLocations? value) {
if (value != null) {
if (provider
......@@ -800,8 +1092,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
value;
provider.selectedSubLocationId =
value!.id!;
provider
.selectedSubLocationValue =
provider.selectedSubLocationValue =
value!.subLocality!;
}
}
......@@ -832,8 +1123,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
Expanded(
child: Text(
'Select Lead Status',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
),
],
......@@ -841,15 +1135,18 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
items:
<String>['Cold', 'Hot', 'Warm']
.map(
(value) =>
DropdownMenuItem<String>(
(value) => DropdownMenuItem<
String
>(
value: value,
child: Text(
value ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
overflow:
TextOverflow
.ellipsis,
),
),
)
......@@ -857,13 +1154,17 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
value: provider.selectedLeadStatus,
onChanged: (String? newValue) {
setState(() {
provider.selectedLeadStatus = newValue!;
provider.selectedLeadStatus =
newValue!;
});
},
buttonStyleData: ddtheme.buttonStyleData,
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
......@@ -931,16 +1232,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
if (_currentStep == 2) ...[
InkResponse(
onTap: () {
setState(() {
if (_currentStep == 0) {
_currentStep = 1;
} else if (_currentStep == 1) {
_currentStep = 2;
} else {
_currentStep = 0;
}
});
if (provider.validateStep3()) {
provider.crmAddNewLeadsAndProspectsAPIFunction(
context,
"",
......@@ -954,7 +1246,10 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
provider.selectedReferenceId,
provider.selectedSubLocationId,
provider.selectedLeadStatus,
{});
provider.getJsonEncodedProducts(),
);
}
details.onStepContinue;
},
child: Container(
......@@ -982,15 +1277,18 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
),
),
] else
...[
] else ...[
InkResponse(
onTap: () {
setState(() {
if (_currentStep == 0) {
if (provider.validateStep1()) {
_currentStep = 1;
}
} else if (_currentStep == 1) {
if (provider.validateStep2()) {
_currentStep = 2;
}
} else {
_currentStep = 0;
}
......
......@@ -226,7 +226,6 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
);
if (res != null) {
print("result ${res}");
}
},
child: Container(
......@@ -579,7 +578,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
],
),
items:
<String>["Extra","Including"]
<String>["Extra", "Including"]
.map(
(value) =>
DropdownMenuItem<String>(
......@@ -589,7 +588,8 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
overflow:
TextOverflow.ellipsis,
),
),
)
......@@ -602,8 +602,10 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
......@@ -656,14 +658,15 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: Material(
elevation: 10,
shadowColor: Colors.black54,
elevation: 2,
shadowColor: Colors.black12,
child: Container(
height: 80,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black26,
color: Colors.white54,
blurRadius: 10,
offset: Offset(0, -2),
),
......@@ -692,14 +695,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
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),
......@@ -711,13 +707,26 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
AppColors.app_blue,
),
)
: SvgPicture.asset(
"assets/svg/download_quote.svg",
: Row(
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(
child: InkResponse(
onTap:
......@@ -737,14 +746,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
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),
......@@ -756,13 +758,26 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
AppColors.app_blue,
),
)
: SvgPicture.asset(
"assets/svg/mail_quote.svg",
: Row(
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(
child: InkResponse(
onTap:
......@@ -782,14 +797,7 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
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),
......@@ -801,57 +809,69 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
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,
: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
"assets/svg/crm/whatsapp_quote_ic.svg",
),
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
SizedBox(width: 10,),
Text(
"Whatsapp",
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaRegular",
),
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",
],
),
),
),
),
// 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';
import 'package:generp/Models/crmModels/LeadListViewResponse.dart';
import 'package:generp/Models/crmModels/ProspectListViewResponse.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/crmNewLeadsProspectsViewResponse.dart';
import 'package:generp/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart';
......@@ -3323,13 +3324,11 @@ class ApiCalling {
static Future<crmNewLeadsProspectsViewResponse?> crmNewLeadsProspectsViewAPI(
empId,
session,
mode,
) async {
try {
Map<String, String> data = {
'emp_id': (empId).toString(),
'session_id': (session).toString(),
'mode': (mode).toString(),
};
final res = await post(data, crmNewProspectLeadViewUrl, {});
if (res != null) {
......@@ -3367,7 +3366,6 @@ class ApiCalling {
tel,
email,
designation,
lead_status,
products,
) async {
......@@ -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(
empId,
session,
......
......@@ -148,6 +148,7 @@ const crmLeadDetailsEditContactUrl = "${baseUrl_test}crm_lead_details_edit_conta
const crmLeadDetailsAddAppointmentUrl = "${baseUrl_test}crm_lead_details_add_appointment";
const crmLeadDetailsGenerateQuotationViewUrl = "${baseUrl_test}crm_lead_details_generate_quotation_view";
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 crmProspectListFilterSubmitUrl = "${baseUrl_test}crm_prospect_list_filter_submit";
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