Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sai Srinivas
GEN_ERP_2025
Commits
29665037
Commit
29665037
authored
Jul 31, 2025
by
Sai Srinivas
Browse files
30-07-2025 By Sai Srinivas
CRM Module
parent
56ca3566
Changes
34
Show whitespace changes
Inline
Side-by-side
assets/images/horizontal_logo.png
0 → 100644
View file @
29665037
20.1 KB
assets/images/maps_ic.png
0 → 100644
View file @
29665037
1.81 KB
assets/svg/crm/clear_search.svg
0 → 100644
View file @
29665037
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"24"
height=
"24"
viewBox=
"0 0 24 24"
id=
"close"
>
<path
fill=
"none"
d=
"M0 0h24v24H0V0z"
></path>
<path
d=
"M18.3 5.71c-.39-.39-1.02-.39-1.41 0L12 10.59 7.11 5.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"
></path>
</svg>
\ No newline at end of file
assets/svg/finance/cred_debit_ic.svg
0 → 100644
View file @
29665037
<svg
width=
"40"
height=
"40"
viewBox=
"0 0 40 40"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<circle
cx=
"20"
cy=
"20"
r=
"20"
fill=
"white"
/>
<path
d=
"M26.4376 15.7071C26.8281 15.3166 26.8281 14.6834 26.4376 14.2929C26.0471 13.9024 25.4139 13.9024 25.0234 14.2929L25.7305 15L26.4376 15.7071ZM13 26.7305C13 27.2828 13.4477 27.7305 14 27.7305L23 27.7305C23.5523 27.7305 24 27.2828 24 26.7305C24 26.1782 23.5523 25.7305 23 25.7305L15 25.7305L15 17.7305C15 17.1782 14.5523 16.7305 14 16.7305C13.4477 16.7305 13 17.1782 13 17.7305L13 26.7305ZM25.7305 15L25.0234 14.2929L13.2929 26.0234L14 26.7305L14.7071 27.4376L26.4376 15.7071L25.7305 15Z"
fill=
"#4CAF50"
/>
</svg>
lib/Notifiers/crmProvider/LeadListProvider.dart
View file @
29665037
// import 'package:flutter/cupertino.dart';
// import 'package:flutter/foundation.dart';
// import 'package:generp/Models/crmModels/GetSegmentOnTeamResponse.dart';
// import 'package:generp/Models/crmModels/GetSourceOnReferenceResponse.dart';
// import 'package:generp/Models/crmModels/LeadListViewResponse.dart';
// import 'package:generp/Models/crmModels/SubmitLeadListFilterResponse.dart';
// import 'package:provider/provider.dart';
//
// import '../../Models/crmModels/GetDistrictOnStateResponse.dart';
// import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart';
// import '../../Models/crmModels/LeadListContactPopUpResponse.dart' show Contacts;
// import '../../services/api_calling.dart';
// import '../HomeScreenNotifier.dart';
//
// class Leadlistprovider extends ChangeNotifier {
// TextEditingController sLeadIDController = TextEditingController();
// TextEditingController mobileNumberController = TextEditingController();
// TextEditingController companyNameController = TextEditingController(
// text: "a",
// );
//
// bool _isLoading = true;
//
// List<Sources> _sourcesList = [];
// List<Teams> _teamsList = [];
// List<States> _statesList = [];
// List<Employees> _employeesList = [];
// List<References> _referencesList = [];
// List<Segments> _segmentsList = [];
// List<Districts> _districtsList = [];
// List<SubLocations> _subLocationsList = [];
// List<Contacts> _contactsList = [];
// List<LeadList> _crmLeadList = [];
// List<String?> _leadStatusList = [];
// List<String?> _openStatusList = [];
// List<String?> _alphabetList = [];
//
//
// Sources? _selectedSources;
// Teams? _selectedTeams;
// States? _selectedStates;
// Employees? _selectedEmployees;
// References? _selectedReferences;
// Segments? _selectedSegments;
// Districts? _selectedDistricts;
// SubLocations? _selectedSubLocations;
// Contacts? _selectedContacts;
// String? _selectedLeadStatus;
// String? _selectedOpenStatus;
// String? _selectedAlphabet;
//
// String? _selectedSourceId;
// String? _selectedSourceValue;
//
// String? _selectedTeamId;
// String? _selectedTeamValue;
//
// String? _selectedStateId;
// String? _selectedStateValue;
//
// String? _selectedEmployeeId;
// String? _selectedEmployeeValue;
//
// String? _selectedReferenceId;
// String? _selectedReferenceValue;
//
// String? _selectedSegmentId;
// String? _selectedSegmentValue;
//
// String? _selectedDistrictId;
// String? _selectedDistrictValue;
//
// String? _selectedSubLocationId;
// String? _selectedSubLocationValue;
//
// String? _selectedContactId;
// String? _selectedContactValue;
//
// bool get isLoading => _isLoading;
//
// List<Sources> get sourcesList => _sourcesList;
//
// List<Teams> get teamsList => _teamsList;
//
// List<States> get statesList => _statesList;
//
// List<Employees> get employeesList => _employeesList;
//
// List<References> get referencesList => _referencesList;
//
// List<Segments> get segmentsList => _segmentsList;
//
// List<Districts> get districtsList => _districtsList;
//
// List<SubLocations> get subLocationsList => _subLocationsList;
//
// List<Contacts> get contactsList => _contactsList;
//
// List<LeadList> get crmLeadList => _crmLeadList;
//
// List<String?> get leadStatusList => _leadStatusList;
//
// List<String?> get alphabetList => _alphabetList;
//
// List<String?> get openStatusList => _openStatusList;
//
// Sources? get selectedSource => _selectedSources;
//
// Teams? get selectedTeam => _selectedTeams;
//
// States? get selectedStates => _selectedStates;
//
// Employees? get selectedEmployee => _selectedEmployees;
//
// References? get selectedReference => _selectedReferences;
//
// Segments? get selectedSegment => _selectedSegments;
//
// Districts? get selectedDistricts => _selectedDistricts;
//
// SubLocations? get selectedSubLocations => _selectedSubLocations;
//
// Contacts? get selectedContacts => _selectedContacts;
//
// String? get selectedLeadStatus => _selectedLeadStatus;
//
// String? get selectedOpenStatus => _selectedOpenStatus;
//
// String? get selectedSourceId => _selectedSourceId;
//
// String? get selectedSourceValue => _selectedSourceValue;
//
// String? get selectedTeamId => _selectedTeamId;
//
// String? get selectedTeamValue => _selectedTeamValue;
//
// String? get selectedStateId => _selectedStateId;
//
// String? get selectedStateValue => _selectedStateValue;
//
// String? get selectedEmployeeId => _selectedEmployeeId;
//
// String? get selectedEmployeeValue => _selectedEmployeeValue;
//
// String? get selectedReferenceId => _selectedReferenceId;
//
// String? get selectedReferenceValue => _selectedReferenceValue;
//
// String? get selectedSegmentId => _selectedSegmentId;
//
// String? get selectedSegmentValue => _selectedSegmentValue;
//
// String? get selectedDistrictId => _selectedDistrictId;
//
// String? get selectedDistrictValue => _selectedDistrictValue;
//
// String? get selectedSubLocationId => _selectedSubLocationId;
//
// String? get selectedSubLocationValue => _selectedSubLocationValue;
//
// String? get selectedContactId => _selectedContactId;
//
// String? get selectedContactValue => _selectedContactValue;
//
// String? get selectedAlphabet => _selectedAlphabet;
//
// set isLoading(bool value) {
// _isLoading = value;
// notifyListeners();
// }
//
// set selectedAlphabet(String? value){
// _selectedAlphabet = value;
// notifyListeners();
// }
//
// set selectedSource(Sources? value) {
// _selectedSources = value;
// _selectedSourceId = value!.id!;
// _selectedSourceValue = value!.name!;
// notifyListeners();
// }
//
// set selectedTeam(Teams? value) {
// _selectedTeams = value;
// _selectedTeamId = value!.id!;
// _selectedTeamValue = value.name;
// notifyListeners();
// }
//
// set selectedStates(States? value) {
// _selectedStates = value;
// _selectedStateId = value!.id!;
// _selectedStateValue = value.name;
// notifyListeners();
// }
//
// set selectedEmployee(Employees? value) {
// _selectedEmployees = value;
// _selectedEmployeeId = value!.id!;
// _selectedEmployeeValue = value.name;
// notifyListeners();
// }
//
// set selectedReference(References? value) {
// _selectedReferences = value;
// _selectedReferenceId = value!.id!;
// _selectedReferenceValue = value.name;
// notifyListeners();
// }
//
// set selectedSegment(Segments? value) {
// _selectedSegments = value;
// _selectedSegmentId = value!.id!;
// _selectedSegmentValue = value.name;
// notifyListeners();
// }
//
// set selectedDistricts(Districts? value) {
// _selectedDistricts = value;
// _selectedDistrictId = value!.id!;
// _selectedDistrictValue = value.district;
// notifyListeners();
// }
//
// set selectedSubLocations(SubLocations? value) {
// _selectedSubLocations = value;
// _selectedSubLocationId = value!.id!;
// _selectedSubLocationValue = value.subLocality;
// notifyListeners();
// }
//
// set selectedContacts(Contacts? value) {
// _selectedContacts = value;
// _selectedContactId = value!.id!;
// _selectedContactValue = value.name;
// notifyListeners();
// }
//
// set selectedLeadStatus(String? value) {
// _selectedLeadStatus = value;
// notifyListeners();
// }
//
// set selectedOpenStatus(String? value) {
// _selectedOpenStatus = value;
// notifyListeners();
// }
//
// set selectedSourceId(String? value) {
// _selectedSourceId = value;
// notifyListeners();
// }
//
// set selectedSourceValue(String? value) {
// _selectedSourceValue = value;
// notifyListeners();
// }
//
// set selectedTeamId(String? value) {
// _selectedTeamId = value;
// notifyListeners();
// }
//
// set selectedTeamValue(String? value) {
// _selectedTeamValue = value;
// notifyListeners();
// }
//
// set selectedStateId(String? value) {
// _selectedStateId = value;
// notifyListeners();
// }
//
// set selectedStateValue(String? value) {
// _selectedStateValue = value;
// notifyListeners();
// }
//
// set selectedEmployeeId(String? value) {
// _selectedEmployeeId = value;
// notifyListeners();
// }
//
// set selectedEmployeeValue(String? value) {
// _selectedEmployeeValue = value;
// notifyListeners();
// }
//
// set selectedReferenceId(String? value) {
// _selectedReferenceId = value;
// notifyListeners();
// }
//
// set selectedReferenceValue(String? value) {
// _selectedReferenceValue = value;
// notifyListeners();
// }
//
// set selectedSegmentId(String? value) {
// _selectedSegmentId = value;
// notifyListeners();
// }
//
// set selectedSegmentValue(String? value) {
// _selectedSegmentValue = value;
// notifyListeners();
// }
//
// set selectedDistrictId(String? value) {
// _selectedDistrictId = value;
// notifyListeners();
// }
//
// set selectedDistrictValue(String? value) {
// _selectedDistrictValue = value;
// notifyListeners();
// }
//
// set selectedSubLocationId(String? value) {
// _selectedSubLocationId = value;
// notifyListeners();
// }
//
// set selectedSubLocationValue(String? value) {
// _selectedSubLocationValue = value;
// notifyListeners();
// }
//
// set selectedContactId(String? value) {
// _selectedContactId = value;
// notifyListeners();
// }
//
// set selectedContactValue(String? value) {
// _selectedContactValue = value;
// notifyListeners();
// }
//
// Future<void> crmLeadListViewAPIFunction(context, mode) async {
// try {
// var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
// final data = await ApiCalling.crmLeadListViewAPI(
// HomeProv.empId,
// HomeProv.session,
// mode,
// );
// if (data != null) {
// print(data.error);
// if (data.error == "0") {
// // print("as");
// _leadStatusList = [
// "all",
// "Hot",
// "Warm",
// "Cold",
// "Order Gain",
// "Order Lost",
// ];
// _alphabetList = List.generate(26, (index) => String.fromCharCode(index + 65));
//
// _openStatusList = ["open", "Closed", "All"];
// _sourcesList = data.sources!;
// _teamsList = data.teams!;
// _statesList = data.states!;
// _employeesList = data.employees!;
// checkDropDownValues();
// // print(_leadStatusList);
// notifyListeners();
// }
// }
// } catch (e, s) {}
// }
//
// Future<void> crmLeadListSourceOnReferenceAPIFunction(
// context,
// mode,
// sourceID,
// ) async {
// try {
// var prov = Provider.of<HomescreenNotifier>(context, listen: false);
// final data = await ApiCalling.crmLeadListSourceOnReferenceAPI(
// prov.empId,
// prov.session,
// sourceID,
// );
// if (data != null) {
// if (data.error == "0") {
// _referencesList = data.references!;
// notifyListeners();
// }
// }
// } catch (e, s) {}
// }
//
// Future<void> crmLeadListSegmentOnTeamAPIFunction(
// context,
// mode,
// teamID,
// ) async {
// try {
// var prov = Provider.of<HomescreenNotifier>(context, listen: false);
// final data = await ApiCalling.crmLeadListSegmentOnTeamAPI(
// prov.empId,
// prov.session,
// teamID,
// );
// if (data != null) {
// if (data.error == "0") {
// _segmentsList = data.segments!;
// notifyListeners();
// }
// }
// } catch (e, s) {}
// }
//
// Future<void> crmLeadListDistrictsOnStateAPIFunction(
// context,
// mode,
// stateID,
// ) async {
// try {
// var prov = Provider.of<HomescreenNotifier>(context, listen: false);
// final data = await ApiCalling.crmDistrictsOnStateAPI(
// prov.empId,
// prov.session,
// stateID,
// );
// if (data != null) {
// if (data.error == "0") {
// _districtsList = data.districts!;
// notifyListeners();
// }
// }
// } catch (e, s) {}
// }
//
// Future<void> crmLeadListSubLocOnDistrictAPIFunction(
// context,
// mode,
// districtID,
// ) async {
// try {
// var prov = Provider.of<HomescreenNotifier>(context, listen: false);
// final data = await ApiCalling.crmSubLocOnDistrictAPI(
// prov.empId,
// prov.session,
// districtID,
// );
// if (data != null) {
// if (data.error == "0") {
// _subLocationsList = data.subLocations!;
// notifyListeners();
// }
// }
// } catch (e, s) {}
// }
//
// Future<void> crmLeadListContactPopUpAPIFunction(
// context,
// mode,
// accountID,
// ) async {
// try {
// var prov = Provider.of<HomescreenNotifier>(context, listen: false);
// final data = await ApiCalling.crmLeadListContactPopUpAPI(
// prov.empId,
// prov.session,
// accountID,
// );
// if (data != null) {
// if (data.error == "0") {
// _contactsList = data.contacts!;
// notifyListeners();
// }
// }
// } catch (e, s) {}
// }
//
// Future<void> crmLeadListAPIFunction(
// context,
// mode,
// leadStatus,
// openStatus,
// sourceID,
// referenceID,
// teamID,
// segmentID,
// alphabet
// ) async {
// try {
// _isLoading = true;
// _crmLeadList.clear();
// notifyListeners();
// var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
// final data = await ApiCalling.crmLeadListFilterSubmitAPI(
// HomeProv.empId,
// HomeProv.session,
// mode,
// leadStatus,
// openStatus,
// mobileNumberController.text,
// companyNameController.text,
// sourceID,
// referenceID,
// teamID,
// segmentID,
// alphabet
// );
// if (data != null) {
// _isLoading = true;
// notifyListeners();
// if (data.error == "0") {
// _crmLeadList = data.leadList!;
// _isLoading = false;
// checkDropDownValues();
// notifyListeners();
// } else {
// _isLoading = false;
// notifyListeners();
// }
// } else {
// _isLoading = false;
// notifyListeners();
// }
// } catch (e, s) {
// _isLoading = false;
// notifyListeners();
// }
// }
//
// onChangedLeadId(value) {
// notifyListeners();
// }
//
// onChangedMobileNum(value) {
// notifyListeners();
// }
//
// onChangedCompanyName(value) {
// notifyListeners();
// }
//
// void resetForm() {
// _isLoading = false;
// sLeadIDController.clear();
// mobileNumberController.clear();
// companyNameController.clear();
// companyNameController.text = "a";
// _selectedEmployees = null;
// _selectedSources = null;
// _selectedReferences = null;
// _selectedSegments = null;
// _selectedTeams = null;
// _selectedDistricts = null;
// _selectedStates = null;
// _selectedSubLocations = null;
// _selectedLeadStatus = null;
// _selectedOpenStatus = null;
// _selectedEmployeeId = null;
// _selectedSourceId = null;
// _selectedReferenceId = null;
// _selectedTeamId = null;
// _selectedSegmentId = null;
// _selectedStateId = null;
// _selectedDistrictId = null;
// _selectedSubLocationId = null;
//
// _selectedEmployeeValue = null;
// _selectedSourceValue = null;
// _selectedReferenceValue = null;
// _selectedTeamValue = null;
// _selectedSegmentValue = null;
// _selectedDistrictValue = null;
// _selectedStateValue = null;
// _selectedSubLocationValue = null;
// checkDropDownValues();
// notifyListeners();
// }
//
// void checkDropDownValues() {
// if (!_employeesList.contains(_selectedEmployees) &&
// _selectedEmployees != null) {
// _selectedEmployeeId = null;
// _selectedEmployeeValue = null;
// }
// if (!_sourcesList.contains(_selectedSources) && _selectedSources != null) {
// _selectedSourceId = null;
// _selectedSourceValue = null;
// }
// if (!_referencesList.contains(_selectedReferences) &&
// _selectedReferences != null) {
// _selectedReferenceId = null;
// _selectedReferenceValue = null;
// }
// if (!_segmentsList.contains(_selectedSegments) &&
// _selectedSegments != null) {
// _selectedTeamId = null;
// _selectedTeamValue = 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) {
// _selectedStateId = null;
// _selectedStateValue = null;
// }
// if (!_subLocationsList.contains(_selectedSubLocations) &&
// _selectedSubLocations != null) {
// _selectedSubLocationId = null;
// _selectedSubLocationValue = null;
// }
// notifyListeners();
// }
// }
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:generp/Models/crmModels/GetSegmentOnTeamResponse.dart'
;
...
...
@@ -15,9 +636,7 @@ import '../HomeScreenNotifier.dart';
class
Leadlistprovider
extends
ChangeNotifier
{
TextEditingController
sLeadIDController
=
TextEditingController
();
TextEditingController
mobileNumberController
=
TextEditingController
();
TextEditingController
companyNameController
=
TextEditingController
(
text:
"a"
,
);
TextEditingController
companyNameController
=
TextEditingController
();
bool
_isLoading
=
true
;
...
...
@@ -35,7 +654,6 @@ class Leadlistprovider extends ChangeNotifier {
List
<
String
?>
_openStatusList
=
[];
List
<
String
?>
_alphabetList
=
[];
Sources
?
_selectedSources
;
Teams
?
_selectedTeams
;
States
?
_selectedStates
;
...
...
@@ -169,71 +787,72 @@ class Leadlistprovider extends ChangeNotifier {
notifyListeners
();
}
set
selectedAlphabet
(
String
?
value
){
set
selectedAlphabet
(
String
?
value
)
{
_selectedAlphabet
=
value
;
notifyListeners
();
}
set
selectedSource
(
Sources
?
value
)
{
_selectedSources
=
value
;
_selectedSourceId
=
value
!.
id
!;
_selectedSourceValue
=
value
!.
name
!;
_selectedSourceId
=
value
?.
id
;
_selectedSourceValue
=
value
?.
name
;
print
(
'Setting selectedSource:
$value
, id:
${_selectedSourceId}
, name:
${_selectedSourceValue}
'
);
notifyListeners
();
}
set
selectedTeam
(
Teams
?
value
)
{
_selectedTeams
=
value
;
_selectedTeamId
=
value
!
.
id
!
;
_selectedTeamValue
=
value
.
name
;
_selectedTeamId
=
value
?
.
id
;
_selectedTeamValue
=
value
?
.
name
;
notifyListeners
();
}
set
selectedStates
(
States
?
value
)
{
_selectedStates
=
value
;
_selectedStateId
=
value
!
.
id
!
;
_selectedStateValue
=
value
.
name
;
_selectedStateId
=
value
?
.
id
;
_selectedStateValue
=
value
?
.
name
;
notifyListeners
();
}
set
selectedEmployee
(
Employees
?
value
)
{
_selectedEmployees
=
value
;
_selectedEmployeeId
=
value
!
.
id
!
;
_selectedEmployeeValue
=
value
.
name
;
_selectedEmployeeId
=
value
?
.
id
;
_selectedEmployeeValue
=
value
?
.
name
;
notifyListeners
();
}
set
selectedReference
(
References
?
value
)
{
_selectedReferences
=
value
;
_selectedReferenceId
=
value
!
.
id
!
;
_selectedReferenceValue
=
value
.
name
;
_selectedReferenceId
=
value
?
.
id
;
_selectedReferenceValue
=
value
?
.
name
;
notifyListeners
();
}
set
selectedSegment
(
Segments
?
value
)
{
_selectedSegments
=
value
;
_selectedSegmentId
=
value
!
.
id
!
;
_selectedSegmentValue
=
value
.
name
;
_selectedSegmentId
=
value
?
.
id
;
_selectedSegmentValue
=
value
?
.
name
;
notifyListeners
();
}
set
selectedDistricts
(
Districts
?
value
)
{
_selectedDistricts
=
value
;
_selectedDistrictId
=
value
!
.
id
!
;
_selectedDistrictValue
=
value
.
district
;
_selectedDistrictId
=
value
?
.
id
;
_selectedDistrictValue
=
value
?
.
district
;
notifyListeners
();
}
set
selectedSubLocations
(
SubLocations
?
value
)
{
_selectedSubLocations
=
value
;
_selectedSubLocationId
=
value
!
.
id
!
;
_selectedSubLocationValue
=
value
.
subLocality
;
_selectedSubLocationId
=
value
?
.
id
;
_selectedSubLocationValue
=
value
?
.
subLocality
;
notifyListeners
();
}
set
selectedContacts
(
Contacts
?
value
)
{
_selectedContacts
=
value
;
_selectedContactId
=
value
!
.
id
!
;
_selectedContactValue
=
value
.
name
;
_selectedContactId
=
value
?
.
id
;
_selectedContactValue
=
value
?
.
name
;
notifyListeners
();
}
...
...
@@ -346,9 +965,8 @@ class Leadlistprovider extends ChangeNotifier {
mode
,
);
if
(
data
!=
null
)
{
print
(
data
.
error
);
print
(
'crmLeadListViewAPI error:
${data.error}
, sources:
${data.sources}
'
);
if
(
data
.
error
==
"0"
)
{
// print("as");
_leadStatusList
=
[
"all"
,
"Hot"
,
...
...
@@ -358,24 +976,24 @@ class Leadlistprovider extends ChangeNotifier {
"Order Lost"
,
];
_alphabetList
=
List
.
generate
(
26
,
(
index
)
=>
String
.
fromCharCode
(
index
+
65
));
_openStatusList
=
[
"open"
,
"Closed"
,
"All"
];
_sourcesList
=
data
.
sources
!
;
_teamsList
=
data
.
teams
!
;
_statesList
=
data
.
states
!
;
_employeesList
=
data
.
employees
!
;
_sourcesList
=
data
.
sources
?.
where
((
source
)
=>
source
!=
null
&&
source
.
id
!=
null
&&
source
.
name
!=
null
).
toList
()
??
[]
;
_teamsList
=
data
.
teams
?.
where
((
team
)
=>
team
!=
null
&&
team
.
id
!=
null
&&
team
.
name
!=
null
).
toList
()
??
[]
;
_statesList
=
data
.
states
?.
where
((
state
)
=>
state
!=
null
&&
state
.
id
!=
null
&&
state
.
name
!=
null
).
toList
()
??
[]
;
_employeesList
=
data
.
employees
?.
where
((
employee
)
=>
employee
!=
null
&&
employee
.
id
!=
null
&&
employee
.
name
!=
null
).
toList
()
??
[]
;
checkDropDownValues
();
// print(_leadStatusList);
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
}
catch
(
e
,
s
)
{
print
(
'crmLeadListViewAPI error:
$e
, stack:
$s
'
);
}
}
Future
<
void
>
crmLeadListSourceOnReferenceAPIFunction
(
context
,
mode
,
sourceID
,
String
?
sourceID
,
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -386,17 +1004,22 @@ class Leadlistprovider extends ChangeNotifier {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_referencesList
=
data
.
references
!;
_referencesList
=
data
.
references
?.
where
((
ref
)
=>
ref
!=
null
&&
ref
.
id
!=
null
&&
ref
.
name
!=
null
).
toList
()
??
[];
notifyListeners
();
}
else
{
_referencesList
.
clear
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
}
catch
(
e
,
s
)
{
print
(
'crmLeadListSourceOnReferenceAPI error:
$e
, stack:
$s
'
);
}
}
Future
<
void
>
crmLeadListSegmentOnTeamAPIFunction
(
context
,
mode
,
teamID
,
String
?
teamID
,
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -407,17 +1030,22 @@ class Leadlistprovider extends ChangeNotifier {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_segmentsList
=
data
.
segments
!;
_segmentsList
=
data
.
segments
?.
where
((
segment
)
=>
segment
!=
null
&&
segment
.
id
!=
null
&&
segment
.
name
!=
null
).
toList
()
??
[];
notifyListeners
();
}
else
{
_segmentsList
.
clear
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
}
catch
(
e
,
s
)
{
print
(
'crmLeadListSegmentOnTeamAPI error:
$e
, stack:
$s
'
);
}
}
Future
<
void
>
crmLeadListDistrictsOnStateAPIFunction
(
context
,
mode
,
stateID
,
String
?
stateID
,
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -428,17 +1056,22 @@ class Leadlistprovider extends ChangeNotifier {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_districtsList
=
data
.
districts
!;
_districtsList
=
data
.
districts
?.
where
((
district
)
=>
district
!=
null
&&
district
.
id
!=
null
&&
district
.
district
!=
null
).
toList
()
??
[];
notifyListeners
();
}
else
{
_districtsList
.
clear
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
}
catch
(
e
,
s
)
{
print
(
'crmLeadListDistrictsOnStateAPI error:
$e
, stack:
$s
'
);
}
}
Future
<
void
>
crmLeadListSubLocOnDistrictAPIFunction
(
context
,
mode
,
districtID
,
String
?
districtID
,
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -449,17 +1082,22 @@ class Leadlistprovider extends ChangeNotifier {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_subLocationsList
=
data
.
subLocations
!
;
_subLocationsList
=
data
.
subLocations
?.
where
((
subLoc
)
=>
subLoc
!=
null
&&
subLoc
.
id
!=
null
&&
subLoc
.
subLocality
!=
null
).
toList
()
??
[]
;
notifyListeners
();
}
else
{
_subLocationsList
.
clear
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{
print
(
'crmLeadListSubLocOnDistrictAPI error:
$e
, stack:
$s
'
);
}
}
catch
(
e
,
s
)
{}
}
Future
<
void
>
crmLeadListContactPopUpAPIFunction
(
context
,
mode
,
accountID
,
String
?
accountID
,
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -470,23 +1108,28 @@ class Leadlistprovider extends ChangeNotifier {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_contactsList
=
data
.
contacts
!
;
_contactsList
=
data
.
contacts
?.
where
((
contact
)
=>
contact
!=
null
&&
contact
.
id
!=
null
&&
contact
.
name
!=
null
).
toList
()
??
[]
;
notifyListeners
();
}
else
{
_contactsList
.
clear
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{
print
(
'crmLeadListContactPopUpAPI error:
$e
, stack:
$s
'
);
}
}
catch
(
e
,
s
)
{}
}
Future
<
void
>
crmLeadListAPIFunction
(
context
,
mode
,
leadStatus
,
openStatus
,
sourceID
,
referenceID
,
teamID
,
segmentID
,
alphabet
String
?
mode
,
String
?
leadStatus
,
String
?
openStatus
,
String
?
sourceID
,
String
?
referenceID
,
String
?
teamID
,
String
?
segmentID
,
String
?
alphabet
,
)
async
{
try
{
_isLoading
=
true
;
...
...
@@ -505,13 +1148,13 @@ class Leadlistprovider extends ChangeNotifier {
referenceID
,
teamID
,
segmentID
,
alphabet
alphabet
,
);
if
(
data
!=
null
)
{
_isLoading
=
true
;
notifyListeners
();
if
(
data
.
error
==
"0"
)
{
_crmLeadList
=
data
.
leadList
!
;
_crmLeadList
=
data
.
leadList
?.
where
((
lead
)
=>
lead
!=
null
).
toList
()
??
[]
;
_isLoading
=
false
;
checkDropDownValues
();
notifyListeners
();
...
...
@@ -524,20 +1167,21 @@ class Leadlistprovider extends ChangeNotifier {
notifyListeners
();
}
}
catch
(
e
,
s
)
{
print
(
'crmLeadListAPIFunction error:
$e
, stack:
$s
'
);
_isLoading
=
false
;
notifyListeners
();
}
}
onChangedLeadId
(
value
)
{
onChangedLeadId
(
String
?
value
)
{
notifyListeners
();
}
onChangedMobileNum
(
value
)
{
onChangedMobileNum
(
String
?
value
)
{
notifyListeners
();
}
onChangedCompanyName
(
value
)
{
onChangedCompanyName
(
String
?
value
)
{
notifyListeners
();
}
...
...
@@ -546,7 +1190,7 @@ class Leadlistprovider extends ChangeNotifier {
sLeadIDController
.
clear
();
mobileNumberController
.
clear
();
companyNameController
.
clear
();
companyNameController
.
text
=
"a"
;
companyNameController
.
clear
()
;
_selectedEmployees
=
null
;
_selectedSources
=
null
;
_selectedReferences
=
null
;
...
...
@@ -557,6 +1201,7 @@ class Leadlistprovider extends ChangeNotifier {
_selectedSubLocations
=
null
;
_selectedLeadStatus
=
null
;
_selectedOpenStatus
=
null
;
_selectedAlphabet
=
null
;
_selectedEmployeeId
=
null
;
_selectedSourceId
=
null
;
_selectedReferenceId
=
null
;
...
...
@@ -565,7 +1210,6 @@ class Leadlistprovider extends ChangeNotifier {
_selectedStateId
=
null
;
_selectedDistrictId
=
null
;
_selectedSubLocationId
=
null
;
_selectedEmployeeValue
=
null
;
_selectedSourceValue
=
null
;
_selectedReferenceValue
=
null
;
...
...
@@ -579,40 +1223,43 @@ class Leadlistprovider extends ChangeNotifier {
}
void
checkDropDownValues
()
{
if
(!
_employeesList
.
contains
(
_selectedEmployees
)
&&
_selectedEmployees
!
=
null
)
{
if
(
_selectedEmployees
!=
null
&&
!
_employeesList
.
contains
(
_selectedEmployees
)
)
{
_selectedEmployees
=
null
;
_selectedEmployeeId
=
null
;
_selectedEmployeeValue
=
null
;
}
if
(!
_sourcesList
.
contains
(
_selectedSources
)
&&
_selectedSources
!=
null
)
{
if
(
_selectedSources
!=
null
&&
!
_sourcesList
.
contains
(
_selectedSources
))
{
_selectedSources
=
null
;
_selectedSourceId
=
null
;
_selectedSourceValue
=
null
;
}
if
(!
_referencesList
.
contains
(
_selectedReferences
)
&&
_selectedReferences
!
=
null
)
{
if
(
_selectedReferences
!=
null
&&
!
_referencesList
.
contains
(
_selectedReferences
)
)
{
_selectedReferences
=
null
;
_selectedReferenceId
=
null
;
_selectedReferenceValue
=
null
;
}
if
(!
_segmentsList
.
contains
(
_selectedSegments
)
&&
_selectedSegments
!=
null
)
{
_selectedTeamId
=
null
;
_selectedTeamValue
=
null
;
}
if
(!
_teamsList
.
contains
(
_selectedTeams
)
&&
_selectedTeams
!=
null
)
{
if
(
_selectedSegments
!=
null
&&
!
_segmentsList
.
contains
(
_selectedSegments
))
{
_selectedSegments
=
null
;
_selectedSegmentId
=
null
;
_selectedSegmentValue
=
null
;
}
if
(!
_districtsList
.
contains
(
_selectedDistricts
)
&&
_selectedDistricts
!=
null
)
{
if
(
_selectedTeams
!=
null
&&
!
_teamsList
.
contains
(
_selectedTeams
))
{
_selectedTeams
=
null
;
_selectedTeamId
=
null
;
_selectedTeamValue
=
null
;
}
if
(
_selectedDistricts
!=
null
&&
!
_districtsList
.
contains
(
_selectedDistricts
))
{
_selectedDistricts
=
null
;
_selectedDistrictId
=
null
;
_selectedDistrictValue
=
null
;
}
if
(!
_statesList
.
contains
(
_selectedStates
)
&&
_selectedStates
!=
null
)
{
if
(
_selectedStates
!=
null
&&
!
_statesList
.
contains
(
_selectedStates
))
{
_selectedStates
=
null
;
_selectedStateId
=
null
;
_selectedStateValue
=
null
;
}
if
(!
_subLocationsList
.
contains
(
_selectedSubLocations
)
&&
_selectedSubLocations
!
=
null
)
{
if
(
_selectedSubLocations
!=
null
&&
!
_subLocationsList
.
contains
(
_selectedSubLocations
)
)
{
_selectedSubLocations
=
null
;
_selectedSubLocationId
=
null
;
_selectedSubLocationValue
=
null
;
}
...
...
lib/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart
View file @
29665037
...
...
@@ -354,6 +354,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
set
productRows
(
value
)
{
_productRows
=
value
;
productsEmptyError
=
""
;
notifyListeners
();
}
...
...
@@ -369,6 +370,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
String
?
TelephoneError
=
""
;
String
?
mobileError
=
""
;
String
?
addressError
=
""
;
String
?
productsEmptyError
=
""
;
String
?
designationError
=
""
;
String
?
taxesError
=
""
;
String
?
SpecialNoteError
=
""
;
...
...
@@ -764,6 +766,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
districtsError
=
""
;
subLocError
=
""
;
leadStatusError
=
""
;
productsEmptyError
=
""
;
notifyListeners
();
}
...
...
@@ -836,7 +839,13 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
if
(
mobileController
.
text
.
trim
().
isEmpty
){
mobileError
=
"Please enter Mobile Number"
;
isValid
=
false
;
}
else
{
if
(
mobileController
.
text
.
length
<
10
){
mobileError
=
"Please enter 10 digits"
;
isValid
=
false
;
}
}
// if(designationController.text.trim().isEmpty){
// designationError = "Please enter Designation";
// isValid = false;
...
...
@@ -849,11 +858,11 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
bool
validateStep2
(){
bool
isValid
=
true
;
//
if(alternateMobileController.text.trim().isEmpty){
//
AlternatemobileError = "";
//
isValid = false;
//
//
}
if
(
alternateMobileController
.
text
.
trim
().
is
Not
Empty
&&
alternateMobileController
.
text
.
length
<
10
){
AlternatemobileError
=
"
Please enter 10 digits
"
;
isValid
=
false
;
}
// if(telephoneController.text.trim().isEmpty){
// isValid = false;
//
...
...
@@ -902,6 +911,10 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
addressError
=
"Please Enter address"
;
isValid
=
false
;
}
if
(
productRows
.
isEmpty
||
_productRows
.
isEmpty
){
productsEmptyError
=
"Please Add min. one Product"
;
isValid
=
false
;
}
notifyListeners
();
return
isValid
;
}
...
...
lib/Notifiers/crmProvider/crmGenerateQuotationProvider.dart
View file @
29665037
import
'dart:convert'
;
import
'dart:io'
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -8,6 +9,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import
'package:generp/Models/crmModels/crmLeadDetailsGenerateQuotationViewResponse.dart'
;
import
'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart'
;
import
'package:generp/screens/LoginScreen.dart'
;
import
'package:get/get.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:intl/intl.dart'
;
import
'package:path_provider/path_provider.dart'
;
...
...
@@ -25,6 +27,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
final
GlobalKey
webViewKey
=
GlobalKey
();
var
dl
=
DownloadManager
();
bool
_buttonsLoading
=
false
;
ProductsData
?
_selectedProductsDeatilsData
;
TextEditingController
addEditProductPriceController
=
TextEditingController
();
TextEditingController
addEditQuantityController
=
TextEditingController
();
...
...
@@ -40,8 +43,16 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
List
<
Map
<
String
,
dynamic
>>
get
productRows
=>
_productRows
;
bool
get
buttonsLoading
=>
_buttonsLoading
;
set
buttonsLoading
(
bool
value
){
_buttonsLoading
=
value
;
notifyListeners
();
}
set
productRows
(
value
)
{
_productRows
=
value
;
productRowsError
=
""
;
notifyListeners
();
}
...
...
@@ -50,6 +61,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
String
?
mailIdError
=
""
;
String
?
mobileError
=
""
;
String
?
subjectsError
=
""
;
String
?
productRowsError
=
""
;
String
?
taxesError
=
""
;
String
?
SpecialNoteError
=
""
;
String
?
forError
=
""
;
...
...
@@ -98,6 +110,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
set
selectedTaxes
(
String
?
value
){
_selectedTaxes
=
value
;
taxesError
=
""
;
notifyListeners
();
}
...
...
@@ -170,7 +183,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
if
(
index
>=
0
&&
index
<
leadProductsList
.
length
)
{
leadProductsList
[
index
]
=
updatedProduct
;
_productRows
[
index
]
=
{
"product_id"
:
updatedProduct
.
productId
!
,
"product_id"
:
updatedProduct
.
productId
,
"price"
:
updatedProduct
.
price
,
"qty"
:
updatedProduct
.
qty
,
"net_price"
:
updatedProduct
.
prodTotalPrice
,
...
...
@@ -190,11 +203,18 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
notifyListeners
();
}
void
preFillFormForEdit
(
LeadProducts
product
)
{
checkDropdownReset
();
selectedLeadProducts
=
product
;
selectedAddEditLeadProductId
=
product
.
id
;
selectedAddEditLeadProductName
=
product
.
productName
;
void
preFillFormForEdit
(
LeadProducts
product
,
int
index
)
{
final
newprod
=
product
;
selectedProducts
=
productsList
.
firstWhere
(
(
p
)
=>
p
.
id
==
newprod
.
productId
,
orElse:
()
=>
Products
(
id:
''
,
name:
'Unknown'
),
);
// selectedLeadProducts = product;
selectedAddEditProductId
=
product
.
productId
;
selectedAddEditProductName
=
product
.
productName
;
addEditProductPriceController
.
text
=
product
.
price
?.
toString
()
??
''
;
addEditQuantityController
.
text
=
product
.
qty
?.
toString
()
??
''
;
addEditTotalAmountController
.
text
=
...
...
@@ -382,6 +402,11 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
quotation_type
,
)
async
{
try
{
if
(!
validateform
()){
return
;
}
_buttonsLoading
=
true
;
notifyListeners
();
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmLeadDetailsGenerateQuotationSubmitAPI
(
prov
.
empId
,
...
...
@@ -399,6 +424,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_buttonsLoading
=
false
;
_quotationFilePath
=
data
.
quoteFilepath
!;
if
(
quotation_type
==
"genquotedown"
)
{
String
suggestedFilename
=
getUniqueFilename
(
'quotation'
,
'pdf'
);
...
...
@@ -419,9 +445,17 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
toast
(
context
,
data
.
message
);
resetForm
();
notifyListeners
();
}
else
{}
}
else
{}
}
else
{
_buttonsLoading
=
false
;
notifyListeners
();
}
}
else
{
_buttonsLoading
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
)
{
_buttonsLoading
=
false
;
notifyListeners
();
print
(
"Error:
$e
, Stack:
$s
"
);
}
}
...
...
@@ -621,6 +655,50 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
notifyListeners
();
}
bool
validateform
(){
bool
isValid
=
true
;
if
(
mailIdController
.
text
.
trim
().
isEmpty
){
mailIdError
=
"Please Enter Email ID"
;
isValid
=
false
;
}
if
(
mobileController
.
text
.
trim
().
isEmpty
){
mobileError
=
"Please Enter Mobile Number"
;
isValid
=
false
;
}
else
{
if
(
mobileController
.
text
.
length
<
10
){
mobileError
=
"Mobile Number should be 10 digits"
;
isValid
=
false
;
}
}
if
(
subjectsController
.
text
.
isEmpty
){
subjectsError
=
"Please Enter Subject"
;
isValid
=
false
;
}
if
(
productRows
.
isEmpty
||
_productRows
.
isEmpty
){
productRowsError
=
"Please Add Min. 1 Product"
;
isValid
=
false
;
}
if
(
_selectedTaxes
==
null
||
_selectedTaxes
==
""
){
taxesError
=
"Please select a value"
;
isValid
=
false
;
}
if
(
SpecialNoteController
.
text
.
trim
().
isEmpty
){
SpecialNoteError
=
"Please Enter a Note"
;
isValid
=
false
;
}
if
(
forController
.
text
.
trim
().
isEmpty
){
forError
=
"Please Enter FOR"
;
isValid
=
false
;
}
if
(
paymentTermsController
.
text
.
trim
().
isEmpty
){
paymentTermsError
=
"Please Enter Terms"
;
isValid
=
false
;
}
_buttonsLoading
=
false
;
notifyListeners
();
return
isValid
;
}
void
resetForm
()
{
checkDropdownReset
();
_productRows
.
clear
();
...
...
@@ -669,6 +747,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
mailIdError
=
""
;
mobileError
=
""
;
subjectsError
=
""
;
productRowsError
=
""
;
taxesError
=
""
;
SpecialNoteError
=
""
;
forError
=
""
;
...
...
lib/Notifiers/crmProvider/crmLeadDetailsProvider.dart
View file @
29665037
import
'dart:io'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
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/Utils/commonServices.dart'
;
import
'package:get/get.dart'
;
import
'package:intl/intl.dart'
;
import
'package:path_provider/path_provider.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:provider/provider.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
import
'../../Models/crmModels/LeadDetailsResponse.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../services/api_calling.dart'
;
import
'../HomeScreenNotifier.dart'
;
import
'package:http/http.dart'
as
http
;
class
crmLeadDetailsProvider
extends
ChangeNotifier
{
final
FlutterLocalNotificationsPlugin
_notificationsPlugin
=
FlutterLocalNotificationsPlugin
();
static
const
platform
=
MethodChannel
(
'in.webgrid.generp/download'
);
final
GlobalKey
webViewKey
=
GlobalKey
();
var
dl
=
DownloadManager
();
bool
_isLoading
=
false
;
bool
_showMoreDetails
=
false
;
bool
_leadDetailsLoading
=
true
;
var
_showEditButton
;
TextEditingController
nameController
=
TextEditingController
();
TextEditingController
designationController
=
TextEditingController
();
...
...
@@ -27,7 +42,8 @@ class crmLeadDetailsProvider extends ChangeNotifier {
TextEditingController
editNameController
=
TextEditingController
();
TextEditingController
editDesignationController
=
TextEditingController
();
TextEditingController
editMobileNumberController
=
TextEditingController
();
TextEditingController
editAlternativeMobileController
=
TextEditingController
();
TextEditingController
editAlternativeMobileController
=
TextEditingController
();
TextEditingController
editTelephoneController
=
TextEditingController
();
TextEditingController
editEmailController
=
TextEditingController
();
TextEditingController
dateController
=
TextEditingController
();
...
...
@@ -47,6 +63,8 @@ class crmLeadDetailsProvider extends ChangeNotifier {
String
?
_editTeleError
;
String
?
_editEmailError
;
String
?
_dateError
;
LeadDetails
_leadDetails
=
LeadDetails
();
...
...
@@ -62,32 +80,53 @@ class crmLeadDetailsProvider extends ChangeNotifier {
List
<
String
>
_subHeadings
=
[];
DateTime
?
_date
;
String
?
_formattedDate
;
String
?
_formattedDateToSend
;
String
?
_visitTypeError
=
""
;
String
?
get
formattedDateToSend
=>
_formattedDateToSend
;
get
showEditButton
=>
_showEditButton
;
String
?
get
nameError
=>
_nameError
;
String
?
get
designationError
=>
_designationError
;
String
?
get
mobileNumError
=>
_mobileNumError
;
String
?
get
altMobError
=>
_altMobError
;
String
?
get
teleError
=>
_teleError
;
String
?
get
emailError
=>
_emailError
;
String
?
get
noteError
=>
_noteError
;
String
?
get
visitTypeError
=>
_visitTypeError
;
String
?
get
editNameError
=>
_editNameError
;
String
?
get
editDesignationError
=>
_editDesignationError
;
String
?
get
editMobileNumError
=>
_editMobileNumError
;
String
?
get
editAltMobError
=>
_editAltMobError
;
String
?
get
editTeleError
=>
_editTeleError
;
String
?
get
editEmailError
=>
_editEmailError
;
String
?
get
dateError
=>
_dateError
;
bool
get
isLoading
=>
_isLoading
;
bool
get
leadDetailsLoading
=>
_leadDetailsLoading
;
bool
get
showMoreDetails
=>
_showMoreDetails
;
List
<
String
>
get
visitTypes
=>
_visitTypes
;
String
?
get
selectedVisitType
=>
_selectedVisitType
;
LeadDetails
get
leadDetails
=>
_leadDetails
;
AccountDetails
get
accountDetails
=>
_accountDetails
;
...
...
@@ -108,74 +147,88 @@ class crmLeadDetailsProvider extends ChangeNotifier {
String
?
get
formattedDate
=>
_formattedDate
;
set
selectedVisitType
(
String
?
value
){
set
selectedVisitType
(
String
?
value
)
{
_selectedVisitType
=
value
;
_visitTypeError
=
""
;
notifyListeners
();
}
set
nameError
(
String
?
value
){
set
nameError
(
String
?
value
)
{
_nameError
=
value
;
notifyListeners
();
}
set
designationError
(
String
?
value
){
set
designationError
(
String
?
value
)
{
_designationError
=
value
;
notifyListeners
();
}
set
mobileNumError
(
String
?
value
){
set
mobileNumError
(
String
?
value
)
{
_mobileNumError
=
value
;
notifyListeners
();
}
set
altMobError
(
String
?
value
){
set
altMobError
(
String
?
value
)
{
_altMobError
=
value
;
notifyListeners
();
}
set
teleError
(
String
?
value
){
set
teleError
(
String
?
value
)
{
_teleError
=
value
;
notifyListeners
();
}
set
emailError
(
String
?
value
){
set
emailError
(
String
?
value
)
{
_emailError
=
value
;
notifyListeners
();
}
set
noteError
(
String
?
value
){
set
noteError
(
String
?
value
)
{
_noteError
=
value
;
notifyListeners
();
}
set
editNameError
(
String
?
value
){
set
editNameError
(
String
?
value
)
{
_editNameError
=
value
;
notifyListeners
();
}
set
editDesignationError
(
String
?
value
){
set
editDesignationError
(
String
?
value
)
{
_editDesignationError
=
value
;
notifyListeners
();
}
set
editMobileNumError
(
String
?
value
){
set
editMobileNumError
(
String
?
value
)
{
_editMobileNumError
=
value
;
notifyListeners
();
}
set
editAltMobError
(
String
?
value
){
set
editAltMobError
(
String
?
value
)
{
_editAltMobError
=
value
;
notifyListeners
();
}
set
editTeleError
(
String
?
value
){
set
editTeleError
(
String
?
value
)
{
_editTeleError
=
value
;
notifyListeners
();
}
set
editEmailError
(
String
?
value
){
set
editEmailError
(
String
?
value
)
{
_editEmailError
=
value
;
notifyListeners
();
}
set
isLoading
(
bool
value
){
set
isLoading
(
bool
value
)
{
_isLoading
=
value
;
notifyListeners
();
}
set
showMoreDetails
(
bool
value
){
set
leadDetailsLoading
(
bool
value
){
_leadDetailsLoading
=
value
;
notifyListeners
();
}
set
showMoreDetails
(
bool
value
)
{
_showMoreDetails
=
value
;
notifyListeners
();
}
...
...
@@ -187,18 +240,20 @@ class crmLeadDetailsProvider extends ChangeNotifier {
notifyListeners
();
}
set
dateError
(
value
){
set
dateError
(
value
)
{
_dateError
=
value
;
notifyListeners
();
}
void
setDate
(
DateTime
newDate
)
{
_date
=
newDate
;
_formattedDate
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
newDate
);
_formattedDate
=
DateFormat
(
'd MMM yyyy'
).
format
(
newDate
);
_formattedDateToSend
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
newDate
);
dateController
.
text
=
_formattedDate
!;
_dateError
=
null
;
notifyListeners
();
}
Future
<
void
>
crmLeadDetailsAPIFunction
(
context
,
leadID
,
mode
)
async
{
try
{
var
HomeProv
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -208,10 +263,10 @@ class crmLeadDetailsProvider extends ChangeNotifier {
leadID
,
mode
,
);
_
i
sLoading
=
true
;
_
leadDetail
sLoading
=
true
;
notifyListeners
();
if
(
data
!=
null
)
{
if
(
data
.
sessionExists
==
1
){
if
(
data
.
sessionExists
==
1
)
{
if
(
data
.
error
==
"0"
)
{
print
(
"calling"
);
_leadDetails
=
data
.
leadDetails
!;
...
...
@@ -222,45 +277,63 @@ class crmLeadDetailsProvider extends ChangeNotifier {
_appointmentDetails
=
data
.
appointmentDetails
!;
_quotationsDetails
=
data
.
quotationsDetails
!;
_showEditButton
=
data
.
showEditAccountButton
;
_visitTypes
=
[
"Phone"
,
"Visit"
];
_
i
sLoading
=
false
;
_visitTypes
=
[
"Phone"
,
"Visit"
];
_
leadDetail
sLoading
=
false
;
notifyListeners
();
}
else
{
_
i
sLoading
=
false
;
}
else
{
_
leadDetail
sLoading
=
false
;
notifyListeners
();
}
}
else
{
}
else
{
sessionDoesNotExist
(
context
);
}
}
else
{
_isLoading
=
false
;
}
else
{
_leadDetailsLoading
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
)
{
_
i
sLoading
=
false
;
_
leadDetail
sLoading
=
false
;
notifyListeners
();
}
}
Future
<
void
>
crmLeadDetailsAddContactAPIFunction
(
context
,
accID
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmLeadDetailsAddContactAPI
(
prov
.
empId
,
prov
.
session
,
accID
,
nameController
.
text
,
mobileNumberController
.
text
,
designationController
.
text
,
alternativeMobileController
.
text
,
telephoneController
.
text
,
emailController
.
text
);
if
(!
AddContactValidation
()){
return
;
}
_isLoading
=
true
;
notifyListeners
();
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmLeadDetailsAddContactAPI
(
prov
.
empId
,
prov
.
session
,
accID
,
nameController
.
text
,
mobileNumberController
.
text
,
designationController
.
text
,
alternativeMobileController
.
text
,
telephoneController
.
text
,
emailController
.
text
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
Navigator
.
pop
(
context
,
true
);
resetAll
();
_leadDetailsLoading
=
false
;
nameController
.
clear
();
mobileNumberController
.
clear
();
designationController
.
clear
();
alternativeMobileController
.
clear
();
telephoneController
.
clear
();
emailController
.
clear
();
Navigator
.
pop
(
context
,
true
);
_isLoading
=
false
;
notifyListeners
();
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
...
...
@@ -270,25 +343,44 @@ class crmLeadDetailsProvider extends ChangeNotifier {
}
}
Future
<
void
>
crmLeadDetailsEditContactAPIFunction
(
context
,
contactID
)
async
{
Future
<
void
>
crmLeadDetailsEditContactAPIFunction
(
context
,
contactID
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmLeadDetailsEditContactAPI
(
prov
.
empId
,
prov
.
session
,
contactID
,
nameController
.
text
,
mobileNumberController
.
text
,
designationController
.
text
,
alternativeMobileController
.
text
,
telephoneController
.
text
,
emailController
.
text
);
if
(!
editContactValidation
()){
return
;
}
_isLoading
=
true
;
notifyListeners
();
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmLeadDetailsEditContactAPI
(
prov
.
empId
,
prov
.
session
,
contactID
,
editNameController
.
text
,
editMobileNumberController
.
text
,
editDesignationController
.
text
,
editAlternativeMobileController
.
text
,
editTelephoneController
.
text
,
editEmailController
.
text
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_isLoading
=
false
;
Navigator
.
pop
(
context
,
true
);
resetAll
();
_isLoading
=
false
;
_leadDetailsLoading
=
false
;
editNameController
.
clear
();
editMobileNumberController
.
clear
();
editDesignationController
.
clear
();
editAlternativeMobileController
.
clear
();
editTelephoneController
.
clear
();
editEmailController
.
clear
();
Navigator
.
pop
(
context
,
true
);
notifyListeners
();
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
...
...
@@ -298,11 +390,61 @@ class crmLeadDetailsProvider extends ChangeNotifier {
}
}
Future
<
void
>
crmDownloadQuotationFunction
(
context
,
leadId
,
quoteId
,
quotationType
,
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmDownloadGenQuoteAPI
(
prov
.
empId
,
prov
.
session
,
leadId
,
quoteId
,
quotationType
,
);
if
(
data
!=
null
)
{
if
(
data
.
sessionExists
==
1
)
{
if
(
data
.
error
==
"0"
)
{
String
suggestedFilename
=
getUniqueFilename
(
'quotation'
,
'pdf'
);
String
contentDisposition
=
'attachment; filename="
$suggestedFilename
"'
;
// _handleDownload(data.quoteFilepath!);
_handleDownload
(
context
,
data
.
quoteFilepath
!,
contentDisposition
,
'application/octet-stream'
,
''
,
);
notifyListeners
();
}
else
{
notifyListeners
();
}
}
else
{
sessionDoesNotExist
(
context
);
}
}
else
{
notifyListeners
();
}
}
catch
(
e
,
s
)
{
_isLoading
=
false
;
notifyListeners
();
}
}
Future
<
void
>
crmCheckFields
(
context
,
value
,
type
)
async
{
Future
<
void
>
crmCheckFields
(
context
,
value
,
type
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmCheckAccountFieldsApi
(
prov
.
empId
,
prov
.
session
,
value
,
type
);
final
data
=
await
ApiCalling
.
crmCheckAccountFieldsApi
(
prov
.
empId
,
prov
.
session
,
value
,
type
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
...
...
@@ -310,43 +452,64 @@ class crmLeadDetailsProvider extends ChangeNotifier {
mobileNumError
=
null
;
altMobError
=
null
;
notifyListeners
();
}
else
if
(
data
.
error
==
"1"
){
if
(
type
==
"name"
){
}
else
if
(
data
.
error
==
"1"
)
{
if
(
type
==
"name"
)
{
nameError
=
data
.
message
!;
}
else
if
(
type
==
'mob1'
){
}
else
if
(
type
==
'mob1'
)
{
mobileNumError
=
data
.
message
!;
}
else
if
(
type
==
'mob2'
){
}
else
if
(
type
==
'mob2'
)
{
altMobError
=
data
.
message
!;
}
notifyListeners
();
}
}
else
{
}
else
{
notifyListeners
();
}
}
catch
(
e
,
s
)
{
notifyListeners
();
}
}
Future
<
void
>
crmLeadDetailsAddAppointmentAPIFunction
(
context
,
leadID
,
appointmentDate
,
appointmentType
,
note
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmLeadDetailsAddAppointmentAPI
(
prov
.
empId
,
prov
.
session
,
leadID
,
appointmentDate
,
appointmentType
,
note
);
Future
<
void
>
crmLeadDetailsAddAppointmentAPIFunction
(
context
,
leadID
,
appointmentDate
,
appointmentType
,
note
,
)
async
{
if
(!
validAppointment
()){
return
;
}
_isLoading
=
true
;
notifyListeners
();
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmLeadDetailsAddAppointmentAPI
(
prov
.
empId
,
prov
.
session
,
leadID
,
appointmentDate
,
appointmentType
,
note
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_isLoading
=
false
;
Navigator
.
pop
(
context
,
true
);
resetAll
();
_leadDetailsLoading
=
false
;
dateController
.
clear
();
noteController
.
clear
();
selectedVisitType
=
null
;
_selectedVisitType
=
null
;
Navigator
.
pop
(
context
,
true
);
_isLoading
=
false
;
notifyListeners
();
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
...
...
@@ -381,7 +544,10 @@ class crmLeadDetailsProvider extends ChangeNotifier {
CupertinoButton
(
child:
Text
(
'Cancel'
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
),
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
onPressed:
()
{
Navigator
.
pop
(
context
);
...
...
@@ -390,10 +556,13 @@ class crmLeadDetailsProvider extends ChangeNotifier {
CupertinoButton
(
child:
Text
(
'Done'
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
),
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
setDate
(
_date
??
DateTime
.
now
());
Navigator
.
pop
(
context
);
},
),
...
...
@@ -406,6 +575,7 @@ class crmLeadDetailsProvider extends ChangeNotifier {
child:
CupertinoDatePicker
(
dateOrder:
DatePickerDateOrder
.
dmy
,
initialDateTime:
_date
??
DateTime
.
now
(),
minimumDate:
DateTime
(
DateTime
.
now
().
year
,
DateTime
.
now
().
month
,
DateTime
.
now
().
day
),
mode:
CupertinoDatePickerMode
.
date
,
use24hFormat:
true
,
showDayOfWeek:
true
,
...
...
@@ -435,14 +605,14 @@ class crmLeadDetailsProvider extends ChangeNotifier {
final
rows
=
[
leadDetails
.
name
??
"-"
,
leadDetails
.
contName
??
"-"
,
leadDetails
.
mob1
??
"-"
,
leadDetails
.
mob2
??
"-"
,
leadDetails
.
email
??
"-"
,
leadDetails
.
address
??
"-"
,
leadDetails
.
prod
??
"-"
,
leadDetails
.
createdDatetime
??
"-"
,
leadDetails
.
name
??
"-"
,
leadDetails
.
contName
??
"-"
,
leadDetails
.
mob1
??
"-"
,
leadDetails
.
mob2
??
"-"
,
leadDetails
.
email
??
"-"
,
leadDetails
.
address
??
"-"
,
leadDetails
.
prod
??
"-"
,
leadDetails
.
createdDatetime
??
"-"
,
].
toList
();
return
[
headers
,
rows
];
...
...
@@ -451,9 +621,9 @@ class crmLeadDetailsProvider extends ChangeNotifier {
void
copyToClipboard
(
BuildContext
context
)
async
{
try
{
if
(
leadDetails
==
null
)
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
"No data to copy"
))
,
);
ScaffoldMessenger
.
of
(
context
,
).
showSnackBar
(
SnackBar
(
content:
Text
(
"No data to copy"
))
);
return
;
}
final
data
=
prepareExportData
();
...
...
@@ -466,73 +636,362 @@ class crmLeadDetailsProvider extends ChangeNotifier {
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"
))
,
);
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"
)),
ScaffoldMessenger
.
of
(
context
,
).
showSnackBar
(
SnackBar
(
content:
Text
(
"Failed to copy to clipboard"
)));
}
}
Future
<
void
>
_handleDownload
(
context
,
String
url
,
String
contentDisposition
,
String
mimeType
,
String
suggestedFilename
,
)
async
{
// Request notification permission for Android 13+
if
(
Platform
.
isIOS
)
{
_handleIOSDownload
(
context
,
url
,
suggestedFilename
);
}
else
if
(
Platform
.
isAndroid
)
{
if
(
await
Permission
.
notification
.
request
().
isGranted
)
{
try
{
// Show custom notification (optional, since DownloadManager shows its own)
if
(
Platform
.
isAndroid
)
{
// Call native Android Download Manager
final
userAgent
=
'Flutter InAppWebView'
;
await
platform
.
invokeMethod
(
'startDownload'
,
{
'url'
:
url
,
'userAgent'
:
userAgent
,
'contentDisposition'
:
contentDisposition
,
'mimeType'
:
mimeType
,
'suggestedFilename'
:
suggestedFilename
,
});
await
launchUrl
(
Uri
.
parse
(
url
),
mode:
LaunchMode
.
externalApplication
,
);
}
else
if
(
Platform
.
isIOS
)
{
_handleIOSDownload
(
context
,
url
,
suggestedFilename
);
}
}
catch
(
e
)
{
print
(
"Download Error
$e
"
);
}
}
else
{
toast
(
context
,
"Notification Permission Denied"
);
}
}
}
Future
<
void
>
_handleIOSDownload
(
context
,
String
url
,
String
suggestedFilename
,
)
async
{
try
{
// Show initial download notification
await
_showDownloadNotification
(
0
,
suggestedFilename
,
isComplete:
false
);
// Get the temporary directory for iOS
final
tempDir
=
await
getTemporaryDirectory
();
final
fileName
=
suggestedFilename
.
isNotEmpty
?
suggestedFilename
:
url
.
split
(
'/'
).
last
;
final
filePath
=
'
${tempDir.path}
/
$fileName
'
;
// Download the file using http
final
response
=
await
http
.
get
(
Uri
.
parse
(
url
));
if
(
response
.
statusCode
==
200
)
{
// Save the file
final
file
=
File
(
filePath
);
await
file
.
writeAsBytes
(
response
.
bodyBytes
);
// Show completion notification
await
_showDownloadNotification
(
100
,
fileName
,
isComplete:
true
);
// Optionally, open the file or notify the user
toast
(
context
,
"File downloaded to
$filePath
"
);
}
else
{
throw
Exception
(
"Failed to download file: HTTP
${response.statusCode}
"
);
}
}
catch
(
e
)
{
print
(
"iOS Download Error:
$e
"
);
await
_showDownloadNotification
(
0
,
suggestedFilename
,
isComplete:
false
,
isError:
true
,
);
toast
(
context
,
"Failed to download file:
$e
"
);
}
}
String
getUniqueFilename
(
String
baseName
,
[
String
ext
=
'pdf'
])
{
final
now
=
DateTime
.
now
();
final
formattedDate
=
DateFormat
(
'yyyyMMdd_HHmmss'
).
format
(
now
);
return
'
${baseName}
_
$formattedDate
.
$ext
'
;
}
Future
<
void
>
_showDownloadNotification
(
int
progress
,
String
fileName
,
{
bool
isComplete
=
false
,
bool
isError
=
false
,
})
async
{
final
androidDetails
=
AndroidNotificationDetails
(
'download_channel'
,
'Downloads'
,
channelDescription:
'Notifications for file downloads'
,
importance:
Importance
.
high
,
priority:
Priority
.
high
,
showProgress:
!
isComplete
&&
!
isError
,
maxProgress:
100
,
progress:
progress
,
ongoing:
!
isComplete
&&
!
isError
,
playSound:
isComplete
||
isError
,
styleInformation:
BigTextStyleInformation
(
isError
?
'Download failed for
$fileName
'
:
isComplete
?
'Download complete:
$fileName
'
:
'Downloading
$fileName
...'
,
),
);
final
iosDetails
=
DarwinNotificationDetails
(
presentAlert:
true
,
presentBadge:
true
,
presentSound:
isComplete
||
isError
,
subtitle:
isError
?
'Download failed'
:
isComplete
?
'Download complete'
:
'Downloading...'
,
threadIdentifier:
'download_thread'
,
);
final
notificationDetails
=
NotificationDetails
(
android:
androidDetails
,
iOS:
iosDetails
,
);
await
_notificationsPlugin
.
show
(
fileName
.
hashCode
,
// Unique ID for the notification
isError
?
'Download Failed'
:
isComplete
?
'Download Complete'
:
'Downloading File'
,
isError
?
'Failed to download
$fileName
'
:
isComplete
?
'Successfully downloaded
$fileName
'
:
'Downloading
$fileName
(
$progress
%)'
,
notificationDetails
,
);
}
void
onChangeName
(
value
){
void
onChangeName
(
value
)
{
_nameError
=
""
;
notifyListeners
();
}
void
onChangeDesignation
(
value
){
void
onChangeDesignation
(
value
)
{
_designationError
=
""
;
notifyListeners
();
}
void
onChangeMobile
(
value
){
void
onChangeMobile
(
value
)
{
_mobileNumError
=
""
;
notifyListeners
();
}
void
onChangeAltMobile
(
value
){
void
onChangeAltMobile
(
value
)
{
if
(
mobileNumberController
.
text
.
trim
()
==
alternativeMobileController
.
text
.
trim
()){
_altMobError
=
"Mobile Number and Alternate Mobile Number Should not be same"
;
}
else
{
_altMobError
=
""
;
}
notifyListeners
();
}
void
onChangeTelephone
(
value
){
void
onChangeTelephone
(
value
)
{
_teleError
=
""
;
notifyListeners
();
}
void
onChangeEmailId
(
value
){
void
onChangeEmailId
(
value
)
{
_emailError
=
""
;
notifyListeners
();
}
void
onChangeEditName
(
value
){
void
onChangeEditName
(
value
)
{
_editNameError
=
""
;
notifyListeners
();
}
void
onChangeEditDesignation
(
value
){
void
onChangeEditDesignation
(
value
)
{
_editDesignationError
=
""
;
notifyListeners
();
}
void
onChangeEditMobile
(
value
){
void
onChangeEditMobile
(
value
)
{
_editMobileNumError
=
""
;
notifyListeners
();
}
void
onChangeEditAltMobile
(
value
){
void
onChangeEditAltMobile
(
value
)
{
if
(
editMobileNumberController
.
text
.
trim
()
==
editAlternativeMobileController
.
text
.
trim
()){
_editAltMobError
=
"Mobile Number and Alternate Mobile Number Should not be same"
;
}
else
{
_editAltMobError
=
""
;
}
notifyListeners
();
}
void
onChangeEditTelephone
(
value
){
void
onChangeEditTelephone
(
value
)
{
_editTeleError
=
""
;
notifyListeners
();
}
void
onChangeEditEmailId
(
value
){
void
onChangeEditEmailId
(
value
)
{
_editEmailError
=
""
;
notifyListeners
();
}
void
onChangeNote
(
value
){
void
onChangeNote
(
value
)
{
_noteError
=
""
;
notifyListeners
();
}
void
resetAll
(){
bool
AddContactValidation
(){
bool
isValid
=
true
;
_nameError
=
null
;
_designationError
=
null
;
_mobileNumError
=
null
;
_altMobError
=
null
;
_teleError
=
null
;
_emailError
=
null
;
_noteError
=
null
;
if
(
nameController
.
text
.
trim
().
isEmpty
){
_nameError
=
"Please Enter Name"
;
isValid
=
false
;
}
if
(
mobileNumberController
.
text
.
trim
().
isEmpty
||
mobileNumberController
.
text
.
length
<
10
){
_mobileNumError
=
"Please Enter Mobile Number 10 Digits"
;
isValid
=
false
;
}
if
(
alternativeMobileController
.
text
.
trim
().
isNotEmpty
){
if
(
alternativeMobileController
.
text
.
length
<
10
){
_altMobError
=
"Please Enter Mobile Number 10 Digits"
;
isValid
=
false
;
}
}
if
(
mobileNumberController
.
text
.
trim
()
==
alternativeMobileController
.
text
.
trim
()){
_altMobError
=
"Mobile Number and Alternate Mobile Number Should not be same"
;
isValid
=
false
;
}
if
(
emailController
.
text
.
isNotEmpty
){
final
RegExp
emailRegex
=
RegExp
(
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
,
);
isValid
=
emailRegex
.
hasMatch
(
emailController
.
text
.
trim
());
if
(!
isValid
){
_emailError
=
"Please Enter Proper Email ID"
;
}
}
_isLoading
=
false
;
notifyListeners
();
return
isValid
;
}
bool
editContactValidation
(){
bool
isValid
=
true
;
_editNameError
=
null
;
_editDesignationError
=
null
;
_editMobileNumError
=
null
;
_editAltMobError
=
null
;
_editTeleError
=
null
;
_editEmailError
=
null
;
_noteError
=
null
;
if
(
editNameController
.
text
.
trim
().
isEmpty
){
_editNameError
=
"Please Enter Name"
;
isValid
=
false
;
}
if
(
editMobileNumberController
.
text
.
trim
().
isEmpty
||
editMobileNumberController
.
text
.
length
<
10
){
_editMobileNumError
=
"Please Enter Mobile Number 10 Digits"
;
isValid
=
false
;
}
if
(
editAlternativeMobileController
.
text
.
trim
().
isNotEmpty
){
if
(
editAlternativeMobileController
.
text
.
length
<
10
){
_editAltMobError
=
"Please Enter Mobile Number 10 Digits"
;
isValid
=
false
;
}
}
if
(
editMobileNumberController
.
text
.
trim
()
==
editAlternativeMobileController
.
text
.
trim
()){
_editAltMobError
=
"Mobile Number and Alternate Mobile Number Should not be same"
;
isValid
=
false
;
}
if
(
editEmailController
.
text
.
isNotEmpty
){
final
RegExp
emailRegex
=
RegExp
(
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
,
);
isValid
=
emailRegex
.
hasMatch
(
editEmailController
.
text
.
trim
());
if
(!
isValid
){
_editEmailError
=
"Please Enter Proper Email ID"
;
}
}
_isLoading
=
false
;
notifyListeners
();
return
isValid
;
}
bool
validAppointment
(){
bool
isValid
=
true
;
_dateError
=
null
;
_visitTypeError
=
null
;
_noteError
=
null
;
if
(
dateController
.
text
.
trim
().
isEmpty
){
_dateError
=
"Please Enter Name"
;
isValid
=
false
;
}
if
(
_selectedVisitType
==
null
||
_selectedVisitType
==
""
){
_visitTypeError
=
"Please Select Appointment Type"
;
isValid
=
false
;
}
if
(
noteController
.
text
.
trim
().
isEmpty
){
_noteError
=
"Please Enter Note"
;
isValid
=
false
;
}
_isLoading
=
false
;
notifyListeners
();
return
isValid
;
}
void
resetAll
()
{
_formattedDateToSend
=
null
;
_formattedDate
=
null
;
_date
=
null
;
nameController
.
clear
();
designationController
.
clear
();
mobileNumberController
.
clear
();
...
...
@@ -557,6 +1016,9 @@ class crmLeadDetailsProvider extends ChangeNotifier {
_editAltMobError
=
""
;
_editTeleError
=
""
;
_editEmailError
=
""
;
_isLoading
=
false
;
_showMoreDetails
=
false
;
_leadDetailsLoading
=
true
;
notifyListeners
();
}
}
lib/Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart
View file @
29665037
// import 'dart:async';
// import 'dart:io';
// import 'dart:ui' as ui;
//
// import 'package:flutter/cupertino.dart';
// import 'package:flutter/foundation.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
// import 'package:generp/Notifiers/HomeScreenNotifier.dart';
// import 'package:generp/screens/crm/LeadDetailsByMode.dart';
// import 'package:generp/screens/genTracker/GeneratorDetails.dart';
// import 'package:generp/services/api_calling.dart';
// import 'package:geolocator/geolocator.dart';
// import 'package:google_maps_flutter/google_maps_flutter.dart';
// import 'package:image_picker/image_picker.dart';
// import 'package:geocoding/geocoding.dart' as geocoding;
// import 'package:location/location.dart' as Location;
// import 'package:permission_handler/permission_handler.dart';
// import 'package:provider/provider.dart';
//
// import '../../Models/crmModels/NearbyOpenLeadsResponse.dart';
// import '../../Utils/commonServices.dart';
//
// class crmNearbyOpenLeadsProvider extends ChangeNotifier {
//
//
// List<LeadList> _leadslist = [];
// TextEditingController _locationController = TextEditingController();
// String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs";
// GoogleMapController? _mapController;
// CameraPosition? _cameraPosition;
// LatLng _startLocation = const LatLng(17.439112226708446, 78.43292499146135);
// String _latlongs = "";
// List<Marker> _markers = [];
// List<String> _addresses = [];
// Location.LocationData? _currentLocation;
// bool _isLocationEnabled = false;
// bool _hasLocationPermission = false;
// Timer? _timer;
// File? _image;
// bool _isLoading = true;
// double _currentValue = 1.0;
// Timer? _debounceTimer;
//
//
// List<LeadList> get leadsList => _leadslist;
// TextEditingController get LocationController => _locationController;
// String get googleAPIKey => _googleApikey;
// GoogleMapController? get mapController => _mapController;
// CameraPosition? get cameraPosition => _cameraPosition;
// LatLng get startLocation => _startLocation;
// String get latlongs => _latlongs;
// List<Marker> get markers => _markers;
// List<String> get addresses => _addresses;
// Location.LocationData? get currentLocation => _currentLocation;
// bool get isLocationEnabled => _isLocationEnabled;
// bool get hasLocationPermission => _hasLocationPermission;
// bool get isLoading => _isLoading;
// Timer? get timer => _timer;
// File? get image => _image;
// double get currentValue => _currentValue;
//
// set currentValue(value){
// _currentValue = value;
// notifyListeners();
// }
//
//
// set markers(List<Marker> value){
// _markers = value;
// notifyListeners();
// }
// set mapController(value){
// _mapController = value;
// notifyListeners();
// }
//
// void resetAll(){
// _currentValue = 1.0;
// _markers= [];
// _addresses = [];
// }
//
// Future<void> getLocationPermission(context) async {
// // Check if location services are enabled
// _isLocationEnabled = await Geolocator.isLocationServiceEnabled();
//
// // Check if the app has been granted location permission
// LocationPermission permission = await Geolocator.checkPermission();
// _hasLocationPermission =
// permission == LocationPermission.always ||
// permission == LocationPermission.whileInUse;
//
// final Location.Location location = Location.Location();
// bool serviceEnabled;
// Location.PermissionStatus permissionGranted;
// serviceEnabled = await location.serviceEnabled();
// if (!serviceEnabled) {
// serviceEnabled = await location.requestService();
// if (!serviceEnabled) {
// return;
// }
// }
// _isLoading = false;
// permissionGranted = (await location.hasPermission());
// if (permissionGranted == PermissionStatus) {
// permissionGranted = (await location.requestPermission());
// if (permissionGranted != PermissionStatus) {
// return;
// }
// }
// final Location.LocationData locData = await location.getLocation();
//
// _currentLocation = locData;
//
// if (_currentLocation != null) {
// _mapController?.animateCamera(
// CameraUpdate.newLatLng(
// LatLng(_currentLocation!.latitude!, _currentLocation!.longitude!),
// ),
// );
// final lat = _currentLocation!.latitude;
// final lang = _currentLocation!.longitude!;
// _latlongs = '$lat,$lang';
// LoadNearbyOpenLeadsAPI(context,_currentValue);
// }
// }
//
// void onCameraMove(context, CameraPosition position) {
// _timer?.cancel(); // Cancel any previous timer
// _timer = Timer(Duration(seconds: 1), () {
// getLocationPermission(context);
// });
// }
// void debounce(VoidCallback callback, Duration duration) {
// _debounceTimer?.cancel();
// _debounceTimer = Timer(duration, callback);
// }
//
//
// Future<void> LoadNearbyOpenLeadsAPI(BuildContext context,radius) async {
// if (_latlongs.isEmpty || _currentValue <= 0) {
// print("Invalid parameters: latlongs=$_latlongs, currentValue=$_currentValue");
// return;
// }
// try {
// var provider = Provider.of<HomescreenNotifier>(context, listen: false);
// final data = await ApiCalling.loadNearbyOpenLeadsAPI(
// provider.empId,
// provider.session,
// _latlongs,
// radius
// );
//
// if (data != null) {
// if (data.error == 0) {
// _leadslist = data.leadList!;
//
// await updateMarkersFromApiResponse(context, data.leadList!);
// _isLoading = false;
// notifyListeners();
// } else if(data.error==1){
// toast(context, data.message);
// }
//
// } else {
// toast(context, "Something went wrong, Please try again.");
// }
// } on Exception catch (e) {
// print("$e");
// }
// }
//
// Future<void> updateMarkersFromApiResponse(
// BuildContext context,
// List<LeadList> leadsList,
// ) async {
// _markers = await createMarkersFromApiResponse(context, leadsList);
// _addresses.clear();
// await Future.forEach(leadsList, (store) async {
// String address = await _getAddressFromLatLng(store.loc);
// _addresses.add(address);
//
// });
// notifyListeners();
// // for (int i = 0; i < _addresses.length; i++) {
// // //print('List of Addresses:' "${addresses[i]}");
// // // print('List of Addresses:' "${addresses[1]}" );
// // }
// }
//
// Future<List<Marker>> createMarkersFromApiResponse(
// BuildContext context,
// List<LeadList> leadsList,
// ) async {
// List<Marker> markers = [];
//
// // print("Hello Nutsby!");
// ByteData data = await rootBundle.load("assets/images/leads_ic.png");
// Uint8List bytes = data.buffer.asUint8List();
//
// await Future.forEach(leadsList, (leads) async {
// ui.Codec codec = await ui.instantiateImageCodec(
// bytes,
// );
// ui.FrameInfo fi = await codec.getNextFrame();
// Uint8List resizedBytes =
// (await fi.image.toByteData(
// format: ui.ImageByteFormat.png,
// ))!.buffer.asUint8List();
//
// markers.add(
// Marker(
// markerId: MarkerId(leads.id.toString()),
//
// position: _parseLatLng(leads.loc),
// icon: BitmapDescriptor.fromBytes(resizedBytes),
// infoWindow: InfoWindow(
//
// onTap:() {
// // onMarkerTap(context, leads.id);
// Navigator.push(
// context, // Use the widget's BuildContext, which is valid here
// MaterialPageRoute(
// builder: (context) => LeadDetailsByMode(
// mode: "",
// pageTitleName: "Lead Details",
// leadId:leads.id ,
//
// ),
// ),
// );
// },
// anchor: Offset(0, 0),
// title: "${leads.name}",
// snippet: "${leads.address}",
//
// ),
// zIndex: 100,
//
// onTap: () {
// int index = leadsList.indexWhere(
// (techResponse) =>
// techResponse.id == leads.id,
// );
// // onMarkerTap(
// // context,
// // leads.id,
// // );
// // print("index:${index}");
// // Navigator.push(
// // context,
// // MaterialPageRoute(
// // builder:
// // (context) => Generatordetails(
// // activityName: "NearByGenerators",
// // genLocation: generator.loc,
// // generatorId: generator.generatorId,
// // ),
// // ),
// // );
//
// },
// ),
// );
// });
// return markers;
// }
// Future<void> onMarkerTap(context, leadID) async {
// ///uncomment with screen navigation
// Navigator.push(
// context, // Use the widget's BuildContext, which is valid here
// MaterialPageRoute(
// builder: (context) => LeadDetailsByMode(
// mode: "",
// pageTitleName: "Lead Details",
// leadId:leadID ,
//
// ),
// ),
// );
//
// _markers = markers;
// notifyListeners();
//
// }
//
// LatLng _parseLatLng(String? location) {
// if (location != null) {
// List<String> parts = location.split(',');
// if (parts.length == 2) {
// double lat = double.tryParse(parts[0]) ?? 0.0;
// double lng = double.tryParse(parts[1]) ?? 0.0;
// return LatLng(lat, lng);
// }
// }
// return const LatLng(0.0, 0.0);
// }
//
// Future<String> _getAddressFromLatLng(String? location) async {
// if (location != null) {
// List<String> parts = location.split(',');
// if (parts.length == 2) {
// double lat = double.tryParse(parts[0]) ?? 0.0;
// double lng = double.tryParse(parts[1]) ?? 0.0;
//
// List<geocoding.Placemark> placemarks = await geocoding
// .placemarkFromCoordinates(lat, lng);
//
// if (placemarks.isNotEmpty) {
// final placemark = placemarks.first;
// String address =
// '${placemark.street ?? ''}, '
// '${placemark.thoroughfare ?? ''} '
// // '${placemark.subThoroughfare ?? ''}, '
// // '${placemark.name ?? ''}, '
// '${placemark.subLocality ?? ''}, '
// '${placemark.locality ?? ''}, '
// '${placemark.administrativeArea ?? ''}, '
// '${placemark.subAdministrativeArea ?? ''} '
// '${placemark.postalCode ?? ''}, '
// '${placemark.country ?? ''}';
// return address.trim();
// }
// }
// }
// return "Address not found";
// }
//
// }
import
'dart:async'
;
import
'dart:io'
;
import
'dart:ui'
as
ui
;
...
...
@@ -8,7 +338,6 @@ import 'package:flutter/material.dart';
import
'package:flutter/services.dart'
;
import
'package:generp/Notifiers/HomeScreenNotifier.dart'
;
import
'package:generp/screens/crm/LeadDetailsByMode.dart'
;
import
'package:generp/screens/genTracker/GeneratorDetails.dart'
;
import
'package:generp/services/api_calling.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:google_maps_flutter/google_maps_flutter.dart'
;
...
...
@@ -22,8 +351,6 @@ import '../../Models/crmModels/NearbyOpenLeadsResponse.dart';
import
'../../Utils/commonServices.dart'
;
class
crmNearbyOpenLeadsProvider
extends
ChangeNotifier
{
List
<
LeadList
>
_leadslist
=
[];
TextEditingController
_locationController
=
TextEditingController
();
String
_googleApikey
=
"AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs"
;
...
...
@@ -41,7 +368,8 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
bool
_isLoading
=
true
;
double
_currentValue
=
1.0
;
Timer
?
_debounceTimer
;
LatLng
?
_mapCenter
;
bool
_isFilterApplied
=
false
;
// Track if filter has been applied
List
<
LeadList
>
get
leadsList
=>
_leadslist
;
TextEditingController
get
LocationController
=>
_locationController
;
...
...
@@ -59,33 +387,50 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
Timer
?
get
timer
=>
_timer
;
File
?
get
image
=>
_image
;
double
get
currentValue
=>
_currentValue
;
bool
get
isFilterApplied
=>
_isFilterApplied
;
set
currentValue
(
value
){
set
currentValue
(
double
value
)
{
_currentValue
=
value
;
notifyListeners
();
}
set
markers
(
List
<
Marker
>
value
){
set
markers
(
List
<
Marker
>
value
)
{
_markers
=
value
;
if
(
value
.
isNotEmpty
)
{
_isLoading
=
false
;
// Mark screen as loaded when markers are added
}
notifyListeners
();
}
set
mapController
(
value
){
set
mapController
(
GoogleMapController
?
value
)
{
_mapController
=
value
;
notifyListeners
();
}
void
resetAll
(){
set
mapCenter
(
LatLng
?
value
)
{
_mapCenter
=
value
;
_latlongs
=
value
!=
null
?
'
${value.latitude}
,
${value.longitude}
'
:
''
;
notifyListeners
();
}
set
isLoading
(
bool
value
)
{
_isLoading
=
value
;
notifyListeners
();
}
void
resetAll
()
{
_currentValue
=
1.0
;
_markers
=
[];
_markers
=
[];
_addresses
=
[];
_mapCenter
=
null
;
_latlongs
=
''
;
_isFilterApplied
=
false
;
_isLoading
=
true
;
notifyListeners
();
}
Future
<
void
>
getLocationPermission
(
context
)
async
{
// Check if location services are enabled
Future
<
void
>
getLocationPermission
(
BuildContext
context
)
async
{
_isLocationEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
// Check if the app has been granted location permission
LocationPermission
permission
=
await
Geolocator
.
checkPermission
();
_hasLocationPermission
=
permission
==
LocationPermission
.
always
||
...
...
@@ -98,14 +443,17 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
if
(!
serviceEnabled
)
{
serviceEnabled
=
await
location
.
requestService
();
if
(!
serviceEnabled
)
{
toast
(
context
,
'Location services are disabled.'
);
_isLoading
=
false
;
return
;
}
}
permissionGranted
=
await
location
.
hasPermission
();
if
(
permissionGranted
==
Location
.
PermissionStatus
.
denied
)
{
permissionGranted
=
await
location
.
requestPermission
();
if
(
permissionGranted
!=
Location
.
PermissionStatus
.
granted
)
{
toast
(
context
,
'Location permission denied.'
);
_isLoading
=
false
;
permissionGranted
=
(
await
location
.
hasPermission
());
if
(
permissionGranted
==
PermissionStatus
)
{
permissionGranted
=
(
await
location
.
requestPermission
());
if
(
permissionGranted
!=
PermissionStatus
)
{
return
;
}
}
...
...
@@ -113,34 +461,45 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
_currentLocation
=
locData
;
if
(
_currentLocation
!=
null
)
{
if
(
_currentLocation
!=
null
&&
_mapCenter
==
null
)
{
_mapCenter
=
LatLng
(
_currentLocation
!.
latitude
!,
_currentLocation
!.
longitude
!);
_latlongs
=
'
${_currentLocation!.latitude}
,
${_currentLocation!.longitude}
'
;
_mapController
?.
animateCamera
(
CameraUpdate
.
newLatLng
(
LatLng
(
_currentLocation
!.
latitude
!,
_currentLocation
!.
longitude
!),
),
CameraUpdate
.
newLatLng
(
_mapCenter
!),
);
final
lat
=
_currentLocation
!.
latitude
;
final
lang
=
_currentLocation
!.
longitude
!;
_latlongs
=
'
$lat
,
$lang
'
;
LoadNearbyOpenLeadsAPI
(
context
,
_currentValue
);
await
LoadNearbyOpenLeadsAPI
(
context
,
_currentValue
);
}
notifyListeners
();
}
void
onCameraMove
(
context
,
CameraPosition
position
)
{
_timer
?.
cancel
();
// Cancel any previous timer
void
onCameraMove
(
BuildContext
context
,
CameraPosition
position
)
{
_timer
?.
cancel
();
_mapCenter
=
position
.
target
;
_latlongs
=
'
${_mapCenter!.latitude}
,
${_mapCenter!.longitude}
'
;
_timer
=
Timer
(
Duration
(
seconds:
1
),
()
{
getLocationPermission
(
context
);
LoadNearbyOpenLeadsAPI
(
context
,
_currentValue
);
});
notifyListeners
();
}
void
debounce
(
VoidCallback
callback
,
Duration
duration
)
{
_debounceTimer
?.
cancel
();
_debounceTimer
=
Timer
(
duration
,
callback
);
}
Future
<
void
>
applyFilter
(
BuildContext
context
,
double
radius
)
async
{
_isLoading
=
true
;
_isFilterApplied
=
true
;
notifyListeners
();
await
LoadNearbyOpenLeadsAPI
(
context
,
radius
);
}
Future
<
void
>
LoadNearbyOpenLeadsAPI
(
BuildContext
context
,
radius
)
async
{
if
(
_latlongs
.
isEmpty
||
_currentValue
<=
0
)
{
print
(
"Invalid parameters: latlongs=
$_latlongs
, currentValue=
$_currentValue
"
);
Future
<
void
>
LoadNearbyOpenLeadsAPI
(
BuildContext
context
,
double
radius
)
async
{
if
(
_latlongs
.
isEmpty
||
radius
<=
0
)
{
print
(
"Invalid parameters: latlongs=
$_latlongs
, radius=
$radius
"
);
toast
(
context
,
'Invalid location or radius.'
);
_isLoading
=
false
;
notifyListeners
();
return
;
}
try
{
...
...
@@ -149,25 +508,32 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
provider
.
empId
,
provider
.
session
,
_latlongs
,
radius
radius
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
0
)
{
_leadslist
=
data
.
leadList
!;
await
updateMarkersFromApiResponse
(
context
,
data
.
leadList
!);
_isLoading
=
false
;
_leadslist
=
data
.
leadList
?.
where
((
lead
)
=>
lead
!=
null
).
toList
()
??
[];
await
updateMarkersFromApiResponse
(
context
,
_leadslist
);
if
(
_leadslist
.
isEmpty
)
{
toast
(
context
,
'No leads found within the selected radius.'
);
}
}
else
{
toast
(
context
,
data
.
message
??
'Failed to load leads.'
);
_isLoading
=
false
;
notifyListeners
();
}
else
if
(
data
.
error
==
1
){
toast
(
context
,
data
.
message
);
}
}
else
{
toast
(
context
,
"Something went wrong, Please try again."
);
toast
(
context
,
"Something went wrong, please try again."
);
_isLoading
=
false
;
notifyListeners
();
}
}
on
Exception
catch
(
e
)
{
print
(
"
$e
"
);
}
on
Exception
catch
(
e
,
s
)
{
print
(
"LoadNearbyOpenLeadsAPI error:
$e
, stack:
$s
"
);
toast
(
context
,
'An error occurred while loading leads.'
);
_isLoading
=
false
;
notifyListeners
();
}
}
...
...
@@ -180,13 +546,8 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
await
Future
.
forEach
(
leadsList
,
(
store
)
async
{
String
address
=
await
_getAddressFromLatLng
(
store
.
loc
);
_addresses
.
add
(
address
);
});
notifyListeners
();
// for (int i = 0; i < _addresses.length; i++) {
// //print('List of Addresses:' "${addresses[i]}");
// // print('List of Addresses:' "${addresses[1]}" );
// }
}
Future
<
List
<
Marker
>>
createMarkersFromApiResponse
(
...
...
@@ -194,95 +555,66 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
List
<
LeadList
>
leadsList
,
)
async
{
List
<
Marker
>
markers
=
[];
// print("Hello Nutsby!");
ByteData
data
=
await
rootBundle
.
load
(
"assets/images/leads_ic.png"
);
ByteData
data
=
await
rootBundle
.
load
(
"assets/images/maps_ic.png"
);
Uint8List
bytes
=
data
.
buffer
.
asUint8List
();
await
Future
.
forEach
(
leadsList
,
(
leads
)
async
{
ui
.
Codec
codec
=
await
ui
.
instantiateImageCodec
(
bytes
,
);
if
(
leads
.
loc
==
null
||
leads
.
id
==
null
||
leads
.
name
==
null
)
{
print
(
'Skipping invalid lead: id=
${leads.id}
, name=
${leads.name}
, loc=
${leads.loc}
'
);
return
;
}
ui
.
Codec
codec
=
await
ui
.
instantiateImageCodec
(
bytes
);
ui
.
FrameInfo
fi
=
await
codec
.
getNextFrame
();
Uint8List
resizedBytes
=
(
await
fi
.
image
.
toByteData
(
Uint8List
resizedBytes
=
(
await
fi
.
image
.
toByteData
(
format:
ui
.
ImageByteFormat
.
png
,
))!.
buffer
.
asUint8List
();
markers
.
add
(
Marker
(
markerId:
MarkerId
(
leads
.
id
.
toString
()),
position:
_parseLatLng
(
leads
.
loc
),
icon:
BitmapDescriptor
.
fromBytes
(
resizedBytes
),
infoWindow:
InfoWindow
(
onTap:
()
{
// onMarkerTap(context, leads.id);
title:
leads
.
name
??
'Unknown Lead'
,
snippet:
leads
.
address
??
'No address available'
,
onTap:
()
{
Navigator
.
push
(
context
,
// Use the widget's BuildContext, which is valid here
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LeadDetailsByMode
(
mode:
""
,
pageTitleName:
"Lead Details"
,
leadId:
leads
.
id
,
leadId:
leads
.
id
,
),
),
);
},
anchor:
Offset
(
0
,
0
),
title:
"Name:
${leads.name}
"
,
snippet:
"Address:
${leads.address}
"
,
anchor:
const
Offset
(
0.5
,
1.0
),
),
zIndex:
100
,
onTap:
()
{
int
index
=
leadsList
.
indexWhere
(
(
techResponse
)
=>
techResponse
.
id
==
leads
.
id
,
);
// onMarkerTap(
// context,
// leads.id,
// );
// print("index:${index}");
// Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => Generatordetails(
// activityName: "NearByGenerators",
// genLocation: generator.loc,
// generatorId: generator.generatorId,
// ),
// ),
// );
_mapController
?.
showMarkerInfoWindow
(
MarkerId
(
leads
.
id
.
toString
()));
print
(
'Marker tapped: id=
${leads.id}
, name=
${leads.name}
'
);
},
),
);
});
return
markers
;
}
Future
<
void
>
onMarkerTap
(
context
,
leadID
)
async
{
///uncomment with screen navigation
Future
<
void
>
onMarkerTap
(
BuildContext
context
,
String
leadID
)
async
{
Navigator
.
push
(
context
,
// Use the widget's BuildContext, which is valid here
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LeadDetailsByMode
(
mode:
""
,
pageTitleName:
"Lead Details"
,
leadId:
leadID
,
leadId:
leadID
,
),
),
);
_markers
=
markers
;
notifyListeners
();
}
LatLng
_parseLatLng
(
String
?
location
)
{
...
...
@@ -291,9 +623,12 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
if
(
parts
.
length
==
2
)
{
double
lat
=
double
.
tryParse
(
parts
[
0
])
??
0.0
;
double
lng
=
double
.
tryParse
(
parts
[
1
])
??
0.0
;
if
(
lat
!=
0.0
&&
lng
!=
0.0
)
{
return
LatLng
(
lat
,
lng
);
}
}
}
print
(
'Invalid location string:
$location
'
);
return
const
LatLng
(
0.0
,
0.0
);
}
...
...
@@ -303,17 +638,15 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
if
(
parts
.
length
==
2
)
{
double
lat
=
double
.
tryParse
(
parts
[
0
])
??
0.0
;
double
lng
=
double
.
tryParse
(
parts
[
1
])
??
0.0
;
List
<
geocoding
.
Placemark
>
placemarks
=
await
geocoding
.
placemarkFromCoordinates
(
lat
,
lng
);
if
(
lat
!=
0.0
&&
lng
!=
0.0
)
{
try
{
List
<
geocoding
.
Placemark
>
placemarks
=
await
geocoding
.
placemarkFromCoordinates
(
lat
,
lng
);
if
(
placemarks
.
isNotEmpty
)
{
final
placemark
=
placemarks
.
first
;
String
address
=
'
${placemark.street ?? ''}
, '
'
${placemark.thoroughfare ?? ''}
'
// '${placemark.subThoroughfare ?? ''}, '
// '${placemark.name ?? ''}, '
'
${placemark.subLocality ?? ''}
, '
'
${placemark.locality ?? ''}
, '
'
${placemark.administrativeArea ?? ''}
, '
...
...
@@ -322,9 +655,12 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
'
${placemark.country ?? ''}
'
;
return
address
.
trim
();
}
}
catch
(
e
)
{
print
(
'Geocoding error for location
$location
:
$e
'
);
}
}
}
}
return
"Address not found"
;
}
}
\ No newline at end of file
lib/Notifiers/crmProvider/crmProspectDetailsProvider.dart
View file @
29665037
...
...
@@ -9,8 +9,6 @@ import '../../services/api_calling.dart';
import
'../HomeScreenNotifier.dart'
;
class
crmProspectDetailsProvider
extends
ChangeNotifier
{
List
<
Leads
>
_leadsList
=
[];
List
<
Contacts
>
_contactsList
=
[];
List
<
Orders
>
_ordersList
=
[];
...
...
@@ -32,7 +30,8 @@ class crmProspectDetailsProvider extends ChangeNotifier {
TextEditingController
editNameController
=
TextEditingController
();
TextEditingController
editDesignationController
=
TextEditingController
();
TextEditingController
editMobileNumberController
=
TextEditingController
();
TextEditingController
editAlternativeMobileController
=
TextEditingController
();
TextEditingController
editAlternativeMobileController
=
TextEditingController
();
TextEditingController
editTelephoneController
=
TextEditingController
();
TextEditingController
editEmailController
=
TextEditingController
();
TextEditingController
dateController
=
TextEditingController
();
...
...
@@ -59,103 +58,131 @@ class crmProspectDetailsProvider extends ChangeNotifier {
List
<
String
>
_subHeadings
=
[];
DateTime
?
_date
;
String
?
_formattedDate
;
String
?
_formattedDateToSend
;
String
?
get
formattedDateToSend
=>
_formattedDateToSend
;
bool
get
showMoreDetails
=>
_showMoreDetails
;
get
showTransferAccount
=>
_transferAccount
;
List
<
Leads
>
get
leadList
=>
_leadsList
;
List
<
Contacts
>
get
contactList
=>
_contactsList
;
List
<
Orders
>
get
ordersList
=>
_ordersList
;
List
<
Payments
>
get
paymentsList
=>
_paymentsList
;
AccountDetails
get
accountDetails
=>
_accountDetails
;
String
?
get
nameError
=>
_nameError
;
String
?
get
designationError
=>
_designationError
;
String
?
get
mobileNumError
=>
_mobileNumError
;
String
?
get
altMobError
=>
_altMobError
;
String
?
get
teleError
=>
_teleError
;
String
?
get
emailError
=>
_emailError
;
String
?
get
noteError
=>
_noteError
;
String
?
get
editNameError
=>
_editNameError
;
String
?
get
editDesignationError
=>
_editDesignationError
;
String
?
get
editMobileNumError
=>
_editMobileNumError
;
String
?
get
editAltMobError
=>
_editAltMobError
;
String
?
get
editTeleError
=>
_editTeleError
;
String
?
get
editEmailError
=>
_editEmailError
;
String
?
get
dateError
=>
_dateError
;
bool
get
isLoading
=>
_isLoading
;
List
<
String
>
get
Headings
=>
_headings
;
List
<
String
>
get
subHeadings
=>
_subHeadings
;
String
?
get
formattedDate
=>
_formattedDate
;
set
showMoreDetails
(
bool
value
){
set
showMoreDetails
(
bool
value
)
{
_showMoreDetails
=
value
;
notifyListeners
();
}
set
nameError
(
String
?
value
){
set
nameError
(
String
?
value
)
{
_nameError
=
value
;
notifyListeners
();
}
set
designationError
(
String
?
value
){
set
designationError
(
String
?
value
)
{
_designationError
=
value
;
notifyListeners
();
}
set
mobileNumError
(
String
?
value
){
set
mobileNumError
(
String
?
value
)
{
_mobileNumError
=
value
;
notifyListeners
();
}
set
altMobError
(
String
?
value
){
set
altMobError
(
String
?
value
)
{
_altMobError
=
value
;
notifyListeners
();
}
set
teleError
(
String
?
value
){
set
teleError
(
String
?
value
)
{
_teleError
=
value
;
notifyListeners
();
}
set
emailError
(
String
?
value
){
set
emailError
(
String
?
value
)
{
_emailError
=
value
;
notifyListeners
();
}
set
noteError
(
String
?
value
){
set
noteError
(
String
?
value
)
{
_noteError
=
value
;
notifyListeners
();
}
set
editNameError
(
String
?
value
){
set
editNameError
(
String
?
value
)
{
_editNameError
=
value
;
notifyListeners
();
}
set
editDesignationError
(
String
?
value
){
set
editDesignationError
(
String
?
value
)
{
_editDesignationError
=
value
;
notifyListeners
();
}
set
editMobileNumError
(
String
?
value
){
set
editMobileNumError
(
String
?
value
)
{
_editMobileNumError
=
value
;
notifyListeners
();
}
set
editAltMobError
(
String
?
value
){
set
editAltMobError
(
String
?
value
)
{
_editAltMobError
=
value
;
notifyListeners
();
}
set
editTeleError
(
String
?
value
){
set
editTeleError
(
String
?
value
)
{
_editTeleError
=
value
;
notifyListeners
();
}
set
editEmailError
(
String
?
value
){
set
editEmailError
(
String
?
value
)
{
_editEmailError
=
value
;
notifyListeners
();
}
set
isLoading
(
bool
value
){
set
isLoading
(
bool
value
)
{
_isLoading
=
value
;
notifyListeners
();
}
...
...
@@ -167,14 +194,15 @@ class crmProspectDetailsProvider extends ChangeNotifier {
notifyListeners
();
}
set
dateError
(
value
){
set
dateError
(
value
)
{
_dateError
=
value
;
notifyListeners
();
}
void
setDate
(
DateTime
newDate
)
{
_date
=
newDate
;
_formattedDate
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
newDate
);
_formattedDate
=
DateFormat
(
'd MMM yyyy'
).
format
(
newDate
);
_formattedDateToSend
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
newDate
);
dateController
.
text
=
_formattedDate
!;
_dateError
=
null
;
notifyListeners
();
...
...
@@ -194,7 +222,7 @@ class crmProspectDetailsProvider extends ChangeNotifier {
if
(
data
.
error
==
"0"
)
{
_leadsList
=
data
.
leads
!;
_accountDetails
=
data
.
accountDetails
!;
_contactsList
=
data
.
contacts
!;
_contactsList
=
data
.
contacts
!;
_ordersList
=
data
.
orders
!;
_paymentsList
=
data
.
payments
!;
_headings
=
[
...
...
@@ -217,31 +245,31 @@ class crmProspectDetailsProvider extends ChangeNotifier {
];
_transferAccount
=
data
.
showTransfeLeadButton
;
_subHeadings
=
[
data
.
accountDetails
!.
name
??
"-"
,
data
.
accountDetails
!.
name
??
"-"
,
data
.
accountDetails
!.
accManager
??
"-"
,
data
.
accountDetails
!.
owner
??
"-"
,
data
.
accountDetails
!.
accManager
??
"-"
,
data
.
accountDetails
!.
owner
??
"-"
,
data
.
accountDetails
!.
address
??
"-"
,
data
.
accountDetails
!.
state
??
"-"
,
data
.
accountDetails
!.
district
??
"-"
,
data
.
accountDetails
!.
subLocality
??
"-"
,
data
.
accountDetails
!.
pincode
??
"-"
,
data
.
accountDetails
!.
address
??
"-"
,
data
.
accountDetails
!.
state
??
"-"
,
data
.
accountDetails
!.
district
??
"-"
,
data
.
accountDetails
!.
subLocality
??
"-"
,
data
.
accountDetails
!.
pincode
??
"-"
,
data
.
accountDetails
!.
source
??
"-"
,
data
.
accountDetails
!.
reference
??
"-"
,
data
.
accountDetails
!.
team
??
"-"
,
data
.
accountDetails
!.
segment
??
"-"
,
data
.
accountDetails
!.
source
??
"-"
,
data
.
accountDetails
!.
reference
??
"-"
,
data
.
accountDetails
!.
team
??
"-"
,
data
.
accountDetails
!.
segment
??
"-"
,
"
${data.accountDetails!.aage ?? "-"}
days old"
,
];
_isLoading
=
false
;
notifyListeners
();
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
...
...
@@ -251,12 +279,15 @@ class crmProspectDetailsProvider extends ChangeNotifier {
}
}
Future
<
void
>
crmCheckFields
(
context
,
value
,
type
)
async
{
Future
<
void
>
crmCheckFields
(
context
,
value
,
type
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmCheckAccountFieldsApi
(
prov
.
empId
,
prov
.
session
,
value
,
type
);
final
data
=
await
ApiCalling
.
crmCheckAccountFieldsApi
(
prov
.
empId
,
prov
.
session
,
value
,
type
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
...
...
@@ -264,43 +295,55 @@ class crmProspectDetailsProvider extends ChangeNotifier {
mobileNumError
=
null
;
altMobError
=
null
;
notifyListeners
();
}
else
if
(
data
.
error
==
"1"
){
if
(
type
==
"name"
){
}
else
if
(
data
.
error
==
"1"
)
{
if
(
type
==
"name"
)
{
nameError
=
data
.
message
!;
}
else
if
(
type
==
'mob1'
){
}
else
if
(
type
==
'mob1'
)
{
mobileNumError
=
data
.
message
!;
}
else
if
(
type
==
'mob2'
){
}
else
if
(
type
==
'mob2'
)
{
altMobError
=
data
.
message
!;
}
notifyListeners
();
}
}
else
{
}
else
{
notifyListeners
();
}
}
catch
(
e
,
s
)
{
notifyListeners
();
}
}
Future
<
void
>
crmProspectDetailsAddContactAPIFunction
(
context
,
accID
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmProspectDetailsAddAccountAPI
(
prov
.
empId
,
prov
.
session
,
accID
,
nameController
.
text
,
mobileNumberController
.
text
,
designationController
.
text
,
alternativeMobileController
.
text
,
telephoneController
.
text
,
emailController
.
text
);
if
(!
AddContactValidation
())
{
return
;
}
_isLoading
=
true
;
notifyListeners
();
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmProspectDetailsAddAccountAPI
(
prov
.
empId
,
prov
.
session
,
nameController
.
text
,
accID
,
mobileNumberController
.
text
,
designationController
.
text
,
alternativeMobileController
.
text
,
telephoneController
.
text
,
emailController
.
text
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
Navigator
.
pop
(
context
,
true
);
Navigator
.
pop
(
context
,
true
);
resetAll
();
_isLoading
=
false
;
notifyListeners
();
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
...
...
@@ -310,25 +353,43 @@ class crmProspectDetailsProvider extends ChangeNotifier {
}
}
Future
<
void
>
crmProspectDetailsEditContactAPIFunction
(
context
,
contactID
,
accID
)
async
{
Future
<
void
>
crmProspectDetailsEditContactAPIFunction
(
context
,
contactID
,
accID
,
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmProspectDetailsEditContactAPI
(
prov
.
empId
,
prov
.
session
,
contactID
,
nameController
.
text
,
accID
,
mobileNumberController
.
text
,
designationController
.
text
,
alternativeMobileController
.
text
,
telephoneController
.
text
,
emailController
.
text
);
if
(!
editContactValidation
())
{
return
;
}
_isLoading
=
true
;
notifyListeners
();
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmProspectDetailsEditContactAPI
(
prov
.
empId
,
prov
.
session
,
contactID
,
editNameController
.
text
,
accID
,
editMobileNumberController
.
text
,
editAlternativeMobileController
.
text
,
editTelephoneController
.
text
,
editDesignationController
.
text
,
editEmailController
.
text
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_isLoading
=
false
;
Navigator
.
pop
(
context
,
true
);
Navigator
.
pop
(
context
,
true
);
resetAll
();
_isLoading
=
false
;
notifyListeners
();
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
}
else
{
}
else
{
_isLoading
=
false
;
notifyListeners
();
}
...
...
@@ -338,8 +399,6 @@ class crmProspectDetailsProvider extends ChangeNotifier {
}
}
void
showDatePickerDialog
(
BuildContext
context
)
{
showCupertinoModalPopup
<
void
>(
context:
context
,
...
...
@@ -365,7 +424,10 @@ class crmProspectDetailsProvider extends ChangeNotifier {
CupertinoButton
(
child:
Text
(
'Cancel'
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
),
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
onPressed:
()
{
Navigator
.
pop
(
context
);
...
...
@@ -374,10 +436,13 @@ class crmProspectDetailsProvider extends ChangeNotifier {
CupertinoButton
(
child:
Text
(
'Done'
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
),
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
setDate
(
_date
??
DateTime
.
now
());
Navigator
.
pop
(
context
);
},
),
...
...
@@ -390,6 +455,7 @@ class crmProspectDetailsProvider extends ChangeNotifier {
child:
CupertinoDatePicker
(
dateOrder:
DatePickerDateOrder
.
dmy
,
initialDateTime:
_date
??
DateTime
.
now
(),
minimumDate:
DateTime
(
DateTime
.
now
().
year
,
DateTime
.
now
().
month
,
DateTime
.
now
().
day
),
mode:
CupertinoDatePickerMode
.
date
,
use24hFormat:
true
,
showDayOfWeek:
true
,
...
...
@@ -405,61 +471,167 @@ class crmProspectDetailsProvider extends ChangeNotifier {
);
}
void
onChangeName
(
value
){
void
onChangeName
(
value
)
{
_nameError
=
""
;
notifyListeners
();
}
void
onChangeDesignation
(
value
){
void
onChangeDesignation
(
value
)
{
_designationError
=
""
;
notifyListeners
();
}
void
onChangeMobile
(
value
){
void
onChangeMobile
(
value
)
{
_mobileNumError
=
""
;
notifyListeners
();
}
void
onChangeAltMobile
(
value
){
void
onChangeAltMobile
(
value
)
{
_altMobError
=
""
;
notifyListeners
();
}
void
onChangeTelephone
(
value
){
void
onChangeTelephone
(
value
)
{
_teleError
=
""
;
notifyListeners
();
}
void
onChangeEmailId
(
value
){
void
onChangeEmailId
(
value
)
{
_emailError
=
""
;
notifyListeners
();
}
void
onChangeEditName
(
value
){
void
onChangeEditName
(
value
)
{
_editNameError
=
""
;
notifyListeners
();
}
void
onChangeEditDesignation
(
value
){
void
onChangeEditDesignation
(
value
)
{
_editDesignationError
=
""
;
notifyListeners
();
}
void
onChangeEditMobile
(
value
){
void
onChangeEditMobile
(
value
)
{
_editMobileNumError
=
""
;
notifyListeners
();
}
void
onChangeEditAltMobile
(
value
){
void
onChangeEditAltMobile
(
value
)
{
_editAltMobError
=
""
;
notifyListeners
();
}
void
onChangeEditTelephone
(
value
){
void
onChangeEditTelephone
(
value
)
{
_editTeleError
=
""
;
notifyListeners
();
}
void
onChangeEditEmailId
(
value
){
void
onChangeEditEmailId
(
value
)
{
_editEmailError
=
""
;
notifyListeners
();
}
void
onChangeNote
(
value
){
void
onChangeNote
(
value
)
{
_noteError
=
""
;
notifyListeners
();
}
void
resetAll
(){
bool
AddContactValidation
()
{
bool
isValid
=
true
;
_nameError
=
null
;
_designationError
=
null
;
_mobileNumError
=
null
;
_altMobError
=
null
;
_teleError
=
null
;
_emailError
=
null
;
_noteError
=
null
;
if
(
nameController
.
text
.
trim
().
isEmpty
)
{
_nameError
=
"Please Enter Name"
;
isValid
=
false
;
}
if
(
mobileNumberController
.
text
.
trim
().
isEmpty
||
mobileNumberController
.
text
.
length
<
10
)
{
_mobileNumError
=
"Please Enter Mobile Number 10 Digits"
;
isValid
=
false
;
}
if
(
alternativeMobileController
.
text
.
trim
().
isNotEmpty
)
{
if
(
alternativeMobileController
.
text
.
length
<
10
)
{
_altMobError
=
"Please Enter Mobile Number 10 Digits"
;
isValid
=
false
;
}
}
if
(
mobileNumberController
.
text
.
trim
()
==
alternativeMobileController
.
text
.
trim
())
{
_altMobError
=
"Mobile Number and Alternate Mobile Number Should not be same"
;
isValid
=
false
;
}
if
(
emailController
.
text
.
isNotEmpty
)
{
final
RegExp
emailRegex
=
RegExp
(
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
,
);
isValid
=
emailRegex
.
hasMatch
(
emailController
.
text
.
trim
());
if
(!
isValid
)
{
_emailError
=
"Please Enter Proper Email ID"
;
}
}
_isLoading
=
false
;
notifyListeners
();
return
isValid
;
}
bool
editContactValidation
()
{
bool
isValid
=
true
;
_editNameError
=
null
;
_editDesignationError
=
null
;
_editMobileNumError
=
null
;
_editAltMobError
=
null
;
_editTeleError
=
null
;
_editEmailError
=
null
;
_noteError
=
null
;
if
(
editNameController
.
text
.
trim
().
isEmpty
)
{
_editNameError
=
"Please Enter Name"
;
isValid
=
false
;
}
if
(
editMobileNumberController
.
text
.
trim
().
isEmpty
||
editMobileNumberController
.
text
.
length
<
10
)
{
_editMobileNumError
=
"Please Enter Mobile Number 10 Digits"
;
isValid
=
false
;
}
if
(
editAlternativeMobileController
.
text
.
trim
().
isNotEmpty
)
{
if
(
editAlternativeMobileController
.
text
.
length
<
10
)
{
_editAltMobError
=
"Please Enter Mobile Number 10 Digits"
;
isValid
=
false
;
}
}
if
(
editMobileNumberController
.
text
.
trim
()
==
editAlternativeMobileController
.
text
.
trim
())
{
_editAltMobError
=
"Mobile Number and Alternate Mobile Number Should not be same"
;
isValid
=
false
;
}
if
(
editEmailController
.
text
.
isNotEmpty
)
{
final
RegExp
emailRegex
=
RegExp
(
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
,
);
isValid
=
emailRegex
.
hasMatch
(
editEmailController
.
text
.
trim
());
if
(!
isValid
)
{
_editEmailError
=
"Please Enter Proper Email ID"
;
}
}
_isLoading
=
false
;
notifyListeners
();
return
isValid
;
}
void
resetAll
()
{
_formattedDateToSend
=
null
;
_formattedDate
=
null
;
_date
=
null
;
_showMoreDetails
=
false
;
nameController
.
clear
();
designationController
.
clear
();
...
...
lib/Notifiers/crmProvider/followUpUpdateProvider.dart
View file @
29665037
...
...
@@ -33,8 +33,22 @@ class followUpUpdateProvider extends ChangeNotifier {
DateTime
?
_date
;
String
?
_formattedDate
;
String
?
_formattedDateToSend
;
String
?
_dateError
;
String
?
followupError
;
String
?
followupFeedbackError
;
String
?
leadStatusError
;
String
?
appStatusError
;
String
?
nextAppDateError
;
String
?
nextAppType
;
String
?
noteError
;
String
?
orderStatusError
;
String
?
competitorError
;
String
?
reasonError
;
String
?
get
formattedDateToSend
=>
_formattedDateToSend
;
bool
get
submitLoading
=>
_submitLoading
;
TimeOfDay
get
selectedTime
=>
_selectedTime
;
...
...
@@ -60,31 +74,37 @@ class followUpUpdateProvider extends ChangeNotifier {
set
selectedFollowupType
(
String
?
value
)
{
_selectedFollowupType
=
value
;
followupError
=
null
;
notifyListeners
();
}
set
selectedLeadStatus
(
String
?
value
)
{
_selectedLeadStatus
=
value
;
leadStatusError
=
null
;
notifyListeners
();
}
set
nextAppointmentStatus
(
String
?
value
)
{
_nextAppointmentStatus
=
value
;
appStatusError
=
null
;
notifyListeners
();
}
set
selectNextAppointmentType
(
String
?
value
)
{
_selectNextAppointmentType
=
value
;
nextAppType
=
null
;
notifyListeners
();
}
set
selectOrderStatus
(
String
?
value
)
{
_selectOrderStatus
=
value
;
orderStatusError
=
null
;
notifyListeners
();
}
set
selectedCompetitor
(
String
?
value
)
{
_selectedCompetitor
=
value
;
competitorError
=
null
;
notifyListeners
();
}
...
...
@@ -109,11 +129,13 @@ class followUpUpdateProvider extends ChangeNotifier {
_formattedDate
=
value
;
nextAppointmentDateController
.
text
=
_formattedDate
!;
_dateError
=
null
;
nextAppDateError
=
null
;
notifyListeners
();
}
set
dateError
(
value
)
{
_dateError
=
value
;
nextAppDateError
=
value
;
notifyListeners
();
}
...
...
@@ -145,6 +167,10 @@ class followUpUpdateProvider extends ChangeNotifier {
[
mode
]
)
async
{
try
{
if
(!
valid
()){
return
;
}
_submitLoading
=
true
;
notifyListeners
();
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -162,7 +188,7 @@ class followUpUpdateProvider extends ChangeNotifier {
competitor
,
reasonController
.
text
,
leadStatus
,
nextAppointmentDateController
.
text
,
_formattedDateToSend
,
appointmentType
,
sms
,
noteController
.
text
,
...
...
@@ -187,9 +213,78 @@ class followUpUpdateProvider extends ChangeNotifier {
}
}
bool
valid
(){
followupError
=
null
;
followupFeedbackError
=
null
;
leadStatusError
=
null
;
appStatusError
=
null
;
nextAppDateError
=
null
;
nextAppType
=
null
;
noteError
=
null
;
orderStatusError
=
null
;
competitorError
=
null
;
reasonError
=
null
;
bool
isValid
=
true
;
if
(
_selectedFollowupType
==
null
||
_selectedFollowupType
==
""
){
followupError
=
"Please select Followup Type"
;
isValid
=
false
;
}
if
(
followUpFeedbackController
.
text
.
trim
().
isEmpty
){
followupFeedbackError
=
"Please enter Feedback"
;
isValid
=
false
;
}
if
(
_selectedLeadStatus
==
null
||
_selectedLeadStatus
==
""
){
leadStatusError
=
"Please Select Lead Status"
;
isValid
=
false
;
}
if
(
_nextAppointmentStatus
==
null
||
_nextAppointmentStatus
==
""
){
appStatusError
=
"Please select a value"
;
isValid
=
false
;
}
if
(
nextAppointmentStatus
==
"Next Appointment"
){
if
(
nextAppointmentDateController
.
text
.
trim
().
isEmpty
){
nextAppDateError
=
"Please Enter Date"
;
isValid
=
false
;
}
if
(
_selectNextAppointmentType
==
null
||
_selectNextAppointmentType
==
""
){
nextAppType
=
"Please select Appointment Type"
;
isValid
=
false
;
}
if
(
noteController
.
text
.
trim
().
isEmpty
){
noteError
=
"Enter Note"
;
isValid
=
false
;
}
}
else
if
(
nextAppointmentStatus
==
"Update Order Status"
){
if
(
_selectOrderStatus
==
null
||
_selectOrderStatus
==
""
){
orderStatusError
=
"Please Select Order Status"
;
isValid
=
false
;
}
if
(
selectOrderStatus
==
"Order Lost"
){
if
(
_selectedCompetitor
==
null
||
_selectedCompetitor
==
""
){
competitorError
=
"Please Select Competitor"
;
isValid
=
false
;
}
}
else
if
(
selectOrderStatus
==
"No Requirement"
){
if
(
reasonController
.
text
.
trim
().
isEmpty
){
reasonError
=
"Please Enter reason"
;
isValid
=
false
;
}
}
}
_submitLoading
=
false
;
notifyListeners
();
return
isValid
;
}
void
setDate
(
DateTime
newDate
)
{
_date
=
newDate
;
_formattedDate
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
newDate
);
// _formattedDate = DateFormat('yyyy-MM-dd').format(newDate);
_formattedDate
=
DateFormat
(
'd MMM yyyy'
).
format
(
newDate
);
_formattedDateToSend
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
newDate
);
nextAppointmentDateController
.
text
=
_formattedDate
!;
_dateError
=
null
;
notifyListeners
();
...
...
@@ -272,11 +367,13 @@ class followUpUpdateProvider extends ChangeNotifier {
),
),
),
Expanded
(
flex:
3
,
child:
CupertinoDatePicker
(
dateOrder:
DatePickerDateOrder
.
dmy
,
initialDateTime:
_date
??
DateTime
.
now
(),
minimumDate:
DateTime
(
DateTime
.
now
().
year
,
DateTime
.
now
().
month
,
DateTime
.
now
().
day
),
dateOrder:
DatePickerDateOrder
.
dmy
,
mode:
CupertinoDatePickerMode
.
date
,
use24hFormat:
true
,
showDayOfWeek:
true
,
...
...
@@ -292,14 +389,28 @@ class followUpUpdateProvider extends ChangeNotifier {
);
}
onFollowUpChanged
(
value
)
{
}
onFollowUpChanged
(
value
)
{
onNoteChanged
(
value
)
{}
followupFeedbackError
=
null
;
notifyListeners
();
}
onNoteChanged
(
value
)
{
noteError
=
null
;
notifyListeners
();
}
onReasonChanged
(
value
)
{}
onReasonChanged
(
value
)
{
reasonError
=
null
;
notifyListeners
();
}
void
resetForm
(){
nextAppointmentDateController
.
clear
();
_formattedDateToSend
=
null
;
_formattedDate
=
null
;
_date
=
null
;
followUpFeedbackController
.
clear
();
noteController
.
clear
();
reasonController
.
clear
();
...
...
@@ -309,6 +420,16 @@ class followUpUpdateProvider extends ChangeNotifier {
_selectNextAppointmentType
=
null
;
_selectOrderStatus
=
null
;
_selectedCompetitor
=
null
;
followupError
=
null
;
followupFeedbackError
=
null
;
leadStatusError
=
null
;
appStatusError
=
null
;
nextAppDateError
=
null
;
nextAppType
=
null
;
noteError
=
null
;
orderStatusError
=
null
;
competitorError
=
null
;
reasonError
=
null
;
notifyListeners
();
}
}
lib/Utils/app_colors.dart
View file @
29665037
...
...
@@ -18,4 +18,13 @@ class AppColors {
static
Color
text_field_color
=
Color
(
0xFFF0F4F5
);
static
Color
overlay_box_color
=
Color
(
0xFFE6F6FF
);
static
Color
ERP_text_color
=
Color
(
0xFF2D357F
);
static
Color
requested_text_color
=
Color
(
0xFF1487C9
);
static
Color
rejected_text_color
=
Color
(
0xFFEF3739
);
static
Color
approved_text_color
=
Color
(
0xFF4CB443
);
static
Color
processed_text_color
=
Color
(
0xFFFFB600
);
static
Color
requested_bg_color
=
Color
(
0xFFE6F6FF
);
static
Color
rejected_bg_color
=
Color
(
0xFFFFF5F5
);
static
Color
approved_bg_color
=
Color
(
0xFFE9FFE8
);
static
Color
processed_bg_color
=
Color
(
0xFFEFFF8E5
);
}
\ No newline at end of file
lib/screens/HomeScreen.dart
View file @
29665037
...
...
@@ -136,9 +136,10 @@ class _MyHomePageState extends State<MyHomePage> {
return
(
connection
==
'Online'
)
?
Consumer2
<
HomescreenNotifier
,
ProfileNotifer
>(
builder:
(
context
,
homescreen
,
profile
,
child
)
{
final
coreRequiredRoles
=
[
"43
3
"
,
"43
4
"
,
"43
0
"
,
"43
0"
];
final
coreRequiredRoles
=
[
"43
0
"
,
"43
0
"
,
"43
3
"
,
"43
4"
,
];
final
requiredRoles
=
[
"430"
,
"430"
,
"431"
,
"431"
];
final
coreNames
=
[
"Service"
,
"Gen Tracker"
,
"CRM"
,
"Orders"
];
final
coreNames
=
[
"CRM"
,
"Orders"
,
"Service"
,
"Gen Tracker"
,
];
final
names
=
[
"Attendance"
,
"Finance"
,
"ERP"
,
"Whizzdom"
];
final
subtitles
=
[
"Check-in,Check-out"
,
...
...
@@ -147,10 +148,11 @@ class _MyHomePageState extends State<MyHomePage> {
"Training, Assessments"
,
];
final
coreIcons
=
[
"assets/svg/home/home_service_ic.svg"
,
"assets/svg/home/home_gentracker_ic.svg"
,
"assets/svg/home/home_crm_ic.svg"
,
"assets/svg/home/home_order_ic.svg"
,
"assets/svg/home/home_service_ic.svg"
,
"assets/svg/home/home_gentracker_ic.svg"
,
];
final
icons
=
[
"assets/svg/home/home_attendance_ic.svg"
,
...
...
@@ -158,6 +160,12 @@ class _MyHomePageState extends State<MyHomePage> {
"assets/svg/home/home_erp_ic.svg"
,
"assets/svg/home/home_whizzdom_ic.svg"
,
];
final
coreSubtitles
=
[
"Leads, Followups"
,
"Orders, TPC, Dispatch"
,
"Visits, P.C. Wallet"
,
"Generator Details"
,
];
final
coreFilteredItems
=
<
Map
<
String
,
String
>>[];
final
filteredItems
=
<
Map
<
String
,
String
>>[];
...
...
@@ -176,6 +184,7 @@ class _MyHomePageState extends State<MyHomePage> {
coreFilteredItems
.
add
({
'name'
:
coreNames
[
i
],
'icon'
:
coreIcons
[
i
],
'subtitle'
:
coreSubtitles
[
i
],
});
}
}
...
...
@@ -412,18 +421,161 @@ class _MyHomePageState extends State<MyHomePage> {
Expanded
(
flex:
10
,
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
gradient:
LinearGradient
(
colors:
[
AppColors
.
scaffold_bg_color
,
AppColors
.
scaffold_bg_color
,
Color
(
0xFFCEEDFF
),
],
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
if
(
coreFilteredItems
.
isNotEmpty
)
...[
Padding
(
// if (coreFilteredItems.isNotEmpty) ...[
// Container(
// padding: const EdgeInsets.only(
// top: 10,
// bottom: 5,
// ),
// margin: EdgeInsets.symmetric(
// horizontal: 10,
// ),
// child: Text(
// "Core Functionalities",
// style: TextStyle(
// color: AppColors.grey_thick,
// fontSize: 14,
// fontFamily: "JakartaMedium",
// ),
// ),
// ),
// Container(
// padding: EdgeInsets.symmetric(
// vertical: 10,
// horizontal: 15,
// ),
// margin: EdgeInsets.symmetric(
// horizontal: 10,
// ),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(14),
// ),
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: List.generate(4, (ic) {
// return Expanded(
// child: InkResponse(
// onTap: () async {
// var res;
// switch (coreFilteredItems[ic]['name']) {
// case "Gen Tracker":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Gentrackerdashboard(),
// settings: RouteSettings(
// arguments:
// 'Gentrackerdashboard',
// ),
// ),
// );
// break;
// case "Service":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Serviceengineerdashboard(),
// ),
// );
// break;
// case "Orders":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Ordermoduledashboard(),
// ),
// );
// case "CRM":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// CrmdashboardScreen(),
// settings: RouteSettings(
// name:
// 'CrmdashboardScreen',
// ),
// ),
// );
// default:
// print("111");
// break;
// }
// if (res == true) {
// homescreen.DashboardApiFunction(
// context,
// );
// }
// },
// child: SizedBox(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.center,
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// SvgPicture.asset(
// coreFilteredItems[ic]['icon'] ??
// "-",
// ),
// SizedBox(height: 10),
// Text(
// coreFilteredItems[ic]['name'] ??
// "-",
// maxLines: 2,
// textAlign:
// TextAlign.center,
// style: TextStyle(
// fontSize: 12,
// fontFamily:
// "JakartaMedium",
// ),
// ),
// ],
// ),
// ),
// ),
// );
// }),
// ),
// ),
// ],
if
(
filteredItems
.
isNotEmpty
)
...[
Container
(
padding:
const
EdgeInsets
.
only
(
top:
10
,
bottom:
5
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
),
child:
Text
(
"
C
ore
Functionalitie
s"
,
"
Workf
or
c
e
& Operation
s"
,
style:
TextStyle
(
color:
AppColors
.
grey_thick
,
fontSize:
14
,
...
...
@@ -436,6 +588,9 @@ class _MyHomePageState extends State<MyHomePage> {
vertical:
10
,
horizontal:
15
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
14
),
...
...
@@ -448,53 +603,93 @@ class _MyHomePageState extends State<MyHomePage> {
child:
InkResponse
(
onTap:
()
async
{
var
res
;
switch
(
coreF
ilteredItems
[
ic
][
'name'
])
{
case
"
Gen Tracker
"
:
switch
(
f
ilteredItems
[
ic
][
'name'
])
{
case
"
Attendance
"
:
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Gentrackerdashboard
(),
AttendanceScreen
(),
settings:
RouteSettings
(
arguments:
'Gentrackerdashboard
'
,
'AttendanceScreen
'
,
),
),
);
break
;
case
"Service"
:
case
"ERP"
:
bool
isGpsEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
if
(
isGpsEnabled
)
{
if
(
Platform
.
isAndroid
)
{
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Serviceengineerdashboard
(),
(
context
,
)
=>
WebErpScreen
(
erp_url:
homescreen
.
webPageUrl
,
),
),
);
}
else
{
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
WebERPIOS
(
url:
homescreen
.
webPageUrl
,
),
),
);
}
}
else
{
requestGpsPermission
();
}
break
;
case
"Orders"
:
case
"Whizzdom"
:
bool
isGpsEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
if
(
isGpsEnabled
)
{
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Ordermoduledashboard
(),
(
context
,
)
=>
WebWhizzdomScreen
(
whizzdom_url:
homescreen
.
whizzdomPageUrl
,
),
),
);
case
"CRM"
:
}
else
{
requestGpsPermission
();
}
break
;
case
"Finance"
:
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Crm
dashboard
Screen
(),
Finance
dashboard
(),
settings:
RouteSettings
(
name
:
'Crm
dashboard
Screen
'
,
arguments
:
'Finance
dashboard'
,
),
),
);
break
;
default
:
print
(
"111"
);
break
;
...
...
@@ -513,12 +708,12 @@ class _MyHomePageState extends State<MyHomePage> {
MainAxisAlignment
.
center
,
children:
[
SvgPicture
.
asset
(
coreF
ilteredItems
[
ic
][
'icon'
]
??
f
ilteredItems
[
ic
][
'icon'
]
??
"-"
,
),
SizedBox
(
height:
10
),
Text
(
coreF
ilteredItems
[
ic
][
'name'
]
??
f
ilteredItems
[
ic
][
'name'
]
??
"-"
,
maxLines:
2
,
textAlign:
...
...
@@ -539,10 +734,14 @@ class _MyHomePageState extends State<MyHomePage> {
),
],
if
(
homescreen
.
roleStatus
.
contains
(
"432"
,
))
...[
Padding
(
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
),
padding:
const
EdgeInsets
.
only
(
top:
10
,
bottom:
5
,
...
...
@@ -572,6 +771,9 @@ class _MyHomePageState extends State<MyHomePage> {
}
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
),
padding:
EdgeInsets
.
symmetric
(
vertical:
15
,
horizontal:
15
,
...
...
@@ -630,14 +832,225 @@ class _MyHomePageState extends State<MyHomePage> {
),
],
if
(
filteredItems
.
isNotEmpty
)
...[
Padding
(
// if (filteredItems.isNotEmpty) ...[
// Container(
// margin: EdgeInsets.symmetric(
// horizontal: 10,
// ),
// padding: const EdgeInsets.only(
// top: 10,
// bottom: 5,
// ),
// child: Text(
// "Workforce & Operations",
// style: TextStyle(
// color: AppColors.grey_thick,
// fontSize: 14,
// fontFamily: "JakartaMedium",
// ),
// ),
// ),
// Container(
// margin: EdgeInsets.symmetric(
// horizontal: 5,
// ),
// child: GridView.builder(
// shrinkWrap: true,
// itemCount: filteredItems.length,
// gridDelegate:
// SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2,
// childAspectRatio: 2 / 1.1,
// ),
// itemBuilder: (context, ci) {
// return InkResponse(
// onTap: () async {
// var res;
// switch (filteredItems[ci]['name']) {
// case "Attendance":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// AttendanceScreen(),
// settings: RouteSettings(
// arguments:
// 'AttendanceScreen',
// ),
// ),
// );
// break;
// case "ERP":
// bool isGpsEnabled =
// await Geolocator.isLocationServiceEnabled();
// if (isGpsEnabled) {
// if (Platform.isAndroid) {
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (
// context,
// ) => WebErpScreen(
// erp_url:
// homescreen
// .webPageUrl,
// ),
// ),
// );
// } else {
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (
// context,
// ) => WebERPIOS(
// url:
// homescreen
// .webPageUrl,
// ),
// ),
// );
// }
// } else {
// requestGpsPermission();
// }
// break;
// case "Whizzdom":
// bool isGpsEnabled =
// await Geolocator.isLocationServiceEnabled();
// if (isGpsEnabled) {
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (
// context,
// ) => WebWhizzdomScreen(
// whizzdom_url:
// homescreen
// .whizzdomPageUrl,
// ),
// ),
// );
// } else {
// requestGpsPermission();
// }
// break;
// case "Finance":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Financedashboard(),
// settings: RouteSettings(
// arguments:
// 'Financedashboard',
// ),
// ),
// );
// break;
// default:
// print("111");
// break;
// }
// if (res == true) {
// homescreen.DashboardApiFunction(
// context,
// );
// }
// },
//
// child: Container(
// padding: EdgeInsets.symmetric(
// vertical: 5,
// horizontal: 15,
// ),
// margin: EdgeInsets.symmetric(
// vertical: 7,
// horizontal: 5,
// ),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius:
// BorderRadius.circular(14),
// ),
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.center,
// crossAxisAlignment:
// CrossAxisAlignment.center,
// children: [
// Expanded(
// flex: 2,
// child: SizedBox(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment
// .start,
// mainAxisAlignment:
// MainAxisAlignment
// .center,
// children: [
// Text(
// filteredItems[ci]['name'] ??
// "-",
// style: TextStyle(
// fontSize: 14,
// color:
// AppColors
// .app_blue,
// fontFamily:
// "JakartaMedium",
// ),
// ),
// Text(
// filteredItems[ci]['subtitle'] ??
// "-",
// style: TextStyle(
// fontSize: 12,
// color:
// AppColors
// .grey_semi,
// fontFamily:
// "JakartaMedium",
// ),
// ),
// ],
// ),
// ),
// ),
// SizedBox(width: 10),
// Expanded(
// flex: 1,
// child: SvgPicture.asset(
// filteredItems[ci]['icon'] ??
// "-",
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
// ),
// ],
if
(
coreFilteredItems
.
isNotEmpty
)
...[
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
),
padding:
const
EdgeInsets
.
only
(
top:
10
,
bottom:
5
,
),
child:
Text
(
"
Workf
or
c
e
& Operation
s"
,
"
C
ore
Functionalitie
s"
,
style:
TextStyle
(
color:
AppColors
.
grey_thick
,
fontSize:
14
,
...
...
@@ -645,9 +1058,13 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
),
Expanded
(
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
5
,
),
child:
GridView
.
builder
(
itemCount:
filteredItems
.
length
,
shrinkWrap:
true
,
itemCount:
coreFilteredItems
.
length
,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
2
,
...
...
@@ -657,93 +1074,53 @@ class _MyHomePageState extends State<MyHomePage> {
return
InkResponse
(
onTap:
()
async
{
var
res
;
switch
(
f
ilteredItems
[
ci
][
'name'
])
{
case
"
Attendance
"
:
switch
(
coreF
ilteredItems
[
ci
][
'name'
])
{
case
"
Gen Tracker
"
:
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
AttendanceScreen
(),
Gentrackerdashboard
(),
settings:
RouteSettings
(
arguments:
'AttendanceScreen
'
,
'Gentrackerdashboard
'
,
),
),
);
break
;
case
"ERP"
:
bool
isGpsEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
if
(
isGpsEnabled
)
{
if
(
Platform
.
isAndroid
)
{
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
WebErpScreen
(
erp_url:
homescreen
.
webPageUrl
,
),
),
);
}
else
{
case
"Service"
:
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
WebERPIOS
(
url:
homescreen
.
webPageUrl
,
),
(
context
)
=>
Serviceengineerdashboard
(),
),
);
}
}
else
{
requestGpsPermission
();
}
break
;
case
"Whizzdom"
:
bool
isGpsEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
if
(
isGpsEnabled
)
{
case
"Orders"
:
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
WebWhizzdomScreen
(
whizzdom_url:
homescreen
.
whizzdomPageUrl
,
),
(
context
)
=>
Ordermoduledashboard
(),
),
);
}
else
{
requestGpsPermission
();
}
break
;
case
"Finance"
:
case
"CRM"
:
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Finance
dashboard
(),
Crm
dashboard
Screen
(),
settings:
RouteSettings
(
arguments
:
'Finance
dashboard'
,
name
:
'Crm
dashboard
Screen
'
,
),
),
);
break
;
default
:
print
(
"111"
);
break
;
...
...
@@ -787,7 +1164,7 @@ class _MyHomePageState extends State<MyHomePage> {
.
center
,
children:
[
Text
(
f
ilteredItems
[
ci
][
'name'
]
??
coreF
ilteredItems
[
ci
][
'name'
]
??
"-"
,
style:
TextStyle
(
fontSize:
14
,
...
...
@@ -799,7 +1176,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
Text
(
f
ilteredItems
[
ci
][
'subtitle'
]
??
coreF
ilteredItems
[
ci
][
'subtitle'
]
??
"-"
,
style:
TextStyle
(
fontSize:
12
,
...
...
@@ -1053,6 +1430,16 @@ class _MyHomePageState extends State<MyHomePage> {
],
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
floatingActionButton:
Container
(
height:
40
,
alignment:
Alignment
.
bottomCenter
,
margin:
EdgeInsets
.
only
(
bottom:
20
),
child:
Image
.
asset
(
fit:
BoxFit
.
scaleDown
,
"assets/images/horizontal_logo.png"
,
),
),
),
),
),
...
...
lib/screens/crm/LeadDetailsByMode.dart
View file @
29665037
...
...
@@ -18,6 +18,7 @@ import 'package:generp/screens/crm/editAccountDetails.dart';
import
'package:generp/screens/crm/followUpUpdateScreen.dart'
;
import
'package:generp/screens/crm/productDetails.dart'
;
import
'package:provider/provider.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
import
'../../Models/crmModels/crmLeadDetailsEditProductsViewResponse.dart'
;
import
'../../Utils/app_colors.dart'
;
...
...
@@ -71,8 +72,6 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
...
...
@@ -94,6 +93,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
context
,
listen:
false
,
).
resetForm
();
Provider
.
of
<
crmLeadDetailsProvider
>(
context
,
listen:
false
,
).
resetAll
();
return
onBackPressed
(
context
);
},
child:
SafeArea
(
...
...
@@ -152,7 +156,6 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
var
appointmentNotEmpty
=
provider
.
appointmentDetails
.
isNotEmpty
;
var
quotationNotEmpty
=
provider
.
quotationsDetails
.
isNotEmpty
;
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
...
...
@@ -201,14 +204,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
],
),
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Column
(
body:
provider
.
leadDetailsLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
,
),
),
)
:
SingleChildScrollView
(
child:
Column
(
children:
[
Card
(
shape:
RoundedRectangleBorder
(
...
...
@@ -277,16 +288,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
EditAccountDetails
(
leadID:
leadDetails
.
id
,
(
context
,
)
=>
EditAccountDetails
(
leadID:
leadDetails
.
id
,
mode:
widget
.
mode
,
accountID:
leadDetails
.
accId
,
companyName:
leadDetails
.
name
,
accountID:
leadDetails
.
accId
,
companyName:
leadDetails
.
name
,
),
),
);
if
(
res
==
true
)
{
provider
.
crmLeadDetailsAPIFunction
(
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadId
,
widget
.
mode
,
...
...
@@ -323,11 +340,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
Visibility
(
visible:
provider
.
showMoreDetails
?
true
:
false
,
visible:
provider
.
showMoreDetails
?
true
:
false
,
child:
Column
(
children:
[
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
4
),
padding:
EdgeInsets
.
symmetric
(
vertical:
4
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -336,7 +358,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Account Details"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
...
...
@@ -345,7 +368,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -353,7 +377,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
),
...
List
.
generate
(
subHeadings1
.
length
,
(
j
)
{
...
List
.
generate
(
subHeadings1
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
,
...
...
@@ -366,9 +392,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
Text
(
headings1
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
...
...
@@ -379,16 +408,21 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
:
subHeadings1
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
color:
Color
(
0xFF818181
,
),
),
),
),
],
),
);
}),
},
),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
4
),
padding:
EdgeInsets
.
symmetric
(
vertical:
4
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -397,7 +431,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Address Details"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
...
...
@@ -406,7 +441,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -414,7 +450,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
),
...
List
.
generate
(
subHeadings2
.
length
,
(
j
)
{
...
List
.
generate
(
subHeadings2
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
,
...
...
@@ -427,9 +465,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
Text
(
headings2
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
...
...
@@ -440,16 +481,21 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
:
subHeadings2
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
color:
Color
(
0xFF818181
,
),
),
),
),
],
),
);
}),
},
),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
4
),
padding:
EdgeInsets
.
symmetric
(
vertical:
4
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -458,7 +504,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Source Details"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
...
...
@@ -467,7 +514,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -475,7 +523,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
),
...
List
.
generate
(
subHeadings3
.
length
,
(
j
)
{
...
List
.
generate
(
subHeadings3
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
,
...
...
@@ -488,9 +538,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
Text
(
headings3
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
...
...
@@ -501,16 +554,21 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
:
subHeadings3
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
color:
Color
(
0xFF818181
,
),
),
),
),
],
),
);
}),
},
),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
4
),
padding:
EdgeInsets
.
symmetric
(
vertical:
4
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -519,7 +577,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Lead Details"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
...
...
@@ -528,7 +587,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -536,7 +596,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
),
...
List
.
generate
(
subHeadings4
.
length
,
(
j
)
{
...
List
.
generate
(
subHeadings4
.
length
,
(
j
,
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
,
...
...
@@ -549,16 +611,20 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
Text
(
headings4
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
child:
subHeadings4
[
j
]
==
"Lead Age"
subHeadings4
[
j
]
==
"Lead Age"
?
Tooltip
(
triggerMode:
TooltipTriggerMode
...
...
@@ -567,11 +633,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
message:
"
${provider.leadDetails.createdDatetime}
"
,
child:
Text
(
subHeadings4
[
j
]
==
""
subHeadings4
[
j
]
==
""
?
"-"
:
subHeadings4
[
j
],
style:
TextStyle
(
fontSize:
14
,
fontSize:
14
,
color:
Color
(
0xFF818181
,
),
...
...
@@ -585,7 +653,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
)
:
Text
(
subHeadings4
[
j
]
==
""
subHeadings4
[
j
]
==
""
?
"-"
:
subHeadings4
[
j
],
style:
TextStyle
(
...
...
@@ -611,10 +680,14 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
!
provider
.
showMoreDetails
;
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
provider
.
showMoreDetails
...
...
@@ -648,14 +721,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
),
Expanded
(
child:
SingleChildScrollView
(
physics:
AlwaysScrollableScrollPhysics
(),
child:
Column
(
Column
(
children:
[
///product details
Container
(
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
),
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -686,6 +760,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
""
,
);
},
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
textAlign:
TextAlign
.
right
,
"+ Add Product"
,
...
...
@@ -697,6 +773,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
),
],
],
),
...
...
@@ -733,22 +810,36 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
editProvider
.
addEditProductPriceController
.
text
=
provider
.
leadProducts
[
lp
].
price
!;
editProvider
.
addEditQuantityController
.
text
=
.
text
=
provider
.
leadProducts
[
lp
].
price
!;
editProvider
.
addEditQuantityController
.
text
=
provider
.
leadProducts
[
lp
].
qty
!;
editProvider
.
addEditTotalAmountController
.
text
=
provider
.
leadProducts
[
lp
].
prodTotalPrice
!;
editProvider
.
selectedProducts
=
editProvider
editProvider
.
addEditTotalAmountController
.
text
=
provider
.
leadProducts
[
lp
]
.
prodTotalPrice
!;
editProvider
.
selectedProducts
=
editProvider
.
productsList
.
firstWhere
(
(
product
)
=>
product
.
id
==
provider
.
leadProducts
[
lp
].
productId
,
provider
.
leadProducts
[
lp
]
.
productId
,
);
editProvider
.
selectedAddEditProductId
=
provider
.
leadProducts
[
lp
].
productId
!;
editProvider
.
selectedAddEditProductName
=
provider
.
leadProducts
[
lp
].
productName
!;
provider
.
leadProducts
[
lp
]
.
productId
!;
editProvider
.
selectedAddEditProductName
=
provider
.
leadProducts
[
lp
]
.
productName
!;
_showAddEditProductsSheet
(
context
,
widget
.
mode
,
...
...
@@ -758,10 +849,14 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
},
child:
Container
(
height:
130
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.95
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.9
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
14
),
borderRadius:
BorderRadius
.
circular
(
14
,
),
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
...
...
@@ -774,8 +869,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
1
,
...
...
@@ -805,27 +902,31 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"-"
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
TextOverflow
.
ellipsis
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
AppColors
.
semi_black
,
),
),
),
Expanded
(
flex:
2
,
child:
Text
(
textAlign:
TextAlign
.
right
,
textAlign:
TextAlign
.
right
,
"₹
${provider.leadProducts[lp].price ?? "-"}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
AppColors
.
semi_black
,
),
),
),
...
...
@@ -834,16 +935,20 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Text
(
"x
${provider.leadProducts[lp].qty ?? "-"}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
grey_semi
,
color:
AppColors
.
grey_semi
,
),
),
SizedBox
(
height:
5
),
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -851,9 +956,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Text
(
"₹
${provider.leadProducts[lp].prodTotalPrice ?? " - "}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
],
...
...
@@ -910,7 +1018,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
///contact details
Container
(
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
),
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -930,6 +1042,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
onTap:
()
{
_showAddContactSheet
(
context
);
},
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
textAlign:
TextAlign
.
right
,
"+ Add Contact"
,
...
...
@@ -941,6 +1055,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
),
],
],
),
...
...
@@ -958,17 +1073,26 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return
InkResponse
(
onTap:
()
async
{
provider
.
editNameController
.
text
=
provider
.
contactDetails
[
lp
].
name
??
""
;
provider
.
contactDetails
[
lp
].
name
??
""
;
provider
.
editDesignationController
.
text
=
provider
.
contactDetails
[
lp
].
designation
??
""
;
provider
.
contactDetails
[
lp
]
.
designation
??
""
;
provider
.
editMobileNumberController
.
text
=
provider
.
contactDetails
[
lp
].
mob1
??
""
;
provider
.
editAlternativeMobileController
.
text
=
provider
.
contactDetails
[
lp
].
mob2
??
""
;
provider
.
contactDetails
[
lp
].
mob1
??
""
;
provider
.
editAlternativeMobileController
.
text
=
provider
.
contactDetails
[
lp
].
mob2
??
""
;
provider
.
editTelephoneController
.
text
=
provider
.
contactDetails
[
lp
].
tel
??
""
;
provider
.
editEmailController
.
text
=
provider
.
contactDetails
[
lp
].
email
??
""
;
provider
.
contactDetails
[
lp
].
email
??
""
;
_showEditContactSheet
(
context
,
lp
);
},
child:
Container
(
...
...
@@ -983,8 +1107,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
margin:
EdgeInsets
.
symmetric
(
vertical:
5
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
1
,
...
...
@@ -1013,21 +1139,45 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
.
name
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
flex:
2
,
child:
InkResponse
(
onTap:
()
{
launch
(
'tel://
${provider.contactDetails[lp].mob1}
'
,
);
},
child:
Text
(
textAlign:
TextAlign
.
right
,
textAlign:
TextAlign
.
right
,
"
${provider.contactDetails[lp].mob1 ?? "-"}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
height:
1
,
decorationColor:
AppColors
.
grey_thick
,
decoration:
TextDecoration
.
underline
,
decorationStyle:
TextDecorationStyle
.
dotted
,
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
),
...
...
@@ -1036,9 +1186,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Text
(
"
${provider.contactDetails[lp].email ?? "-"}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
grey_semi
,
color:
AppColors
.
grey_semi
,
),
),
],
...
...
@@ -1083,7 +1235,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
///Followup details
Container
(
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
),
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -1105,8 +1261,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Followupupdatescreen
(
leadID:
provider
.
leadDetails
.
id
,
(
context
)
=>
Followupupdatescreen
(
leadID:
provider
.
leadDetails
.
id
,
mode:
widget
.
mode
,
),
settings:
RouteSettings
(
...
...
@@ -1115,6 +1275,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
);
},
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
textAlign:
TextAlign
.
right
,
"+ Follow up Update"
,
...
...
@@ -1126,6 +1288,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
),
],
],
),
...
...
@@ -1146,7 +1309,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemBuilder:
(
context
,
lp
)
{
return
Container
(
height:
250
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.95
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.9
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
14
),
...
...
@@ -1155,12 +1320,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
5
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
5
,
),
child:
Column
(
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -1177,7 +1345,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
Column
(
// mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
...
...
@@ -1198,7 +1367,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
...
...
@@ -1212,7 +1382,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
fontSize:
14
,
color:
AppColors
.
grey_semi
,
...
...
@@ -1224,7 +1395,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded
(
flex:
2
,
child:
Container
(
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
,
...
...
@@ -1235,18 +1407,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
horizontal:
5
,
vertical:
10
,
),
child:
Center
(
child:
Text
(
textAlign:
TextAlign
.
right
,
TextAlign
.
right
,
"
${provider.followupDetails[lp].fstatus ?? "-"}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
fontSize:
14
,
color:
Color
(
0xFF586000
,
),
...
...
@@ -1264,7 +1440,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
7.5
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -1273,16 +1451,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Time"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
Expanded
(
flex:
7
,
flex:
9
,
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -1291,11 +1471,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
...
List
.
generate
(
2
,
(
j
)
{
final
heads
=
[
"In Time"
,
"Out Time"
];
final
heads
=
[
"In Time"
,
"Out Time"
,
];
final
subHeads
=
[
provider
.
followupDetails
[
lp
].
finTime
??
provider
.
followupDetails
[
lp
]
.
finTime
??
"-"
,
provider
.
followupDetails
[
lp
].
foutTime
??
provider
.
followupDetails
[
lp
]
.
foutTime
??
"-"
,
];
return
Container
(
...
...
@@ -1311,21 +1498,27 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
textAlign:
TextAlign
.
left
,
heads
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
Text
(
textAlign:
TextAlign
.
right
,
textAlign:
TextAlign
.
right
,
subHeads
[
j
]
==
""
?
"-"
:
subHeads
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
color:
Color
(
0xFF818181
,
),
),
),
),
...
...
@@ -1334,7 +1527,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
}),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
7
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -1343,7 +1538,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Remarks"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
...
...
@@ -1352,7 +1548,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -1361,23 +1558,29 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
3
),
// padding: EdgeInsets.symmetric(
// vertical: 2,
// ),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
3
,
child:
Text
(
textAlign:
TextAlign
.
left
,
"Feedback"
,
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
flex:
7
,
child:
Text
(
textAlign:
TextAlign
.
right
,
provider
...
...
@@ -1449,7 +1652,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
///Appointment details
Container
(
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
),
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -1469,6 +1676,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
onTap:
()
{
_showAddAppointmentSheet
(
context
);
},
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
textAlign:
TextAlign
.
right
,
"+ Add Appointment"
,
...
...
@@ -1480,6 +1689,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
),
],
],
),
...
...
@@ -1487,7 +1697,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if
(
appointmentNotEmpty
)
...[
SizedBox
(
width:
double
.
infinity
,
height:
2
5
5
,
height:
2
2
5
,
child:
ListView
.
builder
(
physics:
AlwaysScrollableScrollPhysics
(),
shrinkWrap:
true
,
...
...
@@ -1499,8 +1709,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount:
provider
.
appointmentDetails
.
length
,
itemBuilder:
(
context
,
lp
)
{
return
Container
(
height:
255
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.95
,
height:
225
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.9
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
14
),
...
...
@@ -1509,12 +1721,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
5
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
5
,
),
child:
Column
(
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -1531,7 +1746,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
Column
(
// mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
...
...
@@ -1552,7 +1768,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
...
...
@@ -1566,7 +1783,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
fontSize:
14
,
color:
AppColors
.
grey_semi
,
...
...
@@ -1581,10 +1799,39 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
if
(
provider
.
appointmentDetails
[
lp
]
.
astatus
==
"No"
)...[
Expanded
(
flex:
2
,
child:
Container
(
height:
45
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
),
decoration:
BoxDecoration
(
color:
AppColors
.
processed_bg_color
,
borderRadius:
BorderRadius
.
circular
(
8
)
),
child:
Center
(
child:
Text
(
"Pending"
,
textAlign:
TextAlign
.
right
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
processed_text_color
,
),
),
),
),
),
]
],
),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -1593,7 +1840,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Appointment"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
...
...
@@ -1602,7 +1850,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -1610,12 +1859,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
),
...
List
.
generate
(
2
,
(
j
)
{
final
headsa
=
[
"Type"
,
"Executed"
];
...
List
.
generate
(
1
,
(
j
)
{
final
headsa
=
[
"Type"
];
final
subHeadsa
=
[
provider
.
appointmentDetails
[
lp
].
atype
??
"-"
,
provider
.
appointmentDetails
[
lp
].
astatus
??
provider
.
appointmentDetails
[
lp
]
.
atype
??
"-"
,
];
return
Container
(
...
...
@@ -1631,21 +1880,27 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
textAlign:
TextAlign
.
left
,
headsa
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
Text
(
textAlign:
TextAlign
.
right
,
textAlign:
TextAlign
.
right
,
subHeadsa
[
j
]
==
""
?
"-"
:
subHeadsa
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
color:
Color
(
0xFF818181
,
),
),
),
),
...
...
@@ -1654,7 +1909,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
}),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -1663,7 +1920,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Remarks"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
...
...
@@ -1672,7 +1930,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -1681,25 +1940,29 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
3
),
padding:
EdgeInsets
.
symmetric
(
vertical:
3
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
1
,
flex:
1
,
child:
Text
(
textAlign:
TextAlign
.
left
,
"Note"
,
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
flex:
5
,
flex:
5
,
child:
Text
(
textAlign:
TextAlign
.
right
,
provider
...
...
@@ -1714,7 +1977,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
maxLines:
2
,
style:
TextStyle
(
fontSize:
14
,
height:
1
,
height:
1
,
color:
Color
(
0xFF818181
),
),
),
...
...
@@ -1760,7 +2023,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
///Quotation details
Container
(
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
),
padding:
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -1782,8 +2049,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Generatequotationscreen
(
leadId:
provider
.
leadDetails
.
id
,
(
context
)
=>
Generatequotationscreen
(
leadId:
provider
.
leadDetails
.
id
,
),
),
);
...
...
@@ -1795,6 +2066,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
}
},
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
textAlign:
TextAlign
.
right
,
"+ Generate Quotation"
,
...
...
@@ -1806,6 +2079,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
),
],
],
),
...
...
@@ -1826,7 +2100,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemBuilder:
(
context
,
lp
)
{
return
Container
(
height:
200
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.95
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.9
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
14
),
...
...
@@ -1835,12 +2111,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
5
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
5
,
),
child:
Column
(
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -1857,7 +2136,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
Column
(
// mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
...
...
@@ -1878,7 +2158,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
...
...
@@ -1892,7 +2173,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
fontSize:
14
,
color:
AppColors
.
grey_semi
,
...
...
@@ -1910,7 +2192,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
),
child:
Row
(
children:
[
Expanded
(
...
...
@@ -1919,7 +2203,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Quotation Details"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
...
...
@@ -1928,7 +2213,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
...
...
@@ -1937,10 +2223,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
...
List
.
generate
(
2
,
(
j
)
{
final
headsa
=
[
"File Attached"
,
"Info"
];
final
headsa
=
[
"File Attached"
,
"Info"
,
];
final
subHeadsa
=
[
"View"
,
provider
.
quotationsDetails
[
lp
].
info
??
provider
.
quotationsDetails
[
lp
]
.
info
??
"-"
,
];
return
Container
(
...
...
@@ -1956,39 +2247,65 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
textAlign:
TextAlign
.
left
,
headsa
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
if
(
subHeadsa
[
j
]
==
"View"
)
...[
if
(
subHeadsa
[
j
]
==
"View"
)
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
provider
.
crmDownloadQuotationFunction
(
context
,
widget
.
leadId
,
provider
.
quotationsDetails
[
lp
]
.
id
,
provider
.
quotationsDetails
[
lp
]
.
type
,
);
},
child:
Text
(
textAlign:
TextAlign
.
right
,
textAlign:
TextAlign
.
right
,
subHeadsa
[
j
]
==
""
?
"-"
:
subHeadsa
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
AppColors
.
app_blue
,
color:
AppColors
.
app_blue
,
decorationColor:
AppColors
.
app_blue
,
AppColors
.
app_blue
,
decoration:
TextDecoration
.
underline
,
TextDecoration
.
underline
,
),
),
),
),
]
else
...[
Expanded
(
child:
Text
(
textAlign:
TextAlign
.
right
,
textAlign:
TextAlign
.
right
,
subHeadsa
[
j
]
==
""
?
"-"
:
subHeadsa
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
color:
Color
(
0xFF818181
,
),
),
),
),
...
...
@@ -2050,10 +2367,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
SizedBox
(
height:
75
),
],
),
),
),
],
),
),
);
},
);
...
...
@@ -2150,7 +2466,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
errorWidget
(
context
,
provider
.
dateError
),
TextWidget
(
context
,
"A
ccount
"
),
TextWidget
(
context
,
"A
ppointment Type
"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
...
...
@@ -2161,7 +2477,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children:
[
Expanded
(
child:
Text
(
'Select
Account
'
,
'Select
Type
'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
...
...
@@ -2228,7 +2544,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
.
crmLeadDetailsAddAppointmentAPIFunction
(
context
,
provider
.
leadDetails
.
id
,
provider
.
dateController
.
text
,
provider
.
formattedDateToSend
,
provider
.
selectedVisitType
,
provider
.
noteController
.
text
,
);
...
...
@@ -2274,8 +2590,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadId
,
widget
.
mode
);
}
,
);
}
,
);
});
});
}
Future
<
void
>
_showAddContactSheet
(
BuildContext
context
)
{
...
...
@@ -2325,7 +2641,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Name"
,
"Enter Name"
,
(
p0
)
{
provider
.
crmCheckFields
(
context
,
provider
.
nameController
.
text
,
"name"
);
provider
.
crmCheckFields
(
context
,
provider
.
nameController
.
text
,
"name"
,
);
provider
.
onChangeName
(
p0
);
},
TextInputType
.
text
,
...
...
@@ -2349,8 +2669,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider
.
mobileNumberController
,
"Mobile Number"
,
"Enter Mobile Number"
,
(
p0
){
provider
.
crmCheckFields
(
context
,
provider
.
mobileNumberController
.
text
,
"mob1"
);
(
p0
)
{
provider
.
crmCheckFields
(
context
,
provider
.
mobileNumberController
.
text
,
"mob1"
,
);
provider
.
onChangeMobile
(
p0
);
},
...
...
@@ -2360,7 +2684,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
null
,
null
,
TextInputAction
.
next
,
10
10
,
),
errorWidget
(
context
,
provider
.
mobileNumError
),
textControllerWidget
(
...
...
@@ -2369,7 +2693,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Alternative Mobile Number"
,
"Enter Alternative Mobile Number"
,
(
p0
)
{
provider
.
crmCheckFields
(
context
,
provider
.
alternativeMobileController
.
text
,
"mob2"
);
provider
.
crmCheckFields
(
context
,
provider
.
alternativeMobileController
.
text
,
"mob2"
,
);
provider
.
onChangeAltMobile
(
p0
);
},
...
...
@@ -2379,7 +2707,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
null
,
null
,
TextInputAction
.
next
,
10
10
,
),
errorWidget
(
context
,
provider
.
altMobError
),
textControllerWidget
(
...
...
@@ -2463,8 +2791,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadId
,
widget
.
mode
);
}
,
);
}
,
);
});
});
}
Future
<
void
>
_showEditContactSheet
(
BuildContext
context
,
index
)
{
...
...
@@ -2513,7 +2841,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Name"
,
"Enter Name"
,
(
p0
)
{
provider
.
crmCheckFields
(
context
,
provider
.
editNameController
.
text
,
"name"
);
provider
.
crmCheckFields
(
context
,
provider
.
editNameController
.
text
,
"name"
,
);
provider
.
onChangeEditName
(
p0
);
},
TextInputType
.
text
,
...
...
@@ -2538,7 +2870,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Mobile Number"
,
"Enter Mobile Number"
,
(
p0
)
{
provider
.
crmCheckFields
(
context
,
provider
.
editMobileNumberController
.
text
,
"mob1"
);
provider
.
crmCheckFields
(
context
,
provider
.
editMobileNumberController
.
text
,
"mob1"
,
);
provider
.
onChangeEditMobile
(
p0
);
},
...
...
@@ -2548,7 +2884,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
null
,
null
,
TextInputAction
.
next
,
10
10
,
),
errorWidget
(
context
,
provider
.
editMobileNumError
),
...
...
@@ -2558,7 +2894,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Alternative Mobile Number"
,
"Enter Alternative Mobile Number"
,
(
p0
)
{
provider
.
crmCheckFields
(
context
,
provider
.
editAlternativeMobileController
.
text
,
"mob2"
);
provider
.
crmCheckFields
(
context
,
provider
.
editAlternativeMobileController
.
text
,
"mob2"
,
);
provider
.
onChangeEditAltMobile
(
p0
);
},
...
...
@@ -2568,7 +2908,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
null
,
null
,
TextInputAction
.
next
,
10
10
,
),
errorWidget
(
context
,
provider
.
editAltMobError
),
textControllerWidget
(
...
...
@@ -2652,10 +2992,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
context
,
listen:
false
,
);
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadId
,
widget
.
mode
);
}
,
);
}
,
);
});
});
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
)
{
...
...
@@ -2867,12 +3206,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
items:
editProvider
.
productsList
.
map
(
(
ord
,
)
=>
DropdownMenuItem
<
Products
>(
(
ord
)
=>
DropdownMenuItem
<
Products
>(
value:
ord
,
child:
Text
(
"(Product Name:
${ord.name}
)
"
,
"
${ord.name}
"
,
style:
const
TextStyle
(
fontSize:
14
,
),
...
...
@@ -2897,7 +3235,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
editProvider
.
selectedAddEditProductName
=
value
.
name
;
editProvider
.
crmSelectedProductDetailsApiFunction
(
context
,
value
.
id
.
toString
());
editProvider
.
crmSelectedProductDetailsApiFunction
(
context
,
value
.
id
.
toString
(),
);
// editProvider.updateSelectedProductIds(j, value);
// editProvider.selectedProductIds[j] =
// value.id?.toString() ?? '';
...
...
@@ -3056,7 +3398,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadId
,
widget
.
mode
);
}
,
);
}
,
);
});
});
}
}
lib/screens/crm/LeadListByMode.dart
View file @
29665037
...
...
@@ -63,7 +63,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
""
,
""
,
""
,
"
A
"
,
""
,
);
}
else
{
provider
.
crmLeadListAPIFunction
(
...
...
@@ -75,7 +75,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
""
,
""
,
""
,
"
A
"
,
""
,
);
}
});
...
...
@@ -948,7 +948,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
// );
// }
Future
<
void
>
_showFilterSheetNew
(
BuildContext
context
)
{
Future
<
void
>
_showFilterSheetNew
1
(
BuildContext
context
)
{
List
<
bool
>
isSelected
=
List
.
generate
(
9
,
(
index
)
=>
index
==
0
?
true
:
false
,
...
...
@@ -976,7 +976,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
(
element
)
=>
element
==
true
,
);
final
headings
=
[
"Alphabet"
,
"Lead Status"
,
"Open/Close Status"
,
"Mobile Number"
,
...
...
@@ -986,7 +985,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
"Team"
,
"Segment"
,
];
if
(
widget
.
mode
!=
"executive"
){
if
(
widget
.
mode
!=
"executive"
)
{
headings
.
add
(
"Employee"
);
}
return
Container
(
...
...
@@ -995,7 +994,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
EdgeInsets
.
only
(
left:
15
),
child:
Text
(
...
...
@@ -1013,7 +1011,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
child:
Container
(
decoration:
BoxDecoration
(
border:
Border
(
top:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
)),
top:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
),
),
bottom:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
),
),
...
...
@@ -1026,8 +1026,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
Expanded
(
flex:
3
,
child:
Column
(
children:
List
.
generate
(
headings
.
length
,
(
jj
)
{
children:
List
.
generate
(
headings
.
length
,
(
jj
,
)
{
return
Expanded
(
child:
InkResponse
(
onTap:
()
{
...
...
@@ -1042,7 +1043,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
});
},
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
7.5
,
horizontal:
10
,
),
...
...
@@ -1051,12 +1053,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
left:
isSelected
[
jj
]
?
BorderSide
(
color:
AppColors
.
app_blue
,
width:
5.0
,
)
:
const
BorderSide
(
color:
...
...
@@ -1084,7 +1084,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
color:
AppColors
.
semi_black
,
),
),
...
...
@@ -1109,47 +1110,22 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
mainAxisSize:
MainAxisSize
.
min
,
children:
[
if
(
selectedIndex
==
0
)
...[
...
provider
.
alphabet
List
.
map
((
...
provider
.
leadStatus
List
.
map
((
status
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
)),
title:
Text
(
status
!,
style:
const
TextStyle
(
fontSize:
14
,
),
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
value:
provider
.
selectedAlphabet
==
status
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedAlphabet
=
status
;
}
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
1
)
...[
...
provider
.
leadStatusList
.
map
((
status
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
)),
title:
Text
(
status
!,
style:
const
TextStyle
(
...
...
@@ -1157,30 +1133,46 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
),
value:
provider
.
selectedLeadStatus
==
provider
.
selectedLeadStatus
==
status
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedLeadStatus
=
status
;
}
else
{
provider
.
selectedLeadStatus
=
null
;
}
print
(
provider
.
selectedLeadStatus
,
);
});
},
contentPadding:
EdgeInsets
.
zero
,
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
2
)
...[
]
else
if
(
selectedIndex
==
1
)
...[
...
provider
.
openStatusList
.
map
((
status
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
)),
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
status
!,
style:
const
TextStyle
(
...
...
@@ -1188,21 +1180,26 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
),
value:
provider
.
selectedOpenStatus
==
provider
.
selectedOpenStatus
==
status
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedOpenStatus
=
status
;
}
else
{
provider
.
selectedOpenStatus
=
null
;
}
});
},
contentPadding:
EdgeInsets
.
zero
,
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
3
)
...[
]
else
if
(
selectedIndex
==
2
)
...[
textControllerWidget
(
context
,
provider
.
mobileNumberController
,
...
...
@@ -1214,7 +1211,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
FilteringTextInputFormatter
.
digitsOnly
,
),
]
else
if
(
selectedIndex
==
4
)
...[
]
else
if
(
selectedIndex
==
3
)
...[
textControllerWidget
(
context
,
provider
.
companyNameController
,
...
...
@@ -1225,14 +1222,23 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
false
,
null
,
),
]
else
if
(
selectedIndex
==
5
)
...[
...
provider
.
sourcesList
.
map
((
source
)
{
]
else
if
(
selectedIndex
==
4
)
...[
...
provider
.
sourcesList
.
map
((
source
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
)),
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
source
.
name
!,
style:
const
TextStyle
(
...
...
@@ -1251,6 +1257,24 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
source
.
id
!;
provider
.
selectedSourceValue
=
source
.
name
!;
}
else
{
provider
.
selectedSourceId
=
null
;
provider
.
selectedSourceValue
=
null
;
if
(
provider
.
selectedReference
!=
null
)
{
provider
.
referencesList
.
clear
();
provider
.
selectedReferenceId
=
null
;
provider
.
selectedReferenceValue
=
null
;
}
}
// Call API if needed
provider
...
...
@@ -1262,23 +1286,36 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
);
});
},
contentPadding:
EdgeInsets
.
zero
,
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
6
)
...[
if
(
provider
.
referencesList
.
isEmpty
)...[
errorWidget
(
context
,
"Please Select Source First"
),
]
else
...[
]
else
if
(
selectedIndex
==
5
)
...[
if
(
provider
.
referencesList
.
isEmpty
)
...[
errorWidget
(
context
,
"Please Select Source First"
,
),
]
else
...[
...
provider
.
referencesList
.
map
((
reference
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
)),
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
reference
.
name
!,
style:
const
TextStyle
(
...
...
@@ -1286,7 +1323,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
),
value:
provider
.
selectedReference
==
provider
.
selectedReference
==
reference
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
...
...
@@ -1297,30 +1335,48 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
reference
.
id
!;
provider
.
selectedReferenceValue
=
reference
.
name
!;
}
else
{
provider
.
referencesList
.
clear
();
provider
.
selectedReferenceId
=
null
;
provider
.
selectedReferenceValue
=
null
;
}
});
},
contentPadding:
EdgeInsets
.
zero
,
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
]
else
if
(
selectedIndex
==
7
)
...[
]
,
]
else
if
(
selectedIndex
==
6
)
...[
...
provider
.
teamsList
.
map
((
team
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
activeColor:
AppColors
.
app_blue
,
title:
Text
(
team
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
)),
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
value:
provider
.
selectedTeam
==
team
,
provider
.
selectedTeam
==
team
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
...
...
@@ -1330,32 +1386,62 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
team
.
id
!;
provider
.
selectedTeamValue
=
team
.
name
!;
}
else
{
provider
.
selectedTeamId
=
null
;
provider
.
selectedTeamValue
=
null
;
if
(
provider
.
selectedSegment
!=
null
)
{
provider
.
segmentsList
.
clear
();
provider
.
selectedSegmentId
=
null
;
provider
.
selectedSegmentValue
=
null
;
}
}
provider
.
crmLeadListSegmentOnTeamAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedTeamId
,
provider
.
selectedTeamId
,
);
});
},
contentPadding:
EdgeInsets
.
zero
,
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
8
)
...[
if
(
provider
.
segmentsList
.
isEmpty
)...[
errorWidget
(
context
,
"Please Select Team ID First"
),
]
else
...[
]
else
if
(
selectedIndex
==
7
)
...[
if
(
provider
.
segmentsList
.
isEmpty
)
...[
errorWidget
(
context
,
"Please Select Team ID First"
,
),
]
else
...[
...
provider
.
segmentsList
.
map
((
segment
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
)),
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
segment
.
name
!,
style:
const
TextStyle
(
...
...
@@ -1363,7 +1449,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
),
value:
provider
.
selectedSegment
==
provider
.
selectedSegment
==
segment
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
...
...
@@ -1374,25 +1461,40 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
segment
.
id
!;
provider
.
selectedSegmentValue
=
segment
.
name
!;
}
else
{
provider
.
segmentsList
.
clear
();
provider
.
selectedSegmentId
=
null
;
provider
.
selectedSegmentValue
=
null
;
}
});
},
contentPadding:
EdgeInsets
.
zero
,
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
],
]
else
if
(
widget
.
mode
!=
"executive"
)
...[
]
else
if
(
widget
.
mode
!=
"executive"
)
...[
...
provider
.
employeesList
.
map
((
employee
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
)
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
employee
.
name
!,
...
...
@@ -1401,7 +1503,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
),
value:
provider
.
selectedEmployee
==
provider
.
selectedEmployee
==
employee
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
...
...
@@ -1422,7 +1525,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
);
});
},
contentPadding:
EdgeInsets
.
zero
,
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
...
...
@@ -1486,4 +1590,647 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
},
);
}
Future
<
void
>
_showFilterSheetNew
(
BuildContext
context
)
{
List
<
bool
>
isSelected
=
List
.
generate
(
9
,
(
index
)
=>
index
==
0
?
true
:
false
,
);
return
showModalBottomSheet
(
useSafeArea:
true
,
isDismissible:
true
,
isScrollControlled:
true
,
showDragHandle:
true
,
backgroundColor:
Colors
.
white
,
enableDrag:
true
,
context:
context
,
builder:
(
context
)
{
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
return
SafeArea
(
child:
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
child:
Consumer
<
Leadlistprovider
>(
builder:
(
context
,
provider
,
child
)
{
int
selectedIndex
=
isSelected
.
indexWhere
(
(
element
)
=>
element
==
true
,
);
final
headings
=
[
"Lead Status"
,
"Open/Close Status"
,
"Mobile Number"
,
"Company Name"
,
"Source"
,
"Reference"
,
"Team"
,
"Segment"
,
];
if
(
widget
.
mode
!=
"executive"
)
{
headings
.
add
(
"Employee"
);
}
return
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.7
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
EdgeInsets
.
only
(
left:
15
),
child:
Text
(
"Filter"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
18
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
const
SizedBox
(
height:
20
),
Expanded
(
child:
Container
(
decoration:
BoxDecoration
(
border:
Border
(
top:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
),
),
bottom:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
),
),
),
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
3
,
child:
Column
(
children:
List
.
generate
(
headings
.
length
,
(
jj
,
)
{
return
Expanded
(
child:
InkResponse
(
onTap:
()
{
setState
(()
{
isSelected
=
List
.
generate
(
headings
.
length
,
(
index
)
=>
false
,
);
isSelected
[
jj
]
=
true
;
});
},
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
7.5
,
horizontal:
10
,
),
decoration:
BoxDecoration
(
border:
Border
(
left:
isSelected
[
jj
]
?
BorderSide
(
color:
AppColors
.
app_blue
,
width:
5.0
,
)
:
const
BorderSide
(
color:
Colors
.
transparent
,
),
bottom:
jj
==
headings
.
length
-
1
?
const
BorderSide
(
color:
Colors
.
transparent
,
)
:
const
BorderSide
(
color:
Color
(
0xFFA5DAF9
,
),
),
),
color:
const
Color
(
0xFFE6F6FF
),
),
child:
Row
(
children:
[
Expanded
(
child:
Text
(
headings
[
jj
],
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaRegular"
,
color:
AppColors
.
semi_black
,
),
),
),
if
(
_isFilterSelected
(
provider
,
jj
))...[
Container
(
margin:
EdgeInsets
.
only
(
left:
5
),
width:
8
,
height:
8
,
decoration:
BoxDecoration
(
color:
Colors
.
green
,
shape:
BoxShape
.
circle
,
),
),
]
],
),
),
),
);
}),
),
),
Expanded
(
flex:
5
,
child:
SingleChildScrollView
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
if
(
selectedIndex
==
0
)
...[
...
provider
.
leadStatusList
.
map
((
status
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
status
??
'Unknown Status'
,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedLeadStatus
==
status
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
provider
.
selectedLeadStatus
=
value
==
true
?
status
:
null
;
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
1
)
...[
...
provider
.
openStatusList
.
map
((
status
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
status
??
'Unknown Status'
,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedOpenStatus
==
status
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
provider
.
selectedOpenStatus
=
value
==
true
?
status
:
null
;
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
2
)
...[
textControllerWidget
(
context
,
provider
.
mobileNumberController
,
"Mobile Number"
,
"Enter Mobile Number"
,
provider
.
onChangedMobileNum
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
),
]
else
if
(
selectedIndex
==
3
)
...[
textControllerWidget
(
context
,
provider
.
companyNameController
,
"Company Name"
,
"Enter Company Name"
,
provider
.
onChangedCompanyName
,
TextInputType
.
text
,
false
,
null
,
),
]
else
if
(
selectedIndex
==
4
)
...[
if
(
provider
.
sourcesList
.
isEmpty
)
errorWidget
(
context
,
"No Sources Available"
,
)
else
...
provider
.
sourcesList
.
map
((
source
,
)
{
if
(
source
==
null
||
source
.
id
==
null
||
source
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
source
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedSource
==
source
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedSource
=
source
;
}
else
{
provider
.
selectedSource
=
null
;
provider
.
referencesList
.
clear
();
provider
.
selectedReference
=
null
;
provider
.
selectedReferenceId
=
null
;
provider
.
selectedReferenceValue
=
null
;
}
provider
.
crmLeadListSourceOnReferenceAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedSourceId
,
);
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
5
)
...[
if
(
provider
.
referencesList
.
isEmpty
)
...[
errorWidget
(
context
,
"Please Select Source First"
,
),
]
else
...[
...
provider
.
referencesList
.
map
((
reference
,
)
{
if
(
reference
==
null
||
reference
.
id
==
null
||
reference
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
reference
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedReference
==
reference
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
provider
.
selectedReference
=
value
==
true
?
reference
:
null
;
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
],
]
else
if
(
selectedIndex
==
6
)
...[
if
(
provider
.
teamsList
.
isEmpty
)
errorWidget
(
context
,
"No Teams Available"
,
)
else
...
provider
.
teamsList
.
map
((
team
)
{
if
(
team
==
null
||
team
.
id
==
null
||
team
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
team
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedTeam
==
team
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedTeam
=
team
;
}
else
{
provider
.
selectedTeam
=
null
;
provider
.
segmentsList
.
clear
();
provider
.
selectedSegment
=
null
;
provider
.
selectedSegmentId
=
null
;
provider
.
selectedSegmentValue
=
null
;
}
provider
.
crmLeadListSegmentOnTeamAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedTeamId
,
);
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
7
)
...[
if
(
provider
.
segmentsList
.
isEmpty
)
...[
errorWidget
(
context
,
"Please Select Team First"
,
),
]
else
...[
...
provider
.
segmentsList
.
map
((
segment
,
)
{
if
(
segment
==
null
||
segment
.
id
==
null
||
segment
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
segment
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedSegment
==
segment
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
provider
.
selectedSegment
=
value
==
true
?
segment
:
null
;
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
],
]
else
if
(
widget
.
mode
!=
"executive"
)
...[
if
(
provider
.
employeesList
.
isEmpty
)
errorWidget
(
context
,
"No Employees Available"
,
)
else
...
provider
.
employeesList
.
map
((
employee
,
)
{
if
(
employee
==
null
||
employee
.
id
==
null
||
employee
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
employee
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedEmployee
==
employee
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
provider
.
selectedEmployee
=
value
==
true
?
employee
:
null
;
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
],
],
),
),
),
],
),
),
),
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
20
,
),
child:
InkResponse
(
onTap:
()
{
provider
.
crmLeadListAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedLeadStatus
,
provider
.
selectedOpenStatus
,
provider
.
selectedSourceId
,
provider
.
selectedReferenceId
,
provider
.
selectedTeamId
,
provider
.
selectedSegmentId
,
provider
.
selectedAlphabet
,
);
Navigator
.
pop
(
context
);
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
const
Text
(
"Search"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
),
],
),
);
},
),
),
);
},
);
},
);
}
bool
_isFilterSelected
(
Leadlistprovider
provider
,
int
index
)
{
switch
(
index
)
{
case
0
:
return
provider
.
selectedLeadStatus
!=
null
;
case
1
:
return
provider
.
selectedOpenStatus
!=
null
;
case
2
:
return
provider
.
mobileNumberController
.
text
.
isNotEmpty
;
case
3
:
return
provider
.
companyNameController
.
text
.
isNotEmpty
;
case
4
:
return
provider
.
selectedSource
!=
null
;
case
5
:
return
provider
.
selectedReference
!=
null
;
case
6
:
return
provider
.
selectedTeam
!=
null
;
case
7
:
return
provider
.
selectedSegment
!=
null
;
case
8
:
return
provider
.
selectedEmployee
!=
null
;
default
:
return
false
;
}
}
}
lib/screens/crm/NearbyOpenLeads.dart
View file @
29665037
// import 'dart:io';
//
// import 'package:connectivity_plus/connectivity_plus.dart';
// import 'package:dropdown_button2/dropdown_button2.dart';
// import 'package:flutter/foundation.dart';
// import 'package:flutter/gestures.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_svg/svg.dart';
// import 'package:generp/Notifiers/NearByGeneratorsProvider.dart';
// import 'package:generp/Utils/app_colors.dart';
// import 'package:generp/Utils/commonServices.dart';
// import 'package:generp/Utils/commonWidgets.dart';
// import 'package:google_maps_flutter/google_maps_flutter.dart';
// import 'package:interactive_slider/interactive_slider.dart';
// import 'package:provider/provider.dart';
//
// import '../../Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart';
// import '../../Utils/dropdownTheme.dart';
//
// class NearbyOpenLeads extends StatefulWidget {
// final latitude;
// final longitude;
// const NearbyOpenLeads({super.key, this.latitude, this.longitude});
//
// @override
// State<NearbyOpenLeads> createState() => _NearbyOpenLeadsState();
// }
//
// class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
// Map _source = {ConnectivityResult.mobile: true};
// final MyConnectivity _connectivity = MyConnectivity.instance;
//
// Dropdowntheme ddtheme = Dropdowntheme();
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// _connectivity.initialise();
// _connectivity.myStream.listen((source) {
// setState(() => _source = source);
// });
// WidgetsBinding.instance.addPostFrameCallback((_) {
// final provider = Provider.of<crmNearbyOpenLeadsProvider>(
// context,
// listen: false,
// );
// provider.getLocationPermission(context);
// });
// }
//
// @override
// void dispose() {
// // TODO: implement dispose
// super.dispose();
// _connectivity.disposeStream();
// }
//
// @override
// Widget build(BuildContext context) {
// switch (_source.keys.toList()[0]) {
// case ConnectivityResult.mobile:
// connection = 'Online';
// break;
// case ConnectivityResult.wifi:
// connection = 'Online';
// break;
// case ConnectivityResult.none:
// default:
// connection = 'Offline';
// }
// return (connection == "Online")
// ? Platform.isAndroid
// ? WillPopScope(
// onWillPop: () => onBackPressed(context),
// child: SafeArea(
// top: false,
// bottom: true,
// child: _scaffold(context),
// ),
// )
// : _scaffold(context)
// : NoNetwork(context);
// }
//
// Widget _scaffold(BuildContext context) {
// debugPrint("Nearbygenerators widget rebuilt");
// return Consumer<crmNearbyOpenLeadsProvider>(
// builder: (context, provider, child) {
// var sendWidget = GestureDetector(
// onTap: () {
// _showFilterBottomSheet(context);
// },
// child: SvgPicture.asset("assets/svg/filter_ic.svg", height: 25),
// );
//
// return Scaffold(
// resizeToAvoidBottomInset: true,
// appBar: appbar2(
// context,
// "Nearby Leads (Open)",
// provider.resetAll,
// sendWidget,
// ),
// backgroundColor: AppColors.scaffold_bg_color,
// body: SafeArea(
// child: Container(
// child: SingleChildScrollView(
// child: Column(
// children: [
// ClipRRect(
// // Apply border radius using ClipRRect
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(30.0),
// topRight: Radius.circular(30.0),
// ),
// // padding: EdgeInsets.fromLTRB(10, 20, 10, 20),
// child: Container(
// height: MediaQuery.of(context).size.height,
// child: Stack(
// children: [
// GoogleMap(
// myLocationEnabled: true,
// zoomGesturesEnabled: true,
// zoomControlsEnabled: true,
// gestureRecognizers: {
//
// Factory<OneSequenceGestureRecognizer>(
// () => EagerGestureRecognizer(),
// ),
// Factory<PanGestureRecognizer>(
// () => PanGestureRecognizer(),
// ),
// Factory<ScaleGestureRecognizer>(
// () => ScaleGestureRecognizer(),
// ), // Prioritize pinch-to-zoom
// },
// initialCameraPosition: CameraPosition(
// target: widget.latitude!=null||widget.longitude!=null?
// LatLng(widget.latitude,widget.longitude):
// provider.startLocation,
// zoom: 14.0,
// ),
// markers: provider.markers.toSet(),
// mapType: MapType.normal,
// onMapCreated: (controller) {
// setState(() {
// provider.mapController = controller;
// });
// },
// onCameraMove: (position) {
// provider.onCameraMove(context, position);
// },
// ),
// ],
// ),
// ),
// ),
// ],
// ),
// ),
// ),
// ),
// );
// },
// );
// }
//
// Future<void> _showFilterBottomSheet(BuildContext context) {
// return showModalBottomSheet(
// useSafeArea: true,
// isDismissible: true,
// isScrollControlled: true,
// showDragHandle: true,
//
// enableDrag: true,
// context: context,
// builder: (context) {
// return StatefulBuilder(
// builder: (context, setState) {
// return SafeArea(
// child: Consumer<crmNearbyOpenLeadsProvider>(
// builder: (context, provider, child) {
// return Container(
// margin: EdgeInsets.only(
// bottom: 15,
// left: 15,
// right: 15,
// top: 15,
// ),
// padding: EdgeInsets.only(
// bottom: MediaQuery.of(context).viewInsets.bottom,
// ),
//
// child: SingleChildScrollView(
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "Filter",
// style: TextStyle(
// color: AppColors.app_blue,
// fontFamily: "JakartaSemiBold",
// fontSize: 16,
// ),
// ),
// SizedBox(height: 15),
//
// Row(
// children: [
// Text(
// "Radius",
// style: TextStyle(
// fontSize: 18.0,
// fontWeight: FontWeight.w500,
// ),
// ),
// Spacer(),
// Text(
// '${provider.currentValue.toStringAsFixed(2)} KM',
// style: TextStyle(
// fontSize: 18.0,
// fontWeight: FontWeight.w500,
// ),
// ),
// ],
// ),
// InteractiveSlider(
// min: 0.0,
// max: 50.0,
// padding: EdgeInsets.symmetric(
// horizontal: 0,
// vertical: 0,
// ),
// iconSize: 0.0,
// enabled: true,
// // backgroundColor: AppColors.app_blue,
// foregroundColor: AppColors.app_blue,
// segmentDividerColor: Color(0xFFF6F6F8),
// onChanged: (value) {
// provider.currentValue = value;
// // provider.debounce(() {
// // provider.LoadNearbyOpenLeadsAPI(context);
// // }, Duration(milliseconds: 200));
// },
// ),
// // Slider(
// // value: provider.currentValue,
// // max: 100,
// // divisions: 100,
// //
// // label: provider.currentValue.toStringAsFixed(2),
// // inactiveColor: Color(0xFFD7D7D7),
// // activeColor: AppColors.cyan_blue,
// // onChanged: (value) {
// // provider.currentValue = value;
// // provider.debounce(() {
// // provider.LoadNearbyOpenLeadsAPI(context);
// // }, Duration(milliseconds: 200));
// // },
// // ),
// SizedBox(height: 30.0),
// Container(
// child: InkWell(
// onTap: () {
// provider.debounce(() {
// provider.LoadNearbyOpenLeadsAPI(
// context,
// provider.currentValue,
// );
// Navigator.pop(context);
// }, Duration(milliseconds: 500));
// },
// child: Container(
// alignment: Alignment.center,
// height: 45,
// margin: EdgeInsets.only(
// left: 15.0,
// right: 15.0,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(14.0),
// color: AppColors.app_blue,
// ),
// child: Text(
// "Search",
// textAlign: TextAlign.center,
// style: TextStyle(
// fontFamily: 'JakartaMedium',
// color: Colors.white,
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// ],
// ),
// ),
// );
// },
// ),
// );
// },
// );
// },
// );
// }
// }
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -18,8 +330,8 @@ import '../../Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart';
import
'../../Utils/dropdownTheme.dart'
;
class
NearbyOpenLeads
extends
StatefulWidget
{
final
latitude
;
final
longitude
;
final
double
?
latitude
;
final
double
?
longitude
;
const
NearbyOpenLeads
({
super
.
key
,
this
.
latitude
,
this
.
longitude
});
@override
...
...
@@ -31,9 +343,9 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
Dropdowntheme
ddtheme
=
Dropdowntheme
();
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
...
...
@@ -50,13 +362,13 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
String
connection
;
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
...
...
@@ -75,17 +387,37 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_
scaffold
(
context
),
child:
_
buildScreen
(
context
),
),
)
:
_scaffold
(
context
)
:
_buildScreen
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
debugPrint
(
"Nearbygenerators widget rebuilt"
);
Widget
_buildScreen
(
BuildContext
context
)
{
return
Consumer
<
crmNearbyOpenLeadsProvider
>(
builder:
(
context
,
provider
,
child
)
{
// {
// return Scaffold(
// backgroundColor: AppColors.scaffold_bg_color,
// body: Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// CircularProgressIndicator(color: AppColors.app_blue),
// SizedBox(height: 16),
// Text(
// 'Loading nearby leads...',
// style: TextStyle(fontSize: 16, color: AppColors.app_blue),
// ),
// ],
// ),
// ),
// );
// }
// Full UI when markers are loaded or filter is applied
var
sendWidget
=
GestureDetector
(
onTap:
()
{
_showFilterBottomSheet
(
context
);
...
...
@@ -103,17 +435,17 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SafeArea
(
child:
Container
(
child:
Stack
(
children:
[
Container
(
child:
SingleChildScrollView
(
child:
Column
(
children:
[
ClipRRect
(
// Apply border radius using ClipRRect
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
30.0
),
topRight:
Radius
.
circular
(
30.0
),
),
// padding: EdgeInsets.fromLTRB(10, 20, 10, 20),
child:
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
child:
Stack
(
...
...
@@ -123,7 +455,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
zoomGesturesEnabled:
true
,
zoomControlsEnabled:
true
,
gestureRecognizers:
{
Factory
<
OneSequenceGestureRecognizer
>(
()
=>
EagerGestureRecognizer
(),
),
...
...
@@ -132,24 +463,29 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
),
Factory
<
ScaleGestureRecognizer
>(
()
=>
ScaleGestureRecognizer
(),
),
// Prioritize pinch-to-zoom
),
},
initialCameraPosition:
CameraPosition
(
target:
widget
.
latitude
!=
null
||
widget
.
longitude
!=
null
?
LatLng
(
widget
.
latitude
,
widget
.
longitude
)
:
provider
.
startLocation
,
target:
widget
.
latitude
!=
null
&&
widget
.
longitude
!=
null
?
LatLng
(
widget
.
latitude
!,
widget
.
longitude
!
)
:
provider
.
startLocation
,
zoom:
14.0
,
),
markers:
provider
.
markers
.
toSet
(),
mapType:
MapType
.
normal
,
onMapCreated:
(
controller
)
{
setState
(()
{
provider
.
mapController
=
controller
;
});
},
onCameraMove:
(
position
)
{
provider
.
onCameraMove
(
context
,
position
);
},
onTap:
(
position
)
{
provider
.
mapController
?.
hideMarkerInfoWindow
(
provider
.
markers
.
isNotEmpty
?
provider
.
markers
.
first
.
markerId
:
MarkerId
(
''
),
);
},
),
],
),
...
...
@@ -159,6 +495,26 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
),
),
),
if
(
provider
.
isLoading
||
(
provider
.
markers
.
isEmpty
))...[
Container
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
height:
MediaQuery
.
of
(
context
).
size
.
height
,
color:
Colors
.
white38
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
CircularProgressIndicator
(
color:
AppColors
.
app_blue
),
SizedBox
(
height:
16
),
Text
(
'Loading nearby leads...'
,
style:
TextStyle
(
fontSize:
16
,
color:
AppColors
.
app_blue
),
),
],
),
)
]
],
),
),
);
},
...
...
@@ -171,7 +527,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
isDismissible:
true
,
isScrollControlled:
true
,
showDragHandle:
true
,
enableDrag:
true
,
context:
context
,
builder:
(
context
)
{
...
...
@@ -190,7 +545,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
child:
SingleChildScrollView
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
...
...
@@ -207,7 +561,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
),
),
SizedBox
(
height:
15
),
Row
(
children:
[
Text
(
...
...
@@ -228,52 +581,29 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
],
),
InteractiveSlider
(
min:
1
.0
,
min:
0
.0
,
max:
50.0
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
0
,
vertical:
0
,
),
iconSize:
0.0
,
initialProgress:
provider
.
currentValue
/
50
,
enabled:
true
,
// backgroundColor: AppColors.app_blue,
foregroundColor:
AppColors
.
app_blue
,
segmentDividerColor:
Color
(
0xFFF6F6F8
),
onChanged:
(
value
)
{
setState
(()
{
provider
.
currentValue
=
value
;
// provider.debounce(() {
// provider.LoadNearbyOpenLeadsAPI(context);
// }, Duration(milliseconds: 200));
});
},
),
// Slider(
// value: provider.currentValue,
// max: 100,
// divisions: 100,
//
// label: provider.currentValue.toStringAsFixed(2),
// inactiveColor: Color(0xFFD7D7D7),
// activeColor: AppColors.cyan_blue,
// onChanged: (value) {
// provider.currentValue = value;
// provider.debounce(() {
// provider.LoadNearbyOpenLeadsAPI(context);
// }, Duration(milliseconds: 200));
// },
// ),
SizedBox
(
height:
30.0
),
Container
(
child:
InkWell
(
onTap:
()
{
provider
.
debounce
(()
{
provider
.
LoadNearbyOpenLeadsAPI
(
context
,
provider
.
currentValue
,
);
provider
.
applyFilter
(
context
,
provider
.
currentValue
);
Navigator
.
pop
(
context
);
},
Duration
(
milliseconds:
500
));
},
child:
Container
(
alignment:
Alignment
.
center
,
...
...
lib/screens/crm/ProspectDetailsByMode.dart
View file @
29665037
...
...
@@ -15,6 +15,7 @@ import 'package:generp/screens/crm/prospectLeadDetails.dart';
import
'package:generp/screens/crm/prospectOrderDetails.dart'
;
import
'package:generp/screens/crm/prospectPaymentDetails.dart'
;
import
'package:provider/provider.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
import
'../../Models/crmModels/GetDistrictOnStateResponse.dart'
;
import
'../../Models/crmModels/GetSubLocOnDistrictResponse.dart'
;
import
'../../Models/crmModels/LeadListViewResponse.dart'
show
Employees
;
...
...
@@ -333,7 +334,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
// ),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Column
(
body:
SingleChildScrollView
(
child:
Column
(
children:
[
Card
(
shape:
RoundedRectangleBorder
(
...
...
@@ -346,10 +348,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
child:
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8
),
child:
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
),
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
...
...
@@ -759,10 +758,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
],
),
),
Expanded
(
child:
SingleChildScrollView
(
physics:
AlwaysScrollableScrollPhysics
(),
child:
Column
(
Column
(
children:
[
///Lead Details
Container
(
...
...
@@ -796,6 +792,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
);
_showAddLeadsSheet
(
context
,
widget
.
mode
);
},
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
textAlign:
TextAlign
.
right
,
"+ Add Lead"
,
...
...
@@ -807,6 +805,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
),
],
],
),
...
...
@@ -814,16 +813,41 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
if
(
leadListNotEmpty
)
...[
SizedBox
(
width:
double
.
infinity
,
height:
2
5
0
,
height:
2
1
0
,
child:
ListView
.
builder
(
itemCount:
leadsList
.
length
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
scrollDirection:
Axis
.
horizontal
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
height:
250
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.95
,
return
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
LeadDetailsByMode
(
mode:
""
,
pageTitleName:
"Lead Details"
,
leadId:
widget
.
leadId
,
),
),
);
if
(
res
==
true
)
{
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadId
,
);
}
},
child:
Container
(
height:
210
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.9
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
...
...
@@ -886,7 +910,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
SizedBox
(
width:
10
),
Expanded
(
flex:
2
,
flex:
4
,
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
...
...
@@ -1013,14 +1037,12 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
],
),
),
...
List
.
generate
(
2
,
(
j
)
{
...
List
.
generate
(
1
,
(
j
)
{
final
textheads
=
[
"Lead Open / Close"
,
"View Details"
,
];
final
textSubheads
=
[
leadsList
[
index
].
openStatus
??
"-"
,
"View"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
...
...
@@ -1041,52 +1063,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
if
(
textSubheads
[
j
]
==
"View"
)
...[
Expanded
(
child:
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
LeadDetailsByMode
(
mode:
""
,
pageTitleName:
"Lead Details"
,
leadId:
widget
.
leadId
,
),
),
);
if
(
res
==
true
)
{
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadId
,
);
}
},
child:
Text
(
textAlign:
TextAlign
.
right
,
textSubheads
[
j
]
==
""
?
"-"
:
textSubheads
[
j
],
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
decorationColor:
AppColors
.
app_blue
,
decoration:
TextDecoration
.
underline
,
),
),
),
),
]
else
...[
Expanded
(
child:
Text
(
textAlign:
TextAlign
.
right
,
...
...
@@ -1099,13 +1076,14 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
],
],
),
);
}),
],
),
),
);
},
),
...
...
@@ -1170,6 +1148,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider
.
accountDetails
.
id
!,
);
},
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
textAlign:
TextAlign
.
right
,
"+ Add Contact"
,
...
...
@@ -1181,6 +1161,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
),
],
],
),
...
...
@@ -1267,10 +1248,20 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
Expanded
(
flex:
2
,
child:
InkResponse
(
onTap:
()
{
launch
(
'tel://
${provider.contactList[lp].mob1}
'
,
);
},
child:
Text
(
textAlign:
TextAlign
.
right
,
"
${provider.contactList[lp].mob1 ?? "-"}
"
,
style:
TextStyle
(
height:
1
,
decorationColor:
AppColors
.
grey_thick
,
decoration:
TextDecoration
.
underline
,
decorationStyle:
TextDecorationStyle
.
dotted
,
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
...
...
@@ -1279,6 +1270,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
),
],
),
Text
(
...
...
@@ -1377,7 +1369,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
itemBuilder:
(
context
,
index
)
{
return
Container
(
height:
250
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.9
5
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.9
,
margin:
EdgeInsets
.
symmetric
(
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
...
...
@@ -1668,22 +1660,48 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
SizedBox
(
width:
double
.
infinity
,
height:
2
5
0
,
height:
2
0
0
,
child:
ListView
.
builder
(
itemCount:
paymentList
.
length
,
shrinkWrap:
true
,
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
,
horizontal:
5
,
),
physics:
AlwaysScrollableScrollPhysics
(),
scrollDirection:
Axis
.
horizontal
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
height:
250
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.95
,
return
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
Paymentdetailsbymode
(
mode:
""
,
pageTitleName:
"Payment Details"
,
paymentId:
paymentList
[
index
]
.
id
,
),
),
);
if
(
res
==
true
)
{
provider
.
crmProspectDetailsAPIFunction
(
context
,
paymentList
[
index
].
id
,
);
}
},
child:
Container
(
height:
200
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.9
,
margin:
EdgeInsets
.
symmetric
(
vertical:
5
),
margin:
EdgeInsets
.
symmetric
(
vertical:
5
,
horizontal:
7.
5
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
,
...
...
@@ -1844,108 +1862,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
);
}),
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
3
,
),
child:
Row
(
children:
[
Expanded
(
flex:
3
,
child:
Text
(
"Others"
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
Expanded
(
flex:
6
,
child:
DottedLine
(
dashGapLength:
4
,
dashGapColor:
Colors
.
white
,
dashColor:
AppColors
.
grey_semi
,
dashLength:
2
,
lineThickness:
0.5
,
),
),
],
),
),
...
List
.
generate
(
1
,
(
j
)
{
final
textheads
=
[
"Action"
];
final
textSubheads
=
[
"View Details"
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
3
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
textAlign:
TextAlign
.
left
,
textheads
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
Paymentdetailsbymode
(
mode:
""
,
pageTitleName:
"Payment Details"
,
paymentId:
paymentList
[
index
]
.
id
,
),
),
);
if
(
res
==
true
)
{
provider
.
crmProspectDetailsAPIFunction
(
context
,
paymentList
[
index
].
id
,
);
}
},
child:
Text
(
textAlign:
TextAlign
.
right
,
textSubheads
[
j
]
==
""
?
"-"
:
textSubheads
[
j
],
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
decorationColor:
AppColors
.
app_blue
,
decoration:
TextDecoration
.
underline
,
),
),
),
),
],
),
);
}),
],
),
);
},
),
...
...
@@ -1954,10 +1875,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
SizedBox
(
height:
75
),
],
),
),
),
],
),
),
);
},
);
...
...
@@ -2150,7 +2070,25 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
},
);
},
).
whenComplete
(()
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
crmProspectDetailsProvider
>(
context
,
listen:
false
,
);
final
editProvider
=
Provider
.
of
<
Crmeditprospectaccountprovider
>(
context
,
listen:
false
,
);
editProvider
.
crmLeadListViewAPIFunction
(
context
,
widget
.
mode
);
editProvider
.
crmProspectDetailsEditAccountViewAPIFunction
(
context
,
widget
.
leadId
,
);
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadId
);
});
},);
}
Future
<
void
>
_showEditContactSheet
(
BuildContext
context
,
index
,
accid
)
{
...
...
@@ -2343,7 +2281,25 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
},
);
},
).
whenComplete
(()
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
crmProspectDetailsProvider
>(
context
,
listen:
false
,
);
final
editProvider
=
Provider
.
of
<
Crmeditprospectaccountprovider
>(
context
,
listen:
false
,
);
editProvider
.
crmLeadListViewAPIFunction
(
context
,
widget
.
mode
);
editProvider
.
crmProspectDetailsEditAccountViewAPIFunction
(
context
,
widget
.
leadId
,
);
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadId
);
});
},);
}
Future
<
void
>
_showTransferAccountSheet
(
BuildContext
context
,
accID
)
{
...
...
@@ -2540,7 +2496,25 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
},
);
},
).
whenComplete
(()
{});
).
whenComplete
(()
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
crmProspectDetailsProvider
>(
context
,
listen:
false
,
);
final
editProvider
=
Provider
.
of
<
Crmeditprospectaccountprovider
>(
context
,
listen:
false
,
);
editProvider
.
crmLeadListViewAPIFunction
(
context
,
widget
.
mode
);
editProvider
.
crmProspectDetailsEditAccountViewAPIFunction
(
context
,
widget
.
leadId
,
);
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadId
);
});
},);
}
Future
<
void
>
_showEditAccountSheet
(
BuildContext
context
,
accID
)
{
...
...
@@ -2935,7 +2909,25 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
},
);
},
).
whenComplete
(()
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
crmProspectDetailsProvider
>(
context
,
listen:
false
,
);
final
editProvider
=
Provider
.
of
<
Crmeditprospectaccountprovider
>(
context
,
listen:
false
,
);
editProvider
.
crmLeadListViewAPIFunction
(
context
,
widget
.
mode
);
editProvider
.
crmProspectDetailsEditAccountViewAPIFunction
(
context
,
widget
.
leadId
,
);
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadId
);
});
},);
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
)
{
...
...
@@ -3251,7 +3243,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
)
=>
DropdownMenuItem
<
Products
>(
value:
ord
,
child:
Text
(
"
(Product Name:
${ord.name}
)
"
,
"
${ord.name}
"
,
style:
const
TextStyle
(
fontSize:
14
,
),
...
...
lib/screens/crm/addLeadProductScreen.dart
View file @
29665037
...
...
@@ -135,7 +135,7 @@ class _AddleadproductscreenState extends State<Addleadproductscreen> {
(
ord
)
=>
DropdownMenuItem
<
Products
>(
value:
ord
,
child:
Text
(
"
(Product Name:
${ord.name}
)
"
,
"
${ord.name}
"
,
style:
const
TextStyle
(
fontSize:
14
,
),
...
...
lib/screens/crm/addLeadsProspectsScreen.dart
View file @
29665037
...
...
@@ -7,6 +7,7 @@ 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/commonServices.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:generp/Utils/dropdownTheme.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -597,6 +598,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
InkResponse
(
onTap:
()
async
{
...
...
@@ -833,6 +835,10 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
),
),
],
if
(
provider
.
productsEmptyError
!.
trim
().
isNotEmpty
)...[
errorWidget
(
context
,
provider
.
productsEmptyError
)
]
],
),
),
...
...
@@ -1233,6 +1239,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
InkResponse
(
onTap:
()
{
if
(
provider
.
validateStep3
())
{
if
(
provider
.
productRows
.
isNotEmpty
){
provider
.
crmAddNewLeadsAndProspectsAPIFunction
(
context
,
""
,
...
...
@@ -1248,6 +1255,10 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
provider
.
selectedLeadStatus
,
provider
.
getJsonEncodedProducts
(),
);
}
else
{
toast
(
context
,
"Add min. 1 product"
);
}
}
details
.
onStepContinue
;
...
...
lib/screens/crm/addProspectLeads.dart
View file @
29665037
...
...
@@ -252,7 +252,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> {
>(
value:
ord
,
child:
Text
(
"
(Product Name:
${ord.name}
)
"
,
"
${ord.name}
"
,
style:
const
TextStyle
(
fontSize:
14
,
),
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment