Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sai Srinivas
GEN_ERP_2025
Commits
8cdaca01
Commit
8cdaca01
authored
Jul 29, 2025
by
Sai Srinivas
Browse files
29-07-2025 By Sai Srinivas
CRM test cases
parent
e079c6e8
Changes
35
Show whitespace changes
Inline
Side-by-side
lib/Models/crmModels/LeadDetailsResponse.dart
View file @
8cdaca01
class
LeadDetailsResponse
{
String
?
error
;
int
?
sessionExists
;
LeadDetails
?
leadDetails
;
AccountDetails
?
accountDetails
;
List
<
LeadProducts
>?
leadProducts
;
...
...
@@ -12,6 +13,7 @@ class LeadDetailsResponse {
LeadDetailsResponse
(
{
this
.
error
,
this
.
sessionExists
,
this
.
leadDetails
,
this
.
accountDetails
,
this
.
leadProducts
,
...
...
@@ -25,6 +27,7 @@ class LeadDetailsResponse {
LeadDetailsResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
error
=
json
[
'error'
];
sessionExists
=
json
[
'session_exists'
];
leadDetails
=
json
[
'lead_details'
]
!=
null
?
new
LeadDetails
.
fromJson
(
json
[
'lead_details'
])
:
null
;
...
...
@@ -68,6 +71,7 @@ class LeadDetailsResponse {
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'error'
]
=
this
.
error
;
data
[
'session_exists'
]
=
this
.
sessionExists
;
if
(
this
.
leadDetails
!=
null
)
{
data
[
'lead_details'
]
=
this
.
leadDetails
!.
toJson
();
}
...
...
lib/Models/crmModels/crmLeadDetailsEditProductsViewResponse.dart
View file @
8cdaca01
...
...
@@ -3,9 +3,10 @@ class crmLeadDetailsEditProductsViewResponse {
List
<
LeadProducts
>?
leadProducts
;
String
?
error
;
String
?
message
;
int
?
sessionExists
;
crmLeadDetailsEditProductsViewResponse
(
{
this
.
products
,
this
.
leadProducts
,
this
.
error
,
this
.
message
});
{
this
.
products
,
this
.
leadProducts
,
this
.
error
,
this
.
message
,
this
.
sessionExists
});
crmLeadDetailsEditProductsViewResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'products'
]
!=
null
)
{
...
...
@@ -22,6 +23,7 @@ class crmLeadDetailsEditProductsViewResponse {
}
error
=
json
[
'error'
];
message
=
json
[
'message'
];
sessionExists
=
json
[
'session_exists'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
...
...
@@ -35,6 +37,7 @@ class crmLeadDetailsEditProductsViewResponse {
}
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'session_exists'
]
=
this
.
sessionExists
;
return
data
;
}
}
...
...
lib/Models/crmModels/crmLeadDetailsGenerateQuotationViewResponse.dart
View file @
8cdaca01
class
crmLeadDetailsGenerateQuotationViewResponse
{
QuoteDetails
?
quoteDetails
;
List
<
LeadProducts
>?
leadProducts
;
List
<
Products
>?
products
;
String
?
error
;
String
?
message
;
int
?
sessionExists
;
crmLeadDetailsGenerateQuotationViewResponse
(
{
this
.
quoteDetails
,
this
.
leadProducts
,
this
.
error
,
this
.
message
,
this
.
sessionExists
});
{
this
.
quoteDetails
,
this
.
leadProducts
,
this
.
products
,
this
.
error
,
this
.
message
,
this
.
sessionExists
});
crmLeadDetailsGenerateQuotationViewResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
...
...
@@ -19,6 +25,12 @@ class crmLeadDetailsGenerateQuotationViewResponse {
leadProducts
!.
add
(
new
LeadProducts
.
fromJson
(
v
));
});
}
if
(
json
[
'products'
]
!=
null
)
{
products
=
<
Products
>[];
json
[
'products'
].
forEach
((
v
)
{
products
!.
add
(
new
Products
.
fromJson
(
v
));
});
}
error
=
json
[
'error'
];
message
=
json
[
'message'
];
sessionExists
=
json
[
'session_exists'
];
...
...
@@ -33,6 +45,9 @@ class crmLeadDetailsGenerateQuotationViewResponse {
data
[
'lead_products'
]
=
this
.
leadProducts
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
products
!=
null
)
{
data
[
'products'
]
=
this
.
products
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'session_exists'
]
=
this
.
sessionExists
;
...
...
@@ -87,12 +102,12 @@ class LeadProducts {
String
?
productId
;
String
?
qty
;
String
?
price
;
String
?
prodTotalPrice
;
String
?
date
;
String
?
isDel
;
String
?
isExists
;
String
?
createdDatetime
;
String
?
updatedDatetime
;
String
?
prodTotalPrice
;
String
?
productName
;
LeadProducts
(
...
...
@@ -101,12 +116,12 @@ class LeadProducts {
this
.
productId
,
this
.
qty
,
this
.
price
,
this
.
prodTotalPrice
,
this
.
date
,
this
.
isDel
,
this
.
isExists
,
this
.
createdDatetime
,
this
.
updatedDatetime
,
this
.
prodTotalPrice
,
this
.
productName
});
LeadProducts
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
...
...
@@ -115,12 +130,12 @@ class LeadProducts {
productId
=
json
[
'product_id'
];
qty
=
json
[
'qty'
];
price
=
json
[
'price'
];
prodTotalPrice
=
json
[
'prod_total_price'
];
date
=
json
[
'date'
];
isDel
=
json
[
'is_del'
];
isExists
=
json
[
'is_exists'
];
createdDatetime
=
json
[
'created_datetime'
];
updatedDatetime
=
json
[
'updated_datetime'
];
prodTotalPrice
=
json
[
'prod_total_price'
];
productName
=
json
[
'product_name'
];
}
...
...
@@ -131,13 +146,32 @@ class LeadProducts {
data
[
'product_id'
]
=
this
.
productId
;
data
[
'qty'
]
=
this
.
qty
;
data
[
'price'
]
=
this
.
price
;
data
[
'prod_total_price'
]
=
this
.
prodTotalPrice
;
data
[
'date'
]
=
this
.
date
;
data
[
'is_del'
]
=
this
.
isDel
;
data
[
'is_exists'
]
=
this
.
isExists
;
data
[
'created_datetime'
]
=
this
.
createdDatetime
;
data
[
'updated_datetime'
]
=
this
.
updatedDatetime
;
data
[
'prod_total_price'
]
=
this
.
prodTotalPrice
;
data
[
'product_name'
]
=
this
.
productName
;
return
data
;
}
}
class
Products
{
String
?
id
;
String
?
name
;
Products
({
this
.
id
,
this
.
name
});
Products
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
name
=
json
[
'name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'name'
]
=
this
.
name
;
return
data
;
}
}
lib/Models/crmModels/crmNewLeadsProspectsViewResponse.dart
0 → 100644
View file @
8cdaca01
class
crmNewLeadsProspectsViewResponse
{
String
?
error
;
String
?
message
;
int
?
sessionExists
;
List
<
Employees
>?
employees
;
List
<
Sources
>?
sources
;
List
<
Teams
>?
teams
;
List
<
States
>?
states
;
List
<
Products
>?
products
;
List
<
String
>?
salutation
;
crmNewLeadsProspectsViewResponse
({
this
.
error
,
this
.
message
,
this
.
sessionExists
,
this
.
employees
,
this
.
sources
,
this
.
teams
,
this
.
states
,
this
.
products
,
this
.
salutation
,
});
crmNewLeadsProspectsViewResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
json
[
'error'
]
=
error
;
json
[
'message'
]
=
message
;
json
[
'session_exists'
]
=
sessionExists
;
if
(
json
[
'employees'
]
!=
null
)
{
employees
=
<
Employees
>[];
json
[
'employees'
].
forEach
((
v
)
{
employees
!.
add
(
new
Employees
.
fromJson
(
v
));
});
}
if
(
json
[
'sources'
]
!=
null
)
{
sources
=
<
Sources
>[];
json
[
'sources'
].
forEach
((
v
)
{
sources
!.
add
(
new
Sources
.
fromJson
(
v
));
});
}
if
(
json
[
'teams'
]
!=
null
)
{
teams
=
<
Teams
>[];
json
[
'teams'
].
forEach
((
v
)
{
teams
!.
add
(
new
Teams
.
fromJson
(
v
));
});
}
if
(
json
[
'states'
]
!=
null
)
{
states
=
<
States
>[];
json
[
'states'
].
forEach
((
v
)
{
states
!.
add
(
new
States
.
fromJson
(
v
));
});
}
if
(
json
[
'products'
]
!=
null
)
{
products
=
<
Products
>[];
json
[
'products'
].
forEach
((
v
)
{
products
!.
add
(
new
Products
.
fromJson
(
v
));
});
}
salutation
=
json
[
'salutation'
].
cast
<
String
>();
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'session_exists'
]
=
this
.
sessionExists
;
if
(
this
.
employees
!=
null
)
{
data
[
'employees'
]
=
this
.
employees
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
sources
!=
null
)
{
data
[
'sources'
]
=
this
.
sources
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
teams
!=
null
)
{
data
[
'teams'
]
=
this
.
teams
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
states
!=
null
)
{
data
[
'states'
]
=
this
.
states
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
products
!=
null
)
{
data
[
'products'
]
=
this
.
products
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'salutation'
]
=
this
.
salutation
;
return
data
;
}
}
class
Employees
{
String
?
id
;
String
?
name
;
Employees
({
this
.
id
,
this
.
name
});
Employees
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
name
=
json
[
'name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'name'
]
=
this
.
name
;
return
data
;
}
}
class
Sources
{
String
?
id
;
String
?
name
;
Sources
({
this
.
id
,
this
.
name
});
Sources
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
name
=
json
[
'name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'name'
]
=
this
.
name
;
return
data
;
}
}
class
Teams
{
String
?
id
;
String
?
name
;
Teams
({
this
.
id
,
this
.
name
});
Teams
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
name
=
json
[
'name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'name'
]
=
this
.
name
;
return
data
;
}
}
class
States
{
String
?
id
;
String
?
name
;
States
({
this
.
id
,
this
.
name
});
States
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
name
=
json
[
'name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'name'
]
=
this
.
name
;
return
data
;
}
}
class
Products
{
String
?
id
;
String
?
name
;
Products
({
this
.
id
,
this
.
name
});
Products
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
name
=
json
[
'name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'name'
]
=
this
.
name
;
return
data
;
}
}
lib/Models/crmModels/crmSelectedProductDetailsResponse.dart
0 → 100644
View file @
8cdaca01
class
crmSelectedProductDetailsResponse
{
ProductsData
?
productsData
;
String
?
error
;
String
?
message
;
crmSelectedProductDetailsResponse
({
this
.
productsData
,
this
.
error
,
this
.
message
});
crmSelectedProductDetailsResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
productsData
=
json
[
'data'
]
!=
null
?
new
ProductsData
.
fromJson
(
json
[
'data'
])
:
null
;
error
=
json
[
'error'
];
message
=
json
[
'message'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
productsData
!=
null
)
{
data
[
'data'
]
=
this
.
productsData
!.
toJson
();
}
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
return
data
;
}
}
class
ProductsData
{
String
?
id
;
String
?
name
;
String
?
application
;
String
?
rating
;
String
?
ratingKw
;
String
?
ordStatus
;
String
?
description
;
String
?
price
;
String
?
createdOn
;
String
?
empId
;
String
?
materialMasterId
;
String
?
isGenerator
;
String
?
isExists
;
String
?
createdDatetime
;
String
?
updatedDatetime
;
ProductsData
(
{
this
.
id
,
this
.
name
,
this
.
application
,
this
.
rating
,
this
.
ratingKw
,
this
.
ordStatus
,
this
.
description
,
this
.
price
,
this
.
createdOn
,
this
.
empId
,
this
.
materialMasterId
,
this
.
isGenerator
,
this
.
isExists
,
this
.
createdDatetime
,
this
.
updatedDatetime
});
ProductsData
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
name
=
json
[
'name'
];
application
=
json
[
'application'
];
rating
=
json
[
'rating'
];
ratingKw
=
json
[
'rating_kw'
];
ordStatus
=
json
[
'ord_status'
];
description
=
json
[
'description'
];
price
=
json
[
'price'
];
createdOn
=
json
[
'created_on'
];
empId
=
json
[
'emp_id'
];
materialMasterId
=
json
[
'material_master_id'
];
isGenerator
=
json
[
'is_generator'
];
isExists
=
json
[
'is_exists'
];
createdDatetime
=
json
[
'created_datetime'
];
updatedDatetime
=
json
[
'updated_datetime'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'name'
]
=
this
.
name
;
data
[
'application'
]
=
this
.
application
;
data
[
'rating'
]
=
this
.
rating
;
data
[
'rating_kw'
]
=
this
.
ratingKw
;
data
[
'ord_status'
]
=
this
.
ordStatus
;
data
[
'description'
]
=
this
.
description
;
data
[
'price'
]
=
this
.
price
;
data
[
'created_on'
]
=
this
.
createdOn
;
data
[
'emp_id'
]
=
this
.
empId
;
data
[
'material_master_id'
]
=
this
.
materialMasterId
;
data
[
'is_generator'
]
=
this
.
isGenerator
;
data
[
'is_exists'
]
=
this
.
isExists
;
data
[
'created_datetime'
]
=
this
.
createdDatetime
;
data
[
'updated_datetime'
]
=
this
.
updatedDatetime
;
return
data
;
}
}
lib/Models/ordersModels/commonResponse.dart
View file @
8cdaca01
class
CommonResponse
{
String
?
error
;
String
?
message
;
int
?
sessionExists
;
CommonResponse
({
this
.
error
,
this
.
message
});
CommonResponse
({
this
.
error
,
this
.
message
,
this
.
sessionExists
});
CommonResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
error
=
json
[
'error'
];
message
=
json
[
'message'
];
sessionExists
=
json
[
'session_exists'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'session_exists'
]
=
this
.
sessionExists
;
return
data
;
}
}
lib/Notifiers/crmProvider/LeadListProvider.dart
View file @
8cdaca01
...
...
@@ -33,6 +33,8 @@ class Leadlistprovider extends ChangeNotifier {
List
<
LeadList
>
_crmLeadList
=
[];
List
<
String
?>
_leadStatusList
=
[];
List
<
String
?>
_openStatusList
=
[];
List
<
String
?>
_alphabetList
=
[];
Sources
?
_selectedSources
;
Teams
?
_selectedTeams
;
...
...
@@ -45,6 +47,7 @@ class Leadlistprovider extends ChangeNotifier {
Contacts
?
_selectedContacts
;
String
?
_selectedLeadStatus
;
String
?
_selectedOpenStatus
;
String
?
_selectedAlphabet
;
String
?
_selectedSourceId
;
String
?
_selectedSourceValue
;
...
...
@@ -97,19 +100,21 @@ class Leadlistprovider extends ChangeNotifier {
List
<
String
?>
get
leadStatusList
=>
_leadStatusList
;
List
<
String
?>
get
alphabetList
=>
_alphabetList
;
List
<
String
?>
get
openStatusList
=>
_openStatusList
;
Sources
?
get
selectedSource
s
=>
_selectedSources
;
Sources
?
get
selectedSource
=>
_selectedSources
;
Teams
?
get
selectedTeam
s
=>
_selectedTeams
;
Teams
?
get
selectedTeam
=>
_selectedTeams
;
States
?
get
selectedStates
=>
_selectedStates
;
Employees
?
get
selectedEmployee
s
=>
_selectedEmployees
;
Employees
?
get
selectedEmployee
=>
_selectedEmployees
;
References
?
get
selectedReference
s
=>
_selectedReferences
;
References
?
get
selectedReference
=>
_selectedReferences
;
Segments
?
get
selectedSegment
s
=>
_selectedSegments
;
Segments
?
get
selectedSegment
=>
_selectedSegments
;
Districts
?
get
selectedDistricts
=>
_selectedDistricts
;
...
...
@@ -157,19 +162,26 @@ class Leadlistprovider extends ChangeNotifier {
String
?
get
selectedContactValue
=>
_selectedContactValue
;
String
?
get
selectedAlphabet
=>
_selectedAlphabet
;
set
isLoading
(
bool
value
)
{
_isLoading
=
value
;
notifyListeners
();
}
set
selectedSources
(
Sources
?
value
)
{
set
selectedAlphabet
(
String
?
value
){
_selectedAlphabet
=
value
;
notifyListeners
();
}
set
selectedSource
(
Sources
?
value
)
{
_selectedSources
=
value
;
_selectedSourceId
=
value
!.
id
!;
_selectedSourceValue
=
value
!.
name
!;
notifyListeners
();
}
set
selectedTeam
s
(
Teams
?
value
)
{
set
selectedTeam
(
Teams
?
value
)
{
_selectedTeams
=
value
;
_selectedTeamId
=
value
!.
id
!;
_selectedTeamValue
=
value
.
name
;
...
...
@@ -183,21 +195,21 @@ class Leadlistprovider extends ChangeNotifier {
notifyListeners
();
}
set
selectedEmployee
s
(
Employees
?
value
)
{
set
selectedEmployee
(
Employees
?
value
)
{
_selectedEmployees
=
value
;
_selectedEmployeeId
=
value
!.
id
!;
_selectedEmployeeValue
=
value
.
name
;
notifyListeners
();
}
set
selectedReference
s
(
References
?
value
)
{
set
selectedReference
(
References
?
value
)
{
_selectedReferences
=
value
;
_selectedReferenceId
=
value
!.
id
!;
_selectedReferenceValue
=
value
.
name
;
notifyListeners
();
}
set
selectedSegment
s
(
Segments
?
value
)
{
set
selectedSegment
(
Segments
?
value
)
{
_selectedSegments
=
value
;
_selectedSegmentId
=
value
!.
id
!;
_selectedSegmentValue
=
value
.
name
;
...
...
@@ -345,6 +357,8 @@ class Leadlistprovider extends ChangeNotifier {
"Order Gain"
,
"Order Lost"
,
];
_alphabetList
=
List
.
generate
(
26
,
(
index
)
=>
String
.
fromCharCode
(
index
+
65
));
_openStatusList
=
[
"open"
,
"Closed"
,
"All"
];
_sourcesList
=
data
.
sources
!;
_teamsList
=
data
.
teams
!;
...
...
@@ -466,16 +480,13 @@ class Leadlistprovider extends ChangeNotifier {
Future
<
void
>
crmLeadListAPIFunction
(
context
,
mode
,
employeeID
,
leadStatus
,
openStatus
,
sourceID
,
referenceID
,
teamID
,
segmentID
,
stateID
,
districtID
,
subLocID
,
alphabet
)
async
{
try
{
_isLoading
=
true
;
...
...
@@ -486,8 +497,6 @@ class Leadlistprovider extends ChangeNotifier {
HomeProv
.
empId
,
HomeProv
.
session
,
mode
,
employeeID
,
sLeadIDController
.
text
,
leadStatus
,
openStatus
,
mobileNumberController
.
text
,
...
...
@@ -496,9 +505,7 @@ class Leadlistprovider extends ChangeNotifier {
referenceID
,
teamID
,
segmentID
,
stateID
,
districtID
,
subLocID
,
alphabet
);
if
(
data
!=
null
)
{
_isLoading
=
true
;
...
...
lib/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart
0 → 100644
View file @
8cdaca01
import
'dart:io'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_download_manager/flutter_download_manager.dart'
;
import
'package:flutter_local_notifications/flutter_local_notifications.dart'
;
import
'package:generp/screens/LoginScreen.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:intl/intl.dart'
;
import
'package:path_provider/path_provider.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:provider/provider.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
import
'../../Models/crmModels/GetDistrictOnStateResponse.dart'
;
import
'../../Models/crmModels/GetSegmentOnTeamResponse.dart'
;
import
'../../Models/crmModels/GetSourceOnReferenceResponse.dart'
;
import
'../../Models/crmModels/GetSubLocOnDistrictResponse.dart'
;
import
'../../Models/crmModels/crmNewLeadsProspectsViewResponse.dart'
;
import
'../../Utils/commonServices.dart'
;
import
'../../services/api_calling.dart'
;
import
'../HomeScreenNotifier.dart'
;
class
Addnewleadsandprospectsprovider
extends
ChangeNotifier
{
final
FlutterLocalNotificationsPlugin
_notificationsPlugin
=
FlutterLocalNotificationsPlugin
();
static
const
platform
=
MethodChannel
(
'in.webgrid.generp/download'
);
final
GlobalKey
webViewKey
=
GlobalKey
();
var
dl
=
DownloadManager
();
TextEditingController
addProductPriceController
=
TextEditingController
();
TextEditingController
addQuantityController
=
TextEditingController
();
TextEditingController
addTotalAmountController
=
TextEditingController
();
TextEditingController
companyNameController
=
TextEditingController
();
TextEditingController
contactPersonNameController
=
TextEditingController
();
TextEditingController
customerMailIdController
=
TextEditingController
();
TextEditingController
mobileController
=
TextEditingController
();
TextEditingController
alternateMobileController
=
TextEditingController
();
TextEditingController
telephoneController
=
TextEditingController
();
TextEditingController
designationController
=
TextEditingController
();
TextEditingController
addressController
=
TextEditingController
();
TextEditingController
taxesController
=
TextEditingController
();
TextEditingController
SpecialNoteController
=
TextEditingController
();
TextEditingController
forController
=
TextEditingController
();
TextEditingController
paymentTermsController
=
TextEditingController
();
List
<
Map
<
String
,
dynamic
>>
_productRows
=
[];
// For backend
List
<
Map
<
String
,
dynamic
>>
get
productRows
=>
_productRows
;
List
<
Employees
>
_employeesList
=
[];
List
<
Sources
>
_sourcesList
=
[];
List
<
Teams
>
_teamsList
=
[];
List
<
States
>
_statesList
=
[];
List
<
Products
>
_productsList
=
[];
List
<
String
>
_salutationList
=
[];
List
<
Districts
>
_districtsList
=
[];
List
<
SubLocations
>
_subLocationsList
=
[];
List
<
References
>
_referencesList
=
[];
List
<
Segments
>
_segmentsList
=
[];
Employees
?
_selectedEmployees
;
String
?
_selectedEmployeesId
;
String
?
_selectedEmployeesValue
;
Sources
?
_selectedSources
;
String
?
_selectedSourcesId
;
String
?
_selectedSourcesValue
;
Teams
?
_selectedTeams
;
String
?
_selectedTeamsId
;
String
?
_selectedTeamsValue
;
States
?
_selectedStates
;
String
?
_selectedStatesId
;
String
?
_selectedStatesValue
;
Products
?
_selectedProducts
;
String
?
_selectedProductsId
;
String
?
_selectedProductsValue
;
String
?
_selectedSalutation
;
Districts
?
_selectedDistricts
;
SubLocations
?
_selectedSubLocations
;
References
?
_selectedReferences
;
Segments
?
_selectedSegments
;
String
?
_selectedDistrictId
;
String
?
_selectedDistrictValue
;
String
?
_selectedSubLocationId
;
String
?
_selectedSubLocationValue
;
String
?
_selectedReferenceId
;
String
?
_selectedReferenceValue
;
String
?
_selectedSegmentId
;
String
?
_selectedSegmentValue
;
String
?
_selectedLeadStatus
;
String
?
get
selectedLeadStatus
=>
_selectedLeadStatus
;
List
<
Employees
>
get
employeesList
=>
_employeesList
;
List
<
Sources
>
get
sourcesList
=>
_sourcesList
;
List
<
Teams
>
get
teamsList
=>
_teamsList
;
List
<
States
>
get
statesList
=>
_statesList
;
List
<
Products
>
get
productsList
=>
_productsList
;
List
<
String
>
get
salutationList
=>
_salutationList
;
Employees
?
get
selectedEmployees
=>
_selectedEmployees
;
String
?
get
selectedEmployeesId
=>
_selectedEmployeesId
;
String
?
get
selectedEmployeesValue
=>
_selectedEmployeesValue
;
Sources
?
get
selectedSources
=>
_selectedSources
;
String
?
get
selectedSourcesId
=>
_selectedSourcesId
;
String
?
get
selectedSourcesValue
=>
_selectedSourcesValue
;
Teams
?
get
selectedTeams
=>
_selectedTeams
;
String
?
get
selectedTeamsId
=>
_selectedTeamsId
;
String
?
get
selectedTeamsValue
=>
_selectedTeamsValue
;
States
?
get
selectedStates
=>
_selectedStates
;
String
?
get
selectedStatesId
=>
_selectedStatesId
;
String
?
get
selectedStatesValue
=>
_selectedStatesValue
;
Products
?
get
selectedProducts
=>
_selectedProducts
;
String
?
get
selectedProductsId
=>
_selectedProductsId
;
String
?
get
selectedProductsValue
=>
_selectedProductsValue
;
String
?
get
selectedSalutation
=>
_selectedSalutation
;
List
<
Districts
>
get
districtsList
=>
_districtsList
;
List
<
SubLocations
>
get
subLocationsList
=>
_subLocationsList
;
List
<
References
>
get
referencesList
=>
_referencesList
;
List
<
Segments
>
get
segmentsList
=>
_segmentsList
;
References
?
get
selectedReference
=>
_selectedReferences
;
Segments
?
get
selectedSegment
=>
_selectedSegments
;
Districts
?
get
selectedDistricts
=>
_selectedDistricts
;
SubLocations
?
get
selectedSubLocations
=>
_selectedSubLocations
;
String
?
get
selectedDistrictId
=>
_selectedDistrictId
;
String
?
get
selectedDistrictValue
=>
_selectedDistrictValue
;
String
?
get
selectedSubLocationId
=>
_selectedSubLocationId
;
String
?
get
selectedSubLocationValue
=>
_selectedSubLocationValue
;
String
?
get
selectedReferenceId
=>
_selectedReferenceId
;
String
?
get
selectedReferenceValue
=>
_selectedReferenceValue
;
String
?
get
selectedSegmentId
=>
_selectedSegmentId
;
String
?
get
selectedSegmentValue
=>
_selectedSegmentValue
;
set
selectedLeadStatus
(
String
?
value
)
{
_selectedLeadStatus
=
value
;
notifyListeners
();
}
set
selectedEmployees
(
Employees
?
value
)
{
_selectedEmployees
=
value
;
_selectedEmployeesId
=
value
!.
id
;
_selectedEmployeesValue
=
value
!.
name
;
notifyListeners
();
}
set
selectedEmployeesId
(
String
?
value
)
{
_selectedEmployeesId
=
value
;
notifyListeners
();
}
set
selectedEmployeesValue
(
String
?
value
)
{
_selectedEmployeesValue
=
value
;
notifyListeners
();
}
set
selectedSources
(
Sources
?
value
)
{
_selectedSources
=
value
;
_selectedSourcesId
=
value
!.
id
;
_selectedSourcesValue
=
value
!.
name
;
notifyListeners
();
}
set
selectedSourcesId
(
String
?
value
)
{
_selectedSourcesId
=
value
;
notifyListeners
();
}
set
selectedSourcesValue
(
String
?
value
)
{
_selectedSourcesValue
=
value
;
notifyListeners
();
}
set
selectedTeams
(
Teams
?
value
)
{
_selectedTeams
=
value
;
_selectedTeamsId
=
value
!.
id
;
_selectedTeamsValue
=
value
!.
name
;
notifyListeners
();
}
set
selectedTeamsId
(
String
?
value
)
{
_selectedTeamsId
=
value
;
notifyListeners
();
}
set
selectedTeamsValue
(
String
?
value
)
{
_selectedTeamsValue
=
value
;
notifyListeners
();
}
set
selectedStates
(
States
?
value
)
{
_selectedStates
=
value
;
_selectedStatesId
=
value
!.
id
;
_selectedStatesValue
=
value
!.
name
;
notifyListeners
();
}
set
selectedStatesId
(
String
?
value
)
{
_selectedStatesId
=
value
;
notifyListeners
();
}
set
selectedStatesValue
(
String
?
value
)
{
_selectedStatesValue
=
value
;
notifyListeners
();
}
set
selectedProducts
(
Products
?
value
)
{
_selectedProducts
=
value
;
_selectedProductsId
=
value
!.
id
;
_selectedProductsValue
=
value
!.
name
;
notifyListeners
();
}
set
selectedProductsId
(
String
?
value
)
{
_selectedProductsId
=
value
;
notifyListeners
();
}
set
selectedProductsValue
(
String
?
value
)
{
_selectedProductsValue
=
value
;
notifyListeners
();
}
set
selectedSalutation
(
String
?
value
)
{
_selectedSalutation
=
value
;
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
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
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
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
productRows
(
value
)
{
_productRows
=
value
;
notifyListeners
();
}
String
?
mailIdError
=
""
;
String
?
companynameError
=
""
;
String
?
salutationError
=
""
;
String
?
nameError
=
""
;
String
?
AlternatemobileError
=
""
;
String
?
TelephoneError
=
""
;
String
?
mobileError
=
""
;
String
?
addressError
=
""
;
String
?
designationError
=
""
;
String
?
taxesError
=
""
;
String
?
SpecialNoteError
=
""
;
String
?
forError
=
""
;
String
?
paymentTermsError
=
""
;
String
?
sourceError
=
""
;
String
?
referenceError
=
""
;
String
?
teamsError
=
""
;
String
?
segmentsError
=
""
;
String
?
statesError
=
""
;
String
?
districtsError
=
""
;
String
?
subLocError
=
""
;
String
?
leadStatusError
=
""
;
bool
_isLoading
=
true
;
bool
_submitLoading
=
false
;
bool
get
isLoading
=>
_isLoading
;
bool
get
submitLoading
=>
_submitLoading
;
set
submitLoading
(
bool
value
)
{
_submitLoading
=
value
;
notifyListeners
();
}
void
addEditUpdateTotalAmount
(
value
)
{
final
price
=
double
.
tryParse
(
addProductPriceController
.
text
)
??
0
;
final
qty
=
int
.
tryParse
(
addQuantityController
.
text
)
??
0
;
addTotalAmountController
.
text
=
(
price
*
qty
).
toString
();
notifyListeners
();
}
void
addInitializeForm
(
BuildContext
context
)
{
addProductPriceController
.
clear
();
addQuantityController
.
clear
();
addTotalAmountController
.
clear
();
notifyListeners
();
}
void
updateSelectedProductIds
(
int
index
,
value
)
{
notifyListeners
();
}
Future
<
void
>
crmAddLeadsView
(
context
,
mode
)
async
{
try
{
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmNewLeadsProspectsViewAPI
(
prov
.
empId
,
prov
.
session
,
mode
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_employeesList
=
data
.
employees
!;
_sourcesList
=
data
.
sources
!;
_teamsList
=
data
.
teams
!;
_statesList
=
data
.
states
!;
_productsList
=
data
.
products
!;
_salutationList
=
data
.
salutation
!;
notifyListeners
();
}
else
{}
}
else
{}
}
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
>
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
>
crmAddNewLeadsAndProspectsAPIFunction
(
BuildContext
context
,
mode
,
acc_manager_id
,
salutation_name
,
district
,
state
,
segment
,
source
,
reference
,
team
,
sub_locality
,
lead_status
,
products
,
)
async
{
try
{
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmNewLeadsProspectsSubmitAPI
(
prov
.
session
,
prov
.
empId
,
mode
,
acc_manager_id
,
salutation_name
,
companyNameController
.
text
,
contactPersonNameController
.
text
,
district
,
state
,
addressController
.
text
,
segment
,
source
,
reference
,
team
,
sub_locality
,
mobileController
.
text
,
alternateMobileController
.
text
,
telephoneController
.
text
,
customerMailIdController
.
text
,
designationController
.
text
,
lead_status
,
products
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
Navigator
.
pop
(
context
,
true
);
toast
(
context
,
data
.
message
);
resetForm
();
notifyListeners
();
}
else
{}
}
else
{}
}
catch
(
e
,
s
)
{
print
(
"Error:
$e
, Stack:
$s
"
);
}
}
onChangemailId
(
value
)
{
mailIdError
=
""
;
notifyListeners
();
}
onChangeCompanyName
(
value
)
{
companynameError
=
""
;
notifyListeners
();
}
onChangeContactPersonName
(
value
)
{
nameError
=
""
;
notifyListeners
();
}
onChangeAlternatemobile
(
value
)
{
AlternatemobileError
=
""
;
notifyListeners
();
}
onChangeTelephone
(
value
)
{
TelephoneError
=
""
;
notifyListeners
();
}
onChangemobile
(
value
)
{
mobileError
=
""
;
notifyListeners
();
}
onChangeaddress
(
value
)
{
addressError
=
""
;
notifyListeners
();
}
onChangedesignation
(
value
)
{
designationError
=
""
;
notifyListeners
();
}
onChangetaxes
(
value
)
{
taxesError
=
""
;
notifyListeners
();
}
onChangeSpecialNote
(
value
)
{
SpecialNoteError
=
""
;
notifyListeners
();
}
onChangefor
(
value
)
{
forError
=
""
;
notifyListeners
();
}
onChangepaymentTerms
(
value
)
{
paymentTermsError
=
""
;
notifyListeners
();
}
void
resetForm
()
{
checkDropdownReset
();
_productRows
.
clear
();
addProductPriceController
.
clear
();
addQuantityController
.
clear
();
addTotalAmountController
.
clear
();
notifyListeners
();
}
void
checkDropdownReset
()
{
notifyListeners
();
}
bool
validateStep1
(){
bool
isValid
=
true
;
if
(
_selectedSalutation
!=
null
||
_selectedSalutation
!=
''
){
isValid
=
false
;
salutationError
=
"Please Select Salutation"
;
}
if
(
companyNameController
.
text
.
trim
().
isEmpty
){
companynameError
=
"Please Enter Company Name"
;
isValid
=
false
;
}
if
(
contactPersonNameController
.
text
.
trim
().
isEmpty
){
nameError
=
"Please Enter Name"
;
isValid
=
false
;
}
// if(customerMailIdController.text.trim().isEmpty){
// mailIdError = "Please enter Email Id";
// isValid = false;
// }
if
(
mobileController
.
text
.
trim
().
isEmpty
){
mobileError
=
"Please enter Mobile Number"
;
isValid
=
false
;
}
// if(designationController.text.trim().isEmpty){
// designationError = "Please enter Designation";
// isValid = false;
// }
notifyListeners
();
return
isValid
;
}
bool
validateStep2
(){
bool
isValid
=
true
;
// if(alternateMobileController.text.trim().isEmpty){
// AlternatemobileError = "";
// isValid = false;
//
// }
// if(telephoneController.text.trim().isEmpty){
// isValid = false;
//
// }
if
(
_selectedSources
!=
null
||
_selectedSourcesId
!.
isEmpty
){
sourceError
=
"Please Select Source"
;
isValid
=
false
;
}
if
(
_selectedReferences
!=
null
||
_selectedReferenceId
!.
isEmpty
){
referenceError
=
"Please Select Reference"
;
isValid
=
false
;
}
if
(
_selectedTeams
!=
null
||
_selectedTeamsId
!.
isEmpty
){
teamsError
=
"Please Select Team"
;
isValid
=
false
;
}
if
(
_selectedSegments
!=
null
||
_selectedSegmentId
!.
isEmpty
){
segmentsError
=
"Please Select Segement"
;
isValid
=
false
;
}
notifyListeners
();
return
isValid
;
}
bool
validateStep3
(){
bool
isValid
=
true
;
if
(
_selectedStates
!=
null
||
_selectedStatesId
!.
isEmpty
){
statesError
=
"Please Select State"
;
isValid
=
false
;
}
if
(
_selectedDistricts
!=
null
||
_selectedDistrictId
!.
isEmpty
){
districtsError
=
"Please Select District"
;
isValid
=
false
;
}
if
(
_selectedSubLocations
!=
null
||
_selectedSubLocationId
!.
isEmpty
){
subLocError
=
"Please Select Sub Location"
;
isValid
=
false
;
}
if
(
_selectedLeadStatus
!=
null
||
_selectedLeadStatus
!.
isEmpty
){
leadStatusError
=
"Please Select Lead Status"
;
isValid
=
false
;
}
if
(
addressController
.
text
.
trim
().
isEmpty
){
addressError
=
"Please Enter address"
;
isValid
=
false
;
}
notifyListeners
();
return
isValid
;
}
resetForm2
()
{
customerMailIdController
.
clear
();
mobileController
.
clear
();
addressController
.
clear
();
taxesController
.
clear
();
SpecialNoteController
.
clear
();
forController
.
clear
();
paymentTermsController
.
clear
();
mailIdError
=
""
;
mobileError
=
""
;
addressError
=
""
;
designationError
=
""
;
taxesError
=
""
;
SpecialNoteError
=
""
;
forError
=
""
;
paymentTermsError
=
""
;
}
}
lib/Notifiers/crmProvider/addProspectLeadsProvider.dart
View file @
8cdaca01
...
...
@@ -4,10 +4,13 @@ import 'package:generp/Models/crmModels/crmProspectDetailsAddLeadsResponse.dart'
import
'package:generp/Notifiers/HomeScreenNotifier.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/services/api_calling.dart'
;
import
'package:get/get.dart'
;
import
'package:provider/provider.dart'
;
class
Addprospectleadsprovider
extends
ChangeNotifier
{
import
'../../Models/crmModels/crmSelectedProductDetailsResponse.dart'
;
import
'crmProspectDetailsProvider.dart'
;
class
Addprospectleadsprovider
extends
ChangeNotifier
{
TextEditingController
searchController
=
TextEditingController
();
List
<
Products
>
_leadProductsList
=
[];
...
...
@@ -18,10 +21,17 @@ class Addprospectleadsprovider extends ChangeNotifier {
String
?
_selectedEmployeeId
;
String
?
_selectedEmployeeValue
;
Products
?
_selectedProducts
;
String
?
_selectedProductsID
;
String
?
_selectedProductsName
;
ProductsData
?
_selectedProductsDeatilsData
;
TextEditingController
addLeadProductPriceController
=
TextEditingController
();
TextEditingController
addLeadProductQtyController
=
TextEditingController
();
TextEditingController
addLeadProductTotalPriceController
=
TextEditingController
();
TextEditingController
addLeadProductTotalPriceController
=
TextEditingController
();
String
?
qtyError
;
String
?
priceError
;
String
?
statusError
;
List
<
TextEditingController
>
editProductPriceControllers
=
[];
List
<
TextEditingController
>
editQuantityControllers
=
[];
...
...
@@ -29,43 +39,71 @@ class Addprospectleadsprovider extends ChangeNotifier {
List
<
String
?>
_selectedProductIds
=
[];
List
<
String
?>
_selectedValues
=
[];
bool
_submitLoading
=
false
;
ProductsData
?
get
selectedProductsDetailsData
=>
_selectedProductsDeatilsData
;
List
<
Products
>
get
leadProductsList
=>
_leadProductsList
;
Products
?
get
selectedProducts
=>
_selectedProducts
;
String
?
get
selectedProductsID
=>
_selectedProductsID
;
String
?
get
selectedProductsName
=>
_selectedProductsName
;
List
<
String
?>
get
selectedProductIds
=>
_selectedProductIds
;
List
<
String
?>
get
selectedValues
=>
_selectedValues
;
bool
get
submitLoading
=>
_submitLoading
;
List
<
LeadEmployees
>
get
employeeList
=>
_employeeList
;
List
<
String
>
get
statusList
=>
_statusList
;
LeadEmployees
?
get
selectedEmployee
=>
_selectedEmployees
;
String
?
get
selectedStatus
=>
_selectedStatus
;
String
?
get
selectedEmployeeId
=>
_selectedEmployeeId
;
String
?
get
selectedEmployeeValue
=>
_selectedEmployeeValue
;
String
?
get
selectedEmployeeValue
=>
_selectedEmployeeValue
;
set
selectedEmployee
(
LeadEmployees
?
value
){
set
selectedEmployee
(
LeadEmployees
?
value
)
{
_selectedEmployees
=
value
;
_selectedEmployeeId
=
value
!.
id
!;
_selectedEmployeeValue
=
value
!.
name
!;
notifyListeners
();
}
set
selectedStatus
(
String
?
value
){
set
selectedStatus
(
String
?
value
)
{
_selectedStatus
=
value
;
statusError
=
null
;
notifyListeners
();
}
set
selectedEmployeeId
(
String
?
value
){
set
selectedEmployeeId
(
String
?
value
)
{
_selectedEmployeeId
=
value
;
notifyListeners
();
}
set
selectedEmployeeValue
(
String
?
value
){
set
selectedEmployeeValue
(
String
?
value
)
{
_selectedEmployeeValue
=
value
;
notifyListeners
();
}
set
selectedProducts
(
Products
?
value
)
{
_selectedProducts
=
value
;
_selectedProductsID
=
value
!.
id
;
_selectedProductsName
=
value
.
name
;
notifyListeners
();
}
set
selectedProductsID
(
String
?
value
)
{
_selectedProductsID
=
value
;
notifyListeners
();
}
set
selectedProductsName
(
String
?
value
)
{
_selectedProductsName
=
value
;
notifyListeners
();
}
...
...
@@ -90,6 +128,28 @@ class Addprospectleadsprovider extends ChangeNotifier {
notifyListeners
();
}
Future
<
void
>
crmSelectedProductDetailsApiFunction
(
BuildContext
context
,
String
productId
,
)
async
{
try
{
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmSelectedProductDetailsApi
(
prov
.
empId
,
prov
.
session
,
productId
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_selectedProductsDeatilsData
=
data
.
productsData
!;
addLeadProductPriceController
.
text
=
data
.
productsData
!.
price
!;
notifyListeners
();
}
}
catch
(
e
,
s
)
{
print
(
"Error:
$e
, Stack:
$s
"
);
}
}
void
editAddNewRow
()
{
editProductPriceControllers
.
add
(
TextEditingController
());
editQuantityControllers
.
add
(
TextEditingController
());
...
...
@@ -132,7 +192,7 @@ class Addprospectleadsprovider extends ChangeNotifier {
"product_id"
:
_selectedProductIds
[
i
]!,
"price"
:
editProductPriceControllers
[
i
].
text
,
"qty"
:
editQuantityControllers
[
i
].
text
,
"net_price"
:
editTotalAmountControllers
[
i
].
text
"net_price"
:
editTotalAmountControllers
[
i
].
text
,
};
insertData
.
add
(
rowData
);
}
...
...
@@ -140,10 +200,17 @@ class Addprospectleadsprovider extends ChangeNotifier {
return
insertData
;
}
Future
<
void
>
crmProspectDetailsAddLeadsViewAPIFunction
(
BuildContext
context
,
String
mode
)
async
{
Future
<
void
>
crmProspectDetailsAddLeadsViewAPIFunction
(
BuildContext
context
,
String
mode
,
)
async
{
try
{
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmProspectDetailsAddLeadViewAPI
(
prov
.
empId
,
prov
.
session
,
mode
);
final
data
=
await
ApiCalling
.
crmProspectDetailsAddLeadViewAPI
(
prov
.
empId
,
prov
.
session
,
mode
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_leadProductsList
=
data
.
products
!;
_employeeList
=
data
.
employees
!;
...
...
@@ -155,13 +222,31 @@ class Addprospectleadsprovider extends ChangeNotifier {
}
}
Future
<
void
>
crmProspectDetailsAddLeadsSubmitAPIFunction
(
BuildContext
context
,
mode
,
account_id
,
acc_manager_id
,
products
,
lead_status
)
async
{
Future
<
void
>
crmProspectDetailsAddLeadsSubmitAPIFunction
(
BuildContext
context
,
mode
,
account_id
,
acc_manager_id
,
products
,
lead_status
,
)
async
{
try
{
_submitLoading
=
true
;
notifyListeners
();
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmProspectDetailsAddLeadSubmitAPI
(
prov
.
empId
,
prov
.
session
,
mode
,
account_id
,
acc_manager_id
,
products
,
lead_status
);
final
data
=
await
ApiCalling
.
crmProspectDetailsAddLeadSubmitAPI
(
prov
.
empId
,
prov
.
session
,
mode
,
account_id
,
acc_manager_id
,
products
,
lead_status
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_submitLoading
=
false
;
resetForm
();
Navigator
.
pop
(
context
,
true
);
Navigator
.
pop
(
context
,
true
);
toast
(
context
,
data
.
message
);
notifyListeners
();
}
...
...
@@ -170,26 +255,113 @@ class Addprospectleadsprovider extends ChangeNotifier {
}
}
void
submitForm
(
BuildContext
context
,
mode
,
accId
,
empID
,
status
)
async
{
Future
<
void
>
crmProspectDetailsAddLeadsSubmitAPIFunctionNew
(
BuildContext
context
,
mode
,
leadId
,
account_id
,
productId
,
lead_status
,
)
async
{
try
{
if
(!
validateform
(
context
))
{
return
;
}
_submitLoading
=
true
;
notifyListeners
();
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
prov2
=
Provider
.
of
<
crmProspectDetailsProvider
>(
context
,
listen:
false
,
);
final
data
=
await
ApiCalling
.
crmProspectDetailsAddLeadAPI
(
prov
.
empId
,
prov
.
session
,
account_id
,
productId
,
addLeadProductQtyController
.
text
,
addLeadProductPriceController
.
text
,
lead_status
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_submitLoading
=
false
;
resetForm
();
Navigator
.
pop
(
context
,
true
);
prov2
.
crmProspectDetailsAPIFunction
(
context
,
leadId
);
toast
(
context
,
data
.
message
);
notifyListeners
();
}
else
{
_submitLoading
=
false
;
notifyListeners
();
}
}
else
{
_submitLoading
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
)
{
_submitLoading
=
false
;
notifyListeners
();
print
(
"Error:
$e
, Stack:
$s
"
);
}
}
bool
validateform
(
context
)
{
bool
isValid
=
true
;
qtyError
=
null
;
priceError
=
null
;
statusError
=
null
;
if
(
addLeadProductQtyController
.
text
.
trim
().
isEmpty
)
{
qtyError
=
"Please Enter Quantity"
;
isValid
=
false
;
}
if
(
addLeadProductPriceController
.
text
.
trim
().
isEmpty
)
{
priceError
=
"Please Enter Price"
;
isValid
=
false
;
}
if
(
_selectedStatus
==
null
||
_selectedStatus
!.
isEmpty
)
{
statusError
=
"Please select a status"
;
isValid
=
false
;
}
notifyListeners
();
return
isValid
;
}
void
submitForm
(
BuildContext
context
,
mode
,
accId
,
empID
,
status
)
async
{
submitLoading
=
true
;
final
insertedData
=
getFormData
();
print
(
"Form Data:
$insertedData
"
);
crmProspectDetailsAddLeadsSubmitAPIFunction
(
context
,
mode
,
accId
,
empID
,
insertedData
,
status
);
crmProspectDetailsAddLeadsSubmitAPIFunction
(
context
,
mode
,
accId
,
empID
,
insertedData
,
status
,
);
submitLoading
=
false
;
}
onChnageProductPrice
(
value
){
onChnageProductPrice
(
value
)
{
priceError
=
null
;
notifyListeners
();
}
onChnageProductQty
(
value
){
onChnageProductQty
(
value
)
{
qtyError
=
null
;
notifyListeners
();
}
onChnageProductTotalPrice
(
value
){
onChnageProductTotalPrice
(
value
)
{
notifyListeners
();
}
void
resetForm
()
{
qtyError
=
null
;
priceError
=
null
;
statusError
=
null
;
searchController
.
clear
();
editProductPriceControllers
.
clear
();
editQuantityControllers
.
clear
();
...
...
@@ -198,18 +370,30 @@ class Addprospectleadsprovider extends ChangeNotifier {
_selectedValues
.
clear
();
_leadProductsList
.
clear
();
_selectedStatus
=
null
;
_selectedProducts
=
null
;
_selectedEmployeeId
=
null
;
_selectedEmployeeValue
=
null
;
_selectedProductsID
=
null
;
_selectedProductsName
=
null
;
addLeadProductPriceController
.
clear
();
addLeadProductQtyController
.
clear
();
addLeadProductTotalPriceController
.
clear
();
checkDropDownReset
();
notifyListeners
();
}
checkDropDownReset
(){
if
(!
_employeeList
.
contains
(
_selectedEmployees
)&&
_selectedEmployees
!=
null
){
_selectedEmployeeId
=
null
;
_selectedEmployeeValue
=
null
;
checkDropDownReset
()
{
// if (!_employeeList.contains(_selectedEmployees) &&
// _selectedEmployees != null) {
// _selectedEmployeeId = null;
// _selectedEmployeeValue = null;
// }
if
(!
_leadProductsList
.
contains
(
_selectedProducts
)
&&
_selectedProducts
!=
null
)
{
_selectedProductsID
=
null
;
_selectedProductsName
=
null
;
}
notifyListeners
();
}
}
lib/Notifiers/crmProvider/crmGenerateQuotationProvider.dart
View file @
8cdaca01
...
...
@@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
import
'package:flutter_download_manager/flutter_download_manager.dart'
;
import
'package:flutter_local_notifications/flutter_local_notifications.dart'
;
import
'package:generp/Models/crmModels/crmLeadDetailsGenerateQuotationViewResponse.dart'
;
import
'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart'
;
import
'package:generp/screens/LoginScreen.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:intl/intl.dart'
;
...
...
@@ -24,7 +25,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
final
GlobalKey
webViewKey
=
GlobalKey
();
var
dl
=
DownloadManager
();
ProductsData
?
_selectedProductsDeatilsData
;
TextEditingController
addEditProductPriceController
=
TextEditingController
();
TextEditingController
addEditQuantityController
=
TextEditingController
();
TextEditingController
addEditTotalAmountController
=
TextEditingController
();
...
...
@@ -44,6 +45,8 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
notifyListeners
();
}
String
?
_selectedTaxes
;
String
?
mailIdError
=
""
;
String
?
mobileError
=
""
;
String
?
subjectsError
=
""
;
...
...
@@ -54,16 +57,24 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
QuoteDetails
_quoteDetails
=
QuoteDetails
();
List
<
LeadProducts
>
_leadProductsList
=
[];
List
<
Products
>
_productsList
=
[];
bool
_isLoading
=
true
;
String
?
_quotationFilePath
;
LeadProducts
?
_selectedLeadProducts
;
Products
?
_selectedProducts
;
String
?
_selectedAddEditLeadProductId
;
String
?
_selectedAddEditLeadProductName
;
String
?
_selectedAddEditProductName
;
String
?
_selectedAddEditProductId
;
List
<
TextEditingController
>
editProductPriceControllers
=
[];
List
<
TextEditingController
>
editQuantityControllers
=
[];
List
<
TextEditingController
>
editTotalAmountControllers
=
[];
ProductsData
?
get
selectedProductsDetailsData
=>
_selectedProductsDeatilsData
;
String
?
get
selectedTaxes
=>
_selectedTaxes
;
List
<
String
?>
_selectedProductIds
=
[];
List
<
String
?>
_selectedValues
=
[];
bool
_submitLoading
=
false
;
...
...
@@ -73,13 +84,25 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
QuoteDetails
get
quoteDetails
=>
_quoteDetails
;
List
<
LeadProducts
>
get
leadProductsList
=>
_leadProductsList
;
List
<
Products
>
get
productsList
=>
_productsList
;
set
leadProductsList
(
List
<
LeadProducts
>
value
)
{
_leadProductsList
=
value
;
notifyListeners
();
}
set
productsList
(
List
<
Products
>
value
)
{
_productsList
=
value
;
notifyListeners
();
}
set
selectedTaxes
(
String
?
value
){
_selectedTaxes
=
value
;
notifyListeners
();
}
LeadProducts
?
get
selectedLeadProducts
=>
_selectedLeadProducts
;
Products
?
get
selectedProducts
=>
_selectedProducts
;
bool
get
isLoading
=>
_isLoading
;
...
...
@@ -89,6 +112,10 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
String
?
get
selectedAddEditLeadProductName
=>
_selectedAddEditLeadProductName
;
String
?
get
selectedAddEditProductId
=>
_selectedAddEditProductId
;
String
?
get
selectedAddEditProductName
=>
_selectedAddEditProductName
;
List
<
String
?>
get
selectedValues
=>
_selectedValues
;
bool
get
submitLoading
=>
_submitLoading
;
...
...
@@ -100,6 +127,23 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
notifyListeners
();
}
set
selectedProducts
(
Products
?
value
){
_selectedProducts
=
value
;
_selectedAddEditProductId
=
value
!.
id
!;
_selectedAddEditProductName
=
value
!.
name
;
notifyListeners
();
}
set
selectedAddEditProductId
(
String
?
value
){
_selectedAddEditProductId
=
value
;
notifyListeners
();
}
set
selectedAddEditProductName
(
String
?
value
){
_selectedAddEditProductName
=
value
;
notifyListeners
();
}
set
selectedAddEditLeadProductId
(
String
?
value
)
{
_selectedAddEditLeadProductId
=
value
;
notifyListeners
();
...
...
@@ -136,6 +180,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
}
void
addEditInitializeForm
(
BuildContext
context
)
{
checkDropdownReset
();
addEditProductPriceController
.
clear
();
addEditQuantityController
.
clear
();
addEditTotalAmountController
.
clear
();
...
...
@@ -146,6 +191,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
}
void
preFillFormForEdit
(
LeadProducts
product
)
{
checkDropdownReset
();
selectedLeadProducts
=
product
;
selectedAddEditLeadProductId
=
product
.
id
;
selectedAddEditLeadProductName
=
product
.
productName
;
...
...
@@ -191,7 +237,27 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
notifyListeners
();
}
Future
<
void
>
crmSelectedProductDetailsApiFunction
(
BuildContext
context
,
String
productId
,
)
async
{
try
{
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmSelectedProductDetailsApi
(
prov
.
empId
,
prov
.
session
,
productId
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_selectedProductsDeatilsData
=
data
.
productsData
!;
addEditProductPriceController
.
text
=
data
.
productsData
!.
price
!;
notifyListeners
();
}
}
catch
(
e
,
s
)
{
print
(
"Error:
$e
, Stack:
$s
"
);
}
}
void
editAddNewRow
()
{
editProductPriceControllers
.
add
(
TextEditingController
());
editQuantityControllers
.
add
(
TextEditingController
());
...
...
@@ -261,6 +327,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
if
(
data
.
error
==
"0"
)
{
_isLoading
=
false
;
_leadProductsList
=
data
.
leadProducts
??
[];
_productsList
=
data
.
products
??
[];
_quoteDetails
=
data
.
quoteDetails
??
...
...
@@ -297,13 +364,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
notifyListeners
();
}
}
else
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LoginScreen
(),
settings:
RouteSettings
(
name:
'LoginScreen'
),
),
);
sessionDoesNotExist
(
context
);
}
}
else
{
_isLoading
=
false
;
...
...
@@ -563,6 +624,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
void
resetForm
()
{
checkDropdownReset
();
_productRows
.
clear
();
selectedTaxes
=
null
;
addEditProductPriceController
.
clear
();
addEditQuantityController
.
clear
();
addEditTotalAmountController
.
clear
();
...
...
@@ -572,6 +634,9 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
_selectedLeadProducts
=
null
;
_selectedAddEditLeadProductId
=
null
;
_selectedAddEditLeadProductName
=
null
;
_selectedAddEditProductName
=
null
;
_selectedAddEditProductId
=
null
;
_selectedProducts
=
null
;
notifyListeners
();
}
...
...
@@ -585,6 +650,9 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
}
resetForm2
()
{
_selectedAddEditProductName
=
null
;
_selectedAddEditProductId
=
null
;
_selectedProducts
=
null
;
mailIdController
.
clear
();
mobileController
.
clear
();
subjectsController
.
clear
();
...
...
@@ -605,5 +673,6 @@ class Crmgeneratequotationprovider extends ChangeNotifier {
SpecialNoteError
=
""
;
forError
=
""
;
paymentTermsError
=
""
;
notifyListeners
();
}
}
lib/Notifiers/crmProvider/crmLeadDetailsProvider.dart
View file @
8cdaca01
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:intl/intl.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -208,7 +209,9 @@ class crmLeadDetailsProvider extends ChangeNotifier {
_isLoading
=
true
;
notifyListeners
();
if
(
data
!=
null
)
{
if
(
data
.
sessionExists
==
1
){
if
(
data
.
error
==
"0"
)
{
print
(
"calling"
);
_leadDetails
=
data
.
leadDetails
!;
_accountDetails
=
data
.
accountDetails
!;
_leadProducts
=
data
.
leadProducts
!;
...
...
@@ -224,6 +227,10 @@ class crmLeadDetailsProvider extends ChangeNotifier {
_isLoading
=
false
;
notifyListeners
();
}
}
else
{
sessionDoesNotExist
(
context
);
}
}
else
{
_isLoading
=
false
;
notifyListeners
();
...
...
@@ -289,6 +296,37 @@ class crmLeadDetailsProvider extends ChangeNotifier {
}
}
Future
<
void
>
crmCheckFields
(
context
,
value
,
type
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmCheckAccountFieldsApi
(
prov
.
empId
,
prov
.
session
,
value
,
type
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
nameError
=
null
;
mobileNumError
=
null
;
altMobError
=
null
;
notifyListeners
();
}
else
if
(
data
.
error
==
"1"
){
if
(
type
==
"name"
){
nameError
=
data
.
message
!;
}
else
if
(
type
==
'mob1'
){
mobileNumError
=
data
.
message
!;
}
else
if
(
type
==
'mob2'
){
altMobError
=
data
.
message
!;
}
notifyListeners
();
}
}
else
{
notifyListeners
();
}
}
catch
(
e
,
s
)
{
notifyListeners
();
}
}
Future
<
void
>
crmLeadDetailsAddAppointmentAPIFunction
(
context
,
leadID
,
appointmentDate
,
appointmentType
,
note
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -353,6 +391,7 @@ class crmLeadDetailsProvider extends ChangeNotifier {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
Navigator
.
pop
(
context
);
},
),
...
...
lib/Notifiers/crmProvider/crmProspectDetailsProvider.dart
View file @
8cdaca01
...
...
@@ -251,6 +251,38 @@ class crmProspectDetailsProvider extends ChangeNotifier {
}
}
Future
<
void
>
crmCheckFields
(
context
,
value
,
type
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmCheckAccountFieldsApi
(
prov
.
empId
,
prov
.
session
,
value
,
type
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
nameError
=
null
;
mobileNumError
=
null
;
altMobError
=
null
;
notifyListeners
();
}
else
if
(
data
.
error
==
"1"
){
if
(
type
==
"name"
){
nameError
=
data
.
message
!;
}
else
if
(
type
==
'mob1'
){
mobileNumError
=
data
.
message
!;
}
else
if
(
type
==
'mob2'
){
altMobError
=
data
.
message
!;
}
notifyListeners
();
}
}
else
{
notifyListeners
();
}
}
catch
(
e
,
s
)
{
notifyListeners
();
}
}
Future
<
void
>
crmProspectDetailsAddContactAPIFunction
(
context
,
accID
)
async
{
try
{
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -345,6 +377,7 @@ class crmProspectDetailsProvider extends ChangeNotifier {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
Navigator
.
pop
(
context
);
},
),
...
...
lib/Notifiers/crmProvider/editProductListProvider.dart
View file @
8cdaca01
...
...
@@ -122,10 +122,14 @@
// }
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart'
;
import
'package:generp/Notifiers/HomeScreenNotifier.dart'
;
import
'package:generp/Utils/SharedpreferencesService.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/services/api_calling.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Models/crmModels/crmLeadDetailsEditProductsViewResponse.dart'
;
import
'../../screens/LoginScreen.dart'
;
import
'crmLeadDetailsProvider.dart'
;
class
Editproductlistprovider
extends
ChangeNotifier
{
...
...
@@ -135,6 +139,7 @@ class Editproductlistprovider extends ChangeNotifier {
List
<
Products
>
_productsList
=
[];
List
<
LeadProducts
>
_leadProductsList
=
[];
Products
?
_selectedProducts
;
ProductsData
?
_selectedProductsDeatilsData
;
String
?
_selectedAddEditProductId
;
String
?
_selectedAddEditProductName
;
List
<
TextEditingController
>
editProductPriceControllers
=
[];
...
...
@@ -143,11 +148,15 @@ class Editproductlistprovider extends ChangeNotifier {
List
<
String
?>
_selectedProductIds
=
[];
List
<
String
?>
_selectedValues
=
[];
bool
_submitLoading
=
false
;
String
?
qtyError
;
String
?
priceError
;
String
?
productError
;
List
<
Products
>
get
productsList
=>
_productsList
;
List
<
LeadProducts
>
get
leadProductsList
=>
_leadProductsList
;
ProductsData
?
get
selectedProductsDetailsData
=>
_selectedProductsDeatilsData
;
Products
?
get
selectedProducts
=>
_selectedProducts
;
String
?
get
selectedAddEditProductId
=>
_selectedAddEditProductId
;
...
...
@@ -164,6 +173,7 @@ class Editproductlistprovider extends ChangeNotifier {
_selectedProducts
=
value
;
_selectedAddEditProductId
=
value
!.
id
!;
_selectedAddEditProductName
=
value
.
name
;
productError
=
null
;
notifyListeners
();
}
...
...
@@ -285,16 +295,50 @@ class Editproductlistprovider extends ChangeNotifier {
prov
.
session
,
leadID
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
if
(
data
!=
null
){
if
(
data
.
sessionExists
==
1
){
if
(
data
.
error
==
"0"
)
{
_leadProductsList
=
data
.
leadProducts
??
[];
_productsList
=
data
.
products
??
[];
notifyListeners
();
}
}
else
{
sessionDoesNotExist
(
context
);
}
}
}
catch
(
e
,
s
)
{
print
(
"Error:
$e
, Stack:
$s
"
);
}
}
Future
<
void
>
crmSelectedProductDetailsApiFunction
(
BuildContext
context
,
String
productId
,
)
async
{
try
{
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmSelectedProductDetailsApi
(
prov
.
empId
,
prov
.
session
,
productId
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_selectedProductsDeatilsData
=
data
.
productsData
!;
addEditProductPriceController
.
text
=
data
.
productsData
!.
price
!;
notifyListeners
();
}
}
catch
(
e
,
s
)
{
print
(
"Error:
$e
, Stack:
$s
"
);
}
}
Future
<
void
>
crmLeadDetailsEditProductsSubmitAPIFunction
(
BuildContext
context
,
products
,
...
...
@@ -327,6 +371,9 @@ class Editproductlistprovider extends ChangeNotifier {
productId
,
)
async
{
try
{
if
(!
validateform
(
context
)){
return
;
}
_submitLoading
=
true
;
notifyListeners
();
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -339,7 +386,7 @@ class Editproductlistprovider extends ChangeNotifier {
leadProductId
,
productId
,
addEditQuantityController
.
text
,
addEdit
TotalAmount
Controller
.
text
,
addEdit
ProductPrice
Controller
.
text
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_submitLoading
=
false
;
...
...
@@ -358,6 +405,28 @@ class Editproductlistprovider extends ChangeNotifier {
}
}
bool
validateform
(
context
){
bool
isValid
=
true
;
qtyError
=
null
;
priceError
=
null
;
productError
=
null
;
if
(
addEditQuantityController
.
text
.
trim
().
isEmpty
){
qtyError
=
"Please Enter Quantity"
;
isValid
=
false
;
}
if
(
addEditTotalAmountController
.
text
.
trim
().
isEmpty
){
priceError
=
"Please Enter Price"
;
isValid
=
false
;
}
if
(
_selectedProducts
==
null
||
_selectedAddEditProductId
!.
isEmpty
)
{
productError
=
"Please select a Product"
;
isValid
=
false
;
}
notifyListeners
();
return
isValid
;
}
void
submitForm
(
BuildContext
context
,
leadID
)
async
{
submitLoading
=
true
;
final
insertedData
=
getFormData
();
...
...
lib/Notifiers/crmProvider/followUpUpdateProvider.dart
View file @
8cdaca01
...
...
@@ -264,6 +264,7 @@ class followUpUpdateProvider extends ChangeNotifier {
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
Navigator
.
pop
(
context
);
},
),
...
...
lib/Notifiers/financeProvider/RequestionListProvider.dart
View file @
8cdaca01
...
...
@@ -703,6 +703,7 @@ class Requestionlistprovider extends ChangeNotifier {
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
Navigator
.
pop
(
context
);
},
),
...
...
lib/Notifiers/financeProvider/paymentReceiptsProvider.dart
View file @
8cdaca01
...
...
@@ -960,6 +960,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
),
),
onPressed:
()
{
Navigator
.
pop
(
context
);
},
),
...
...
@@ -972,6 +973,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
Navigator
.
pop
(
context
);
},
),
...
...
lib/Notifiers/ordersProvider/addOrderProvider.dart
View file @
8cdaca01
...
...
@@ -1586,6 +1586,7 @@ class Addorderprovider extends ChangeNotifier {
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
Navigator
.
pop
(
context
);
},
),
...
...
lib/Notifiers/ordersProvider/addPaymentProvider.dart
View file @
8cdaca01
...
...
@@ -624,6 +624,7 @@ class Addpaymentprovider extends ChangeNotifier{
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
),
),
onPressed:
()
{
setDate
(
_date
??
DateTime
.
now
()
);
Navigator
.
pop
(
context
);
},
),
...
...
lib/Utils/commonServices.dart
View file @
8cdaca01
...
...
@@ -5,6 +5,9 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'../screens/LoginScreen.dart'
;
import
'SharedpreferencesService.dart'
;
toast
(
context
,
text
)
{
// OwnToast(context, text, "0");
Fluttertoast
.
showToast
(
...
...
@@ -17,6 +20,21 @@ toast(context, text) {
fontSize:
15.0
,
);
}
void
sessionDoesNotExist
(
context
)
{
SharedpreferencesService
().
clearPreferences
();
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LoginScreen
(),
settings:
RouteSettings
(
name:
'LoginScreen'
),
),
);
}
String
connection
=
"Online"
;
class
MyConnectivity
{
...
...
lib/Utils/commonWidgets.dart
View file @
8cdaca01
...
...
@@ -222,10 +222,12 @@ Widget textControllerWidget(
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
if
(
textHead
!=
""
)...[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
textHead
),
),
],
Container
(
height:
hintText
==
"Enter Description"
||
hintText
==
"Write Feedback"
?
150
:
50
,
alignment:
Alignment
.
center
,
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment