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
dc88a3f9
Commit
dc88a3f9
authored
Oct 08, 2025
by
Sai Srinivas
Browse files
gen erp 08-10
parent
d2c9404a
Changes
42
Hide whitespace changes
Inline
Side-by-side
android/app/src/main/AndroidManifest.xml
View file @
dc88a3f9
...
...
@@ -61,7 +61,6 @@
</intent-filter>
<intent-filter
android:autoVerify=
"true"
>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
...
...
@@ -70,6 +69,11 @@
<data
android:host=
"whizzdom.gengroup.in"
/>
<data
android:pathPrefix=
""
/>
</intent-filter>
<intent-filter>
<action
android:name=
"FLUTTER_NOTIFICATION_CLICK"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
</intent-filter>
</activity>
<meta-data
android:name=
"flutter_deeplinking_enabled"
...
...
assets/svg/hrm/advance_list_ic.svg
0 → 100644
View file @
dc88a3f9
<svg
width=
"21"
height=
"22"
viewBox=
"0 0 21 22"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<g
clip-path=
"url(#clip0_1_1917)"
>
<path
d=
"M20.1475 11.0416C20.1475 16.6068 15.6361 21.1182 10.0709 21.1182C4.50558 21.1182 -0.00585938 16.6068 -0.00585938 11.0416C-0.00585938 5.47629 4.50558 0.964844 10.0709 0.964844C15.6361 0.964844 20.1475 5.47629 20.1475 11.0416Z"
fill=
"#FFC107"
/>
<path
d=
"M12.1329 15.621C11.9992 15.621 11.8654 15.5826 11.7464 15.5019L6.70795 12.0667C6.4597 11.8964 6.34984 11.5849 6.43874 11.2963C6.52747 11.0077 6.79417 10.8117 7.09543 10.8117H9.15657C10.0407 10.8117 10.7598 10.0926 10.7598 9.2086C10.7598 8.32463 10.0407 7.60554 9.15657 7.60554H7.09543C6.71617 7.60554 6.40838 7.29775 6.40838 6.91849C6.40838 6.53924 6.71617 6.23145 7.09543 6.23145H9.15657C10.7982 6.23145 12.1339 7.56696 12.1339 9.2086C12.1339 10.7961 10.8843 12.0979 9.31693 12.1821L12.5214 14.367C12.8347 14.5804 12.9152 15.0083 12.7019 15.3214C12.569 15.5157 12.3528 15.621 12.1329 15.621Z"
fill=
"#FAFAFA"
/>
<path
d=
"M13.0497 7.60554H7.09525C6.716 7.60554 6.4082 7.29775 6.4082 6.91849C6.4082 6.53924 6.716 6.23145 7.09525 6.23145H13.0497C13.429 6.23145 13.7368 6.53924 13.7368 6.91849C13.7368 7.29775 13.429 7.60554 13.0497 7.60554Z"
fill=
"#FAFAFA"
/>
<path
d=
"M13.0497 10.1241H7.09525C6.716 10.1241 6.4082 9.8163 6.4082 9.43705C6.4082 9.0578 6.716 8.75 7.09525 8.75H13.0497C13.429 8.75 13.7368 9.0578 13.7368 9.43705C13.7368 9.8163 13.429 10.1241 13.0497 10.1241Z"
fill=
"#FAFAFA"
/>
</g>
<defs>
<clipPath
id=
"clip0_1_1917"
>
<rect
width=
"20.1534"
height=
"20.1534"
fill=
"white"
transform=
"translate(-0.00585938 0.964844)"
/>
</clipPath>
</defs>
</svg>
assets/svg/hrm/casual_leave_history_ic.svg
0 → 100644
View file @
dc88a3f9
<svg
width=
"22"
height=
"20"
viewBox=
"0 0 22 20"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M19.17 19.3281C18.2386 19.5383 11.9178 19.7886 10.9836 19.7368C10.9836 19.7368 10.1202 19.7335 9.09516 19.6516C8.48121 19.6026 7.99342 19.5604 7.42326 19.4692C6.44126 19.3112 6.01897 18.897 6.01897 18.8978C7.31357 19.7669 8.53907 18.864 8.73957 17.6281C8.80004 17.203 8.83867 16.775 8.85529 16.3459C12.996 16.3861 17.1364 16.3096 21.2766 16.1165C21.2312 16.6196 21.0878 17.3046 21.0648 17.4023C20.8736 18.23 20.3239 19.1614 19.17 19.3281ZM3.54226 2.83374C3.55271 2.51592 3.51253 2.20492 3.33051 1.99277C3.22323 1.85053 2.6603 1.42262 2.00818 1.54436C1.58347 1.62392 1.23873 1.92889 1.07158 2.32587C0.999978 2.4966 0.943901 2.67344 0.904026 2.85424C0.881927 2.95308 0.743305 3.59476 0.703125 4.09781C1.62406 4.05522 2.54485 4.01812 3.46551 3.98651C3.50047 3.51118 3.53141 3.07563 3.54226 2.83374ZM17.8926 10.1208C17.9139 11.0852 17.7785 13.7981 17.6222 15.4648C15.4091 15.5295 13.1891 15.5636 10.9893 15.5636C10.2833 15.5636 9.56728 15.56 8.85971 15.5532H8.85207C8.64495 15.5532 8.44606 15.6343 8.29792 15.7791C8.14978 15.9238 8.06414 16.1208 8.05932 16.3279C8.04398 16.7213 8.00858 17.1137 7.95324 17.5035C7.86485 18.0432 7.47791 18.4498 7.0524 18.4498C6.3396 18.4731 5.93981 18.2489 5.51712 17.9419C4.62793 17.2954 4.40573 16.1631 4.3997 16.1382C4.22653 14.6612 4.02964 11.2306 4.06018 10.1208C4.05094 9.41365 4.1088 7.76908 4.21206 6.28482C4.22412 5.71949 4.4202 3.45413 4.45314 2.73048C4.48328 1.87826 4.05134 0.909514 2.78968 0.962552C3.30399 0.777321 10.0454 0.453067 10.978 0.505703C12.2638 0.505703 14.229 0.688121 14.9297 0.859691C16.0797 1.15421 17.1879 2.33551 17.4611 3.51158C17.6463 4.23201 17.9288 8.80492 17.8926 10.1208ZM13.1891 9.22963C13.1891 9.02716 13.1087 8.83298 12.9655 8.68981C12.8224 8.54664 12.6282 8.46621 12.4257 8.46621H7.36741C7.16494 8.46621 6.97076 8.54664 6.82759 8.68981C6.68442 8.83298 6.60399 9.02716 6.60399 9.22963C6.60399 9.4321 6.68442 9.62628 6.82759 9.76945C6.97076 9.91262 7.16494 9.99305 7.36741 9.99305H12.4257C12.6282 9.99305 12.8224 9.91262 12.9655 9.76945C13.1087 9.62628 13.1891 9.4321 13.1891 9.22963ZM15.3749 6.01963C15.3749 5.81716 15.2945 5.62298 15.1513 5.47981C15.0082 5.33664 14.814 5.25621 14.6115 5.25621H7.36741C7.26716 5.25621 7.16789 5.27595 7.07526 5.31432C6.98264 5.35269 6.89848 5.40892 6.82759 5.47981C6.7567 5.5507 6.70047 5.63486 6.6621 5.72748C6.62374 5.82011 6.60399 5.91938 6.60399 6.01963C6.60399 6.11989 6.62374 6.21916 6.6621 6.31178C6.70047 6.40441 6.7567 6.48856 6.82759 6.55945C6.89848 6.63035 6.98264 6.68658 7.07526 6.72494C7.16789 6.76331 7.26716 6.78306 7.36741 6.78306H14.6111C14.7114 6.78311 14.8107 6.7634 14.9034 6.72506C14.996 6.68672 15.0803 6.63049 15.1512 6.5596C15.2221 6.4887 15.2784 6.40452 15.3168 6.31187C15.3552 6.21923 15.3749 6.11992 15.3749 6.01963Z"
fill=
"url(#paint0_linear_1_12857)"
/>
<defs>
<linearGradient
id=
"paint0_linear_1_12857"
x1=
"18.9215"
y1=
"27.2575"
x2=
"-3.66815"
y2=
"-12.5131"
gradientUnits=
"userSpaceOnUse"
>
<stop
stop-color=
"#0893B1"
/>
<stop
offset=
"1"
stop-color=
"#68D0E6"
/>
</linearGradient>
</defs>
</svg>
lib/Models/commonModels/commonAccountLedgerResponse.dart
View file @
dc88a3f9
...
...
@@ -141,6 +141,8 @@ class AccountDetails {
String
?
state
;
String
?
district
;
String
?
subLocality
;
String
?
pincode
;
String
?
date
;
AccountDetails
({
this
.
id
,
...
...
@@ -158,6 +160,8 @@ class AccountDetails {
this
.
state
,
this
.
district
,
this
.
subLocality
,
this
.
pincode
,
this
.
date
,
});
AccountDetails
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
...
...
@@ -176,8 +180,12 @@ class AccountDetails {
state
=
json
[
'state'
];
district
=
json
[
'district'
];
subLocality
=
json
[
'sub_locality'
];
pincode
=
json
[
'pincode'
];
date
=
json
[
'date'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
id
;
...
...
@@ -195,6 +203,8 @@ class AccountDetails {
data
[
'state'
]
=
state
;
data
[
'district'
]
=
district
;
data
[
'sub_locality'
]
=
subLocality
;
data
[
'pincode'
]
=
pincode
;
data
[
'date'
]
=
date
;
return
data
;
}
}
lib/Models/crmModels/LeadDetailsResponse.dart
View file @
dc88a3f9
...
...
@@ -341,6 +341,7 @@ class LeadProducts {
String
?
createdDatetime
;
String
?
updatedDatetime
;
String
?
productName
;
String
?
remarks
;
LeadProducts
({
this
.
id
,
...
...
@@ -355,6 +356,7 @@ class LeadProducts {
this
.
createdDatetime
,
this
.
updatedDatetime
,
this
.
productName
,
this
.
remarks
});
LeadProducts
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
...
...
@@ -370,6 +372,7 @@ class LeadProducts {
createdDatetime
=
json
[
'created_datetime'
];
updatedDatetime
=
json
[
'updated_datetime'
];
productName
=
json
[
'product_name'
];
remarks
=
json
[
'remarks'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
...
...
@@ -386,6 +389,7 @@ class LeadProducts {
data
[
'created_datetime'
]
=
createdDatetime
;
data
[
'updated_datetime'
]
=
updatedDatetime
;
data
[
'product_name'
]
=
productName
;
data
[
'remarks'
]
=
remarks
;
return
data
;
}
}
...
...
lib/Models/crmModels/crmLeadDetailsEditProductsViewResponse.dart
View file @
dc88a3f9
...
...
@@ -77,6 +77,7 @@ class LeadProducts {
String
?
createdDatetime
;
String
?
updatedDatetime
;
String
?
productName
;
String
?
remarks
;
LeadProducts
({
this
.
id
,
...
...
@@ -90,6 +91,7 @@ class LeadProducts {
this
.
createdDatetime
,
this
.
updatedDatetime
,
this
.
productName
,
this
.
remarks
});
LeadProducts
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
...
...
@@ -104,6 +106,7 @@ class LeadProducts {
createdDatetime
=
json
[
'created_datetime'
];
updatedDatetime
=
json
[
'updated_datetime'
];
productName
=
json
[
'product_name'
];
remarks
=
json
[
"remarks"
];
}
Map
<
String
,
dynamic
>
toJson
()
{
...
...
@@ -119,6 +122,7 @@ class LeadProducts {
data
[
'created_datetime'
]
=
createdDatetime
;
data
[
'updated_datetime'
]
=
updatedDatetime
;
data
[
'product_name'
]
=
productName
;
data
[
'remarks'
]
=
remarks
;
return
data
;
}
}
lib/Models/crmModels/crmNewLeadsProspectsViewResponse.dart
View file @
dc88a3f9
...
...
@@ -87,17 +87,20 @@ 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
=
<
String
,
dynamic
>{};
data
[
'id'
]
=
id
;
data
[
'name'
]
=
name
;
return
data
;
}
}
...
...
@@ -162,18 +165,21 @@ class States {
class
Products
{
String
?
id
;
String
?
name
;
String
?
remarks
;
Products
({
this
.
id
,
this
.
name
});
Products
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
name
=
json
[
'name'
];
remarks
=
json
[
'remarks'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
<
String
,
dynamic
>{};
data
[
'id'
]
=
id
;
data
[
'name'
]
=
name
;
data
[
'remarks'
];
return
data
;
}
}
lib/Models/crmModels/crmSelectedProductDetailsResponse.dart
View file @
dc88a3f9
...
...
@@ -43,6 +43,7 @@ class ProductsData {
String
?
isExists
;
String
?
createdDatetime
;
String
?
updatedDatetime
;
String
?
remarks
;
ProductsData
({
this
.
id
,
...
...
@@ -60,6 +61,7 @@ class ProductsData {
this
.
isExists
,
this
.
createdDatetime
,
this
.
updatedDatetime
,
this
.
remarks
,
});
ProductsData
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
...
...
@@ -78,6 +80,7 @@ class ProductsData {
isExists
=
json
[
'is_exists'
];
createdDatetime
=
json
[
'created_datetime'
];
updatedDatetime
=
json
[
'updated_datetime'
];
remarks
=
json
[
'remarks'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
...
...
@@ -97,6 +100,7 @@ class ProductsData {
data
[
'is_exists'
]
=
isExists
;
data
[
'created_datetime'
]
=
createdDatetime
;
data
[
'updated_datetime'
]
=
updatedDatetime
;
data
[
'remarks'
]
=
remarks
;
return
data
;
}
}
lib/Models/hrmModels/advanceListResponse.dart
0 → 100644
View file @
dc88a3f9
class
AdvanceListResponse
{
List
<
AdvanceList
>?
advanceList
;
String
?
error
;
String
?
message
;
int
?
sessionExists
;
AdvanceListResponse
(
{
this
.
advanceList
,
this
.
error
,
this
.
message
,
this
.
sessionExists
});
AdvanceListResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'advance_list'
]
!=
null
)
{
advanceList
=
<
AdvanceList
>[];
json
[
'advance_list'
].
forEach
((
v
)
{
advanceList
!.
add
(
new
AdvanceList
.
fromJson
(
v
));
});
}
error
=
json
[
'error'
];
message
=
json
[
'message'
];
sessionExists
=
json
[
'session_exists'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
advanceList
!=
null
)
{
data
[
'advance_list'
]
=
this
.
advanceList
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'session_exists'
]
=
this
.
sessionExists
;
return
data
;
}
}
class
AdvanceList
{
String
?
id
;
String
?
createdDatetime
;
String
?
narration
;
String
?
issuedAmount
;
String
?
deductedAmount
;
String
?
type
;
AdvanceList
(
{
this
.
id
,
this
.
createdDatetime
,
this
.
narration
,
this
.
issuedAmount
,
this
.
deductedAmount
,
this
.
type
});
AdvanceList
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
createdDatetime
=
json
[
'created_datetime'
];
narration
=
json
[
'narration'
];
issuedAmount
=
json
[
'issued_amount'
];
deductedAmount
=
json
[
'deducted_amount'
];
type
=
json
[
'type'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'created_datetime'
]
=
this
.
createdDatetime
;
data
[
'narration'
]
=
this
.
narration
;
data
[
'issued_amount'
]
=
this
.
issuedAmount
;
data
[
'deducted_amount'
]
=
this
.
deductedAmount
;
data
[
'type'
]
=
this
.
type
;
return
data
;
}
}
lib/Models/hrmModels/casualLeaveHistoryResponse.dart
0 → 100644
View file @
dc88a3f9
class
CasualLeaveHistoryResponse
{
List
<
CasualLeaveHistory
>?
casualLeaveHistory
;
String
?
error
;
String
?
message
;
int
?
sessionExists
;
CasualLeaveHistoryResponse
(
{
this
.
casualLeaveHistory
,
this
.
error
,
this
.
message
,
this
.
sessionExists
});
CasualLeaveHistoryResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'casual_leave_history'
]
!=
null
)
{
casualLeaveHistory
=
<
CasualLeaveHistory
>[];
json
[
'casual_leave_history'
].
forEach
((
v
)
{
casualLeaveHistory
!.
add
(
new
CasualLeaveHistory
.
fromJson
(
v
));
});
}
error
=
json
[
'error'
];
message
=
json
[
'message'
];
sessionExists
=
json
[
'session_exists'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
casualLeaveHistory
!=
null
)
{
data
[
'casual_leave_history'
]
=
this
.
casualLeaveHistory
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'session_exists'
]
=
this
.
sessionExists
;
return
data
;
}
}
class
CasualLeaveHistory
{
String
?
des
;
String
?
type
;
String
?
cnt
;
String
?
year
;
CasualLeaveHistory
({
this
.
des
,
this
.
type
,
this
.
cnt
,
this
.
year
});
CasualLeaveHistory
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
des
=
json
[
'des'
];
type
=
json
[
'type'
];
cnt
=
json
[
'cnt'
];
year
=
json
[
'year'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'des'
]
=
this
.
des
;
data
[
'type'
]
=
this
.
type
;
data
[
'cnt'
]
=
this
.
cnt
;
data
[
'year'
]
=
this
.
year
;
return
data
;
}
}
lib/Models/ordersModels/AddOrderViewResponse.dart
View file @
dc88a3f9
import
'../commonModels/commonAccountLedgerResponse.dart'
;
class
AddOrderViewResponse
{
List
<
Employees
>?
employees
;
List
<
States
>?
states
;
...
...
@@ -8,6 +10,15 @@ class AddOrderViewResponse {
String
?
error
;
String
?
message
;
// 🔹 New fields
AccountDetails
?
accountDetails
;
List
<
Product
>?
productList
;
String
?
feedback
;
String
?
followupType
;
String
?
inTime
;
String
?
loc
;
int
?
sessionExists
;
AddOrderViewResponse
({
this
.
employees
,
this
.
states
,
...
...
@@ -19,6 +30,7 @@ class AddOrderViewResponse {
this
.
message
,
});
AddOrderViewResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'employees'
]
!=
null
)
{
employees
=
<
Employees
>[];
...
...
@@ -38,9 +50,18 @@ class AddOrderViewResponse {
saleProducts
!.
add
(
SaleProducts
.
fromJson
(
v
));
});
}
unloadingScope
=
json
[
'unloading_scope'
].
cast
<
String
>();
freightScope
=
json
[
'freight_scope'
].
cast
<
String
>();
erectionScope
=
json
[
'erection_scope'
].
cast
<
String
>();
// 🔹 add this
accountDetails
=
json
[
'account_details'
]
!=
null
?
AccountDetails
.
fromJson
(
json
[
'account_details'
])
// from addOrderAccontDetailsResponse.dart
:
null
;
unloadingScope
=
(
json
[
'unloading_scope'
]
as
List
?)?.
map
((
e
)
=>
e
.
toString
()).
toList
();
freightScope
=
(
json
[
'freight_scope'
]
as
List
?)?.
map
((
e
)
=>
e
.
toString
()).
toList
();
erectionScope
=
(
json
[
'erection_scope'
]
as
List
?)?.
map
((
e
)
=>
e
.
toString
()).
toList
();
error
=
json
[
'error'
];
message
=
json
[
'message'
];
}
...
...
@@ -84,6 +105,25 @@ class Employees {
}
}
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
=
<
String
,
dynamic
>{};
data
[
'id'
]
=
id
;
data
[
'name'
]
=
name
;
return
data
;
}
}
class
SaleProducts
{
String
?
id
;
String
?
productCode
;
...
...
@@ -105,6 +145,7 @@ class SaleProducts {
String
?
refId
;
String
?
price
;
String
?
type
;
String
?
status
;
// ✅ Added field
String
?
productionProcessId
;
String
?
createdBy
;
String
?
datetime
;
...
...
@@ -132,6 +173,7 @@ class SaleProducts {
this
.
refId
,
this
.
price
,
this
.
type
,
this
.
status
,
this
.
productionProcessId
,
this
.
createdBy
,
this
.
datetime
,
...
...
@@ -160,6 +202,7 @@ class SaleProducts {
refId
=
json
[
'ref_id'
];
price
=
json
[
'price'
];
type
=
json
[
'type'
];
status
=
json
[
'status'
];
// ✅ Added
productionProcessId
=
json
[
'production_process_id'
];
createdBy
=
json
[
'created_by'
];
datetime
=
json
[
'datetime'
];
...
...
@@ -189,6 +232,7 @@ class SaleProducts {
data
[
'ref_id'
]
=
refId
;
data
[
'price'
]
=
price
;
data
[
'type'
]
=
type
;
data
[
'status'
]
=
status
;
// ✅ Added
data
[
'production_process_id'
]
=
productionProcessId
;
data
[
'created_by'
]
=
createdBy
;
data
[
'datetime'
]
=
datetime
;
...
...
@@ -198,21 +242,25 @@ class SaleProducts {
}
}
class
States
{
String
?
id
;
class
Product
{
String
?
productId
;
String
?
name
;
String
?
price
;
States
({
this
.
id
,
this
.
nam
e
});
Product
({
this
.
productId
,
this
.
name
,
this
.
pric
e
});
States
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
i
d
=
json
[
'id'
];
Product
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
productI
d
=
json
[
'
product_
id'
];
name
=
json
[
'name'
];
price
=
json
[
'price'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
<
String
,
dynamic
>{};
data
[
'
id'
]
=
i
d
;
data
[
'
product_id'
]
=
productI
d
;
data
[
'name'
]
=
name
;
data
[
'price'
]
=
price
;
return
data
;
}
}
lib/Notifiers/crmProvider/LeadListProvider.dart
View file @
dc88a3f9
...
...
@@ -1235,20 +1235,27 @@ class Leadlistprovider extends ChangeNotifier {
'empId:
${HomeProv.empId}
, session:
${HomeProv.session}
, pageNumber:
$_currentPage
'
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
if
(
append
)
{
_crmLeadList
.
addAll
(
data
.
leadList
??
[]);
}
else
{
_crmLeadList
=
data
.
leadList
??
[];
}
if
(
data
.
leadList
==
null
||
data
.
leadList
!.
length
<
10
)
{
_hasMoreData
=
false
;
// no more pages
if
(
data
!=
null
){
if
(
data
.
error
==
"0"
)
{
print
(
"Lead List Length
${data.leadList!.length}
"
);
if
(
append
)
{
_crmLeadList
.
addAll
(
data
.
leadList
??
[]);
}
else
{
_crmLeadList
=
data
.
leadList
??
[];
}
if
(
data
.
leadList
!.
length
<
15
)
{
_hasMoreData
=
false
;
// no more pages
}
}
else
if
(
data
.
error
==
"1"
)
{
if
(!
append
)
_errorMessage
=
"No leads found!"
;
_hasMoreData
=
false
;
}
}
else
{
if
(!
append
)
_errorMessage
=
"No leads found!"
;
}
else
{
_hasMoreData
=
false
;
}
}
catch
(
e
)
{
_errorMessage
=
"Error:
$e
"
;
}
...
...
lib/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart
View file @
dc88a3f9
...
...
@@ -41,6 +41,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
TextEditingController
addProductPriceController
=
TextEditingController
();
TextEditingController
addQuantityController
=
TextEditingController
();
TextEditingController
addTotalAmountController
=
TextEditingController
();
TextEditingController
remarkController
=
TextEditingController
();
TextEditingController
companyNameController
=
TextEditingController
();
TextEditingController
contactPersonNameController
=
TextEditingController
();
...
...
@@ -58,6 +59,8 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
List
<
Map
<
String
,
dynamic
>>
_productRows
=
[];
// For backend
List
<
Map
<
String
,
dynamic
>>
get
productRows
=>
_productRows
;
ProductsData
?
_selectedProductsDeatilsData
;
List
<
Employees
>
_employeesList
=
[];
List
<
Sources
>
_sourcesList
=
[];
...
...
@@ -84,6 +87,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
String
?
_selectedStatesId
;
String
?
_selectedStatesValue
;
Products
?
_selectedProducts
;
String
?
_selectedProductsRemarks
;
String
?
_selectedProductsId
;
String
?
_selectedProductsValue
;
String
?
_selectedSalutation
;
...
...
@@ -143,6 +147,8 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
Products
?
get
selectedProducts
=>
_selectedProducts
;
String
?
get
selectedProductsRemarks
=>
_selectedProductsRemarks
;
String
?
get
selectedProductsId
=>
_selectedProductsId
;
String
?
get
selectedProductsValue
=>
_selectedProductsValue
;
...
...
@@ -263,6 +269,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
if
(
value
!=
null
)
{
_selectedProductsId
=
value
.
id
;
_selectedProductsValue
=
value
.
name
;
_selectedProductsRemarks
=
value
.
remarks
;
}
notifyListeners
();
...
...
@@ -278,6 +285,11 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
notifyListeners
();
}
set
selectedProductsRemark
(
String
?
value
)
{
_selectedProductsRemarks
=
value
;
notifyListeners
();
}
set
selectedSalutation
(
String
?
value
)
{
_selectedSalutation
=
value
;
salutationError
=
null
;
...
...
@@ -430,6 +442,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
addProductPriceController
.
text
=
product
[
'price'
]
??
''
;
addQuantityController
.
text
=
product
[
'qty'
]
??
''
;
addTotalAmountController
.
text
=
product
[
'net_price'
]
??
''
;
remarkController
.
text
=
product
[
'remarks'
]
??
''
;
notifyListeners
();
}
...
...
@@ -443,6 +456,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
void
addInitializeForm
(
BuildContext
context
)
{
addProductPriceController
.
clear
();
addQuantityController
.
clear
();
remarkController
.
clear
();
addTotalAmountController
.
clear
();
notifyListeners
();
...
...
@@ -477,6 +491,44 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
}
catch
(
e
)
{}
}
/// check phone number and name existence on server
Future
<
bool
>
checkAccountFieldExistence
(
BuildContext
context
,
{
required
String
type
,
// e.g. "mob1", "mob2", "name"
required
String
typeValue
,
})
async
{
try
{
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
res
=
await
ApiCalling
.
crmCheckAccountFieldsApi
(
prov
.
empId
,
prov
.
session
,
typeValue
,
type
,
);
if
(
res
!=
null
)
{
if
(
res
.
error
==
"0"
)
{
// ✅ No error -> field available
debugPrint
(
"✅
$type
is available:
$typeValue
"
);
return
true
;
}
else
{
// ❌ Field already exists
debugPrint
(
"⚠️
$type
already exists:
$typeValue
"
);
return
false
;
}
}
else
{
debugPrint
(
"❌ Null Response while checking
$type
"
);
return
false
;
}
}
catch
(
e
,
s
)
{
debugPrint
(
"❌ Error in checkAccountFieldExistence:
$e
\n
$s
"
);
return
false
;
}
}
Future
<
void
>
crmLeadListDistrictsOnStateAPIFunction
(
context
,
mode
,
...
...
@@ -645,6 +697,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_selectedProductsDeatilsData
=
data
.
productsData
!;
addProductPriceController
.
text
=
data
.
productsData
!.
price
!;
remarkController
.
text
=
data
.
productsData
!.
remarks
!;
notifyListeners
();
}
}
catch
(
e
,
s
)
{
...
...
@@ -662,10 +715,8 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
notifyListeners
();
}
onChangeContactPersonName
(
value
)
{
nameError
=
""
;
notifyListeners
();
}
onChangeAlternatemobile
(
value
)
{
AlternatemobileError
=
""
;
...
...
@@ -677,11 +728,51 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
notifyListeners
();
}
onChangemobile
(
value
)
{
Future
<
void
>
onChangeContactPersonName
(
BuildContext
context
,
String
value
)
async
{
nameError
=
""
;
if
(
value
.
isEmpty
)
{
nameError
=
"Name cannot be empty"
;
}
else
if
(
value
.
length
<
3
)
{
nameError
=
"Name must be at least 3 characters"
;
}
else
{
final
exists
=
await
checkAccountFieldExistence
(
context
,
type:
"name"
,
typeValue:
value
,
);
if
(!
exists
)
{
nameError
=
"Name already exists"
;
}
else
{
nameError
=
null
;
}
}
notifyListeners
();
}
Future
<
void
>
onChangemobile
(
BuildContext
context
,
String
value
)
async
{
mobileError
=
""
;
if
(
value
.
isEmpty
)
{
mobileError
=
"Mobile number cannot be empty"
;
}
else
if
(
value
.
length
!=
10
)
{
mobileError
=
"Mobile number must be 10 digits"
;
}
else
{
// ✅ Call API to check existence
final
exists
=
await
checkAccountFieldExistence
(
context
,
type:
"mob1"
,
// or "mob2" depending on which mobile field you are validating
typeValue:
value
,
);
if
(!
exists
)
{
mobileError
=
"Mobile number already exists"
;
}
else
{
mobileError
=
null
;
}
}
notifyListeners
();
}
onChangeaddress
(
value
)
{
addressError
=
""
;
notifyListeners
();
...
...
@@ -715,6 +806,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
void
resetForm
()
{
checkDropdownReset
();
_productRows
.
clear
();
remarkController
.
clear
();
sourceSearchController
.
clear
();
referenceSearchController
.
clear
();
teamSearchController
.
clear
();
...
...
@@ -752,6 +844,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedStatesId
=
null
;
_selectedStatesValue
=
null
;
_selectedProducts
=
null
;
_selectedProductsRemarks
=
null
;
_selectedProductsId
=
null
;
_selectedProductsValue
=
null
;
_selectedSalutation
=
null
;
...
...
@@ -798,6 +891,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
_selectedProducts
!=
null
)
{
_selectedProductsId
=
null
;
_selectedProductsValue
=
null
;
_selectedProductsRemarks
=
null
;
}
if
(!
_employeesList
.
contains
(
_selectedEmployees
)
&&
_selectedEmployees
!=
null
)
{
...
...
lib/Notifiers/crmProvider/addProspectLeadsProvider.dart
View file @
dc88a3f9
...
...
@@ -23,11 +23,12 @@ class Addprospectleadsprovider extends ChangeNotifier {
Products
?
_selectedProducts
;
String
?
_selectedProductsID
;
String
?
_selectedProductsName
;
String
?
_selectedProductsRemark
;
ProductsData
?
_selectedProductsDeatilsData
;
TextEditingController
addLeadProductPriceController
=
TextEditingController
();
TextEditingController
addLeadProductQtyController
=
TextEditingController
();
TextEditingController
addLeadProductTotalPriceController
=
TextEditingController
();
TextEditingController
addLeadProductTotalPriceController
=
TextEditingController
();
TextEditingController
addLeadProductRemarksController
=
TextEditingController
();
String
?
qtyError
;
String
?
priceError
;
...
...
@@ -36,8 +37,11 @@ class Addprospectleadsprovider extends ChangeNotifier {
List
<
TextEditingController
>
editProductPriceControllers
=
[];
List
<
TextEditingController
>
editQuantityControllers
=
[];
List
<
TextEditingController
>
editTotalAmountControllers
=
[];
List
<
TextEditingController
>
editRemarkControllers
=
[];
final
List
<
String
?>
_selectedProductIds
=
[];
final
List
<
String
?>
_selectedValues
=
[];
bool
_submitLoading
=
false
;
ProductsData
?
get
selectedProductsDetailsData
=>
_selectedProductsDeatilsData
;
...
...
@@ -49,6 +53,8 @@ class Addprospectleadsprovider extends ChangeNotifier {
String
?
get
selectedProductsName
=>
_selectedProductsName
;
String
?
get
selectedProductsRemark
=>
_selectedProductsRemark
;
List
<
String
?>
get
selectedProductIds
=>
_selectedProductIds
;
List
<
String
?>
get
selectedValues
=>
_selectedValues
;
...
...
@@ -193,6 +199,7 @@ class Addprospectleadsprovider extends ChangeNotifier {
"price"
:
editProductPriceControllers
[
i
].
text
,
"qty"
:
editQuantityControllers
[
i
].
text
,
"net_price"
:
editTotalAmountControllers
[
i
].
text
,
"remarks"
:
editRemarkControllers
[
i
].
text
,
};
insertData
.
add
(
rowData
);
}
...
...
@@ -282,6 +289,7 @@ class Addprospectleadsprovider extends ChangeNotifier {
addLeadProductQtyController
.
text
,
addLeadProductPriceController
.
text
,
leadStatus
,
addLeadProductRemarksController
.
text
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
...
...
@@ -364,6 +372,7 @@ class Addprospectleadsprovider extends ChangeNotifier {
statusError
=
null
;
searchController
.
clear
();
editProductPriceControllers
.
clear
();
addLeadProductRemarksController
.
clear
();
editQuantityControllers
.
clear
();
editTotalAmountControllers
.
clear
();
_selectedProductIds
.
clear
();
...
...
@@ -375,6 +384,7 @@ class Addprospectleadsprovider extends ChangeNotifier {
_selectedEmployeeValue
=
null
;
_selectedProductsID
=
null
;
_selectedProductsName
=
null
;
_selectedProductsRemark
=
null
;
addLeadProductPriceController
.
clear
();
addLeadProductQtyController
.
clear
();
addLeadProductTotalPriceController
.
clear
();
...
...
@@ -393,6 +403,8 @@ class Addprospectleadsprovider extends ChangeNotifier {
_selectedProducts
!=
null
)
{
_selectedProductsID
=
null
;
_selectedProductsName
=
null
;
_selectedProductsRemark
=
null
;
}
notifyListeners
();
}
...
...
lib/Notifiers/crmProvider/editProductListProvider.dart
View file @
dc88a3f9
...
...
@@ -141,6 +141,7 @@ class Editproductlistprovider extends ChangeNotifier {
TextEditingController
addEditProductPriceController
=
TextEditingController
();
TextEditingController
addEditQuantityController
=
TextEditingController
();
TextEditingController
addEditTotalAmountController
=
TextEditingController
();
TextEditingController
addEditRemarkController
=
TextEditingController
();
List
<
Products
>
_productsList
=
[];
List
<
LeadProducts
>
_leadProductsList
=
[];
Products
?
_selectedProducts
;
...
...
@@ -150,12 +151,14 @@ class Editproductlistprovider extends ChangeNotifier {
List
<
TextEditingController
>
editProductPriceControllers
=
[];
List
<
TextEditingController
>
editQuantityControllers
=
[];
List
<
TextEditingController
>
editTotalAmountControllers
=
[];
List
<
TextEditingController
>
editRemarkControllers
=
[];
final
List
<
String
?>
_selectedProductIds
=
[];
final
List
<
String
?>
_selectedValues
=
[];
bool
_submitLoading
=
false
;
String
?
qtyError
;
String
?
priceError
;
String
?
productError
;
String
?
remarkError
;
bool
get
editProductDetailsClicked
=>
_editProductDetailsClicked
;
bool
get
editContactDetailsClicked
=>
_editContactDetailsClicked
;
...
...
@@ -234,6 +237,7 @@ class Editproductlistprovider extends ChangeNotifier {
editProductPriceControllers
.
clear
();
editQuantityControllers
.
clear
();
editTotalAmountControllers
.
clear
();
editRemarkControllers
.
clear
();
_selectedProductIds
.
clear
();
_selectedValues
.
clear
();
...
...
@@ -253,6 +257,9 @@ class Editproductlistprovider extends ChangeNotifier {
.
toString
(),
),
);
editRemarkControllers
.
add
(
TextEditingController
(
text:
product
.
remarks
?.
toString
()
??
''
),
);
_selectedProductIds
.
add
(
product
.
productId
);
_selectedValues
.
add
(
product
.
productName
);
}
...
...
@@ -281,6 +288,7 @@ class Editproductlistprovider extends ChangeNotifier {
editProductPriceControllers
.
removeAt
(
index
);
editQuantityControllers
.
removeAt
(
index
);
editTotalAmountControllers
.
removeAt
(
index
);
editRemarkControllers
.
removeAt
(
index
);
_selectedProductIds
.
removeAt
(
index
);
_selectedValues
.
removeAt
(
index
);
notifyListeners
();
...
...
@@ -314,6 +322,7 @@ class Editproductlistprovider extends ChangeNotifier {
"product_id"
:
_selectedProductIds
[
i
]!,
"price"
:
editProductPriceControllers
[
i
].
text
,
"qty"
:
editQuantityControllers
[
i
].
text
,
"remarks"
:
editRemarkControllers
[
i
].
text
,
};
insertData
.
add
(
rowData
);
}
...
...
@@ -401,6 +410,7 @@ class Editproductlistprovider extends ChangeNotifier {
type
,
leadProductId
,
productId
,
prductRemark
,
)
async
{
try
{
if
(!
validateform
(
context
))
{
...
...
@@ -419,6 +429,7 @@ class Editproductlistprovider extends ChangeNotifier {
productId
,
addEditQuantityController
.
text
,
addEditProductPriceController
.
text
,
addEditRemarkController
.
text
,
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_submitLoading
=
false
;
...
...
@@ -477,10 +488,12 @@ class Editproductlistprovider extends ChangeNotifier {
_quotationDetailsClicked
=
false
;
addEditProductPriceController
.
clear
();
addEditQuantityController
.
clear
();
addEditRemarkController
.
clear
();
addEditTotalAmountController
.
clear
();
editProductPriceControllers
.
clear
();
editQuantityControllers
.
clear
();
editTotalAmountControllers
.
clear
();
editRemarkControllers
.
clear
();
_selectedProductIds
.
clear
();
_selectedProducts
=
null
;
_selectedAddEditProductId
=
null
;
...
...
lib/Notifiers/crmProvider/followUpUpdateProvider.dart
View file @
dc88a3f9
...
...
@@ -9,6 +9,7 @@ import 'package:intl/intl.dart';
import
'package:provider/provider.dart'
;
import
'../../screens/crm/LeadDetailsByMode.dart'
;
import
'../../screens/order/addOrder.dart'
;
import
'../../services/api_calling.dart'
;
import
'crmLeadDetailsProvider.dart'
;
...
...
@@ -156,26 +157,33 @@ class followUpUpdateProvider extends ChangeNotifier {
}
Future
<
void
>
crmAddFollowUpAPIFunction
(
BuildContext
context
,
fromScreen
,
nextAppointmentStatus
,
orderStatus
,
leadID
,
followupType
,
competitor
,
leadStatus
,
appointmentType
,
sms
,
[
mode
,
])
async
{
BuildContext
context
,
fromScreen
,
nextAppointmentStatus
,
orderStatus
,
leadID
,
followupType
,
competitor
,
leadStatus
,
appointmentType
,
feedback
,
inTime
,
loc
,
sms
,
[
mode
,
])
async
{
try
{
// validate form before API call
if
(!
valid
())
{
return
;
}
_submitLoading
=
true
;
notifyListeners
();
final
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
prov2
=
Provider
.
of
<
crmLeadDetailsProvider
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
crmLeadDetailsAddFollowUpAPI
(
prov
.
session
,
prov
.
empId
,
...
...
@@ -194,24 +202,44 @@ class followUpUpdateProvider extends ChangeNotifier {
sms
,
noteController
.
text
,
);
debugPrint
(
"status ================
$orderStatus
"
);
if
(
data
!=
null
&&
data
.
error
==
"0"
)
{
_submitLoading
=
false
;
resetForm
();
if
(
fromScreen
==
"Pending Tasks"
)
{
if
(
orderStatus
==
"Order Gain"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
AddorderScreen
(
key:
UniqueKey
(),
mode:
mode
,
pageTitleName:
"Add Order"
,
leadId:
leadID
,
feedback:
feedback
,
followupType:
followupType
,
inTime:
inTime
,
loc:
loc
,
),
),
);
}
else
if
(
fromScreen
==
"Pending Tasks"
)
{
Navigator
.
pushAndRemoveUntil
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LeadDetailsByMode
(
mode:
"executive"
,
pageTitleName:
"Lead Details"
,
leadId:
leadID
??
"-"
,
),
settings:
RouteSettings
(
name:
"LeadDetailsByMode"
),
builder:
(
_
)
=>
LeadDetailsByMode
(
mode:
"executive"
,
pageTitleName:
"Lead Details"
,
leadId:
leadID
??
"-"
,
),
settings:
const
RouteSettings
(
name:
"LeadDetailsByMode"
),
),
(
Route
<
dynamic
>
route
)
{
return
route
.
settings
.
name
==
'CrmdashboardScreen'
;
},
(
Route
<
dynamic
>
route
)
=>
route
.
settings
.
name
==
'CrmdashboardScreen'
,
);
}
else
{
Navigator
.
pop
(
context
);
...
...
@@ -229,10 +257,11 @@ class followUpUpdateProvider extends ChangeNotifier {
}
catch
(
e
,
s
)
{
_submitLoading
=
false
;
notifyListeners
();
p
rint
(
"Error:
$e
, Stack:
$s
"
);
debugP
rint
(
"Error:
$e
, Stack:
$s
"
);
}
}
bool
valid
()
{
followupError
=
null
;
followupFeedbackError
=
null
;
...
...
lib/Notifiers/financeProvider/RequesitionLidtDetailsProvider.dart
View file @
dc88a3f9
...
...
@@ -390,45 +390,85 @@ class Requesitionlidtdetailsprovider extends ChangeNotifier {
}
Future
<
void
>
paymentrequisitionApproveSubmitAPIFunction
(
context
,
mode
,
paymentRequestId
,
approvedAmount
,
approveRemarks
,
proposedPaymentAccountId
,
)
async
{
BuildContext
context
,
String
mode
,
String
payment_request_id
,
String
approved_amount
,
String
approve_remarks
,
String
proposed_payment_account_id
,
)
async
{
print
(
"🎯 === PROVIDER METHOD STARTED ==="
);
try
{
if
(!
validateApproval
(
approvedAmount
,
approveRemarks
,
proposedPaymentAccountId
,
))
{
print
(
"🔍 Starting validation..."
);
if
(!
validateApproval
(
approved_amount
,
approve_remarks
,
proposed_payment_account_id
))
{
print
(
"❌ VALIDATION FAILED - Stopping execution"
);
return
;
}
print
(
"✅ Validation passed"
);
var
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
print
(
"👤 Getting home provider..."
);
var
homeProvider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
print
(
"👤 Emp ID:
${homeProvider.empId}
, Session:
${homeProvider.session}
"
);
print
(
"🌐 Calling API..."
);
final
data
=
await
ApiCalling
.
ApprovePaymentRequestSubmitAPI
(
p
rovider
.
empId
,
p
rovider
.
session
,
homeP
rovider
.
empId
,
homeP
rovider
.
session
,
mode
,
payment
R
equest
I
d
,
approved
A
mount
,
approve
R
emarks
,
proposed
P
ayment
A
ccount
I
d
,
payment
_r
equest
_i
d
,
approved
_a
mount
,
approve
_r
emarks
,
proposed
_p
ayment
_a
ccount
_i
d
,
);
print
(
"🌐 API call completed"
);
if
(
data
!=
null
)
{
print
(
"📡 API Response: error=
${data.error}
, message=
${data.message}
"
);
if
(
data
.
error
==
"0"
)
{
paymentRequesitionDetails
(
context
,
paymentRequestId
);
resetAll
();
toast
(
context
,
data
.
message
);
Navigator
.
pop
(
context
,
true
);
print
(
"✅ API SUCCESS - Processing..."
);
// Check if context is still valid before UI operations
if
(
context
.
mounted
)
{
print
(
"🎯 Context mounted - performing UI operations"
);
paymentRequesitionDetails
(
context
,
payment_request_id
);
resetAll
();
toast
(
context
,
data
.
message
);
Navigator
.
pop
(
context
,
true
);
print
(
"✅ UI operations completed"
);
}
else
{
print
(
"⚠️ Context not mounted - skipping UI operations"
);
}
notifyListeners
();
print
(
"✅ Notify listeners called"
);
}
else
{
print
(
"❌ API returned error:
${data.message}
"
);
if
(
context
.
mounted
)
{
toast
(
context
,
data
.
message
??
"Submission failed"
);
}
}
}
else
{
print
(
"❌ NULL response from API"
);
if
(
context
.
mounted
)
{
toast
(
context
,
"No response from server"
);
}
}
}
catch
(
e
)
{}
}
catch
(
e
,
s
)
{
print
(
"💥 EXCEPTION in provider method:
$e
"
);
print
(
"📋 Stack trace:
$s
"
);
// Show error to user
if
(
context
.
mounted
)
{
toast
(
context
,
"Error:
${e.toString()}
"
);
}
}
print
(
"🎯 === PROVIDER METHOD COMPLETED ==="
);
}
editPrevalues
()
{
editPaymentRequestedAmountController
.
text
=
_requestDetails
.
requestedAmount
??
"-"
;
...
...
@@ -530,35 +570,72 @@ class Requesitionlidtdetailsprovider extends ChangeNotifier {
}
bool
validateApproval
(
approvedAmount
,
approveRemarks
,
proposedPaymentAccountId
,
)
{
String
approvedAmount
,
// Add type for clarity
String
approveRemarks
,
// Add type for clarity
String
proposedPaymentAccountId
,
// Add type for clarity
)
{
print
(
"🔍 === VALIDATION STARTED ==="
);
print
(
" Approved Amount: '
$approvedAmount
'"
);
print
(
" Requested Amount: '
${requestedAmount.text}
'"
);
print
(
" Remarks: '
$approveRemarks
'"
);
print
(
" Payment Account ID: '
$proposedPaymentAccountId
'"
);
print
(
" Selected ID: '
$_selectedID
'"
);
remarksError
=
null
;
ApprovedAmountError
=
null
;
selectpaymentAccountError
=
null
;
bool
isValid
=
true
;
if
(
approvedAmount
.
toString
().
trim
().
isEmpty
)
{
// Fix 1: Use the String parameter directly (no .text)
if
(
approvedAmount
.
trim
().
isEmpty
)
{
ApprovedAmountError
=
"Enter Amount"
;
isValid
=
false
;
print
(
"❌ Approved amount is empty"
);
}
if
(
approveRemarks
.
toString
().
trim
().
isEmpty
)
{
// Fix 2: Use the String parameter directly (no .text)
if
(
approveRemarks
.
trim
().
isEmpty
)
{
remarksError
=
"Please Enter Remarks"
;
isValid
=
false
;
print
(
"❌ Remarks are empty"
);
}
final
numberFormat
=
NumberFormat
.
decimalPattern
();
if
(
numberFormat
.
parse
(
approvedAmount
.
text
)
>
numberFormat
.
parse
(
requestedAmount
.
text
))
{
ApprovedAmountError
=
"Approved Amount should not be greater than requested amount"
;
isValid
=
false
;
// Fix 3: Parse the String parameters, not .text
if
(
approvedAmount
.
trim
().
isNotEmpty
&&
requestedAmount
.
text
.
trim
().
isNotEmpty
)
{
try
{
final
numberFormat
=
NumberFormat
.
decimalPattern
();
double
approved
=
numberFormat
.
parse
(
approvedAmount
.
trim
()).
toDouble
();
double
requested
=
numberFormat
.
parse
(
requestedAmount
.
text
.
trim
()).
toDouble
();
print
(
"💰 Amount Comparison: Approved:
$approved
, Requested:
$requested
"
);
if
(
approved
>
requested
)
{
ApprovedAmountError
=
"Approved Amount should not be greater than requested amount"
;
isValid
=
false
;
print
(
"❌ Approved amount exceeds requested amount"
);
}
}
catch
(
e
)
{
print
(
"💥 Error parsing amounts:
$e
"
);
ApprovedAmountError
=
"Invalid amount format"
;
isValid
=
false
;
}
}
if
(
_selectedPaymentAccounts
==
null
||
_selectedID
.
isEmpty
)
{
// Fix 4: Use the parameter OR check both for consistency
if
(
proposedPaymentAccountId
.
isEmpty
&&
_selectedID
.
isEmpty
)
{
selectpaymentAccountError
=
"Please select an account"
;
isValid
=
false
;
print
(
"❌ No payment account selected"
);
}
else
if
(
proposedPaymentAccountId
.
isNotEmpty
&&
_selectedID
.
isEmpty
)
{
// If parameter has value but _selectedID doesn't, sync them
_selectedID
=
proposedPaymentAccountId
;
print
(
"🔄 Synced selected ID from parameter:
$_selectedID
"
);
}
_submitClicked
=
false
;
notifyListeners
();
print
(
"🔍 === VALIDATION RESULT:
$isValid
==="
);
return
isValid
;
}
...
...
lib/Notifiers/hrmProvider/advanceProvider.dart
0 → 100644
View file @
dc88a3f9
import
'package:flutter/material.dart'
;
import
'../../Models/hrmModels/advanceListResponse.dart'
;
import
'../../services/api_calling.dart'
;
class
AdvanceListProvider
extends
ChangeNotifier
{
bool
_isLoading
=
false
;
bool
get
isLoading
=>
_isLoading
;
String
?
_errorMessage
;
String
?
get
errorMessage
=>
_errorMessage
;
List
<
AdvanceList
>
_advanceList
=
[];
List
<
AdvanceList
>
get
advanceList
=>
_advanceList
;
int
_currentPage
=
1
;
int
get
currentPage
=>
_currentPage
;
bool
_hasMore
=
true
;
bool
get
hasMore
=>
_hasMore
;
/// Fetch Advance List
Future
<
void
>
fetchAdvanceList
(
BuildContext
context
,
String
session
,
String
empId
,
{
int
page
=
1
,
bool
loadMore
=
false
})
async
{
if
(
_isLoading
)
return
;
_isLoading
=
true
;
if
(!
loadMore
)
{
_errorMessage
=
null
;
_advanceList
=
[];
_currentPage
=
1
;
_hasMore
=
true
;
}
notifyListeners
();
try
{
final
response
=
await
ApiCalling
.
advanceListAPI
(
session
,
empId
,
page
);
debugPrint
(
'lenght:
${response?.advanceList?.length}
, empId:
${empId}
, session:
${session}
, pageNumber:
$page
'
);
if
(
response
!=
null
)
{
if
(
response
.
error
==
"0"
)
{
final
newList
=
response
.
advanceList
??
[];
if
(
loadMore
)
{
_advanceList
.
addAll
(
newList
);
}
else
{
_advanceList
=
newList
;
}
_currentPage
=
page
;
_hasMore
=
newList
.
isNotEmpty
;
}
else
{
_errorMessage
=
response
.
message
??
"Something went wrong"
;
}
}
else
{
_errorMessage
=
"No response from server"
;
}
}
catch
(
e
)
{
_errorMessage
=
"Failed to fetch advance list:
$e
"
;
}
finally
{
_isLoading
=
false
;
notifyListeners
();
}
}
/// Refresh Advance List
Future
<
void
>
refreshAdvanceList
(
BuildContext
context
,
String
session
,
String
empId
)
async
{
await
fetchAdvanceList
(
context
,
session
,
empId
,
page:
1
,
loadMore:
false
);
}
/// Load More (Pagination)
Future
<
void
>
loadMoreAdvanceList
(
BuildContext
context
,
String
session
,
String
empId
)
async
{
if
(!
_hasMore
||
_isLoading
)
return
;
await
fetchAdvanceList
(
context
,
session
,
empId
,
page:
_currentPage
+
1
,
loadMore:
true
);
}
/// Clear state
void
clear
()
{
_advanceList
=
[];
_errorMessage
=
null
;
_currentPage
=
1
;
_hasMore
=
true
;
notifyListeners
();
}
}
lib/Notifiers/hrmProvider/casualLeaveHistoryProvider.dart
0 → 100644
View file @
dc88a3f9
import
'package:flutter/material.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Models/hrmModels/casualLeaveHistoryResponse.dart'
;
import
'../../services/api_calling.dart'
;
import
'../HomeScreenNotifier.dart'
;
class
CasualLeaveHistoryProvider
extends
ChangeNotifier
{
/// --- Variables ---
List
<
CasualLeaveHistory
>
casualLeaveHistoryList
=
[];
bool
isLoading
=
false
;
String
?
errorMessage
;
/// --- Fetch Casual Leave History ---
Future
<
void
>
fetchCasualLeaveHistory
(
BuildContext
context
)
async
{
isLoading
=
true
;
errorMessage
=
null
;
notifyListeners
();
try
{
final
homeProvider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
response
=
await
ApiCalling
.
casualLeaveHistoryAPI
(
homeProvider
.
session
,
homeProvider
.
empId
,
);
if
(
response
!=
null
)
{
if
(
response
.
error
!=
null
&&
response
.
error
!=
"0"
)
{
errorMessage
=
response
.
message
??
"Something went wrong"
;
casualLeaveHistoryList
=
[];
}
else
{
casualLeaveHistoryList
=
response
.
casualLeaveHistory
??
[];
}
}
else
{
errorMessage
=
"No response from server"
;
}
}
catch
(
e
)
{
errorMessage
=
"Failed to load leave history:
$e
"
;
}
finally
{
isLoading
=
false
;
notifyListeners
();
}
}
/// --- Clear data (optional) ---
void
clearHistory
()
{
casualLeaveHistoryList
.
clear
();
errorMessage
=
null
;
notifyListeners
();
}
}
lib/Notifiers/ordersProvider/addOrderProvider.dart
View file @
dc88a3f9
...
...
@@ -89,7 +89,7 @@ class Addorderprovider extends ChangeNotifier {
List
<
String
>
_tpcApplicable
=
[];
List
<
TpcList
>
_tpcAgent
=
[];
AccountDetails
_accountDetails
=
AccountDetails
();
String
?
selectAccountError
;
String
?
orderDateError
;
...
...
@@ -309,7 +309,6 @@ class Addorderprovider extends ChangeNotifier {
String
?
get
selectedTpcAgentValue
=>
_selectedTpcAgentValue
;
AccountDetails
get
accountDetails
=>
_accountDetails
;
set
accountList
(
List
<
AccountList
>
value
)
{
_accountList
=
value
;
...
...
@@ -529,10 +528,7 @@ class Addorderprovider extends ChangeNotifier {
notifyListeners
();
}
set
accountDetails
(
AccountDetails
value
)
{
_accountDetails
=
value
;
notifyListeners
();
}
set
imagePath
(
File
?
value
)
{
_imageName
=
value
;
...
...
@@ -812,13 +808,18 @@ class Addorderprovider extends ChangeNotifier {
// };
// }
Future
<
void
>
ordersAddOrderAPIViewFunction
(
context
,
mode
)
async
{
Future
<
void
>
ordersAddOrderAPIViewFunction
(
context
,
mode
,
leadId
,
feedback
,
followupType
,
inTime
,
loc
)
async
{
try
{
final
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
addOrderViewAPI
(
provider
.
empId
,
provider
.
session
,
mode
,
provider
.
empId
,
provider
.
session
,
mode
,
leadId
,
feedback
,
followupType
,
inTime
,
loc
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
...
...
@@ -839,6 +840,116 @@ class Addorderprovider extends ChangeNotifier {
}
catch
(
e
)
{}
}
// AccountDetails _accountDetails = AccountDetails();
//
// AccountDetails get accountDetails => _accountDetails;
AccountDetails
?
_accountDetails
;
// nullable
AccountDetails
?
get
accountDetails
=>
_accountDetails
;
set
accountDetails
(
AccountDetails
?
value
)
{
_accountDetails
=
value
;
notifyListeners
();
}
Future
<
void
>
fetchAddOrderViewData
(
BuildContext
context
,
String
empId
,
String
session
,
String
mode
,
leadId
,
feedback
,
followupType
,
inTime
,
loc
)
async
{
debugPrint
(
"🔥 fetchAddOrderViewData CALLED with leadId=
$leadId
, mode=
$mode
"
);
try
{
_isLoading
=
true
;
notifyListeners
();
final
response
=
await
ApiCalling
.
addOrderViewAPI
(
empId
,
session
,
mode
,
leadId
,
feedback
,
followupType
,
inTime
,
loc
);
if
(
response
!=
null
)
{
if
(
response
.
error
==
"0"
)
{
_tpcApplicable
=
[
"Yes"
,
"No"
];
_erectionScope
=
response
.
erectionScope
??
[];
_unloadingScope
=
response
.
unloadingScope
??
[];
_freightScope
=
response
.
freightScope
??
[];
_employees
=
response
.
employees
??
[];
_billingStates
=
response
.
states
??
[];
_dispatchStates
=
response
.
states
??
[];
_saleProducts
=
response
.
saleProducts
??
[];
// getSubLocationAPI(context, response.accountDetails?.subLocality);
// getDistrictAPI(context, response.accountDetails?.district);
// _billingStates = response.accountDetails?.state as List<States>;
checkDropdownselected
();
notifyListeners
();
}
else
{}
}
else
{}
debugPrint
(
" data to all fields##################################"
);
if
(
response
!=
null
)
{
debugPrint
(
"Employees:
${response.accountDetails?.pincode}
"
);
debugPrint
(
"States:
${response.accountDetails?.state}
"
);
debugPrint
(
"Sale Products:
${response.accountDetails?.address}
"
);
debugPrint
(
"Account Details Name:
${response.accountDetails?.name}
"
);
debugPrint
(
"District:
${response.accountDetails?.district}
"
);
debugPrint
(
"Sub location:
${response.accountDetails?.name}
"
);
}
else
{
debugPrint
(
"Response is NULL"
);
}
if
(
response
!=
null
&&
response
.
error
==
"0"
)
{
// Save accountDetails safely
_accountDetails
=
AccountDetails
(
id:
response
.
accountDetails
?.
id
,
name:
response
.
accountDetails
?.
name
,
address:
response
.
accountDetails
?.
address
,
state:
response
.
accountDetails
?.
state
,
pincode:
response
.
accountDetails
?.
pincode
,
date:
response
.
accountDetails
?.
date
,
subLocality:
response
.
accountDetails
?.
subLocality
,
district:
response
.
accountDetails
?.
district
,
);
// Save lists safely
_unloadingScope
=
response
.
unloadingScope
??
[];
_freightScope
=
response
.
freightScope
??
[];
_erectionScope
=
response
.
erectionScope
??
[];
// default selections
if
(
_employees
.
isNotEmpty
)
selectedEmployees
=
_employees
.
first
;
if
(
leadId
!=
""
)
if
(
_billingStates
.
isNotEmpty
)
selecetdBillingStates
=
_billingStates
.
first
;
if
(
_billingDistricts
.
isNotEmpty
)
selectedBillingDistricts
=
_billingDistricts
.
first
;
if
(
_billingStates
.
isNotEmpty
)
selecetdBillingStates
=
_billingStates
.
first
;
if
(
_dispatchStates
.
isNotEmpty
)
selecetdDispatchStates
=
_dispatchStates
.
first
;
if
(
_saleProducts
.
isNotEmpty
)
selectedSaleProducts
=
_saleProducts
.
first
;
if
(
_unloadingScope
.
isNotEmpty
)
selectedUnloadingScope
=
_unloadingScope
.
first
;
if
(
_freightScope
.
isNotEmpty
)
selectedFreightScope
=
_freightScope
.
first
;
if
(
_erectionScope
.
isNotEmpty
)
selectedErectionScope
=
_erectionScope
.
first
;
notifyListeners
();
// notify listeners/UI
}
else
{
debugPrint
(
"API Error:
${response?.message}
"
);
}
}
catch
(
e
)
{
debugPrint
(
"Provider Error in fetchAddOrderViewData:
$e
"
);
}
finally
{
_isLoading
=
false
;
notifyListeners
();
}
}
void
checkDropdownselected
()
{
if
(
_selectedAccountList
!=
null
&&
!
_accountList
.
contains
(
_selectedAccountList
))
{
...
...
@@ -972,12 +1083,12 @@ class Addorderprovider extends ChangeNotifier {
if
(
data
.
error
==
"0"
)
{
_billingDistricts
=
data
.
districts
!;
_selectedBillingDistricts
=
data
.
districts
!.
firstWhere
(
(
e
)
=>
e
.
id
==
accountDetails
.
district
!,
(
e
)
=>
e
.
id
==
accountDetails
?
.
district
!,
);
_selectedBillingDistrictValue
=
data
.
districts
!
.
firstWhere
((
e
)
=>
e
.
id
==
accountDetails
.
district
!)
.
firstWhere
((
e
)
=>
e
.
id
==
accountDetails
?
.
district
!)
.
district
;
notifyListeners
();
...
...
@@ -1020,12 +1131,12 @@ class Addorderprovider extends ChangeNotifier {
if
(
data
.
error
==
"0"
)
{
_billingSubLocations
=
data
.
subLocations
!;
_selectedBillingSubLocations
=
data
.
subLocations
!.
firstWhere
(
(
e
)
=>
e
.
id
==
accountDetails
.
subLocality
!,
(
e
)
=>
e
.
id
==
accountDetails
?
.
subLocality
!,
);
_selectedBillingSubLocValue
=
data
.
subLocations
!
.
firstWhere
((
e
)
=>
e
.
id
==
accountDetails
.
subLocality
!)
.
firstWhere
((
e
)
=>
e
.
id
==
accountDetails
?
.
subLocality
!)
.
subLocality
;
notifyListeners
();
...
...
Prev
1
2
3
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