Commit 29665037 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

30-07-2025 By Sai Srinivas

CRM Module
parent 56ca3566
<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
<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>
// 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/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:generp/Models/crmModels/GetSegmentOnTeamResponse.dart'; import 'package:generp/Models/crmModels/GetSegmentOnTeamResponse.dart';
...@@ -15,9 +636,7 @@ import '../HomeScreenNotifier.dart'; ...@@ -15,9 +636,7 @@ import '../HomeScreenNotifier.dart';
class Leadlistprovider extends ChangeNotifier { class Leadlistprovider extends ChangeNotifier {
TextEditingController sLeadIDController = TextEditingController(); TextEditingController sLeadIDController = TextEditingController();
TextEditingController mobileNumberController = TextEditingController(); TextEditingController mobileNumberController = TextEditingController();
TextEditingController companyNameController = TextEditingController( TextEditingController companyNameController = TextEditingController();
text: "a",
);
bool _isLoading = true; bool _isLoading = true;
...@@ -35,7 +654,6 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -35,7 +654,6 @@ class Leadlistprovider extends ChangeNotifier {
List<String?> _openStatusList = []; List<String?> _openStatusList = [];
List<String?> _alphabetList = []; List<String?> _alphabetList = [];
Sources? _selectedSources; Sources? _selectedSources;
Teams? _selectedTeams; Teams? _selectedTeams;
States? _selectedStates; States? _selectedStates;
...@@ -169,71 +787,72 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -169,71 +787,72 @@ class Leadlistprovider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
set selectedAlphabet(String? value){ set selectedAlphabet(String? value) {
_selectedAlphabet = value; _selectedAlphabet = value;
notifyListeners(); notifyListeners();
} }
set selectedSource(Sources? value) { set selectedSource(Sources? value) {
_selectedSources = value; _selectedSources = value;
_selectedSourceId = value!.id!; _selectedSourceId = value?.id;
_selectedSourceValue = value!.name!; _selectedSourceValue = value?.name;
print('Setting selectedSource: $value, id: ${_selectedSourceId}, name: ${_selectedSourceValue}');
notifyListeners(); notifyListeners();
} }
set selectedTeam(Teams? value) { set selectedTeam(Teams? value) {
_selectedTeams = value; _selectedTeams = value;
_selectedTeamId = value!.id!; _selectedTeamId = value?.id;
_selectedTeamValue = value.name; _selectedTeamValue = value?.name;
notifyListeners(); notifyListeners();
} }
set selectedStates(States? value) { set selectedStates(States? value) {
_selectedStates = value; _selectedStates = value;
_selectedStateId = value!.id!; _selectedStateId = value?.id;
_selectedStateValue = value.name; _selectedStateValue = value?.name;
notifyListeners(); notifyListeners();
} }
set selectedEmployee(Employees? value) { set selectedEmployee(Employees? value) {
_selectedEmployees = value; _selectedEmployees = value;
_selectedEmployeeId = value!.id!; _selectedEmployeeId = value?.id;
_selectedEmployeeValue = value.name; _selectedEmployeeValue = value?.name;
notifyListeners(); notifyListeners();
} }
set selectedReference(References? value) { set selectedReference(References? value) {
_selectedReferences = value; _selectedReferences = value;
_selectedReferenceId = value!.id!; _selectedReferenceId = value?.id;
_selectedReferenceValue = value.name; _selectedReferenceValue = value?.name;
notifyListeners(); notifyListeners();
} }
set selectedSegment(Segments? value) { set selectedSegment(Segments? value) {
_selectedSegments = value; _selectedSegments = value;
_selectedSegmentId = value!.id!; _selectedSegmentId = value?.id;
_selectedSegmentValue = value.name; _selectedSegmentValue = value?.name;
notifyListeners(); notifyListeners();
} }
set selectedDistricts(Districts? value) { set selectedDistricts(Districts? value) {
_selectedDistricts = value; _selectedDistricts = value;
_selectedDistrictId = value!.id!; _selectedDistrictId = value?.id;
_selectedDistrictValue = value.district; _selectedDistrictValue = value?.district;
notifyListeners(); notifyListeners();
} }
set selectedSubLocations(SubLocations? value) { set selectedSubLocations(SubLocations? value) {
_selectedSubLocations = value; _selectedSubLocations = value;
_selectedSubLocationId = value!.id!; _selectedSubLocationId = value?.id;
_selectedSubLocationValue = value.subLocality; _selectedSubLocationValue = value?.subLocality;
notifyListeners(); notifyListeners();
} }
set selectedContacts(Contacts? value) { set selectedContacts(Contacts? value) {
_selectedContacts = value; _selectedContacts = value;
_selectedContactId = value!.id!; _selectedContactId = value?.id;
_selectedContactValue = value.name; _selectedContactValue = value?.name;
notifyListeners(); notifyListeners();
} }
...@@ -346,9 +965,8 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -346,9 +965,8 @@ class Leadlistprovider extends ChangeNotifier {
mode, mode,
); );
if (data != null) { if (data != null) {
print(data.error); print('crmLeadListViewAPI error: ${data.error}, sources: ${data.sources}');
if (data.error == "0") { if (data.error == "0") {
// print("as");
_leadStatusList = [ _leadStatusList = [
"all", "all",
"Hot", "Hot",
...@@ -358,25 +976,25 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -358,25 +976,25 @@ class Leadlistprovider extends ChangeNotifier {
"Order Lost", "Order Lost",
]; ];
_alphabetList = List.generate(26, (index) => String.fromCharCode(index + 65)); _alphabetList = List.generate(26, (index) => String.fromCharCode(index + 65));
_openStatusList = ["open", "Closed", "All"]; _openStatusList = ["open", "Closed", "All"];
_sourcesList = data.sources!; _sourcesList = data.sources?.where((source) => source != null && source.id != null && source.name != null).toList() ?? [];
_teamsList = data.teams!; _teamsList = data.teams?.where((team) => team != null && team.id != null && team.name != null).toList() ?? [];
_statesList = data.states!; _statesList = data.states?.where((state) => state != null && state.id != null && state.name != null).toList() ?? [];
_employeesList = data.employees!; _employeesList = data.employees?.where((employee) => employee != null && employee.id != null && employee.name != null).toList() ?? [];
checkDropDownValues(); checkDropDownValues();
// print(_leadStatusList);
notifyListeners(); notifyListeners();
} }
} }
} catch (e, s) {} } catch (e, s) {
print('crmLeadListViewAPI error: $e, stack: $s');
}
} }
Future<void> crmLeadListSourceOnReferenceAPIFunction( Future<void> crmLeadListSourceOnReferenceAPIFunction(
context, context,
mode, mode,
sourceID, String? sourceID,
) async { ) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmLeadListSourceOnReferenceAPI( final data = await ApiCalling.crmLeadListSourceOnReferenceAPI(
...@@ -386,18 +1004,23 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -386,18 +1004,23 @@ class Leadlistprovider extends ChangeNotifier {
); );
if (data != null) { if (data != null) {
if (data.error == "0") { 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(); notifyListeners();
} }
} }
} catch (e, s) {} } catch (e, s) {
print('crmLeadListSourceOnReferenceAPI error: $e, stack: $s');
}
} }
Future<void> crmLeadListSegmentOnTeamAPIFunction( Future<void> crmLeadListSegmentOnTeamAPIFunction(
context, context,
mode, mode,
teamID, String? teamID,
) async { ) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmLeadListSegmentOnTeamAPI( final data = await ApiCalling.crmLeadListSegmentOnTeamAPI(
...@@ -407,18 +1030,23 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -407,18 +1030,23 @@ class Leadlistprovider extends ChangeNotifier {
); );
if (data != null) { if (data != null) {
if (data.error == "0") { 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(); notifyListeners();
} }
} }
} catch (e, s) {} } catch (e, s) {
print('crmLeadListSegmentOnTeamAPI error: $e, stack: $s');
}
} }
Future<void> crmLeadListDistrictsOnStateAPIFunction( Future<void> crmLeadListDistrictsOnStateAPIFunction(
context, context,
mode, mode,
stateID, String? stateID,
) async { ) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmDistrictsOnStateAPI( final data = await ApiCalling.crmDistrictsOnStateAPI(
...@@ -428,18 +1056,23 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -428,18 +1056,23 @@ class Leadlistprovider extends ChangeNotifier {
); );
if (data != null) { if (data != null) {
if (data.error == "0") { 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(); notifyListeners();
} }
} }
} catch (e, s) {} } catch (e, s) {
print('crmLeadListDistrictsOnStateAPI error: $e, stack: $s');
}
} }
Future<void> crmLeadListSubLocOnDistrictAPIFunction( Future<void> crmLeadListSubLocOnDistrictAPIFunction(
context, context,
mode, mode,
districtID, String? districtID,
) async { ) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmSubLocOnDistrictAPI( final data = await ApiCalling.crmSubLocOnDistrictAPI(
...@@ -449,18 +1082,23 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -449,18 +1082,23 @@ class Leadlistprovider extends ChangeNotifier {
); );
if (data != null) { if (data != null) {
if (data.error == "0") { 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(); notifyListeners();
} }
} }
} catch (e, s) {} } catch (e, s) {
print('crmLeadListSubLocOnDistrictAPI error: $e, stack: $s');
}
} }
Future<void> crmLeadListContactPopUpAPIFunction( Future<void> crmLeadListContactPopUpAPIFunction(
context, context,
mode, mode,
accountID, String? accountID,
) async { ) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmLeadListContactPopUpAPI( final data = await ApiCalling.crmLeadListContactPopUpAPI(
...@@ -470,24 +1108,29 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -470,24 +1108,29 @@ class Leadlistprovider extends ChangeNotifier {
); );
if (data != null) { if (data != null) {
if (data.error == "0") { 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(); notifyListeners();
} }
} }
} catch (e, s) {} } catch (e, s) {
print('crmLeadListContactPopUpAPI error: $e, stack: $s');
}
} }
Future<void> crmLeadListAPIFunction( Future<void> crmLeadListAPIFunction(
context, context,
mode, String? mode,
leadStatus, String? leadStatus,
openStatus, String? openStatus,
sourceID, String? sourceID,
referenceID, String? referenceID,
teamID, String? teamID,
segmentID, String? segmentID,
alphabet String? alphabet,
) async { ) async {
try { try {
_isLoading = true; _isLoading = true;
_crmLeadList.clear(); _crmLeadList.clear();
...@@ -505,13 +1148,13 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -505,13 +1148,13 @@ class Leadlistprovider extends ChangeNotifier {
referenceID, referenceID,
teamID, teamID,
segmentID, segmentID,
alphabet alphabet,
); );
if (data != null) { if (data != null) {
_isLoading = true; _isLoading = true;
notifyListeners(); notifyListeners();
if (data.error == "0") { if (data.error == "0") {
_crmLeadList = data.leadList!; _crmLeadList = data.leadList?.where((lead) => lead != null).toList() ?? [];
_isLoading = false; _isLoading = false;
checkDropDownValues(); checkDropDownValues();
notifyListeners(); notifyListeners();
...@@ -524,20 +1167,21 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -524,20 +1167,21 @@ class Leadlistprovider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
} catch (e, s) { } catch (e, s) {
print('crmLeadListAPIFunction error: $e, stack: $s');
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
} }
onChangedLeadId(value) { onChangedLeadId(String? value) {
notifyListeners(); notifyListeners();
} }
onChangedMobileNum(value) { onChangedMobileNum(String? value) {
notifyListeners(); notifyListeners();
} }
onChangedCompanyName(value) { onChangedCompanyName(String? value) {
notifyListeners(); notifyListeners();
} }
...@@ -546,7 +1190,7 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -546,7 +1190,7 @@ class Leadlistprovider extends ChangeNotifier {
sLeadIDController.clear(); sLeadIDController.clear();
mobileNumberController.clear(); mobileNumberController.clear();
companyNameController.clear(); companyNameController.clear();
companyNameController.text = "a"; companyNameController.clear();
_selectedEmployees = null; _selectedEmployees = null;
_selectedSources = null; _selectedSources = null;
_selectedReferences = null; _selectedReferences = null;
...@@ -557,6 +1201,7 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -557,6 +1201,7 @@ class Leadlistprovider extends ChangeNotifier {
_selectedSubLocations = null; _selectedSubLocations = null;
_selectedLeadStatus = null; _selectedLeadStatus = null;
_selectedOpenStatus = null; _selectedOpenStatus = null;
_selectedAlphabet = null;
_selectedEmployeeId = null; _selectedEmployeeId = null;
_selectedSourceId = null; _selectedSourceId = null;
_selectedReferenceId = null; _selectedReferenceId = null;
...@@ -565,7 +1210,6 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -565,7 +1210,6 @@ class Leadlistprovider extends ChangeNotifier {
_selectedStateId = null; _selectedStateId = null;
_selectedDistrictId = null; _selectedDistrictId = null;
_selectedSubLocationId = null; _selectedSubLocationId = null;
_selectedEmployeeValue = null; _selectedEmployeeValue = null;
_selectedSourceValue = null; _selectedSourceValue = null;
_selectedReferenceValue = null; _selectedReferenceValue = null;
...@@ -579,43 +1223,46 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -579,43 +1223,46 @@ class Leadlistprovider extends ChangeNotifier {
} }
void checkDropDownValues() { void checkDropDownValues() {
if (!_employeesList.contains(_selectedEmployees) && if (_selectedEmployees != null && !_employeesList.contains(_selectedEmployees)) {
_selectedEmployees != null) { _selectedEmployees = null;
_selectedEmployeeId = null; _selectedEmployeeId = null;
_selectedEmployeeValue = null; _selectedEmployeeValue = null;
} }
if (!_sourcesList.contains(_selectedSources) && _selectedSources != null) { if (_selectedSources != null && !_sourcesList.contains(_selectedSources)) {
_selectedSources = null;
_selectedSourceId = null; _selectedSourceId = null;
_selectedSourceValue = null; _selectedSourceValue = null;
} }
if (!_referencesList.contains(_selectedReferences) && if (_selectedReferences != null && !_referencesList.contains(_selectedReferences)) {
_selectedReferences != null) { _selectedReferences = null;
_selectedReferenceId = null; _selectedReferenceId = null;
_selectedReferenceValue = null; _selectedReferenceValue = null;
} }
if (!_segmentsList.contains(_selectedSegments) && if (_selectedSegments != null && !_segmentsList.contains(_selectedSegments)) {
_selectedSegments != null) { _selectedSegments = null;
_selectedTeamId = null;
_selectedTeamValue = null;
}
if (!_teamsList.contains(_selectedTeams) && _selectedTeams != null) {
_selectedSegmentId = null; _selectedSegmentId = null;
_selectedSegmentValue = null; _selectedSegmentValue = null;
} }
if (!_districtsList.contains(_selectedDistricts) && if (_selectedTeams != null && !_teamsList.contains(_selectedTeams)) {
_selectedDistricts != null) { _selectedTeams = null;
_selectedTeamId = null;
_selectedTeamValue = null;
}
if (_selectedDistricts != null && !_districtsList.contains(_selectedDistricts)) {
_selectedDistricts = null;
_selectedDistrictId = null; _selectedDistrictId = null;
_selectedDistrictValue = null; _selectedDistrictValue = null;
} }
if (!_statesList.contains(_selectedStates) && _selectedStates != null) { if (_selectedStates != null && !_statesList.contains(_selectedStates)) {
_selectedStates = null;
_selectedStateId = null; _selectedStateId = null;
_selectedStateValue = null; _selectedStateValue = null;
} }
if (!_subLocationsList.contains(_selectedSubLocations) && if (_selectedSubLocations != null && !_subLocationsList.contains(_selectedSubLocations)) {
_selectedSubLocations != null) { _selectedSubLocations = null;
_selectedSubLocationId = null; _selectedSubLocationId = null;
_selectedSubLocationValue = null; _selectedSubLocationValue = null;
} }
notifyListeners(); notifyListeners();
} }
} }
\ No newline at end of file
...@@ -354,6 +354,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -354,6 +354,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
set productRows(value) { set productRows(value) {
_productRows = value; _productRows = value;
productsEmptyError = "";
notifyListeners(); notifyListeners();
} }
...@@ -369,6 +370,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -369,6 +370,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
String? TelephoneError = ""; String? TelephoneError = "";
String? mobileError = ""; String? mobileError = "";
String? addressError = ""; String? addressError = "";
String? productsEmptyError = "";
String? designationError = ""; String? designationError = "";
String? taxesError = ""; String? taxesError = "";
String? SpecialNoteError = ""; String? SpecialNoteError = "";
...@@ -764,6 +766,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -764,6 +766,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
districtsError = ""; districtsError = "";
subLocError = ""; subLocError = "";
leadStatusError = ""; leadStatusError = "";
productsEmptyError = "";
notifyListeners(); notifyListeners();
} }
...@@ -836,7 +839,13 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -836,7 +839,13 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
if(mobileController.text.trim().isEmpty){ if(mobileController.text.trim().isEmpty){
mobileError = "Please enter Mobile Number"; mobileError = "Please enter Mobile Number";
isValid = false; isValid = false;
}else{
if(mobileController.text.length<10){
mobileError = "Please enter 10 digits";
isValid = false;
}
} }
// if(designationController.text.trim().isEmpty){ // if(designationController.text.trim().isEmpty){
// designationError = "Please enter Designation"; // designationError = "Please enter Designation";
// isValid = false; // isValid = false;
...@@ -849,11 +858,11 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -849,11 +858,11 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
bool validateStep2(){ bool validateStep2(){
bool isValid = true; bool isValid = true;
// if(alternateMobileController.text.trim().isEmpty){ if(alternateMobileController.text.trim().isNotEmpty && alternateMobileController.text.length<10){
// AlternatemobileError = ""; AlternatemobileError = "Please enter 10 digits";
// isValid = false; isValid = false;
//
// } }
// if(telephoneController.text.trim().isEmpty){ // if(telephoneController.text.trim().isEmpty){
// isValid = false; // isValid = false;
// //
...@@ -902,6 +911,10 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -902,6 +911,10 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
addressError = "Please Enter address"; addressError = "Please Enter address";
isValid = false; isValid = false;
} }
if(productRows.isEmpty || _productRows.isEmpty){
productsEmptyError = "Please Add min. one Product";
isValid = false;
}
notifyListeners(); notifyListeners();
return isValid; return isValid;
} }
......
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
...@@ -8,6 +9,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.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/crmLeadDetailsGenerateQuotationViewResponse.dart';
import 'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart'; import 'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart';
import 'package:generp/screens/LoginScreen.dart'; import 'package:generp/screens/LoginScreen.dart';
import 'package:get/get.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
...@@ -25,6 +27,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -25,6 +27,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
final GlobalKey webViewKey = GlobalKey(); final GlobalKey webViewKey = GlobalKey();
var dl = DownloadManager(); var dl = DownloadManager();
bool _buttonsLoading = false;
ProductsData? _selectedProductsDeatilsData; ProductsData? _selectedProductsDeatilsData;
TextEditingController addEditProductPriceController = TextEditingController(); TextEditingController addEditProductPriceController = TextEditingController();
TextEditingController addEditQuantityController = TextEditingController(); TextEditingController addEditQuantityController = TextEditingController();
...@@ -40,8 +43,16 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -40,8 +43,16 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
List<Map<String, dynamic>> get productRows => _productRows; List<Map<String, dynamic>> get productRows => _productRows;
bool get buttonsLoading => _buttonsLoading;
set buttonsLoading(bool value){
_buttonsLoading = value;
notifyListeners();
}
set productRows(value) { set productRows(value) {
_productRows = value; _productRows = value;
productRowsError = "";
notifyListeners(); notifyListeners();
} }
...@@ -50,6 +61,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -50,6 +61,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
String? mailIdError = ""; String? mailIdError = "";
String? mobileError = ""; String? mobileError = "";
String? subjectsError = ""; String? subjectsError = "";
String? productRowsError = "";
String? taxesError = ""; String? taxesError = "";
String? SpecialNoteError = ""; String? SpecialNoteError = "";
String? forError = ""; String? forError = "";
...@@ -98,6 +110,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -98,6 +110,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
set selectedTaxes(String? value){ set selectedTaxes(String? value){
_selectedTaxes = value; _selectedTaxes = value;
taxesError = "";
notifyListeners(); notifyListeners();
} }
...@@ -170,7 +183,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -170,7 +183,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
if (index >= 0 && index < leadProductsList.length) { if (index >= 0 && index < leadProductsList.length) {
leadProductsList[index] = updatedProduct; leadProductsList[index] = updatedProduct;
_productRows[index] = { _productRows[index] = {
"product_id": updatedProduct.productId!, "product_id": updatedProduct.productId,
"price": updatedProduct.price, "price": updatedProduct.price,
"qty": updatedProduct.qty, "qty": updatedProduct.qty,
"net_price": updatedProduct.prodTotalPrice, "net_price": updatedProduct.prodTotalPrice,
...@@ -190,11 +203,18 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -190,11 +203,18 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
void preFillFormForEdit(LeadProducts product) { void preFillFormForEdit(LeadProducts product,int index) {
checkDropdownReset(); final newprod = product;
selectedLeadProducts = product; selectedProducts = productsList.firstWhere(
selectedAddEditLeadProductId = product.id; (p) => p.id == newprod.productId,
selectedAddEditLeadProductName = product.productName; orElse: () => Products(id: '', name: 'Unknown'),
);
// selectedLeadProducts = product;
selectedAddEditProductId = product.productId;
selectedAddEditProductName = product.productName;
addEditProductPriceController.text = product.price?.toString() ?? ''; addEditProductPriceController.text = product.price?.toString() ?? '';
addEditQuantityController.text = product.qty?.toString() ?? ''; addEditQuantityController.text = product.qty?.toString() ?? '';
addEditTotalAmountController.text = addEditTotalAmountController.text =
...@@ -382,6 +402,11 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -382,6 +402,11 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
quotation_type, quotation_type,
) async { ) async {
try { try {
if(!validateform()){
return;
}
_buttonsLoading = true;
notifyListeners();
final prov = Provider.of<HomescreenNotifier>(context, listen: false); final prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmLeadDetailsGenerateQuotationSubmitAPI( final data = await ApiCalling.crmLeadDetailsGenerateQuotationSubmitAPI(
prov.empId, prov.empId,
...@@ -399,6 +424,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -399,6 +424,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
); );
if (data != null) { if (data != null) {
if (data.error == "0") { if (data.error == "0") {
_buttonsLoading = false;
_quotationFilePath = data.quoteFilepath!; _quotationFilePath = data.quoteFilepath!;
if (quotation_type == "genquotedown") { if (quotation_type == "genquotedown") {
String suggestedFilename = getUniqueFilename('quotation', 'pdf'); String suggestedFilename = getUniqueFilename('quotation', 'pdf');
...@@ -419,9 +445,17 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -419,9 +445,17 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
toast(context, data.message); toast(context, data.message);
resetForm(); resetForm();
notifyListeners(); notifyListeners();
} else {} } else {
} else {} _buttonsLoading = false;
notifyListeners();
}
} else {
_buttonsLoading = false;
notifyListeners();
}
} catch (e, s) { } catch (e, s) {
_buttonsLoading = false;
notifyListeners();
print("Error: $e, Stack: $s"); print("Error: $e, Stack: $s");
} }
} }
...@@ -621,6 +655,50 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -621,6 +655,50 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
notifyListeners(); 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() { void resetForm() {
checkDropdownReset(); checkDropdownReset();
_productRows.clear(); _productRows.clear();
...@@ -669,6 +747,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { ...@@ -669,6 +747,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
mailIdError = ""; mailIdError = "";
mobileError = ""; mobileError = "";
subjectsError = ""; subjectsError = "";
productRowsError = "";
taxesError = ""; taxesError = "";
SpecialNoteError = ""; SpecialNoteError = "";
forError = ""; forError = "";
......
import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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:generp/Utils/commonServices.dart';
import 'package:get/get.dart';
import 'package:intl/intl.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:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../Models/crmModels/LeadDetailsResponse.dart'; import '../../Models/crmModels/LeadDetailsResponse.dart';
import '../../Utils/app_colors.dart'; import '../../Utils/app_colors.dart';
import '../../services/api_calling.dart'; import '../../services/api_calling.dart';
import '../HomeScreenNotifier.dart'; import '../HomeScreenNotifier.dart';
import 'package:http/http.dart' as http;
class crmLeadDetailsProvider extends ChangeNotifier { 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 _isLoading = false;
bool _showMoreDetails = false; bool _showMoreDetails = false;
bool _leadDetailsLoading = true;
var _showEditButton; var _showEditButton;
TextEditingController nameController = TextEditingController(); TextEditingController nameController = TextEditingController();
TextEditingController designationController = TextEditingController(); TextEditingController designationController = TextEditingController();
...@@ -27,7 +42,8 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -27,7 +42,8 @@ class crmLeadDetailsProvider extends ChangeNotifier {
TextEditingController editNameController = TextEditingController(); TextEditingController editNameController = TextEditingController();
TextEditingController editDesignationController = TextEditingController(); TextEditingController editDesignationController = TextEditingController();
TextEditingController editMobileNumberController = TextEditingController(); TextEditingController editMobileNumberController = TextEditingController();
TextEditingController editAlternativeMobileController = TextEditingController(); TextEditingController editAlternativeMobileController =
TextEditingController();
TextEditingController editTelephoneController = TextEditingController(); TextEditingController editTelephoneController = TextEditingController();
TextEditingController editEmailController = TextEditingController(); TextEditingController editEmailController = TextEditingController();
TextEditingController dateController = TextEditingController(); TextEditingController dateController = TextEditingController();
...@@ -47,6 +63,8 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -47,6 +63,8 @@ class crmLeadDetailsProvider extends ChangeNotifier {
String? _editTeleError; String? _editTeleError;
String? _editEmailError; String? _editEmailError;
String? _dateError; String? _dateError;
LeadDetails _leadDetails = LeadDetails(); LeadDetails _leadDetails = LeadDetails();
...@@ -62,32 +80,53 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -62,32 +80,53 @@ class crmLeadDetailsProvider extends ChangeNotifier {
List<String> _subHeadings = []; List<String> _subHeadings = [];
DateTime? _date; DateTime? _date;
String? _formattedDate; String? _formattedDate;
String? _formattedDateToSend;
String? _visitTypeError = ""; String? _visitTypeError = "";
String? get formattedDateToSend => _formattedDateToSend;
get showEditButton => _showEditButton; get showEditButton => _showEditButton;
String? get nameError => _nameError; String? get nameError => _nameError;
String? get designationError => _designationError; String? get designationError => _designationError;
String? get mobileNumError => _mobileNumError; String? get mobileNumError => _mobileNumError;
String? get altMobError => _altMobError; String? get altMobError => _altMobError;
String? get teleError => _teleError; String? get teleError => _teleError;
String? get emailError => _emailError; String? get emailError => _emailError;
String? get noteError => _noteError; String? get noteError => _noteError;
String? get visitTypeError => _visitTypeError; String? get visitTypeError => _visitTypeError;
String? get editNameError => _editNameError; String? get editNameError => _editNameError;
String? get editDesignationError => _editDesignationError; String? get editDesignationError => _editDesignationError;
String? get editMobileNumError => _editMobileNumError; String? get editMobileNumError => _editMobileNumError;
String? get editAltMobError => _editAltMobError; String? get editAltMobError => _editAltMobError;
String? get editTeleError => _editTeleError; String? get editTeleError => _editTeleError;
String? get editEmailError => _editEmailError; String? get editEmailError => _editEmailError;
String? get dateError => _dateError; String? get dateError => _dateError;
bool get isLoading => _isLoading; bool get isLoading => _isLoading;
bool get leadDetailsLoading => _leadDetailsLoading;
bool get showMoreDetails => _showMoreDetails; bool get showMoreDetails => _showMoreDetails;
List<String> get visitTypes => _visitTypes; List<String> get visitTypes => _visitTypes;
String? get selectedVisitType => _selectedVisitType; String? get selectedVisitType => _selectedVisitType;
LeadDetails get leadDetails => _leadDetails; LeadDetails get leadDetails => _leadDetails;
AccountDetails get accountDetails => _accountDetails; AccountDetails get accountDetails => _accountDetails;
...@@ -108,74 +147,88 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -108,74 +147,88 @@ class crmLeadDetailsProvider extends ChangeNotifier {
String? get formattedDate => _formattedDate; String? get formattedDate => _formattedDate;
set selectedVisitType(String? value){ set selectedVisitType(String? value) {
_selectedVisitType = value; _selectedVisitType = value;
_visitTypeError = ""; _visitTypeError = "";
notifyListeners(); notifyListeners();
} }
set nameError(String? value){ set nameError(String? value) {
_nameError = value; _nameError = value;
notifyListeners(); notifyListeners();
} }
set designationError(String? value){
set designationError(String? value) {
_designationError = value; _designationError = value;
notifyListeners(); notifyListeners();
} }
set mobileNumError(String? value){
set mobileNumError(String? value) {
_mobileNumError = value; _mobileNumError = value;
notifyListeners(); notifyListeners();
} }
set altMobError(String? value){
set altMobError(String? value) {
_altMobError = value; _altMobError = value;
notifyListeners(); notifyListeners();
} }
set teleError(String? value){
set teleError(String? value) {
_teleError = value; _teleError = value;
notifyListeners(); notifyListeners();
} }
set emailError(String? value){
set emailError(String? value) {
_emailError = value; _emailError = value;
notifyListeners(); notifyListeners();
} }
set noteError(String? value){ set noteError(String? value) {
_noteError = value; _noteError = value;
notifyListeners(); notifyListeners();
} }
set editNameError(String? value) {
set editNameError(String? value){
_editNameError = value; _editNameError = value;
notifyListeners(); notifyListeners();
} }
set editDesignationError(String? value){
set editDesignationError(String? value) {
_editDesignationError = value; _editDesignationError = value;
notifyListeners(); notifyListeners();
} }
set editMobileNumError(String? value){
set editMobileNumError(String? value) {
_editMobileNumError = value; _editMobileNumError = value;
notifyListeners(); notifyListeners();
} }
set editAltMobError(String? value){
set editAltMobError(String? value) {
_editAltMobError = value; _editAltMobError = value;
notifyListeners(); notifyListeners();
} }
set editTeleError(String? value){
set editTeleError(String? value) {
_editTeleError = value; _editTeleError = value;
notifyListeners(); notifyListeners();
} }
set editEmailError(String? value){
set editEmailError(String? value) {
_editEmailError = value; _editEmailError = value;
notifyListeners(); notifyListeners();
} }
set isLoading(bool value){ set isLoading(bool value) {
_isLoading = value; _isLoading = value;
notifyListeners(); notifyListeners();
} }
set showMoreDetails(bool value){ set leadDetailsLoading(bool value){
_leadDetailsLoading = value;
notifyListeners();
}
set showMoreDetails(bool value) {
_showMoreDetails = value; _showMoreDetails = value;
notifyListeners(); notifyListeners();
} }
...@@ -187,18 +240,20 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -187,18 +240,20 @@ class crmLeadDetailsProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
set dateError(value){ set dateError(value) {
_dateError = value; _dateError = value;
notifyListeners(); notifyListeners();
} }
void setDate(DateTime newDate) { void setDate(DateTime newDate) {
_date = 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!; dateController.text = _formattedDate!;
_dateError = null; _dateError = null;
notifyListeners(); notifyListeners();
} }
Future<void> crmLeadDetailsAPIFunction(context, leadID, mode) async { Future<void> crmLeadDetailsAPIFunction(context, leadID, mode) async {
try { try {
var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false); var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
...@@ -208,10 +263,10 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -208,10 +263,10 @@ class crmLeadDetailsProvider extends ChangeNotifier {
leadID, leadID,
mode, mode,
); );
_isLoading = true; _leadDetailsLoading = true;
notifyListeners(); notifyListeners();
if (data != null) { if (data != null) {
if(data.sessionExists==1){ if (data.sessionExists == 1) {
if (data.error == "0") { if (data.error == "0") {
print("calling"); print("calling");
_leadDetails = data.leadDetails!; _leadDetails = data.leadDetails!;
...@@ -222,45 +277,63 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -222,45 +277,63 @@ class crmLeadDetailsProvider extends ChangeNotifier {
_appointmentDetails = data.appointmentDetails!; _appointmentDetails = data.appointmentDetails!;
_quotationsDetails = data.quotationsDetails!; _quotationsDetails = data.quotationsDetails!;
_showEditButton = data.showEditAccountButton; _showEditButton = data.showEditAccountButton;
_visitTypes = ["Phone","Visit"]; _visitTypes = ["Phone", "Visit"];
_isLoading = false; _leadDetailsLoading = false;
notifyListeners(); notifyListeners();
}else{ } else {
_isLoading = false; _leadDetailsLoading = false;
notifyListeners(); notifyListeners();
} }
}else{ } else {
sessionDoesNotExist(context); sessionDoesNotExist(context);
} }
} else {
}else{ _leadDetailsLoading = false;
_isLoading = false;
notifyListeners(); notifyListeners();
} }
} catch (e, s) { } catch (e, s) {
_isLoading = false; _leadDetailsLoading = false;
notifyListeners(); notifyListeners();
} }
} }
Future<void> crmLeadDetailsAddContactAPIFunction(context, accID) async { Future<void> crmLeadDetailsAddContactAPIFunction(context, accID) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); if(!AddContactValidation()){
final data = await ApiCalling.crmLeadDetailsAddContactAPI(prov.empId, prov.session, accID, return;
nameController.text, mobileNumberController.text, designationController.text, alternativeMobileController.text, telephoneController.text, emailController.text); }
_isLoading = true; _isLoading = true;
notifyListeners(); 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 != null) {
if (data.error == "0") { if (data.error == "0") {
Navigator.pop(context,true); _leadDetailsLoading = false;
resetAll(); nameController.clear();
mobileNumberController.clear();
designationController.clear();
alternativeMobileController.clear();
telephoneController.clear();
emailController.clear();
Navigator.pop(context, true);
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
...@@ -270,25 +343,44 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -270,25 +343,44 @@ class crmLeadDetailsProvider extends ChangeNotifier {
} }
} }
Future<void> crmLeadDetailsEditContactAPIFunction(context,contactID) async {
Future<void> crmLeadDetailsEditContactAPIFunction(context, contactID) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); if(!editContactValidation()){
final data = await ApiCalling.crmLeadDetailsEditContactAPI(prov.empId, prov.session, contactID, return;
nameController.text, mobileNumberController.text, designationController.text, alternativeMobileController.text, telephoneController.text, emailController.text); }
_isLoading = true; _isLoading = true;
notifyListeners(); 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 != null) {
if (data.error == "0") { if (data.error == "0") {
_isLoading = false; _isLoading = false;
Navigator.pop(context,true); _leadDetailsLoading = false;
resetAll(); editNameController.clear();
_isLoading = false; editMobileNumberController.clear();
editDesignationController.clear();
editAlternativeMobileController.clear();
editTelephoneController.clear();
editEmailController.clear();
Navigator.pop(context, true);
notifyListeners(); notifyListeners();
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
...@@ -298,11 +390,61 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -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,
);
Future<void> crmCheckFields(context,value,type) async { 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 {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); 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 != null) {
if (data.error == "0") { if (data.error == "0") {
...@@ -310,43 +452,64 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -310,43 +452,64 @@ class crmLeadDetailsProvider extends ChangeNotifier {
mobileNumError = null; mobileNumError = null;
altMobError = null; altMobError = null;
notifyListeners(); notifyListeners();
}else if(data.error=="1"){ } else if (data.error == "1") {
if(type=="name"){ if (type == "name") {
nameError = data.message!; nameError = data.message!;
}else if(type == 'mob1'){ } else if (type == 'mob1') {
mobileNumError = data.message!; mobileNumError = data.message!;
}else if(type == 'mob2'){ } else if (type == 'mob2') {
altMobError = data.message!; altMobError = data.message!;
} }
notifyListeners(); notifyListeners();
} }
}else{ } else {
notifyListeners(); notifyListeners();
} }
} catch (e, s) { } catch (e, s) {
notifyListeners(); notifyListeners();
} }
} }
Future<void> crmLeadDetailsAddAppointmentAPIFunction(context, leadID, appointmentDate, appointmentType, note) async { Future<void> crmLeadDetailsAddAppointmentAPIFunction(
context,
leadID,
appointmentDate,
appointmentType,
note,
) async {
if(!validAppointment()){
return;
}
_isLoading = true;
notifyListeners();
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmLeadDetailsAddAppointmentAPI(prov.empId, prov.session, leadID, appointmentDate, appointmentType, note); final data = await ApiCalling.crmLeadDetailsAddAppointmentAPI(
_isLoading = true; prov.empId,
notifyListeners(); prov.session,
leadID,
appointmentDate,
appointmentType,
note,
);
if (data != null) { if (data != null) {
if (data.error == "0") { if (data.error == "0") {
_isLoading = false; _isLoading = false;
Navigator.pop(context,true); _leadDetailsLoading = false;
resetAll(); dateController.clear();
noteController.clear();
selectedVisitType = null;
_selectedVisitType = null;
Navigator.pop(context, true);
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
...@@ -361,63 +524,70 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -361,63 +524,70 @@ class crmLeadDetailsProvider extends ChangeNotifier {
context: context, context: context,
builder: builder:
(BuildContext context) => Container( (BuildContext context) => Container(
height: 216, height: 216,
padding: const EdgeInsets.only(top: 6.0), padding: const EdgeInsets.only(top: 6.0),
margin: EdgeInsets.only( margin: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom, bottom: MediaQuery.of(context).viewInsets.bottom,
), ),
color: CupertinoColors.systemBackground.resolveFrom(context), color: CupertinoColors.systemBackground.resolveFrom(context),
child: SafeArea( child: SafeArea(
top: false, top: false,
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
CupertinoButton( CupertinoButton(
child: Text( child: Text(
'Cancel', 'Cancel',
style: TextStyle(fontFamily: "JakartaMedium",color: AppColors.app_blue), style: TextStyle(
), fontFamily: "JakartaMedium",
onPressed: () { color: AppColors.app_blue,
Navigator.pop(context); ),
}, ),
), onPressed: () {
CupertinoButton( Navigator.pop(context);
child: Text( },
'Done', ),
style: TextStyle(fontFamily: "JakartaMedium",color: AppColors.app_blue), CupertinoButton(
), child: Text(
onPressed: () { 'Done',
setDate(_date ?? DateTime.now() ); style: TextStyle(
Navigator.pop(context); fontFamily: "JakartaMedium",
}, color: AppColors.app_blue,
),
),
onPressed: () {
setDate(_date ?? DateTime.now());
Navigator.pop(context);
},
),
],
), ),
], ),
), ),
), Expanded(
), flex: 3,
Expanded( child: CupertinoDatePicker(
flex: 3, dateOrder: DatePickerDateOrder.dmy,
child: CupertinoDatePicker( initialDateTime: _date ?? DateTime.now(),
dateOrder: DatePickerDateOrder.dmy, minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day),
initialDateTime: _date ?? DateTime.now(), mode: CupertinoDatePickerMode.date,
mode: CupertinoDatePickerMode.date, use24hFormat: true,
use24hFormat: true, showDayOfWeek: true,
showDayOfWeek: true, onDateTimeChanged: (DateTime newDate) {
onDateTimeChanged: (DateTime newDate) { setDate(newDate);
setDate(newDate); },
}, ),
), ),
],
), ),
], ),
), ),
),
),
); );
} }
...@@ -434,16 +604,16 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -434,16 +604,16 @@ class crmLeadDetailsProvider extends ChangeNotifier {
]; ];
final rows = final rows =
[ [
leadDetails.name??"-", leadDetails.name ?? "-",
leadDetails.contName??"-", leadDetails.contName ?? "-",
leadDetails.mob1??"-", leadDetails.mob1 ?? "-",
leadDetails.mob2??"-", leadDetails.mob2 ?? "-",
leadDetails.email??"-", leadDetails.email ?? "-",
leadDetails.address??"-", leadDetails.address ?? "-",
leadDetails.prod??"-", leadDetails.prod ?? "-",
leadDetails.createdDatetime??"-", leadDetails.createdDatetime ?? "-",
].toList(); ].toList();
return [headers, rows]; return [headers, rows];
} }
...@@ -451,9 +621,9 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -451,9 +621,9 @@ class crmLeadDetailsProvider extends ChangeNotifier {
void copyToClipboard(BuildContext context) async { void copyToClipboard(BuildContext context) async {
try { try {
if (leadDetails == null) { if (leadDetails == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(
SnackBar(content: Text("No data to copy")), context,
); ).showSnackBar(SnackBar(content: Text("No data to copy")));
return; return;
} }
final data = prepareExportData(); final data = prepareExportData();
...@@ -466,73 +636,362 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -466,73 +636,362 @@ class crmLeadDetailsProvider extends ChangeNotifier {
String raw = data.map((row) => row.join('\t')).join('\n'); String raw = data.map((row) => row.join('\t')).join('\n');
print('Clipboard data: $raw'); print('Clipboard data: $raw');
await Clipboard.setData(ClipboardData(text: raw)); await Clipboard.setData(ClipboardData(text: raw));
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(
SnackBar(content: Text("Copied to Clipboard")), context,
); ).showSnackBar(SnackBar(content: Text("Copied to Clipboard")));
} catch (e) { } catch (e) {
print('Error copying to clipboard: $e'); print('Error copying to clipboard: $e');
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(
SnackBar(content: Text("Failed to copy to clipboard")), 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...',
),
);
void onChangeName(value){ 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) {
_nameError = ""; _nameError = "";
notifyListeners(); notifyListeners();
} }
void onChangeDesignation(value){
void onChangeDesignation(value) {
_designationError = ""; _designationError = "";
notifyListeners(); notifyListeners();
} }
void onChangeMobile(value){
void onChangeMobile(value) {
_mobileNumError = ""; _mobileNumError = "";
notifyListeners(); notifyListeners();
} }
void onChangeAltMobile(value){
_altMobError = ""; void onChangeAltMobile(value) {
if(mobileNumberController.text.trim() == alternativeMobileController.text.trim()){
_altMobError = "Mobile Number and Alternate Mobile Number Should not be same";
}else{
_altMobError = "";
}
notifyListeners(); notifyListeners();
} }
void onChangeTelephone(value){
void onChangeTelephone(value) {
_teleError = ""; _teleError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEmailId(value){
void onChangeEmailId(value) {
_emailError = ""; _emailError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditName(value){ void onChangeEditName(value) {
_editNameError = ""; _editNameError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditDesignation(value){
void onChangeEditDesignation(value) {
_editDesignationError = ""; _editDesignationError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditMobile(value){
void onChangeEditMobile(value) {
_editMobileNumError = ""; _editMobileNumError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditAltMobile(value){
_editAltMobError = ""; void onChangeEditAltMobile(value) {
if(editMobileNumberController.text.trim() == editAlternativeMobileController.text.trim()){
_editAltMobError = "Mobile Number and Alternate Mobile Number Should not be same";
}else{
_editAltMobError = "";
}
notifyListeners(); notifyListeners();
} }
void onChangeEditTelephone(value){
void onChangeEditTelephone(value) {
_editTeleError = ""; _editTeleError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditEmailId(value){
void onChangeEditEmailId(value) {
_editEmailError = ""; _editEmailError = "";
notifyListeners(); notifyListeners();
} }
void onChangeNote(value){
void onChangeNote(value) {
_noteError = ""; _noteError = "";
notifyListeners(); 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(); nameController.clear();
designationController.clear(); designationController.clear();
mobileNumberController.clear(); mobileNumberController.clear();
...@@ -557,6 +1016,9 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -557,6 +1016,9 @@ class crmLeadDetailsProvider extends ChangeNotifier {
_editAltMobError = ""; _editAltMobError = "";
_editTeleError = ""; _editTeleError = "";
_editEmailError = ""; _editEmailError = "";
_isLoading = false;
_showMoreDetails = false;
_leadDetailsLoading = true;
notifyListeners(); notifyListeners();
} }
} }
// 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:async';
import 'dart:io'; import 'dart:io';
import 'dart:ui' as ui; import 'dart:ui' as ui;
...@@ -8,7 +338,6 @@ import 'package:flutter/material.dart'; ...@@ -8,7 +338,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:generp/Notifiers/HomeScreenNotifier.dart'; import 'package:generp/Notifiers/HomeScreenNotifier.dart';
import 'package:generp/screens/crm/LeadDetailsByMode.dart'; import 'package:generp/screens/crm/LeadDetailsByMode.dart';
import 'package:generp/screens/genTracker/GeneratorDetails.dart';
import 'package:generp/services/api_calling.dart'; import 'package:generp/services/api_calling.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
...@@ -22,8 +351,6 @@ import '../../Models/crmModels/NearbyOpenLeadsResponse.dart'; ...@@ -22,8 +351,6 @@ import '../../Models/crmModels/NearbyOpenLeadsResponse.dart';
import '../../Utils/commonServices.dart'; import '../../Utils/commonServices.dart';
class crmNearbyOpenLeadsProvider extends ChangeNotifier { class crmNearbyOpenLeadsProvider extends ChangeNotifier {
List<LeadList> _leadslist = []; List<LeadList> _leadslist = [];
TextEditingController _locationController = TextEditingController(); TextEditingController _locationController = TextEditingController();
String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs"; String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs";
...@@ -41,7 +368,8 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { ...@@ -41,7 +368,8 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
bool _isLoading = true; bool _isLoading = true;
double _currentValue = 1.0; double _currentValue = 1.0;
Timer? _debounceTimer; Timer? _debounceTimer;
LatLng? _mapCenter;
bool _isFilterApplied = false; // Track if filter has been applied
List<LeadList> get leadsList => _leadslist; List<LeadList> get leadsList => _leadslist;
TextEditingController get LocationController => _locationController; TextEditingController get LocationController => _locationController;
...@@ -59,33 +387,50 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { ...@@ -59,33 +387,50 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
Timer? get timer => _timer; Timer? get timer => _timer;
File? get image => _image; File? get image => _image;
double get currentValue => _currentValue; double get currentValue => _currentValue;
bool get isFilterApplied => _isFilterApplied;
set currentValue(value){ set currentValue(double value) {
_currentValue = value; _currentValue = value;
notifyListeners(); notifyListeners();
} }
set markers(List<Marker> value) {
set markers(List<Marker> value){
_markers = value; _markers = value;
if (value.isNotEmpty) {
_isLoading = false; // Mark screen as loaded when markers are added
}
notifyListeners(); notifyListeners();
} }
set mapController(value){
set mapController(GoogleMapController? value) {
_mapController = value; _mapController = value;
notifyListeners(); 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; _currentValue = 1.0;
_markers= []; _markers = [];
_addresses = []; _addresses = [];
_mapCenter = null;
_latlongs = '';
_isFilterApplied = false;
_isLoading = true;
notifyListeners();
} }
Future<void> getLocationPermission(context) async { Future<void> getLocationPermission(BuildContext context) async {
// Check if location services are enabled
_isLocationEnabled = await Geolocator.isLocationServiceEnabled(); _isLocationEnabled = await Geolocator.isLocationServiceEnabled();
// Check if the app has been granted location permission
LocationPermission permission = await Geolocator.checkPermission(); LocationPermission permission = await Geolocator.checkPermission();
_hasLocationPermission = _hasLocationPermission =
permission == LocationPermission.always || permission == LocationPermission.always ||
...@@ -98,14 +443,17 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { ...@@ -98,14 +443,17 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
if (!serviceEnabled) { if (!serviceEnabled) {
serviceEnabled = await location.requestService(); serviceEnabled = await location.requestService();
if (!serviceEnabled) { if (!serviceEnabled) {
toast(context, 'Location services are disabled.');
_isLoading = false;
return; return;
} }
} }
_isLoading = false; permissionGranted = await location.hasPermission();
permissionGranted = (await location.hasPermission()); if (permissionGranted == Location.PermissionStatus.denied) {
if (permissionGranted == PermissionStatus) { permissionGranted = await location.requestPermission();
permissionGranted = (await location.requestPermission()); if (permissionGranted != Location.PermissionStatus.granted) {
if (permissionGranted != PermissionStatus) { toast(context, 'Location permission denied.');
_isLoading = false;
return; return;
} }
} }
...@@ -113,34 +461,45 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { ...@@ -113,34 +461,45 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
_currentLocation = locData; _currentLocation = locData;
if (_currentLocation != null) { if (_currentLocation != null && _mapCenter == null) {
_mapCenter = LatLng(_currentLocation!.latitude!, _currentLocation!.longitude!);
_latlongs = '${_currentLocation!.latitude},${_currentLocation!.longitude}';
_mapController?.animateCamera( _mapController?.animateCamera(
CameraUpdate.newLatLng( CameraUpdate.newLatLng(_mapCenter!),
LatLng(_currentLocation!.latitude!, _currentLocation!.longitude!),
),
); );
final lat = _currentLocation!.latitude; await LoadNearbyOpenLeadsAPI(context, _currentValue);
final lang = _currentLocation!.longitude!;
_latlongs = '$lat,$lang';
LoadNearbyOpenLeadsAPI(context,_currentValue);
} }
notifyListeners();
} }
void onCameraMove(context, CameraPosition position) { void onCameraMove(BuildContext context, CameraPosition position) {
_timer?.cancel(); // Cancel any previous timer _timer?.cancel();
_mapCenter = position.target;
_latlongs = '${_mapCenter!.latitude},${_mapCenter!.longitude}';
_timer = Timer(Duration(seconds: 1), () { _timer = Timer(Duration(seconds: 1), () {
getLocationPermission(context); LoadNearbyOpenLeadsAPI(context, _currentValue);
}); });
notifyListeners();
} }
void debounce(VoidCallback callback, Duration duration) { void debounce(VoidCallback callback, Duration duration) {
_debounceTimer?.cancel(); _debounceTimer?.cancel();
_debounceTimer = Timer(duration, callback); _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 { Future<void> LoadNearbyOpenLeadsAPI(BuildContext context, double radius) async {
if (_latlongs.isEmpty || _currentValue <= 0) { if (_latlongs.isEmpty || radius <= 0) {
print("Invalid parameters: latlongs=$_latlongs, currentValue=$_currentValue"); print("Invalid parameters: latlongs=$_latlongs, radius=$radius");
toast(context, 'Invalid location or radius.');
_isLoading = false;
notifyListeners();
return; return;
} }
try { try {
...@@ -149,25 +508,32 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { ...@@ -149,25 +508,32 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
provider.empId, provider.empId,
provider.session, provider.session,
_latlongs, _latlongs,
radius radius,
); );
if (data != null) { if (data != null) {
if (data.error == 0) { if (data.error == 0) {
_leadslist = data.leadList!; _isLoading = false;
_leadslist = data.leadList?.where((lead) => lead != null).toList() ?? [];
await updateMarkersFromApiResponse(context, data.leadList!); await updateMarkersFromApiResponse(context, _leadslist);
_isLoading = false; if (_leadslist.isEmpty) {
notifyListeners(); toast(context, 'No leads found within the selected radius.');
} else if(data.error==1){
toast(context, data.message);
} }
} else {
toast(context, data.message ?? 'Failed to load leads.');
_isLoading = false;
notifyListeners();
}
} else { } else {
toast(context, "Something went wrong, Please try again."); toast(context, "Something went wrong, please try again.");
_isLoading = false;
notifyListeners();
} }
} on Exception catch (e) { } on Exception catch (e, s) {
print("$e"); 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 { ...@@ -180,13 +546,8 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
await Future.forEach(leadsList, (store) async { await Future.forEach(leadsList, (store) async {
String address = await _getAddressFromLatLng(store.loc); String address = await _getAddressFromLatLng(store.loc);
_addresses.add(address); _addresses.add(address);
}); });
notifyListeners(); 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( Future<List<Marker>> createMarkersFromApiResponse(
...@@ -194,95 +555,66 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { ...@@ -194,95 +555,66 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
List<LeadList> leadsList, List<LeadList> leadsList,
) async { ) async {
List<Marker> markers = []; List<Marker> markers = [];
ByteData data = await rootBundle.load("assets/images/maps_ic.png");
// print("Hello Nutsby!");
ByteData data = await rootBundle.load("assets/images/leads_ic.png");
Uint8List bytes = data.buffer.asUint8List(); Uint8List bytes = data.buffer.asUint8List();
await Future.forEach(leadsList, (leads) async { await Future.forEach(leadsList, (leads) async {
ui.Codec codec = await ui.instantiateImageCodec( if (leads.loc == null || leads.id == null || leads.name == null) {
bytes, 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(); ui.FrameInfo fi = await codec.getNextFrame();
Uint8List resizedBytes = Uint8List resizedBytes = (await fi.image.toByteData(
(await fi.image.toByteData(
format: ui.ImageByteFormat.png, format: ui.ImageByteFormat.png,
))!.buffer.asUint8List(); ))!.buffer.asUint8List();
markers.add( markers.add(
Marker( Marker(
markerId: MarkerId(leads.id.toString()), markerId: MarkerId(leads.id.toString()),
position: _parseLatLng(leads.loc), position: _parseLatLng(leads.loc),
icon: BitmapDescriptor.fromBytes(resizedBytes), icon: BitmapDescriptor.fromBytes(resizedBytes),
infoWindow: InfoWindow( infoWindow: InfoWindow(
title: leads.name ?? 'Unknown Lead',
onTap:() { snippet: leads.address ?? 'No address available',
// onMarkerTap(context, leads.id); onTap: () {
Navigator.push( Navigator.push(
context, // Use the widget's BuildContext, which is valid here context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => LeadDetailsByMode( builder: (context) => LeadDetailsByMode(
mode: "", mode: "",
pageTitleName: "Lead Details", pageTitleName: "Lead Details",
leadId:leads.id , leadId: leads.id,
), ),
), ),
); );
}, },
anchor: Offset(0, 0), anchor: const Offset(0.5, 1.0),
title: "Name: ${leads.name}",
snippet: "Address: ${leads.address}",
), ),
zIndex: 100, zIndex: 100,
onTap: () { onTap: () {
int index = leadsList.indexWhere( _mapController?.showMarkerInfoWindow(MarkerId(leads.id.toString()));
(techResponse) => print('Marker tapped: id=${leads.id}, name=${leads.name}');
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; return markers;
} }
Future<void> onMarkerTap(context, leadID) async {
///uncomment with screen navigation Future<void> onMarkerTap(BuildContext context, String leadID) async {
Navigator.push( Navigator.push(
context, // Use the widget's BuildContext, which is valid here context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => LeadDetailsByMode( builder: (context) => LeadDetailsByMode(
mode: "", mode: "",
pageTitleName: "Lead Details", pageTitleName: "Lead Details",
leadId:leadID , leadId: leadID,
), ),
), ),
); );
_markers = markers;
notifyListeners(); notifyListeners();
} }
LatLng _parseLatLng(String? location) { LatLng _parseLatLng(String? location) {
...@@ -291,9 +623,12 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { ...@@ -291,9 +623,12 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
if (parts.length == 2) { if (parts.length == 2) {
double lat = double.tryParse(parts[0]) ?? 0.0; double lat = double.tryParse(parts[0]) ?? 0.0;
double lng = double.tryParse(parts[1]) ?? 0.0; double lng = double.tryParse(parts[1]) ?? 0.0;
return LatLng(lat, lng); if (lat != 0.0 && lng != 0.0) {
return LatLng(lat, lng);
}
} }
} }
print('Invalid location string: $location');
return const LatLng(0.0, 0.0); return const LatLng(0.0, 0.0);
} }
...@@ -303,28 +638,29 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { ...@@ -303,28 +638,29 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier {
if (parts.length == 2) { if (parts.length == 2) {
double lat = double.tryParse(parts[0]) ?? 0.0; double lat = double.tryParse(parts[0]) ?? 0.0;
double lng = double.tryParse(parts[1]) ?? 0.0; double lng = double.tryParse(parts[1]) ?? 0.0;
if (lat != 0.0 && lng != 0.0) {
List<geocoding.Placemark> placemarks = await geocoding try {
.placemarkFromCoordinates(lat, lng); List<geocoding.Placemark> placemarks =
await geocoding.placemarkFromCoordinates(lat, lng);
if (placemarks.isNotEmpty) { if (placemarks.isNotEmpty) {
final placemark = placemarks.first; final placemark = placemarks.first;
String address = String address =
'${placemark.street ?? ''}, ' '${placemark.street ?? ''}, '
'${placemark.thoroughfare ?? ''} ' '${placemark.thoroughfare ?? ''} '
// '${placemark.subThoroughfare ?? ''}, ' '${placemark.subLocality ?? ''}, '
// '${placemark.name ?? ''}, ' '${placemark.locality ?? ''}, '
'${placemark.subLocality ?? ''}, ' '${placemark.administrativeArea ?? ''}, '
'${placemark.locality ?? ''}, ' '${placemark.subAdministrativeArea ?? ''} '
'${placemark.administrativeArea ?? ''}, ' '${placemark.postalCode ?? ''}, '
'${placemark.subAdministrativeArea ?? ''} ' '${placemark.country ?? ''}';
'${placemark.postalCode ?? ''}, ' return address.trim();
'${placemark.country ?? ''}'; }
return address.trim(); } catch (e) {
print('Geocoding error for location $location: $e');
}
} }
} }
} }
return "Address not found"; return "Address not found";
} }
}
} \ No newline at end of file
...@@ -9,8 +9,6 @@ import '../../services/api_calling.dart'; ...@@ -9,8 +9,6 @@ import '../../services/api_calling.dart';
import '../HomeScreenNotifier.dart'; import '../HomeScreenNotifier.dart';
class crmProspectDetailsProvider extends ChangeNotifier { class crmProspectDetailsProvider extends ChangeNotifier {
List<Leads> _leadsList = []; List<Leads> _leadsList = [];
List<Contacts> _contactsList = []; List<Contacts> _contactsList = [];
List<Orders> _ordersList = []; List<Orders> _ordersList = [];
...@@ -32,7 +30,8 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -32,7 +30,8 @@ class crmProspectDetailsProvider extends ChangeNotifier {
TextEditingController editNameController = TextEditingController(); TextEditingController editNameController = TextEditingController();
TextEditingController editDesignationController = TextEditingController(); TextEditingController editDesignationController = TextEditingController();
TextEditingController editMobileNumberController = TextEditingController(); TextEditingController editMobileNumberController = TextEditingController();
TextEditingController editAlternativeMobileController = TextEditingController(); TextEditingController editAlternativeMobileController =
TextEditingController();
TextEditingController editTelephoneController = TextEditingController(); TextEditingController editTelephoneController = TextEditingController();
TextEditingController editEmailController = TextEditingController(); TextEditingController editEmailController = TextEditingController();
TextEditingController dateController = TextEditingController(); TextEditingController dateController = TextEditingController();
...@@ -59,103 +58,131 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -59,103 +58,131 @@ class crmProspectDetailsProvider extends ChangeNotifier {
List<String> _subHeadings = []; List<String> _subHeadings = [];
DateTime? _date; DateTime? _date;
String? _formattedDate; String? _formattedDate;
String? _formattedDateToSend;
String? get formattedDateToSend => _formattedDateToSend;
bool get showMoreDetails => _showMoreDetails; bool get showMoreDetails => _showMoreDetails;
get showTransferAccount => _transferAccount; get showTransferAccount => _transferAccount;
List<Leads> get leadList => _leadsList; List<Leads> get leadList => _leadsList;
List<Contacts> get contactList => _contactsList; List<Contacts> get contactList => _contactsList;
List<Orders> get ordersList => _ordersList;
List<Orders> get ordersList => _ordersList;
List<Payments> get paymentsList => _paymentsList; List<Payments> get paymentsList => _paymentsList;
AccountDetails get accountDetails => _accountDetails; AccountDetails get accountDetails => _accountDetails;
String? get nameError => _nameError; String? get nameError => _nameError;
String? get designationError => _designationError; String? get designationError => _designationError;
String? get mobileNumError => _mobileNumError; String? get mobileNumError => _mobileNumError;
String? get altMobError => _altMobError; String? get altMobError => _altMobError;
String? get teleError => _teleError; String? get teleError => _teleError;
String? get emailError => _emailError; String? get emailError => _emailError;
String? get noteError => _noteError; String? get noteError => _noteError;
String? get editNameError => _editNameError; String? get editNameError => _editNameError;
String? get editDesignationError => _editDesignationError; String? get editDesignationError => _editDesignationError;
String? get editMobileNumError => _editMobileNumError; String? get editMobileNumError => _editMobileNumError;
String? get editAltMobError => _editAltMobError; String? get editAltMobError => _editAltMobError;
String? get editTeleError => _editTeleError; String? get editTeleError => _editTeleError;
String? get editEmailError => _editEmailError; String? get editEmailError => _editEmailError;
String? get dateError => _dateError; String? get dateError => _dateError;
bool get isLoading => _isLoading; bool get isLoading => _isLoading;
List<String> get Headings => _headings; List<String> get Headings => _headings;
List<String> get subHeadings => _subHeadings; List<String> get subHeadings => _subHeadings;
String? get formattedDate => _formattedDate; String? get formattedDate => _formattedDate;
set showMoreDetails(bool value){ set showMoreDetails(bool value) {
_showMoreDetails = value; _showMoreDetails = value;
notifyListeners(); notifyListeners();
} }
set nameError(String? value){ set nameError(String? value) {
_nameError = value; _nameError = value;
notifyListeners(); notifyListeners();
} }
set designationError(String? value){
set designationError(String? value) {
_designationError = value; _designationError = value;
notifyListeners(); notifyListeners();
} }
set mobileNumError(String? value){
set mobileNumError(String? value) {
_mobileNumError = value; _mobileNumError = value;
notifyListeners(); notifyListeners();
} }
set altMobError(String? value){
set altMobError(String? value) {
_altMobError = value; _altMobError = value;
notifyListeners(); notifyListeners();
} }
set teleError(String? value){
set teleError(String? value) {
_teleError = value; _teleError = value;
notifyListeners(); notifyListeners();
} }
set emailError(String? value){
set emailError(String? value) {
_emailError = value; _emailError = value;
notifyListeners(); notifyListeners();
} }
set noteError(String? value){ set noteError(String? value) {
_noteError = value; _noteError = value;
notifyListeners(); notifyListeners();
} }
set editNameError(String? value) {
set editNameError(String? value){
_editNameError = value; _editNameError = value;
notifyListeners(); notifyListeners();
} }
set editDesignationError(String? value){
set editDesignationError(String? value) {
_editDesignationError = value; _editDesignationError = value;
notifyListeners(); notifyListeners();
} }
set editMobileNumError(String? value){
set editMobileNumError(String? value) {
_editMobileNumError = value; _editMobileNumError = value;
notifyListeners(); notifyListeners();
} }
set editAltMobError(String? value){
set editAltMobError(String? value) {
_editAltMobError = value; _editAltMobError = value;
notifyListeners(); notifyListeners();
} }
set editTeleError(String? value){
set editTeleError(String? value) {
_editTeleError = value; _editTeleError = value;
notifyListeners(); notifyListeners();
} }
set editEmailError(String? value){
set editEmailError(String? value) {
_editEmailError = value; _editEmailError = value;
notifyListeners(); notifyListeners();
} }
set isLoading(bool value){ set isLoading(bool value) {
_isLoading = value; _isLoading = value;
notifyListeners(); notifyListeners();
} }
...@@ -167,14 +194,15 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -167,14 +194,15 @@ class crmProspectDetailsProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
set dateError(value){ set dateError(value) {
_dateError = value; _dateError = value;
notifyListeners(); notifyListeners();
} }
void setDate(DateTime newDate) { void setDate(DateTime newDate) {
_date = 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!; dateController.text = _formattedDate!;
_dateError = null; _dateError = null;
notifyListeners(); notifyListeners();
...@@ -194,7 +222,7 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -194,7 +222,7 @@ class crmProspectDetailsProvider extends ChangeNotifier {
if (data.error == "0") { if (data.error == "0") {
_leadsList = data.leads!; _leadsList = data.leads!;
_accountDetails = data.accountDetails!; _accountDetails = data.accountDetails!;
_contactsList =data.contacts!; _contactsList = data.contacts!;
_ordersList = data.orders!; _ordersList = data.orders!;
_paymentsList = data.payments!; _paymentsList = data.payments!;
_headings = [ _headings = [
...@@ -217,31 +245,31 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -217,31 +245,31 @@ class crmProspectDetailsProvider extends ChangeNotifier {
]; ];
_transferAccount = data.showTransfeLeadButton; _transferAccount = data.showTransfeLeadButton;
_subHeadings = [ _subHeadings = [
data.accountDetails!.name??"-", data.accountDetails!.name ?? "-",
data.accountDetails!.accManager??"-", data.accountDetails!.accManager ?? "-",
data.accountDetails!.owner??"-", data.accountDetails!.owner ?? "-",
data.accountDetails!.address??"-", data.accountDetails!.address ?? "-",
data.accountDetails!.state??"-", data.accountDetails!.state ?? "-",
data.accountDetails!.district??"-", data.accountDetails!.district ?? "-",
data.accountDetails!.subLocality??"-", data.accountDetails!.subLocality ?? "-",
data.accountDetails!.pincode??"-", data.accountDetails!.pincode ?? "-",
data.accountDetails!.source??"-", data.accountDetails!.source ?? "-",
data.accountDetails!.reference??"-", data.accountDetails!.reference ?? "-",
data.accountDetails!.team??"-", data.accountDetails!.team ?? "-",
data.accountDetails!.segment??"-", data.accountDetails!.segment ?? "-",
"${data.accountDetails!.aage ?? "-"} days old", "${data.accountDetails!.aage ?? "-"} days old",
]; ];
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
...@@ -251,12 +279,15 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -251,12 +279,15 @@ class crmProspectDetailsProvider extends ChangeNotifier {
} }
} }
Future<void> crmCheckFields(context, value, type) async {
Future<void> crmCheckFields(context,value,type) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); 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 != null) {
if (data.error == "0") { if (data.error == "0") {
...@@ -264,43 +295,55 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -264,43 +295,55 @@ class crmProspectDetailsProvider extends ChangeNotifier {
mobileNumError = null; mobileNumError = null;
altMobError = null; altMobError = null;
notifyListeners(); notifyListeners();
}else if(data.error=="1"){ } else if (data.error == "1") {
if(type=="name"){ if (type == "name") {
nameError = data.message!; nameError = data.message!;
}else if(type == 'mob1'){ } else if (type == 'mob1') {
mobileNumError = data.message!; mobileNumError = data.message!;
}else if(type == 'mob2'){ } else if (type == 'mob2') {
altMobError = data.message!; altMobError = data.message!;
} }
notifyListeners(); notifyListeners();
} }
}else{ } else {
notifyListeners(); notifyListeners();
} }
} catch (e, s) { } catch (e, s) {
notifyListeners(); notifyListeners();
} }
} }
Future<void> crmProspectDetailsAddContactAPIFunction(context, accID) async { Future<void> crmProspectDetailsAddContactAPIFunction(context, accID) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); if (!AddContactValidation()) {
final data = await ApiCalling.crmProspectDetailsAddAccountAPI(prov.empId, prov.session, accID, return;
nameController.text, mobileNumberController.text, designationController.text, alternativeMobileController.text, telephoneController.text, emailController.text); }
_isLoading = true; _isLoading = true;
notifyListeners(); 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 != null) {
if (data.error == "0") { if (data.error == "0") {
Navigator.pop(context,true); Navigator.pop(context, true);
resetAll(); resetAll();
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
...@@ -310,25 +353,43 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -310,25 +353,43 @@ class crmProspectDetailsProvider extends ChangeNotifier {
} }
} }
Future<void> crmProspectDetailsEditContactAPIFunction(context,contactID,accID) async { Future<void> crmProspectDetailsEditContactAPIFunction(
context,
contactID,
accID,
) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); if (!editContactValidation()) {
final data = await ApiCalling.crmProspectDetailsEditContactAPI(prov.empId, prov.session, contactID, return;
nameController.text,accID, mobileNumberController.text, designationController.text, alternativeMobileController.text, telephoneController.text, emailController.text); }
_isLoading = true; _isLoading = true;
notifyListeners(); 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 != null) {
if (data.error == "0") { if (data.error == "0") {
_isLoading = false; _isLoading = false;
Navigator.pop(context,true); Navigator.pop(context, true);
resetAll(); resetAll();
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
}else{ } else {
_isLoading = false; _isLoading = false;
notifyListeners(); notifyListeners();
} }
...@@ -338,128 +399,239 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -338,128 +399,239 @@ class crmProspectDetailsProvider extends ChangeNotifier {
} }
} }
void showDatePickerDialog(BuildContext context) { void showDatePickerDialog(BuildContext context) {
showCupertinoModalPopup<void>( showCupertinoModalPopup<void>(
context: context, context: context,
builder: builder:
(BuildContext context) => Container( (BuildContext context) => Container(
height: 216, height: 216,
padding: const EdgeInsets.only(top: 6.0), padding: const EdgeInsets.only(top: 6.0),
margin: EdgeInsets.only( margin: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom, bottom: MediaQuery.of(context).viewInsets.bottom,
), ),
color: CupertinoColors.systemBackground.resolveFrom(context), color: CupertinoColors.systemBackground.resolveFrom(context),
child: SafeArea( child: SafeArea(
top: false, top: false,
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
CupertinoButton( CupertinoButton(
child: Text( child: Text(
'Cancel', 'Cancel',
style: TextStyle(fontFamily: "JakartaMedium",color: AppColors.app_blue), style: TextStyle(
), fontFamily: "JakartaMedium",
onPressed: () { color: AppColors.app_blue,
Navigator.pop(context); ),
}, ),
), onPressed: () {
CupertinoButton( Navigator.pop(context);
child: Text( },
'Done', ),
style: TextStyle(fontFamily: "JakartaMedium",color: AppColors.app_blue), CupertinoButton(
), child: Text(
onPressed: () { 'Done',
setDate(_date ?? DateTime.now() ); style: TextStyle(
Navigator.pop(context); fontFamily: "JakartaMedium",
}, color: AppColors.app_blue,
),
),
onPressed: () {
setDate(_date ?? DateTime.now());
Navigator.pop(context);
},
),
],
), ),
], ),
), ),
), Expanded(
), flex: 3,
Expanded( child: CupertinoDatePicker(
flex: 3, dateOrder: DatePickerDateOrder.dmy,
child: CupertinoDatePicker( initialDateTime: _date ?? DateTime.now(),
dateOrder: DatePickerDateOrder.dmy, minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day),
initialDateTime: _date ?? DateTime.now(), mode: CupertinoDatePickerMode.date,
mode: CupertinoDatePickerMode.date, use24hFormat: true,
use24hFormat: true, showDayOfWeek: true,
showDayOfWeek: true, onDateTimeChanged: (DateTime newDate) {
onDateTimeChanged: (DateTime newDate) { setDate(newDate);
setDate(newDate); },
}, ),
), ),
],
), ),
], ),
), ),
),
),
); );
} }
void onChangeName(value){ void onChangeName(value) {
_nameError = ""; _nameError = "";
notifyListeners(); notifyListeners();
} }
void onChangeDesignation(value){
void onChangeDesignation(value) {
_designationError = ""; _designationError = "";
notifyListeners(); notifyListeners();
} }
void onChangeMobile(value){
void onChangeMobile(value) {
_mobileNumError = ""; _mobileNumError = "";
notifyListeners(); notifyListeners();
} }
void onChangeAltMobile(value){
void onChangeAltMobile(value) {
_altMobError = ""; _altMobError = "";
notifyListeners(); notifyListeners();
} }
void onChangeTelephone(value){
void onChangeTelephone(value) {
_teleError = ""; _teleError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEmailId(value){
void onChangeEmailId(value) {
_emailError = ""; _emailError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditName(value){ void onChangeEditName(value) {
_editNameError = ""; _editNameError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditDesignation(value){
void onChangeEditDesignation(value) {
_editDesignationError = ""; _editDesignationError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditMobile(value){
void onChangeEditMobile(value) {
_editMobileNumError = ""; _editMobileNumError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditAltMobile(value){
void onChangeEditAltMobile(value) {
_editAltMobError = ""; _editAltMobError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditTelephone(value){
void onChangeEditTelephone(value) {
_editTeleError = ""; _editTeleError = "";
notifyListeners(); notifyListeners();
} }
void onChangeEditEmailId(value){
void onChangeEditEmailId(value) {
_editEmailError = ""; _editEmailError = "";
notifyListeners(); notifyListeners();
} }
void onChangeNote(value){
void onChangeNote(value) {
_noteError = ""; _noteError = "";
notifyListeners(); 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; _showMoreDetails = false;
nameController.clear(); nameController.clear();
designationController.clear(); designationController.clear();
......
...@@ -33,8 +33,22 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -33,8 +33,22 @@ class followUpUpdateProvider extends ChangeNotifier {
DateTime? _date; DateTime? _date;
String? _formattedDate; String? _formattedDate;
String? _formattedDateToSend;
String? _dateError; 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; bool get submitLoading => _submitLoading;
TimeOfDay get selectedTime => _selectedTime; TimeOfDay get selectedTime => _selectedTime;
...@@ -60,31 +74,37 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -60,31 +74,37 @@ class followUpUpdateProvider extends ChangeNotifier {
set selectedFollowupType(String? value) { set selectedFollowupType(String? value) {
_selectedFollowupType = value; _selectedFollowupType = value;
followupError = null;
notifyListeners(); notifyListeners();
} }
set selectedLeadStatus(String? value) { set selectedLeadStatus(String? value) {
_selectedLeadStatus = value; _selectedLeadStatus = value;
leadStatusError = null;
notifyListeners(); notifyListeners();
} }
set nextAppointmentStatus(String? value) { set nextAppointmentStatus(String? value) {
_nextAppointmentStatus = value; _nextAppointmentStatus = value;
appStatusError = null;
notifyListeners(); notifyListeners();
} }
set selectNextAppointmentType(String? value) { set selectNextAppointmentType(String? value) {
_selectNextAppointmentType = value; _selectNextAppointmentType = value;
nextAppType = null;
notifyListeners(); notifyListeners();
} }
set selectOrderStatus(String? value) { set selectOrderStatus(String? value) {
_selectOrderStatus = value; _selectOrderStatus = value;
orderStatusError = null;
notifyListeners(); notifyListeners();
} }
set selectedCompetitor(String? value) { set selectedCompetitor(String? value) {
_selectedCompetitor = value; _selectedCompetitor = value;
competitorError = null;
notifyListeners(); notifyListeners();
} }
...@@ -109,11 +129,13 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -109,11 +129,13 @@ class followUpUpdateProvider extends ChangeNotifier {
_formattedDate = value; _formattedDate = value;
nextAppointmentDateController.text = _formattedDate!; nextAppointmentDateController.text = _formattedDate!;
_dateError = null; _dateError = null;
nextAppDateError = null;
notifyListeners(); notifyListeners();
} }
set dateError(value) { set dateError(value) {
_dateError = value; _dateError = value;
nextAppDateError = value;
notifyListeners(); notifyListeners();
} }
...@@ -145,6 +167,10 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -145,6 +167,10 @@ class followUpUpdateProvider extends ChangeNotifier {
[mode] [mode]
) async { ) async {
try { try {
if(!valid()){
return;
}
_submitLoading = true; _submitLoading = true;
notifyListeners(); notifyListeners();
final prov = Provider.of<HomescreenNotifier>(context, listen: false); final prov = Provider.of<HomescreenNotifier>(context, listen: false);
...@@ -162,7 +188,7 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -162,7 +188,7 @@ class followUpUpdateProvider extends ChangeNotifier {
competitor, competitor,
reasonController.text, reasonController.text,
leadStatus, leadStatus,
nextAppointmentDateController.text, _formattedDateToSend,
appointmentType, appointmentType,
sms, sms,
noteController.text, noteController.text,
...@@ -187,9 +213,78 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -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) { void setDate(DateTime newDate) {
_date = 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!; nextAppointmentDateController.text = _formattedDate!;
_dateError = null; _dateError = null;
notifyListeners(); notifyListeners();
...@@ -272,11 +367,13 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -272,11 +367,13 @@ class followUpUpdateProvider extends ChangeNotifier {
), ),
), ),
), ),
Expanded( Expanded(
flex: 3, flex: 3,
child: CupertinoDatePicker( child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(), initialDateTime: _date ?? DateTime.now(),
minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day),
dateOrder: DatePickerDateOrder.dmy,
mode: CupertinoDatePickerMode.date, mode: CupertinoDatePickerMode.date,
use24hFormat: true, use24hFormat: true,
showDayOfWeek: true, showDayOfWeek: true,
...@@ -292,14 +389,28 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -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(){ void resetForm(){
nextAppointmentDateController.clear(); nextAppointmentDateController.clear();
_formattedDateToSend = null;
_formattedDate = null;
_date = null;
followUpFeedbackController.clear(); followUpFeedbackController.clear();
noteController.clear(); noteController.clear();
reasonController.clear(); reasonController.clear();
...@@ -309,6 +420,16 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -309,6 +420,16 @@ class followUpUpdateProvider extends ChangeNotifier {
_selectNextAppointmentType = null; _selectNextAppointmentType = null;
_selectOrderStatus = null; _selectOrderStatus = null;
_selectedCompetitor = null; _selectedCompetitor = null;
followupError = null;
followupFeedbackError = null;
leadStatusError = null;
appStatusError = null;
nextAppDateError = null;
nextAppType = null;
noteError = null;
orderStatusError = null;
competitorError = null;
reasonError = null;
notifyListeners(); notifyListeners();
} }
} }
...@@ -18,4 +18,13 @@ class AppColors { ...@@ -18,4 +18,13 @@ class AppColors {
static Color text_field_color = Color(0xFFF0F4F5); static Color text_field_color = Color(0xFFF0F4F5);
static Color overlay_box_color = Color(0xFFE6F6FF); static Color overlay_box_color = Color(0xFFE6F6FF);
static Color ERP_text_color = Color(0xFF2D357F); 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
...@@ -136,9 +136,10 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -136,9 +136,10 @@ class _MyHomePageState extends State<MyHomePage> {
return (connection == 'Online') return (connection == 'Online')
? Consumer2<HomescreenNotifier, ProfileNotifer>( ? Consumer2<HomescreenNotifier, ProfileNotifer>(
builder: (context, homescreen, profile, child) { builder: (context, homescreen, profile, child) {
final coreRequiredRoles = ["433", "434", "430", "430"]; final coreRequiredRoles = ["430", "430","433", "434", ];
final requiredRoles = ["430", "430", "431", "431"]; 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 names = ["Attendance", "Finance", "ERP", "Whizzdom"];
final subtitles = [ final subtitles = [
"Check-in,Check-out", "Check-in,Check-out",
...@@ -147,10 +148,11 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -147,10 +148,11 @@ class _MyHomePageState extends State<MyHomePage> {
"Training, Assessments", "Training, Assessments",
]; ];
final coreIcons = [ 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_crm_ic.svg",
"assets/svg/home/home_order_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 = [ final icons = [
"assets/svg/home/home_attendance_ic.svg", "assets/svg/home/home_attendance_ic.svg",
...@@ -158,6 +160,12 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -158,6 +160,12 @@ class _MyHomePageState extends State<MyHomePage> {
"assets/svg/home/home_erp_ic.svg", "assets/svg/home/home_erp_ic.svg",
"assets/svg/home/home_whizzdom_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 coreFilteredItems = <Map<String, String>>[];
final filteredItems = <Map<String, String>>[]; final filteredItems = <Map<String, String>>[];
...@@ -176,6 +184,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -176,6 +184,7 @@ class _MyHomePageState extends State<MyHomePage> {
coreFilteredItems.add({ coreFilteredItems.add({
'name': coreNames[i], 'name': coreNames[i],
'icon': coreIcons[i], 'icon': coreIcons[i],
'subtitle': coreSubtitles[i],
}); });
} }
} }
...@@ -412,18 +421,161 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -412,18 +421,161 @@ class _MyHomePageState extends State<MyHomePage> {
Expanded( Expanded(
flex: 10, flex: 10,
child: Container( 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( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (coreFilteredItems.isNotEmpty) ...[ // if (coreFilteredItems.isNotEmpty) ...[
Padding( // 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( padding: const EdgeInsets.only(
top: 10, top: 10,
bottom: 5, bottom: 5,
), ),
margin: EdgeInsets.symmetric(
horizontal: 10,
),
child: Text( child: Text(
"Core Functionalities", "Workforce & Operations",
style: TextStyle( style: TextStyle(
color: AppColors.grey_thick, color: AppColors.grey_thick,
fontSize: 14, fontSize: 14,
...@@ -436,65 +588,108 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -436,65 +588,108 @@ class _MyHomePageState extends State<MyHomePage> {
vertical: 10, vertical: 10,
horizontal: 15, horizontal: 15,
), ),
margin: EdgeInsets.symmetric(
horizontal: 10,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(14), borderRadius: BorderRadius.circular(14),
), ),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
children: List.generate(4, (ic) { children: List.generate(4, (ic) {
return Expanded( return Expanded(
child: InkResponse( child: InkResponse(
onTap: () async { onTap: () async {
var res; var res;
switch (coreFilteredItems[ic]['name']) { switch (filteredItems[ic]['name']) {
case "Gen Tracker": case "Attendance":
res = await Navigator.push( res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => (context) =>
Gentrackerdashboard(), AttendanceScreen(),
settings: RouteSettings( settings: RouteSettings(
arguments: arguments:
'Gentrackerdashboard', 'AttendanceScreen',
), ),
), ),
); );
break; break;
case "Service": case "ERP":
res = await Navigator.push( bool isGpsEnabled =
context, await Geolocator.isLocationServiceEnabled();
MaterialPageRoute( if (isGpsEnabled) {
builder: if (Platform.isAndroid) {
(context) => res = await Navigator.push(
Serviceengineerdashboard(), 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; break;
case "Orders": case "Whizzdom":
res = await Navigator.push( bool isGpsEnabled =
context, await Geolocator.isLocationServiceEnabled();
MaterialPageRoute( if (isGpsEnabled) {
builder: res = await Navigator.push(
(context) => context,
Ordermoduledashboard(), MaterialPageRoute(
), builder:
); (
case "CRM": context,
) => WebWhizzdomScreen(
whizzdom_url:
homescreen
.whizzdomPageUrl,
),
),
);
} else {
requestGpsPermission();
}
break;
case "Finance":
res = await Navigator.push( res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => (context) =>
CrmdashboardScreen(), Financedashboard(),
settings: RouteSettings( settings: RouteSettings(
name: arguments:
'CrmdashboardScreen', 'Financedashboard',
), ),
), ),
); );
break;
default: default:
print("111"); print("111");
break; break;
...@@ -508,25 +703,25 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -508,25 +703,25 @@ class _MyHomePageState extends State<MyHomePage> {
child: SizedBox( child: SizedBox(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
coreFilteredItems[ic]['icon'] ?? filteredItems[ic]['icon'] ??
"-", "-",
), ),
SizedBox(height: 10), SizedBox(height: 10),
Text( Text(
coreFilteredItems[ic]['name'] ?? filteredItems[ic]['name'] ??
"-", "-",
maxLines: 2, maxLines: 2,
textAlign: textAlign:
TextAlign.center, TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontFamily: fontFamily:
"JakartaMedium", "JakartaMedium",
), ),
), ),
], ],
...@@ -539,10 +734,14 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -539,10 +734,14 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
], ],
if (homescreen.roleStatus.contains( if (homescreen.roleStatus.contains(
"432", "432",
)) ...[ )) ...[
Padding( Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
),
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 10, top: 10,
bottom: 5, bottom: 5,
...@@ -572,6 +771,9 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -572,6 +771,9 @@ class _MyHomePageState extends State<MyHomePage> {
} }
}, },
child: Container( child: Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 15, vertical: 15,
horizontal: 15, horizontal: 15,
...@@ -630,14 +832,225 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -630,14 +832,225 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
], ],
if (filteredItems.isNotEmpty) ...[ // if (filteredItems.isNotEmpty) ...[
Padding( // 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( padding: const EdgeInsets.only(
top: 10, top: 10,
bottom: 5, bottom: 5,
), ),
child: Text( child: Text(
"Workforce & Operations", "Core Functionalities",
style: TextStyle( style: TextStyle(
color: AppColors.grey_thick, color: AppColors.grey_thick,
fontSize: 14, fontSize: 14,
...@@ -645,105 +1058,69 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -645,105 +1058,69 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
), ),
Expanded( Container(
margin: EdgeInsets.symmetric(
horizontal: 5,
),
child: GridView.builder( child: GridView.builder(
itemCount: filteredItems.length, shrinkWrap: true,
itemCount: coreFilteredItems.length,
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount( SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
childAspectRatio: 2 / 1.1, childAspectRatio: 2 / 1.1,
), ),
itemBuilder: (context, ci) { itemBuilder: (context, ci) {
return InkResponse( return InkResponse(
onTap: () async { onTap: () async {
var res; var res;
switch (filteredItems[ci]['name']) { switch (coreFilteredItems[ci]['name']) {
case "Attendance": case "Gen Tracker":
res = await Navigator.push( res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => (context) =>
AttendanceScreen(), Gentrackerdashboard(),
settings: RouteSettings( settings: RouteSettings(
arguments: arguments:
'AttendanceScreen', 'Gentrackerdashboard',
), ),
), ),
); );
break; break;
case "ERP": case "Service":
bool isGpsEnabled = res = await Navigator.push(
await Geolocator.isLocationServiceEnabled(); context,
if (isGpsEnabled) { MaterialPageRoute(
if (Platform.isAndroid) { builder:
res = await Navigator.push( (context) =>
context, Serviceengineerdashboard(),
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; break;
case "Finance": case "Orders":
res = await Navigator.push( res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => (context) =>
Financedashboard(), Ordermoduledashboard(),
),
);
case "CRM":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
CrmdashboardScreen(),
settings: RouteSettings( settings: RouteSettings(
arguments: name:
'Financedashboard', 'CrmdashboardScreen',
), ),
), ),
); );
break;
default: default:
print("111"); print("111");
break; break;
...@@ -767,47 +1144,47 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -767,47 +1144,47 @@ class _MyHomePageState extends State<MyHomePage> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: borderRadius:
BorderRadius.circular(14), BorderRadius.circular(14),
), ),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
flex: 2, flex: 2,
child: SizedBox( child: SizedBox(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment CrossAxisAlignment
.start, .start,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment MainAxisAlignment
.center, .center,
children: [ children: [
Text( Text(
filteredItems[ci]['name'] ?? coreFilteredItems[ci]['name'] ??
"-", "-",
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: color:
AppColors AppColors
.app_blue, .app_blue,
fontFamily: fontFamily:
"JakartaMedium", "JakartaMedium",
), ),
), ),
Text( Text(
filteredItems[ci]['subtitle'] ?? coreFilteredItems[ci]['subtitle'] ??
"-", "-",
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: color:
AppColors AppColors
.grey_semi, .grey_semi,
fontFamily: fontFamily:
"JakartaMedium", "JakartaMedium",
), ),
), ),
], ],
...@@ -1053,6 +1430,16 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -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",
),
),
), ),
), ),
), ),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -63,7 +63,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -63,7 +63,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
"", "",
"", "",
"", "",
"A", "",
); );
} else { } else {
provider.crmLeadListAPIFunction( provider.crmLeadListAPIFunction(
...@@ -75,7 +75,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -75,7 +75,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
"", "",
"", "",
"", "",
"A", "",
); );
} }
}); });
...@@ -948,7 +948,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -948,7 +948,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
// ); // );
// } // }
Future<void> _showFilterSheetNew(BuildContext context) { Future<void> _showFilterSheetNew1(BuildContext context) {
List<bool> isSelected = List.generate( List<bool> isSelected = List.generate(
9, 9,
(index) => index == 0 ? true : false, (index) => index == 0 ? true : false,
...@@ -976,7 +976,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -976,7 +976,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
(element) => element == true, (element) => element == true,
); );
final headings = [ final headings = [
"Alphabet",
"Lead Status", "Lead Status",
"Open/Close Status", "Open/Close Status",
"Mobile Number", "Mobile Number",
...@@ -986,7 +985,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -986,7 +985,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
"Team", "Team",
"Segment", "Segment",
]; ];
if(widget.mode!="executive"){ if (widget.mode != "executive") {
headings.add("Employee"); headings.add("Employee");
} }
return Container( return Container(
...@@ -995,7 +994,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -995,7 +994,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(left: 15), padding: EdgeInsets.only(left: 15),
child: Text( child: Text(
...@@ -1013,7 +1011,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1013,7 +1011,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
top: BorderSide(color: const Color(0xFFA5DAF9)), top: BorderSide(
color: const Color(0xFFA5DAF9),
),
bottom: BorderSide( bottom: BorderSide(
color: const Color(0xFFA5DAF9), color: const Color(0xFFA5DAF9),
), ),
...@@ -1026,8 +1026,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1026,8 +1026,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
Expanded( Expanded(
flex: 3, flex: 3,
child: Column( child: Column(
children: List.generate(headings.length, (jj) { children: List.generate(headings.length, (
jj,
) {
return Expanded( return Expanded(
child: InkResponse( child: InkResponse(
onTap: () { onTap: () {
...@@ -1042,21 +1043,20 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1042,21 +1043,20 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
}); });
}, },
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding:
vertical: 7.5, const EdgeInsets.symmetric(
horizontal: 10, vertical: 7.5,
), horizontal: 10,
),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
left: left:
isSelected[jj] isSelected[jj]
? BorderSide( ? BorderSide(
color: color:
AppColors AppColors
.app_blue, .app_blue,
width: 5.0, width: 5.0,
) )
: const BorderSide( : const BorderSide(
color: color:
...@@ -1064,7 +1064,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1064,7 +1064,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
.transparent, .transparent,
), ),
bottom: bottom:
jj == headings.length - 1 jj == headings.length - 1
? const BorderSide( ? const BorderSide(
color: color:
Colors Colors
...@@ -1084,7 +1084,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1084,7 +1084,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontFamily: "JakartaRegular", fontFamily:
"JakartaRegular",
color: AppColors.semi_black, color: AppColors.semi_black,
), ),
), ),
...@@ -1109,47 +1110,22 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1109,47 +1110,22 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (selectedIndex == 0) ...[ if (selectedIndex == 0) ...[
...provider.alphabetList.map(( ...provider.leadStatusList.map((
status, status,
) { ) {
return SizedBox( return SizedBox(
height: 35, height: 35,
child: CheckboxListTile( child: CheckboxListTile(
activeColor:
activeColor: AppColors.app_blue, AppColors.app_blue,
controlAffinity: ListTileControlAffinity.leading, controlAffinity:
checkboxShape: CircleBorder(side: BorderSide(width:0.5)), ListTileControlAffinity
title: Text( .leading,
status!, checkboxShape: CircleBorder(
style: const TextStyle( side: BorderSide(
fontSize: 14, 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( title: Text(
status!, status!,
style: const TextStyle( style: const TextStyle(
...@@ -1157,30 +1133,46 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1157,30 +1133,46 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
), ),
value: value:
provider.selectedLeadStatus == provider
.selectedLeadStatus ==
status, status,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { setState(() {
if (value == true) { if (value == true) {
provider.selectedLeadStatus = provider.selectedLeadStatus =
status; status;
} else {
provider.selectedLeadStatus =
null;
} }
print(
provider
.selectedLeadStatus,
);
}); });
}, },
contentPadding: EdgeInsets.zero, contentPadding:
EdgeInsets.zero,
), ),
); );
}).toList(), }).toList(),
] else if (selectedIndex == 2) ...[ ] else if (selectedIndex == 1) ...[
...provider.openStatusList.map(( ...provider.openStatusList.map((
status, status,
) { ) {
return SizedBox( return SizedBox(
height: 35, height: 35,
child: CheckboxListTile( child: CheckboxListTile(
activeColor: AppColors.app_blue, activeColor:
controlAffinity: ListTileControlAffinity.leading, AppColors.app_blue,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )), controlAffinity:
ListTileControlAffinity
.leading,
checkboxShape: CircleBorder(
side: BorderSide(
width: 0.5,
),
),
title: Text( title: Text(
status!, status!,
style: const TextStyle( style: const TextStyle(
...@@ -1188,21 +1180,26 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1188,21 +1180,26 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
), ),
value: value:
provider.selectedOpenStatus == provider
.selectedOpenStatus ==
status, status,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { setState(() {
if (value == true) { if (value == true) {
provider.selectedOpenStatus = provider.selectedOpenStatus =
status; status;
} else {
provider.selectedOpenStatus =
null;
} }
}); });
}, },
contentPadding: EdgeInsets.zero, contentPadding:
EdgeInsets.zero,
), ),
); );
}).toList(), }).toList(),
] else if (selectedIndex == 3) ...[ ] else if (selectedIndex == 2) ...[
textControllerWidget( textControllerWidget(
context, context,
provider.mobileNumberController, provider.mobileNumberController,
...@@ -1214,7 +1211,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1214,7 +1211,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
FilteringTextInputFormatter FilteringTextInputFormatter
.digitsOnly, .digitsOnly,
), ),
] else if (selectedIndex == 4) ...[ ] else if (selectedIndex == 3) ...[
textControllerWidget( textControllerWidget(
context, context,
provider.companyNameController, provider.companyNameController,
...@@ -1225,14 +1222,23 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1225,14 +1222,23 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
false, false,
null, null,
), ),
] else if (selectedIndex == 5) ...[ ] else if (selectedIndex == 4) ...[
...provider.sourcesList.map((source) { ...provider.sourcesList.map((
source,
) {
return SizedBox( return SizedBox(
height: 35, height: 35,
child: CheckboxListTile( child: CheckboxListTile(
activeColor: AppColors.app_blue, activeColor:
controlAffinity: ListTileControlAffinity.leading, AppColors.app_blue,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )), controlAffinity:
ListTileControlAffinity
.leading,
checkboxShape: CircleBorder(
side: BorderSide(
width: 0.5,
),
),
title: Text( title: Text(
source.name!, source.name!,
style: const TextStyle( style: const TextStyle(
...@@ -1251,6 +1257,24 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1251,6 +1257,24 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
source.id!; source.id!;
provider.selectedSourceValue = provider.selectedSourceValue =
source.name!; 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 // Call API if needed
provider provider
...@@ -1262,170 +1286,869 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1262,170 +1286,869 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
); );
}); });
}, },
contentPadding: EdgeInsets.zero, contentPadding:
EdgeInsets.zero,
), ),
); );
}).toList(), }).toList(),
] 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,
),
),
title: Text(
reference.name!,
style: const TextStyle(
fontSize: 14,
),
),
value:
provider
.selectedReference ==
reference,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedReference =
reference;
provider.selectedReferenceId =
reference.id!;
provider.selectedReferenceValue =
reference.name!;
} else {
provider
.referencesList
.clear();
provider.selectedReferenceId =
null;
provider.selectedReferenceValue =
null;
}
});
},
contentPadding:
EdgeInsets.zero,
),
);
}).toList(),
],
] else if (selectedIndex == 6) ...[ ] else if (selectedIndex == 6) ...[
if(provider.referencesList.isEmpty)...[ ...provider.teamsList.map((team) {
errorWidget(context, "Please Select Source First"),
]else...[
...provider.referencesList.map((
reference,
) {
return SizedBox( return SizedBox(
height: 35, height: 35,
child: CheckboxListTile( child: CheckboxListTile(
activeColor: AppColors.app_blue, activeColor:
controlAffinity: ListTileControlAffinity.leading, AppColors.app_blue,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
title: Text( title: Text(
reference.name!, team.name!,
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
controlAffinity:
ListTileControlAffinity
.leading,
checkboxShape: CircleBorder(
side: BorderSide(
width: 0.5,
),
),
value: value:
provider.selectedReference == provider.selectedTeam ==
reference, team,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { setState(() {
if (value == true) { if (value == true) {
provider.selectedReference = provider.selectedTeam =
reference; team;
provider.selectedReferenceId = provider.selectedTeamId =
reference.id!; team.id!;
provider.selectedReferenceValue = provider.selectedTeamValue =
reference.name!; 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,
);
}); });
}, },
contentPadding: EdgeInsets.zero, contentPadding:
EdgeInsets.zero,
), ),
); );
}).toList(), }).toList(),
]
] else if (selectedIndex == 7) ...[ ] else if (selectedIndex == 7) ...[
...provider.teamsList.map((team) { 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,
),
),
title: Text(
segment.name!,
style: const TextStyle(
fontSize: 14,
),
),
value:
provider
.selectedSegment ==
segment,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedSegment =
segment;
provider.selectedSegmentId =
segment.id!;
provider.selectedSegmentValue =
segment.name!;
} else {
provider.segmentsList
.clear();
provider.selectedSegmentId =
null;
provider.selectedSegmentValue =
null;
}
});
},
contentPadding:
EdgeInsets.zero,
),
);
}).toList(),
],
] else if (widget.mode !=
"executive") ...[
...provider.employeesList.map((
employee,
) {
return SizedBox( return SizedBox(
height: 35, height: 35,
child: CheckboxListTile( child: CheckboxListTile(
activeColor: AppColors.app_blue, activeColor:
AppColors.app_blue,
controlAffinity:
ListTileControlAffinity
.leading,
checkboxShape: CircleBorder(
side: BorderSide(
width: 0.5,
),
),
title: Text( title: Text(
team.name!, employee.name!,
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
value: value:
provider.selectedTeam == team, provider
.selectedEmployee ==
employee,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { setState(() {
if (value == true) { if (value == true) {
provider.selectedTeam = provider.selectedEmployee =
team; employee;
provider.selectedTeamId = provider.selectedEmployeeId =
team.id!; employee.id!;
provider.selectedTeamValue = provider.selectedEmployeeValue =
team.name!; employee.name!;
} }
provider provider
.crmLeadListSegmentOnTeamAPIFunction( .crmLeadListSourceOnReferenceAPIFunction(
context, context,
widget.mode, widget.mode,
provider.selectedTeamId, provider
.selectedSourceId,
); );
}); });
}, },
contentPadding: EdgeInsets.zero, contentPadding:
EdgeInsets.zero,
), ),
); );
}).toList(), }).toList(),
] else if (selectedIndex == 8) ...[ ],
if(provider.segmentsList.isEmpty)...[ ],
errorWidget(context, "Please Select Team ID First"), ),
]else...[ ),
...provider.segmentsList.map(( ),
segment, ],
) { ),
),
),
// Search Button
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,
),
),
),
),
),
],
),
);
},
),
),
);
},
);
},
);
}
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( return SizedBox(
height: 35, height: 35,
child: CheckboxListTile( child: CheckboxListTile(
activeColor: AppColors.app_blue, activeColor:
controlAffinity: ListTileControlAffinity.leading, AppColors.app_blue,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )), controlAffinity:
ListTileControlAffinity
.leading,
checkboxShape: CircleBorder(
side: BorderSide(
width: 0.5,
),
),
title: Text( title: Text(
segment.name!, status ?? 'Unknown Status',
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
value: value:
provider.selectedSegment == provider
segment, .selectedLeadStatus ==
status,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { setState(() {
if (value == true) { provider.selectedLeadStatus =
provider.selectedSegment = value == true ? status : null;
segment;
provider.selectedSegmentId =
segment.id!;
provider.selectedSegmentValue =
segment.name!;
}
}); });
}, },
contentPadding: EdgeInsets.zero, contentPadding:
EdgeInsets.zero,
), ),
); );
}).toList(), }).toList(),
], ] else if (selectedIndex == 1) ...[
] else if (widget.mode != "executive") ...[ ...provider.openStatusList.map((
...provider.employeesList.map(( status,
employee, ) {
) {
return SizedBox( return SizedBox(
height: 35, height: 35,
child: CheckboxListTile( child: CheckboxListTile(
activeColor: AppColors.app_blue, activeColor:
controlAffinity: ListTileControlAffinity.leading, AppColors.app_blue,
controlAffinity:
ListTileControlAffinity
.leading,
checkboxShape: CircleBorder( checkboxShape: CircleBorder(
side: BorderSide(width:0.5 ) side: BorderSide(
width: 0.5,
),
), ),
title: Text( title: Text(
employee.name!, status ?? 'Unknown Status',
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
value: value:
provider.selectedEmployee == provider
employee, .selectedOpenStatus ==
status,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { setState(() {
if (value == true) { provider.selectedOpenStatus =
provider.selectedEmployee = value == true ? status : null;
employee;
provider.selectedEmployeeId =
employee.id!;
provider.selectedEmployeeValue =
employee.name!;
}
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
widget.mode,
provider
.selectedSourceId,
);
}); });
}, },
contentPadding: EdgeInsets.zero, contentPadding:
EdgeInsets.zero,
), ),
); );
}).toList(), }).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(),
], ],
], ],
), ),
...@@ -1435,7 +2158,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1435,7 +2158,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
), ),
), ),
// Search Button
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 15, horizontal: 15,
...@@ -1486,4 +2208,29 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -1486,4 +2208,29 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
}, },
); );
} }
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;
}
}
} }
// 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 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -18,8 +330,8 @@ import '../../Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart'; ...@@ -18,8 +330,8 @@ import '../../Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart';
import '../../Utils/dropdownTheme.dart'; import '../../Utils/dropdownTheme.dart';
class NearbyOpenLeads extends StatefulWidget { class NearbyOpenLeads extends StatefulWidget {
final latitude; final double? latitude;
final longitude; final double? longitude;
const NearbyOpenLeads({super.key, this.latitude, this.longitude}); const NearbyOpenLeads({super.key, this.latitude, this.longitude});
@override @override
...@@ -31,9 +343,9 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -31,9 +343,9 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
final MyConnectivity _connectivity = MyConnectivity.instance; final MyConnectivity _connectivity = MyConnectivity.instance;
Dropdowntheme ddtheme = Dropdowntheme(); Dropdowntheme ddtheme = Dropdowntheme();
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
_connectivity.initialise(); _connectivity.initialise();
_connectivity.myStream.listen((source) { _connectivity.myStream.listen((source) {
...@@ -50,13 +362,13 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -50,13 +362,13 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
super.dispose();
_connectivity.disposeStream(); _connectivity.disposeStream();
super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String connection;
switch (_source.keys.toList()[0]) { switch (_source.keys.toList()[0]) {
case ConnectivityResult.mobile: case ConnectivityResult.mobile:
connection = 'Online'; connection = 'Online';
...@@ -70,22 +382,42 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -70,22 +382,42 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
} }
return (connection == "Online") return (connection == "Online")
? Platform.isAndroid ? Platform.isAndroid
? WillPopScope( ? WillPopScope(
onWillPop: () => onBackPressed(context), onWillPop: () => onBackPressed(context),
child: SafeArea( child: SafeArea(
top: false, top: false,
bottom: true, bottom: true,
child: _scaffold(context), child: _buildScreen(context),
), ),
) )
: _scaffold(context) : _buildScreen(context)
: NoNetwork(context); : NoNetwork(context);
} }
Widget _scaffold(BuildContext context) { Widget _buildScreen(BuildContext context) {
debugPrint("Nearbygenerators widget rebuilt");
return Consumer<crmNearbyOpenLeadsProvider>( return Consumer<crmNearbyOpenLeadsProvider>(
builder: (context, provider, child) { 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( var sendWidget = GestureDetector(
onTap: () { onTap: () {
_showFilterBottomSheet(context); _showFilterBottomSheet(context);
...@@ -103,61 +435,85 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -103,61 +435,85 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
), ),
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: SafeArea( body: SafeArea(
child: Container( child: Stack(
child: SingleChildScrollView( children: [
child: Column( Container(
children: [ child: SingleChildScrollView(
ClipRRect( child: Column(
// Apply border radius using ClipRRect children: [
borderRadius: BorderRadius.only( ClipRRect(
topLeft: Radius.circular(30.0), borderRadius: BorderRadius.only(
topRight: Radius.circular(30.0), topLeft: Radius.circular(30.0),
), topRight: Radius.circular(30.0),
// padding: EdgeInsets.fromLTRB(10, 20, 10, 20), ),
child: Container( child: Container(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
child: Stack( child: Stack(
children: [ children: [
GoogleMap( GoogleMap(
myLocationEnabled: true, myLocationEnabled: true,
zoomGesturesEnabled: true, zoomGesturesEnabled: true,
zoomControlsEnabled: true, zoomControlsEnabled: true,
gestureRecognizers: { gestureRecognizers: {
Factory<OneSequenceGestureRecognizer>(
Factory<OneSequenceGestureRecognizer>( () => EagerGestureRecognizer(),
() => EagerGestureRecognizer(), ),
), Factory<PanGestureRecognizer>(
Factory<PanGestureRecognizer>( () => PanGestureRecognizer(),
() => PanGestureRecognizer(), ),
Factory<ScaleGestureRecognizer>(
() => ScaleGestureRecognizer(),
),
},
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) {
provider.mapController = controller;
},
onCameraMove: (position) {
provider.onCameraMove(context, position);
},
onTap: (position) {
provider.mapController?.hideMarkerInfoWindow(
provider.markers.isNotEmpty
? provider.markers.first.markerId
: MarkerId(''),
);
},
), ),
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);
},
), ),
], ),
), ),
), ],
), ),
], ),
), ),
), 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> { ...@@ -171,7 +527,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
isDismissible: true, isDismissible: true,
isScrollControlled: true, isScrollControlled: true,
showDragHandle: true, showDragHandle: true,
enableDrag: true, enableDrag: true,
context: context, context: context,
builder: (context) { builder: (context) {
...@@ -190,7 +545,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -190,7 +545,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom, bottom: MediaQuery.of(context).viewInsets.bottom,
), ),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
...@@ -207,7 +561,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -207,7 +561,6 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
), ),
), ),
SizedBox(height: 15), SizedBox(height: 15),
Row( Row(
children: [ children: [
Text( Text(
...@@ -228,52 +581,29 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -228,52 +581,29 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
], ],
), ),
InteractiveSlider( InteractiveSlider(
min: 1.0, min: 0.0,
max: 50.0, max: 50.0,
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 0, horizontal: 0,
vertical: 0, vertical: 0,
), ),
iconSize: 0.0, iconSize: 0.0,
initialProgress: provider.currentValue/50,
enabled: true, enabled: true,
// backgroundColor: AppColors.app_blue,
foregroundColor: AppColors.app_blue, foregroundColor: AppColors.app_blue,
segmentDividerColor: Color(0xFFF6F6F8), segmentDividerColor: Color(0xFFF6F6F8),
onChanged: (value) { onChanged: (value) {
provider.currentValue = value; setState(() {
// provider.debounce(() { provider.currentValue = value;
// 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), SizedBox(height: 30.0),
Container( Container(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
provider.debounce(() { provider.applyFilter(context, provider.currentValue);
provider.LoadNearbyOpenLeadsAPI( Navigator.pop(context);
context,
provider.currentValue,
);
Navigator.pop(context);
}, Duration(milliseconds: 500));
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
...@@ -311,4 +641,4 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> { ...@@ -311,4 +641,4 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
}, },
); );
} }
} }
\ No newline at end of file
...@@ -15,6 +15,7 @@ import 'package:generp/screens/crm/prospectLeadDetails.dart'; ...@@ -15,6 +15,7 @@ import 'package:generp/screens/crm/prospectLeadDetails.dart';
import 'package:generp/screens/crm/prospectOrderDetails.dart'; import 'package:generp/screens/crm/prospectOrderDetails.dart';
import 'package:generp/screens/crm/prospectPaymentDetails.dart'; import 'package:generp/screens/crm/prospectPaymentDetails.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../Models/crmModels/GetDistrictOnStateResponse.dart'; import '../../Models/crmModels/GetDistrictOnStateResponse.dart';
import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart'; import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart';
import '../../Models/crmModels/LeadListViewResponse.dart' show Employees; import '../../Models/crmModels/LeadListViewResponse.dart' show Employees;
...@@ -333,77 +334,98 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -333,77 +334,98 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
// ), // ),
), ),
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: Column( body: SingleChildScrollView(
children: [ child: Column(
Card( children: [
shape: RoundedRectangleBorder( Card(
borderRadius: BorderRadius.only( shape: RoundedRectangleBorder(
bottomLeft: Radius.circular(30), borderRadius: BorderRadius.only(
bottomRight: Radius.circular(30), bottomLeft: Radius.circular(30),
), bottomRight: Radius.circular(30),
),
elevation: 2,
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
), ),
Container( ),
decoration: BoxDecoration( elevation: 2,
color: Colors.white,
borderRadius: BorderRadius.vertical( child: Column(
bottom: Radius.circular(30), children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30),
),
), ),
), // margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
// margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( vertical: 10,
vertical: 10, horizontal: 10,
horizontal: 10, ),
), child: Column(
child: Column( children: [
children: [ Row(
Row( children: [
children: [ Expanded(
Expanded( flex: 1,
flex: 1, child: Container(
child: Container( height: 50,
height: 50, width: 35,
width: 35, child: SvgPicture.asset(
child: SvgPicture.asset( "assets/svg/crm/lead_details_ic.svg",
"assets/svg/crm/lead_details_ic.svg", ),
), ),
), ),
), SizedBox(width: 10),
SizedBox(width: 10), Expanded(
Expanded( flex: 4,
flex: 4, child: SizedBox(
child: SizedBox( child: Column(
child: Column( crossAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, children: [
children: [ Text(
Text( "${leadDetails.salutationName ?? "-"} ${leadDetails.name ?? "-"}",
"${leadDetails.salutationName ?? "-"} ${leadDetails.name ?? "-"}", style: TextStyle(
style: TextStyle( fontFamily: "JakartaMedium",
fontFamily: "JakartaMedium", fontSize: 14,
fontSize: 14, color: AppColors.semi_black,
color: AppColors.semi_black, ),
), ),
), ],
], ),
), ),
), ),
),
if (provider.showTransferAccount == "1") ...[
if (provider.showTransferAccount == "1") ...[ SizedBox(width: 5),
Expanded(
flex: 1,
child: InkResponse(
onTap: () async {
_showTransferAccountSheet(
context,
provider.accountDetails.id!,
);
},
child: Container(
height: 32,
width: 30,
padding: EdgeInsets.all(8.0),
child: SvgPicture.asset(
"assets/svg/transfer_ac.svg",
),
),
),
),
],
SizedBox(width: 5), SizedBox(width: 5),
Expanded( Expanded(
flex: 1, flex: 1,
child: InkResponse( child: InkResponse(
onTap: () async { onTap: () async {
_showTransferAccountSheet( editProvider.checkDropDownValues();
prefill();
await _showEditAccountSheet(
context, context,
provider.accountDetails.id!, provider.accountDetails.id!,
); );
...@@ -413,273 +435,268 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -413,273 +435,268 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
width: 30, width: 30,
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/svg/transfer_ac.svg", "assets/svg/crm/lead_details_edit_ic.svg",
), ),
), ),
), ),
), ),
], ],
SizedBox(width: 5), ),
Expanded( Visibility(
flex: 1, visible: provider.showMoreDetails ? true : false,
child: InkResponse( child: Column(
onTap: () async { children: [
editProvider.checkDropDownValues(); Container(
prefill(); padding: EdgeInsets.symmetric(vertical: 4),
await _showEditAccountSheet(
context,
provider.accountDetails.id!,
);
},
child: Container(
height: 32,
width: 30,
padding: EdgeInsets.all(8.0),
child: SvgPicture.asset(
"assets/svg/crm/lead_details_edit_ic.svg",
),
),
),
),
],
),
Visibility(
visible: provider.showMoreDetails ? true : false,
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(vertical: 4),
child: Row(
children: [
Expanded(
flex: 3,
child: Text(
"Account Details",
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(subHeadings1.length, (j) {
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row( child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 3,
child: Text( child: Text(
headings1[j], "Account Details",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaRegular",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, fontFamily: "JakartaSemiBold",
), ),
), ),
), ),
Expanded( Expanded(
child: Text( flex: 6,
subHeadings1[j] == "" child: DottedLine(
? "-" dashGapLength: 4,
: subHeadings1[j], dashGapColor: Colors.white,
style: TextStyle( dashColor: AppColors.grey_semi,
fontSize: 14, dashLength: 2,
color: Color(0xFF818181), lineThickness: 0.5,
),
), ),
), ),
], ],
), ),
); ),
}), ...List.generate(subHeadings1.length, (j) {
Container( return Container(
padding: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric(vertical: 7),
child: Row( child: Row(
children: [ crossAxisAlignment:
Expanded( CrossAxisAlignment.start,
flex: 3, children: [
child: Text( Expanded(
"Address Details", child: Text(
style: TextStyle( headings1[j],
fontSize: 14, style: TextStyle(
fontFamily: "JakartaSemiBold", fontFamily: "JakartaRegular",
fontSize: 14,
color: AppColors.semi_black,
),
),
), ),
), Expanded(
), child: Text(
Expanded( subHeadings1[j] == ""
flex: 6, ? "-"
child: DottedLine( : subHeadings1[j],
dashGapLength: 4, style: TextStyle(
dashGapColor: Colors.white, fontSize: 14,
dashColor: AppColors.grey_semi, color: Color(0xFF818181),
dashLength: 2, ),
lineThickness: 0.5, ),
), ),
],
), ),
], );
), }),
), Container(
...List.generate(subHeadings2.length, (j) { padding: EdgeInsets.symmetric(vertical: 4),
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row( child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 3,
child: Text( child: Text(
headings2[j], "Address Details",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaRegular",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, fontFamily: "JakartaSemiBold",
), ),
), ),
), ),
Expanded( Expanded(
child: Text( flex: 6,
subHeadings2[j] == "" child: DottedLine(
? "-" dashGapLength: 4,
: subHeadings2[j], dashGapColor: Colors.white,
style: TextStyle( dashColor: AppColors.grey_semi,
fontSize: 14, dashLength: 2,
color: Color(0xFF818181), lineThickness: 0.5,
),
), ),
), ),
], ],
), ),
); ),
}), ...List.generate(subHeadings2.length, (j) {
Container( return Container(
padding: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric(vertical: 7),
child: Row( child: Row(
children: [ crossAxisAlignment:
Expanded( CrossAxisAlignment.start,
flex: 3, children: [
child: Text( Expanded(
"Source Details", child: Text(
style: TextStyle( headings2[j],
fontSize: 14, style: TextStyle(
fontFamily: "JakartaSemiBold", fontFamily: "JakartaRegular",
fontSize: 14,
color: AppColors.semi_black,
),
),
), ),
), Expanded(
), child: Text(
Expanded( subHeadings2[j] == ""
flex: 6, ? "-"
child: DottedLine( : subHeadings2[j],
dashGapLength: 4, style: TextStyle(
dashGapColor: Colors.white, fontSize: 14,
dashColor: AppColors.grey_semi, color: Color(0xFF818181),
dashLength: 2, ),
lineThickness: 0.5, ),
), ),
],
), ),
], );
), }),
), Container(
...List.generate(subHeadings3.length, (j) { padding: EdgeInsets.symmetric(vertical: 4),
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row( child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 3,
child: Text( child: Text(
headings3[j], "Source Details",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaRegular",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, fontFamily: "JakartaSemiBold",
), ),
), ),
), ),
Expanded( Expanded(
child: Text( flex: 6,
subHeadings3[j] == "" child: DottedLine(
? "-" dashGapLength: 4,
: subHeadings3[j], dashGapColor: Colors.white,
style: TextStyle( dashColor: AppColors.grey_semi,
fontSize: 14, dashLength: 2,
color: Color(0xFF818181), lineThickness: 0.5,
),
), ),
), ),
], ],
), ),
); ),
}), ...List.generate(subHeadings3.length, (j) {
Container( return Container(
padding: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric(vertical: 7),
child: Row( child: Row(
children: [ crossAxisAlignment:
Expanded( CrossAxisAlignment.start,
flex: 3, children: [
child: Text( Expanded(
"Lead Details", child: Text(
style: TextStyle( headings3[j],
fontSize: 14, style: TextStyle(
fontFamily: "JakartaSemiBold", fontFamily: "JakartaRegular",
fontSize: 14,
color: AppColors.semi_black,
),
),
), ),
), Expanded(
), child: Text(
Expanded( subHeadings3[j] == ""
flex: 6, ? "-"
child: DottedLine( : subHeadings3[j],
dashGapLength: 4, style: TextStyle(
dashGapColor: Colors.white, fontSize: 14,
dashColor: AppColors.grey_semi, color: Color(0xFF818181),
dashLength: 2, ),
lineThickness: 0.5, ),
), ),
],
), ),
], );
), }),
), Container(
...List.generate(subHeadings4.length, (j) { padding: EdgeInsets.symmetric(vertical: 4),
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row( child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 3,
child: Text( child: Text(
headings4[j], "Lead Details",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaRegular",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, fontFamily: "JakartaSemiBold",
), ),
), ),
), ),
Expanded( Expanded(
child: InkResponse( flex: 6,
child: child: DottedLine(
subHeadings4[j] == "Lead Age" dashGapLength: 4,
? Tooltip( dashGapColor: Colors.white,
triggerMode: dashColor: AppColors.grey_semi,
TooltipTriggerMode dashLength: 2,
.tap, lineThickness: 0.5,
),
message: ),
"${leadDetails.createdDatetime}", ],
child: Text( ),
),
...List.generate(subHeadings4.length, (j) {
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings4[j],
style: TextStyle(
fontFamily: "JakartaRegular",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
child:
subHeadings4[j] == "Lead Age"
? Tooltip(
triggerMode:
TooltipTriggerMode
.tap,
message:
"${leadDetails.createdDatetime}",
child: Text(
subHeadings4[j] == ""
? "-"
: subHeadings4[j],
style: TextStyle(
fontSize: 14,
color: Color(
0xFF818181,
),
decorationColor:
AppColors
.grey_semi,
decoration:
TextDecoration
.underline,
),
),
)
: Text(
subHeadings4[j] == "" subHeadings4[j] == ""
? "-" ? "-"
: subHeadings4[j], : subHeadings4[j],
...@@ -688,114 +705,95 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -688,114 +705,95 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
color: Color( color: Color(
0xFF818181, 0xFF818181,
), ),
decorationColor:
AppColors
.grey_semi,
decoration:
TextDecoration
.underline,
),
),
)
: Text(
subHeadings4[j] == ""
? "-"
: subHeadings4[j],
style: TextStyle(
fontSize: 14,
color: Color(
0xFF818181,
), ),
), ),
), ),
), ),
), ],
], ),
), );
); }),
}),
],
),
),
InkResponse(
onTap: () async {
provider.showMoreDetails =
!provider.showMoreDetails;
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
provider.showMoreDetails
? "Hide Details"
: "View Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
Transform.flip(
flipY:
provider.showMoreDetails ? true : false,
child: SvgPicture.asset(
"assets/svg/arrow_dropdown.svg",
height: 25,
width: 20,
color: AppColors.app_blue,
),
),
], ],
), ),
), ),
),
], InkResponse(
), onTap: () async {
), provider.showMoreDetails =
], !provider.showMoreDetails;
), },
), child: Container(
Expanded( padding: EdgeInsets.symmetric(vertical: 5),
child: SingleChildScrollView( child: Row(
physics: AlwaysScrollableScrollPhysics(), crossAxisAlignment: CrossAxisAlignment.center,
child: Column( mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
///Lead Details Text(
Container( provider.showMoreDetails
padding: EdgeInsets.only( ? "Hide Details"
left: 10, : "View Details",
right: 10, style: TextStyle(
top: 25, fontFamily: "JakartaMedium",
bottom: 5, fontSize: 14,
), color: AppColors.app_blue,
child: Row( ),
children: [ ),
Expanded( Transform.flip(
child: Text( flipY:
textAlign: TextAlign.left, provider.showMoreDetails ? true : false,
"Lead Details", child: SvgPicture.asset(
style: TextStyle( "assets/svg/arrow_dropdown.svg",
fontFamily: "JakartaMedium", height: 25,
fontSize: 14, width: 20,
color: AppColors.grey_thick, color: AppColors.app_blue,
),
),
],
), ),
), ),
), ),
if (leadListNotEmpty) ...[ ],
Expanded( ),
child: InkResponse( ),
onTap: () async { ],
await addleadProvider ),
.crmProspectDetailsAddLeadsViewAPIFunction( ),
context, Column(
widget.mode, children: [
); ///Lead Details
_showAddLeadsSheet(context, widget.mode); Container(
}, padding: EdgeInsets.only(
left: 10,
right: 10,
top: 25,
bottom: 5,
),
child: Row(
children: [
Expanded(
child: Text(
textAlign: TextAlign.left,
"Lead Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.grey_thick,
),
),
),
if (leadListNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () async {
await addleadProvider
.crmProspectDetailsAddLeadsViewAPIFunction(
context,
widget.mode,
);
_showAddLeadsSheet(context, widget.mode);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
"+ Add Lead", "+ Add Lead",
...@@ -807,23 +805,49 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -807,23 +805,49 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
], ),
], ],
), ],
), ),
if (leadListNotEmpty) ...[ ),
SizedBox( if (leadListNotEmpty) ...[
width: double.infinity, SizedBox(
height: 250, width: double.infinity,
child: ListView.builder( height: 210,
itemCount: leadsList.length, child: ListView.builder(
shrinkWrap: true, itemCount: leadsList.length,
physics: AlwaysScrollableScrollPhysics(), shrinkWrap: true,
scrollDirection: Axis.horizontal, physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) { scrollDirection: Axis.horizontal,
return Container( itemBuilder: (context, index) {
height: 250, return InkResponse(
width: MediaQuery.of(context).size.width * 0.95, 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( margin: EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
...@@ -886,7 +910,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -886,7 +910,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
SizedBox(width: 10), SizedBox(width: 10),
Expanded( Expanded(
flex: 2, flex: 4,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
...@@ -1013,14 +1037,12 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1013,14 +1037,12 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
], ],
), ),
), ),
...List.generate(2, (j) { ...List.generate(1, (j) {
final textheads = [ final textheads = [
"Lead Open / Close", "Lead Open / Close",
"View Details",
]; ];
final textSubheads = [ final textSubheads = [
leadsList[index].openStatus ?? "-", leadsList[index].openStatus ?? "-",
"View",
]; ];
return Container( return Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
...@@ -1041,52 +1063,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -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( Expanded(
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
...@@ -1099,77 +1076,80 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1099,77 +1076,80 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
],
], ],
), ),
); );
}), }),
], ],
), ),
),
);
},
),
),
] else ...[
InkResponse(
onTap: () async {
await addleadProvider
.crmProspectDetailsAddLeadsViewAPIFunction(
context,
widget.mode,
); );
}, _showAddLeadsSheet(context, widget.mode);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
), ),
), decoration: BoxDecoration(
] else ...[ color: Colors.white,
InkResponse( borderRadius: BorderRadius.circular(16),
onTap: () async { ),
await addleadProvider child: Center(
.crmProspectDetailsAddLeadsViewAPIFunction( child: Text(
context, textAlign: TextAlign.right,
widget.mode, "+ Add Lead",
); style: TextStyle(
_showAddLeadsSheet(context, widget.mode); fontFamily: "JakartaMedium",
}, fontSize: 14,
child: Container( color: AppColors.app_blue,
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Add Lead",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
), ),
), ),
), ),
), ),
], ),
],
///Contact Details
Container( ///Contact Details
padding: EdgeInsets.only(left: 10, right: 10, top: 10), Container(
child: Row( padding: EdgeInsets.only(left: 10, right: 10, top: 10),
children: [ child: Row(
Expanded( children: [
child: Text( Expanded(
textAlign: TextAlign.left, child: Text(
"Contact Details", textAlign: TextAlign.left,
style: TextStyle( "Contact Details",
fontFamily: "JakartaMedium", style: TextStyle(
fontSize: 14, fontFamily: "JakartaMedium",
color: AppColors.grey_thick, fontSize: 14,
), color: AppColors.grey_thick,
), ),
), ),
if (contactNotEmpty) ...[ ),
Expanded( if (contactNotEmpty) ...[
child: InkResponse( Expanded(
onTap: () { child: InkResponse(
_showAddContactSheet( onTap: () {
context, _showAddContactSheet(
provider.accountDetails.id!, context,
); provider.accountDetails.id!,
}, );
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
"+ Add Contact", "+ Add Contact",
...@@ -1181,96 +1161,107 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1181,96 +1161,107 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
], ),
], ],
), ],
), ),
if (contactNotEmpty) ...[ ),
ListView.builder( if (contactNotEmpty) ...[
physics: NeverScrollableScrollPhysics(), ListView.builder(
shrinkWrap: true, physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.symmetric( shrinkWrap: true,
vertical: 10, padding: EdgeInsets.symmetric(
horizontal: 10, vertical: 10,
), horizontal: 10,
itemCount: provider.contactList.length, ),
itemBuilder: (context, lp) { itemCount: provider.contactList.length,
return InkResponse( itemBuilder: (context, lp) {
onTap: () async { return InkResponse(
provider.editNameController.text = onTap: () async {
provider.contactList[lp].name ?? ""; provider.editNameController.text =
provider.editDesignationController.text = provider.contactList[lp].name ?? "";
provider.contactList[lp].designation ?? ""; provider.editDesignationController.text =
provider.editMobileNumberController.text = provider.contactList[lp].designation ?? "";
provider.contactList[lp].mob1 ?? ""; provider.editMobileNumberController.text =
provider.editAlternativeMobileController.text = provider.contactList[lp].mob1 ?? "";
provider.contactList[lp].mob2 ?? ""; provider.editAlternativeMobileController.text =
provider.editTelephoneController.text = provider.contactList[lp].mob2 ?? "";
provider.contactList[lp].tel ?? ""; provider.editTelephoneController.text =
provider.editEmailController.text = provider.contactList[lp].tel ?? "";
provider.contactList[lp].email ?? ""; provider.editEmailController.text =
_showEditContactSheet( provider.contactList[lp].email ?? "";
context, _showEditContactSheet(
lp, context,
provider.accountDetails.id!, lp,
); provider.accountDetails.id!,
}, );
child: Container( },
decoration: BoxDecoration( child: Container(
color: Colors.white, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14), color: Colors.white,
), borderRadius: BorderRadius.circular(14),
padding: EdgeInsets.symmetric( ),
horizontal: 10, padding: EdgeInsets.symmetric(
vertical: 10, horizontal: 10,
), vertical: 10,
margin: EdgeInsets.symmetric(vertical: 5), ),
margin: EdgeInsets.symmetric(vertical: 5),
child: Row(
mainAxisAlignment: MainAxisAlignment.start, child: Row(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Expanded( children: [
flex: 1, Expanded(
child: SvgPicture.asset( flex: 1,
"assets/svg/crm/contact_details_ic.svg", child: SvgPicture.asset(
), "assets/svg/crm/contact_details_ic.svg",
), ),
SizedBox(width: 10), ),
Expanded( SizedBox(width: 10),
flex: 6, Expanded(
child: SizedBox( flex: 6,
child: Column( child: SizedBox(
// mainAxisAlignment: MainAxisAlignment.start, child: Column(
crossAxisAlignment: // mainAxisAlignment: MainAxisAlignment.start,
CrossAxisAlignment.start, crossAxisAlignment:
mainAxisAlignment: CrossAxisAlignment.start,
MainAxisAlignment.start, mainAxisAlignment:
children: [ MainAxisAlignment.start,
Row( children: [
children: [ Row(
Expanded( children: [
flex: 4, Expanded(
child: Text( flex: 4,
provider child: Text(
.contactList[lp] provider
.name ?? .contactList[lp]
"-", .name ??
style: TextStyle( "-",
fontFamily: style: TextStyle(
"JakartaMedium", fontFamily:
fontSize: 14, "JakartaMedium",
color: fontSize: 14,
AppColors.semi_black, color:
), AppColors.semi_black,
), ),
), ),
Expanded( ),
flex: 2, Expanded(
flex: 2,
child: InkResponse(
onTap: () {
launch(
'tel://${provider.contactList[lp].mob1}',
);
},
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
"${provider.contactList[lp].mob1 ?? "-"}", "${provider.contactList[lp].mob1 ?? "-"}",
style: TextStyle( style: TextStyle(
height: 1,
decorationColor: AppColors.grey_thick,
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.dotted,
fontFamily: fontFamily:
"JakartaMedium", "JakartaMedium",
fontSize: 14, fontSize: 14,
...@@ -1279,411 +1270,438 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1279,411 +1270,438 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
],
),
Text(
provider.contactList[lp].email ==
""
? "-"
: provider
.contactList[lp]
.email ??
"-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.grey_semi,
), ),
],
),
Text(
provider.contactList[lp].email ==
""
? "-"
: provider
.contactList[lp]
.email ??
"-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.grey_semi,
), ),
], ),
), ],
), ),
), ),
], ),
), ],
), ),
);
},
),
] else ...[
InkResponse(
onTap: () {
_showAddContactSheet(
context,
provider.accountDetails.id!,
);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
), ),
decoration: BoxDecoration( );
color: Colors.white, },
borderRadius: BorderRadius.circular(16), ),
] else ...[
InkResponse(
onTap: () {
_showAddContactSheet(
context,
provider.accountDetails.id!,
);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Add Contact",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
), ),
child: Center( ),
),
),
],
///Order Details
if (orderNotEmpty) ...[
Container(
padding: EdgeInsets.only(
left: 10,
right: 10,
top: 10,
),
child: Row(
children: [
Expanded(
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.left,
"+ Add Contact", "Order Details",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
fontSize: 14, fontSize: 14,
color: AppColors.app_blue, color: AppColors.grey_thick,
), ),
), ),
), ),
), ],
), ),
], ),
SizedBox(
///Order Details width: double.infinity,
if (orderNotEmpty) ...[ height: 250,
Container( child: ListView.builder(
padding: EdgeInsets.only( itemCount: orderList.length,
left: 10, shrinkWrap: true,
right: 10, padding: EdgeInsets.symmetric(
top: 10, vertical: 10,
horizontal: 10,
), ),
child: Row( physics: AlwaysScrollableScrollPhysics(),
children: [ scrollDirection: Axis.horizontal,
Expanded( itemBuilder: (context, index) {
child: Text( return Container(
textAlign: TextAlign.left, height: 250,
"Order Details", width: MediaQuery.of(context).size.width * 0.9,
style: TextStyle(
fontFamily: "JakartaMedium", margin: EdgeInsets.symmetric(vertical: 5),
fontSize: 14, padding: EdgeInsets.symmetric(
color: AppColors.grey_thick, horizontal: 15,
), vertical: 10,
),
), ),
], decoration: BoxDecoration(
), color: Colors.white,
), borderRadius: BorderRadius.circular(20),
SizedBox( ),
width: double.infinity, child: Column(
height: 250, crossAxisAlignment: CrossAxisAlignment.start,
child: ListView.builder( children: [
itemCount: orderList.length, Row(
shrinkWrap: true, mainAxisAlignment:
padding: EdgeInsets.symmetric( MainAxisAlignment.start,
vertical: 10, crossAxisAlignment:
horizontal: 10, CrossAxisAlignment.start,
), children: [
physics: AlwaysScrollableScrollPhysics(), Expanded(
scrollDirection: Axis.horizontal, flex: 1,
itemBuilder: (context, index) { child: SvgPicture.asset(
return Container( "assets/svg/crm/product_details_ic.svg",
height: 250,
width: MediaQuery.of(context).size.width * 0.95,
margin: EdgeInsets.symmetric(vertical: 5),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/crm/product_details_ic.svg",
),
), ),
SizedBox(width: 10), ),
Expanded( SizedBox(width: 10),
flex: 4, Expanded(
child: SizedBox( flex: 4,
child: Column( child: SizedBox(
// mainAxisAlignment: MainAxisAlignment.start, child: Column(
crossAxisAlignment: // mainAxisAlignment: MainAxisAlignment.start,
CrossAxisAlignment.start, crossAxisAlignment:
mainAxisAlignment: CrossAxisAlignment.start,
MainAxisAlignment.start, mainAxisAlignment:
children: [ MainAxisAlignment.start,
Text( children: [
"Order ID", Text(
style: TextStyle( "Order ID",
fontFamily: "JakartaMedium", style: TextStyle(
fontSize: 14, fontFamily: "JakartaMedium",
color: AppColors.semi_black, fontSize: 14,
), color: AppColors.semi_black,
),
Text(
"${orderList[index].id}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.grey_semi,
),
), ),
], ),
),
), Text(
), "${orderList[index].id}",
SizedBox(width: 10),
Expanded(
flex: 2,
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8),
color: Color(0xFFF3FFD5),
),
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"${orderList[index].status ?? "-"}",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
fontSize: 14, fontSize: 14,
color: Color(0xFF586000), color: AppColors.grey_semi,
), ),
), ),
), ],
), ),
), ),
],
),
Container(
padding: EdgeInsets.symmetric(
vertical: 3,
), ),
child: Row( SizedBox(width: 10),
children: [ Expanded(
Expanded( flex: 2,
flex: 3, child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8),
color: Color(0xFFF3FFD5),
),
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
child: Center(
child: Text( child: Text(
"Order Created", textAlign: TextAlign.right,
"${orderList[index].status ?? "-"}",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14, fontSize: 14,
fontFamily: "JakartaSemiBold", color: Color(0xFF586000),
), ),
), ),
), ),
Expanded( ),
flex: 6,
child: DottedLine(
dashGapLength: 4,
dashGapColor: Colors.white,
dashColor: AppColors.grey_semi,
dashLength: 2,
lineThickness: 0.5,
),
),
],
), ),
],
),
Container(
padding: EdgeInsets.symmetric(
vertical: 3,
), ),
...List.generate(1, (j) { child: Row(
final textheads = ["Time"]; children: [
final textSubheads = [ Expanded(
orderList[index].createdDatetime ?? "-", flex: 3,
]; child: Text(
return Container( "Order Created",
padding: EdgeInsets.symmetric( style: TextStyle(
vertical: 3, fontSize: 14,
), fontFamily: "JakartaSemiBold",
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: Text(
textAlign: TextAlign.right,
textSubheads[j] == ""
? "-"
: textSubheads[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
),
),
), ),
], ),
), ),
); Expanded(
}), flex: 6,
child: DottedLine(
Container( dashGapLength: 4,
dashGapColor: Colors.white,
dashColor: AppColors.grey_semi,
dashLength: 2,
lineThickness: 0.5,
),
),
],
),
),
...List.generate(1, (j) {
final textheads = ["Time"];
final textSubheads = [
orderList[index].createdDatetime ?? "-",
];
return Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 4, vertical: 3,
), ),
child: Row( child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 3,
child: Text( child: Text(
"Order Details", textAlign: TextAlign.left,
textheads[j],
style: TextStyle( style: TextStyle(
fontFamily: "JakartaRegular",
fontSize: 14, fontSize: 14,
fontFamily: "JakartaSemiBold", color: AppColors.semi_black,
), ),
), ),
), ),
Expanded( Expanded(
flex: 6, child: Text(
child: DottedLine( textAlign: TextAlign.right,
dashGapLength: 4, textSubheads[j] == ""
dashGapColor: Colors.white, ? "-"
dashColor: AppColors.grey_semi, : textSubheads[j],
dashLength: 2, style: TextStyle(
lineThickness: 0.5, fontSize: 14,
color: Color(0xFF818181),
),
), ),
), ),
], ],
), ),
);
}),
Container(
padding: EdgeInsets.symmetric(
vertical: 4,
), ),
...List.generate(1, (j) { child: Row(
final textheads = ["View Details"]; children: [
final textSubheads = ["View"]; Expanded(
return Container( flex: 3,
padding: EdgeInsets.symmetric( child: Text(
vertical: 7, "Order Details",
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaSemiBold",
),
),
), ),
child: Row( Expanded(
crossAxisAlignment: flex: 6,
CrossAxisAlignment.start, child: DottedLine(
children: [ dashGapLength: 4,
Expanded( dashGapColor: Colors.white,
child: Text( dashColor: AppColors.grey_semi,
textAlign: TextAlign.left, dashLength: 2,
textheads[j], lineThickness: 0.5,
style: TextStyle( ),
fontFamily: "JakartaRegular", ),
fontSize: 14, ],
color: AppColors.semi_black, ),
), ),
...List.generate(1, (j) {
final textheads = ["View Details"];
final textSubheads = ["View"];
return Container(
padding: EdgeInsets.symmetric(
vertical: 7,
),
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( Expanded(
onTap: () async { child: InkResponse(
var res = await Navigator.push( onTap: () async {
context, var res = await Navigator.push(
MaterialPageRoute( context,
builder: MaterialPageRoute(
( builder:
context, (
) => Ordersdetailsbymodes(
mode: "",
pageTitleName:
"Order Details",
orderId:
widget.leadId,
),
),
);
if (res == true) {
provider
.crmProspectDetailsAPIFunction(
context, context,
widget.leadId, ) => Ordersdetailsbymodes(
); mode: "",
} pageTitleName:
}, "Order Details",
child: Text( orderId:
textAlign: TextAlign.right, widget.leadId,
textSubheads[j] == "" ),
? "-"
: textSubheads[j],
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.app_blue,
decorationColor:
AppColors.app_blue,
decoration:
TextDecoration
.underline,
), ),
);
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,
), ),
), ),
), ),
], ),
), ],
); ),
}), );
], }),
), ],
); ),
}, );
), },
), ),
], ),
],
///Payment Details
if (paymentsNotEmpty) ...[ ///Payment Details
Container( if (paymentsNotEmpty) ...[
padding: EdgeInsets.only( Container(
left: 10, padding: EdgeInsets.only(
right: 10, left: 10,
top: 10, right: 10,
), top: 10,
child: Row( ),
children: [ child: Row(
Expanded( children: [
child: Text( Expanded(
textAlign: TextAlign.left, child: Text(
"Payment Details", textAlign: TextAlign.left,
style: TextStyle( "Payment Details",
fontFamily: "JakartaMedium", style: TextStyle(
fontSize: 14, fontFamily: "JakartaMedium",
color: AppColors.grey_thick, fontSize: 14,
), color: AppColors.grey_thick,
), ),
), ),
], ),
), ],
), ),
),
SizedBox(
width: double.infinity,
height: 200,
child: ListView.builder(
itemCount: paymentList.length,
shrinkWrap: true,
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 5,
),
physics: AlwaysScrollableScrollPhysics(),
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
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,
SizedBox( margin: EdgeInsets.symmetric(vertical: 5,horizontal: 7.5),
width: double.infinity,
height: 250,
child: ListView.builder(
itemCount: paymentList.length,
shrinkWrap: true,
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
physics: AlwaysScrollableScrollPhysics(),
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Container(
height: 250,
width: MediaQuery.of(context).size.width * 0.95,
margin: EdgeInsets.symmetric(vertical: 5),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 15, horizontal: 15,
vertical: 10, vertical: 10,
...@@ -1844,119 +1862,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1844,119 +1862,21 @@ 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,
),
),
),
),
],
),
);
}),
], ],
), ),
); ),
}, );
), },
), ),
], ),
SizedBox(height: 75),
], ],
), SizedBox(height: 75),
],
), ),
), ],
], ),
), ),
); );
}, },
...@@ -2150,7 +2070,25 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -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) { Future<void> _showEditContactSheet(BuildContext context, index, accid) {
...@@ -2343,7 +2281,25 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -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) { Future<void> _showTransferAccountSheet(BuildContext context, accID) {
...@@ -2540,7 +2496,25 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -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) { Future<void> _showEditAccountSheet(BuildContext context, accID) {
...@@ -2935,7 +2909,25 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -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) { Future<void> _showOptionsSheet(BuildContext context) {
...@@ -3251,7 +3243,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3251,7 +3243,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
) => DropdownMenuItem<Products>( ) => DropdownMenuItem<Products>(
value: ord, value: ord,
child: Text( child: Text(
"(Product Name: ${ord.name})", "${ord.name}",
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
......
...@@ -135,7 +135,7 @@ class _AddleadproductscreenState extends State<Addleadproductscreen> { ...@@ -135,7 +135,7 @@ class _AddleadproductscreenState extends State<Addleadproductscreen> {
(ord) => DropdownMenuItem<Products>( (ord) => DropdownMenuItem<Products>(
value: ord, value: ord,
child: Text( child: Text(
"(Product Name: ${ord.name})", "${ord.name}",
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
......
...@@ -7,6 +7,7 @@ import 'package:flutter/services.dart'; ...@@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart'; import 'package:generp/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart';
import 'package:generp/Utils/app_colors.dart'; import 'package:generp/Utils/app_colors.dart';
import 'package:generp/Utils/commonServices.dart';
import 'package:generp/Utils/commonWidgets.dart'; import 'package:generp/Utils/commonWidgets.dart';
import 'package:generp/Utils/dropdownTheme.dart'; import 'package:generp/Utils/dropdownTheme.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
...@@ -597,6 +598,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -597,6 +598,7 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
InkResponse( InkResponse(
onTap: () async { onTap: () async {
...@@ -833,6 +835,10 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -833,6 +835,10 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
), ),
), ),
], ],
if(provider.productsEmptyError!.trim().isNotEmpty)...[
errorWidget(context, provider.productsEmptyError)
]
], ],
), ),
), ),
...@@ -1233,21 +1239,26 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -1233,21 +1239,26 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
InkResponse( InkResponse(
onTap: () { onTap: () {
if (provider.validateStep3()) { if (provider.validateStep3()) {
provider.crmAddNewLeadsAndProspectsAPIFunction( if(provider.productRows.isNotEmpty){
context, provider.crmAddNewLeadsAndProspectsAPIFunction(
"", context,
provider.selectedEmployeesId, "",
provider.selectedSalutation, provider.selectedEmployeesId,
provider.selectedDistrictId, provider.selectedSalutation,
provider.selectedStatesId, provider.selectedDistrictId,
provider.selectedSegmentId, provider.selectedStatesId,
provider.selectedSourcesId, provider.selectedSegmentId,
provider.selectedReferenceId, provider.selectedSourcesId,
provider.selectedReferenceId, provider.selectedReferenceId,
provider.selectedSubLocationId, provider.selectedReferenceId,
provider.selectedLeadStatus, provider.selectedSubLocationId,
provider.getJsonEncodedProducts(), provider.selectedLeadStatus,
); provider.getJsonEncodedProducts(),
);
}else{
toast(context, "Add min. 1 product");
}
} }
details.onStepContinue; details.onStepContinue;
......
...@@ -252,7 +252,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> { ...@@ -252,7 +252,7 @@ class _AddProspectLeadsState extends State<AddProspectLeads> {
>( >(
value: ord, value: ord,
child: Text( child: Text(
"(Product Name: ${ord.name})", "${ord.name}",
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment