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
1a2ae52a
Commit
1a2ae52a
authored
Jun 27, 2025
by
Sai Srinivas
Browse files
27-06-2025 By Sai Srinivas
Add Order Module and Test cases.
parent
381932be
Changes
16
Hide whitespace changes
Inline
Side-by-side
lib/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart
0 → 100644
View file @
1a2ae52a
class
ordersDetailsDispatchOrderViewResponse
{
List
<
Products
>?
products
;
String
?
error
;
String
?
message
;
ordersDetailsDispatchOrderViewResponse
(
{
this
.
products
,
this
.
error
,
this
.
message
});
ordersDetailsDispatchOrderViewResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'products'
]
!=
null
)
{
products
=
<
Products
>[];
json
[
'products'
].
forEach
((
v
)
{
products
!.
add
(
new
Products
.
fromJson
(
v
));
});
}
error
=
json
[
'error'
];
message
=
json
[
'message'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
products
!=
null
)
{
data
[
'products'
]
=
this
.
products
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
return
data
;
}
}
class
Products
{
String
?
id
;
String
?
orderId
;
String
?
productId
;
String
?
pdiId
;
String
?
qty
;
String
?
unitPrice
;
String
?
cgstPercentage
;
String
?
sgstPercentage
;
String
?
igstPercentage
;
String
?
totalPrice
;
String
?
isExist
;
String
?
createdDatetime
;
String
?
updatedDatetime
;
String
?
productName
;
String
?
crmOrderPId
;
Products
(
{
this
.
id
,
this
.
orderId
,
this
.
productId
,
this
.
pdiId
,
this
.
qty
,
this
.
unitPrice
,
this
.
cgstPercentage
,
this
.
sgstPercentage
,
this
.
igstPercentage
,
this
.
totalPrice
,
this
.
isExist
,
this
.
createdDatetime
,
this
.
updatedDatetime
,
this
.
productName
,
this
.
crmOrderPId
});
Products
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
orderId
=
json
[
'order_id'
];
productId
=
json
[
'product_id'
];
pdiId
=
json
[
'pdi_id'
];
qty
=
json
[
'qty'
];
unitPrice
=
json
[
'unit_price'
];
cgstPercentage
=
json
[
'cgst_percentage'
];
sgstPercentage
=
json
[
'sgst_percentage'
];
igstPercentage
=
json
[
'igst_percentage'
];
totalPrice
=
json
[
'total_price'
];
isExist
=
json
[
'is_exist'
];
createdDatetime
=
json
[
'created_datetime'
];
updatedDatetime
=
json
[
'updated_datetime'
];
productName
=
json
[
'product_name'
];
crmOrderPId
=
json
[
'crm_order_p_id'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'order_id'
]
=
this
.
orderId
;
data
[
'product_id'
]
=
this
.
productId
;
data
[
'pdi_id'
]
=
this
.
pdiId
;
data
[
'qty'
]
=
this
.
qty
;
data
[
'unit_price'
]
=
this
.
unitPrice
;
data
[
'cgst_percentage'
]
=
this
.
cgstPercentage
;
data
[
'sgst_percentage'
]
=
this
.
sgstPercentage
;
data
[
'igst_percentage'
]
=
this
.
igstPercentage
;
data
[
'total_price'
]
=
this
.
totalPrice
;
data
[
'is_exist'
]
=
this
.
isExist
;
data
[
'created_datetime'
]
=
this
.
createdDatetime
;
data
[
'updated_datetime'
]
=
this
.
updatedDatetime
;
data
[
'product_name'
]
=
this
.
productName
;
data
[
'crm_order_p_id'
]
=
this
.
crmOrderPId
;
return
data
;
}
}
lib/Notifiers/ordersProvider/addOrderProvider.dart
View file @
1a2ae52a
...
...
@@ -22,624 +22,642 @@ import '../../Models/ordersModels/addOrderTpcAgentListResponse.dart';
import
'../../services/api_calling.dart'
;
import
'../HomeScreenNotifier.dart'
;
class
Addorderprovider
extends
ChangeNotifier
{
TextEditingController
dropDownSearchController
=
TextEditingController
();
TextEditingController
dropDownTpcSearchController
=
TextEditingController
();
TextEditingController
billingStateSearchController
=
TextEditingController
();
TextEditingController
billingDistrictSearchController
=
TextEditingController
();
TextEditingController
billingSubLocSearchController
=
TextEditingController
();
TextEditingController
dispatchStateSearchController
=
TextEditingController
();
TextEditingController
dispatchDistrictSearchController
=
TextEditingController
();
TextEditingController
dispatchSubLocSearchController
=
TextEditingController
();
TextEditingController
billingNameController
=
TextEditingController
();
TextEditingController
billingAddressController
=
TextEditingController
();
TextEditingController
billingPincodeController
=
TextEditingController
();
TextEditingController
dispatchAddressController
=
TextEditingController
();
TextEditingController
dispatchPincodeController
=
TextEditingController
();
TextEditingController
gstController
=
TextEditingController
();
TextEditingController
orderReceivedDateController
=
TextEditingController
();
TextEditingController
tpcAmountController
=
TextEditingController
();
List
<
TextEditingController
>
ProductControllers
=
[];
List
<
TextEditingController
>
PriceControllers
=
[];
List
<
TextEditingController
>
QuantityControllers
=
[];
List
<
TextEditingController
>
CGSTControllers
=
[];
List
<
TextEditingController
>
SGSTControllers
=
[];
List
<
TextEditingController
>
IGSTControllers
=
[];
List
<
TextEditingController
>
TotalPriceControllers
=
[];
List
<
TextEditingController
>
TaxableValueControllers
=
[];
TextEditingController
basicAmountReadOnlyController
=
TextEditingController
();
TextEditingController
cgstReadOnlyController
=
TextEditingController
();
TextEditingController
sgstReadOnlyController
=
TextEditingController
();
TextEditingController
igstReadOnlyController
=
TextEditingController
();
TextEditingController
totalReadOnlyAmountController
=
TextEditingController
();
TextEditingController
noteController
=
TextEditingController
();
List
<
AccountList
>
_accountList
=
[];
List
<
Employees
>
_employees
=
[];
List
<
States
>
_billingStates
=
[];
List
<
States
>
_dispatchStates
=
[];
List
<
SaleProducts
>
_saleProducts
=
[];
List
<
Districts
>
_billingDistricts
=
[];
List
<
Districts
>
_dispatchDistricts
=
[];
List
<
SubLocations
>
_billingSubLocations
=
[];
List
<
SubLocations
>
_dispatchSubLocations
=
[];
List
<
String
>
_unloadingScope
=
[];
List
<
String
>
_freightScope
=
[];
List
<
String
>
_erectionScope
=
[];
List
<
String
>
_tpcApplicable
=
[];
List
<
TpcList
>
_tpcAgent
=
[];
AccountDetails
_accountDetails
=
AccountDetails
();
String
selectAccountError
=
""
;
String
billingNameError
=
""
;
String
billingAddressError
=
""
;
String
billingPincodeError
=
""
;
String
dispatchAddressError
=
""
;
String
dispatchPincodeError
=
""
;
String
tpcAmountError
=
""
;
String
gstError
=
""
;
AccountList
?
_selectedAccountList
;
String
?
_selectedAccountID
;
String
?
_selectedAccountName
;
Employees
?
_selectedEmployees
;
String
?
_selectedEmployeeID
;
String
?
_selectedEmployeeName
;
States
?
_selectedBillingStates
;
String
?
_selectedBillingStateID
;
String
?
_selectedBillingStateName
;
Districts
?
_selectedBillingDistricts
;
String
?
_selectedBillingDistrictID
;
String
?
_selectedBillingDistrictValue
;
SubLocations
?
_selectedBillingSubLocations
;
String
?
_selectedBillingSubLocID
;
String
?
_selectedBillingSubLocValue
;
States
?
_selectedDispatchStates
;
String
?
_selectedDispatchStateID
;
String
?
_selectedDispatchStateName
;
Districts
?
_selectedDispatchDistricts
;
String
?
_selectedDispatchDistrictID
;
String
?
_selectedDispatchDistrictValue
;
SubLocations
?
_selectedDispatchSubLocations
;
String
?
_selectedDispatchSubLocID
;
String
?
_selectedDispatchSubLocValue
;
SaleProducts
?
_selectedSaleProducts
;
List
<
String
?>
_selectedSaleProductID
=
[];
String
?
_selectedSaleProductName
;
String
?
_selectedUnloadingScope
;
String
?
_selectedFreightScope
;
String
?
_selectedErectionScope
;
String
?
_selectedTpcStatus
;
TpcList
?
_selectedTpcAgent
;
String
?
_selectedTpcAgentID
;
String
?
_selectedTpcAgentValue
;
LatLng
startLocation
=
const
LatLng
(
17.439112226708446
,
78.43292499146135
);
LatLng
?
currentLocationLatLng
;
String
latlongs
=
""
;
Set
<
Marker
>
markers
=
{};
Location
.
LocationData
?
currentLocation
;
bool
isLocationEnabled
=
false
;
bool
hasLocationPermission
=
false
;
String
?
FileError
;
String
?
dateError
;
bool
_isLoading
=
false
;
int
_imagePicked
=
0
;
File
?
_image
;
File
?
_imageName
;
final
ImagePicker
_picker
=
ImagePicker
();
DateTime
?
_date
;
String
?
_formattedDate
;
Timer
?
_debounce
;
List
<
Map
<
String
,
String
>>
_selectedOrders
=
[];
List
<
Map
<
String
,
String
>>
get
selectedOrders
=>
_selectedOrders
;
bool
_submitClicked
=
false
;
bool
get
submitClicked
=>
_submitClicked
;
set
submitClicked
(
bool
value
){
_submitClicked
=
value
;
notifyListeners
();
}
set
selectedOrders
(
value
)
{
_selectedOrders
=
selectedOrders
;
notifyListeners
();
}
bool
get
isLoading
=>
_isLoading
;
class
Addorderprovider
extends
ChangeNotifier
{
TextEditingController
dropDownSearchController
=
TextEditingController
();
TextEditingController
dropDownTpcSearchController
=
TextEditingController
();
TextEditingController
billingStateSearchController
=
TextEditingController
();
TextEditingController
billingDistrictSearchController
=
TextEditingController
();
TextEditingController
billingSubLocSearchController
=
TextEditingController
();
TextEditingController
dispatchStateSearchController
=
TextEditingController
();
TextEditingController
dispatchDistrictSearchController
=
TextEditingController
();
TextEditingController
dispatchSubLocSearchController
=
TextEditingController
();
TextEditingController
billingNameController
=
TextEditingController
();
TextEditingController
billingAddressController
=
TextEditingController
();
TextEditingController
billingPincodeController
=
TextEditingController
();
TextEditingController
dispatchAddressController
=
TextEditingController
();
TextEditingController
dispatchPincodeController
=
TextEditingController
();
TextEditingController
gstController
=
TextEditingController
();
TextEditingController
orderReceivedDateController
=
TextEditingController
();
TextEditingController
tpcAmountController
=
TextEditingController
();
List
<
TextEditingController
>
ProductControllers
=
[];
List
<
TextEditingController
>
PriceControllers
=
[];
List
<
TextEditingController
>
QuantityControllers
=
[];
List
<
TextEditingController
>
CGSTControllers
=
[];
List
<
TextEditingController
>
SGSTControllers
=
[];
List
<
TextEditingController
>
IGSTControllers
=
[];
List
<
TextEditingController
>
TotalPriceControllers
=
[];
List
<
TextEditingController
>
TaxableValueControllers
=
[];
TextEditingController
basicAmountReadOnlyController
=
TextEditingController
();
TextEditingController
cgstReadOnlyController
=
TextEditingController
();
TextEditingController
sgstReadOnlyController
=
TextEditingController
();
TextEditingController
igstReadOnlyController
=
TextEditingController
();
TextEditingController
totalReadOnlyAmountController
=
TextEditingController
();
TextEditingController
noteController
=
TextEditingController
();
List
<
AccountList
>
_accountList
=
[];
List
<
Employees
>
_employees
=
[];
List
<
States
>
_billingStates
=
[];
List
<
States
>
_dispatchStates
=
[];
List
<
SaleProducts
>
_saleProducts
=
[];
List
<
Districts
>
_billingDistricts
=
[];
List
<
Districts
>
_dispatchDistricts
=
[];
List
<
SubLocations
>
_billingSubLocations
=
[];
List
<
SubLocations
>
_dispatchSubLocations
=
[];
List
<
String
>
_unloadingScope
=
[];
List
<
String
>
_freightScope
=
[];
List
<
String
>
_erectionScope
=
[];
List
<
String
>
_tpcApplicable
=
[];
List
<
TpcList
>
_tpcAgent
=
[];
AccountDetails
_accountDetails
=
AccountDetails
();
String
selectAccountError
=
""
;
String
orderDateError
=
""
;
String
billingNameError
=
""
;
String
billingAddressError
=
""
;
String
billingPincodeError
=
""
;
String
dispatchAddressError
=
""
;
String
dispatchPincodeError
=
""
;
String
tpcAmountError
=
""
;
String
gstError
=
""
;
String
selectedBillingStateError
=
""
;
String
selectedBillingDistrictError
=
""
;
String
selectedBillingSubLocError
=
""
;
String
selectedDispatchStateError
=
""
;
String
selectedDispatchDistrictError
=
""
;
String
selectedDispatchSubLocError
=
""
;
AccountList
?
_selectedAccountList
;
String
?
_selectedAccountID
;
String
?
_selectedAccountName
;
Employees
?
_selectedEmployees
;
String
?
_selectedEmployeeID
;
String
?
_selectedEmployeeName
;
States
?
_selectedBillingStates
;
String
?
_selectedBillingStateID
;
String
?
_selectedBillingStateName
;
Districts
?
_selectedBillingDistricts
;
String
?
_selectedBillingDistrictID
;
String
?
_selectedBillingDistrictValue
;
SubLocations
?
_selectedBillingSubLocations
;
String
?
_selectedBillingSubLocID
;
String
?
_selectedBillingSubLocValue
;
States
?
_selectedDispatchStates
;
String
?
_selectedDispatchStateID
;
String
?
_selectedDispatchStateName
;
Districts
?
_selectedDispatchDistricts
;
String
?
_selectedDispatchDistrictID
;
String
?
_selectedDispatchDistrictValue
;
SubLocations
?
_selectedDispatchSubLocations
;
String
?
_selectedDispatchSubLocID
;
String
?
_selectedDispatchSubLocValue
;
SaleProducts
?
_selectedSaleProducts
;
List
<
String
?>
_selectedSaleProductID
=
[];
String
?
_selectedSaleProductName
;
String
?
_selectedUnloadingScope
;
String
?
_selectedFreightScope
;
String
?
_selectedErectionScope
;
String
?
_selectedTpcStatus
;
TpcList
?
_selectedTpcAgent
;
String
?
_selectedTpcAgentID
;
String
?
_selectedTpcAgentValue
;
LatLng
startLocation
=
const
LatLng
(
17.439112226708446
,
78.43292499146135
);
LatLng
?
currentLocationLatLng
;
String
latlongs
=
""
;
Set
<
Marker
>
markers
=
{};
Location
.
LocationData
?
currentLocation
;
bool
isLocationEnabled
=
false
;
bool
hasLocationPermission
=
false
;
String
?
FileError
;
String
?
dateError
;
bool
_isLoading
=
false
;
int
_imagePicked
=
0
;
File
?
_image
;
File
?
_imageName
;
final
ImagePicker
_picker
=
ImagePicker
();
DateTime
?
_date
;
String
?
_formattedDate
;
Timer
?
_debounce
;
List
<
Map
<
String
,
String
>>
_selectedOrders
=
[];
List
<
Map
<
String
,
String
>>
get
selectedOrders
=>
_selectedOrders
;
bool
_submitClicked
=
false
;
bool
get
submitClicked
=>
_submitClicked
;
set
submitClicked
(
bool
value
)
{
_submitClicked
=
value
;
notifyListeners
();
}
String
?
get
formattedDate
=>
_formattedDate
;
set
selectedOrders
(
value
)
{
_selectedOrders
=
selectedOrders
;
notifyListeners
();
}
DateTime
?
get
dateNow
=>
_date
;
bool
get
isLoading
=>
_isLoading
;
File
?
get
imageP
at
h
=>
_
imageNam
e
;
String
?
get
formattedD
at
e
=>
_
formattedDat
e
;
File
?
get
imageFilePath
=>
_
imag
e
;
DateTime
?
get
dateNow
=>
_
dat
e
;
int
get
imageP
icked
=>
_image
Picked
;
File
?
get
imageP
ath
=>
_image
Name
;
List
<
AccountList
>
get
accountList
=>
_accountList
;
File
?
get
imageFilePath
=>
_image
;
List
<
Employees
>
get
employees
=>
_employees
;
int
get
imagePicked
=>
_imagePicked
;
List
<
SaleProducts
>
get
saleProducts
=>
_saleProducts
;
List
<
AccountList
>
get
accountList
=>
_accountList
;
List
<
String
>
get
unloadingScope
=>
_unloadingScope
;
List
<
Employees
>
get
employees
=>
_employees
;
List
<
S
tring
>
get
freightScope
=>
_freightScope
;
List
<
S
aleProducts
>
get
saleProducts
=>
_saleProducts
;
List
<
String
>
get
erection
Scope
=>
_
erection
Scope
;
List
<
String
>
get
unloading
Scope
=>
_
unloading
Scope
;
List
<
String
>
get
tpcApplicable
=>
_tpcApplicabl
e
;
List
<
String
>
get
freightScope
=>
_freightScop
e
;
List
<
TpcList
>
get
tpcAgent
=>
_tpcAgent
;
List
<
String
>
get
erectionScope
=>
_erectionScope
;
AccountList
?
get
selectedAccountList
=>
_selectedAccountList
;
List
<
String
>
get
tpcApplicable
=>
_tpcApplicable
;
String
?
get
selectedAccountID
=>
_selectedAccountID
;
List
<
TpcList
>
get
tpcAgent
=>
_tpcAgent
;
String
?
get
selectedAccount
Name
=>
_selectedAccount
Name
;
AccountList
?
get
selectedAccount
List
=>
_selectedAccount
List
;
Employees
?
get
selected
Employees
=>
_selected
Employees
;
String
?
get
selected
AccountID
=>
_selected
AccountID
;
String
?
get
selected
EmployeeID
=>
_selected
EmployeeID
;
String
?
get
selected
AccountName
=>
_selected
AccountName
;
String
?
get
selectedEmployee
Name
=>
_selectedEmployee
Name
;
Employees
?
get
selectedEmployee
s
=>
_selectedEmployee
s
;
List
<
States
>
get
billingStates
=>
_billingStates
;
String
?
get
selectedEmployeeID
=>
_selectedEmployeeID
;
States
?
get
selec
etdBillingStates
=>
_selectedBillingStates
;
String
?
get
selec
tedEmployeeName
=>
_selectedEmployeeName
;
String
?
get
selectedB
illingState
ID
=>
_
selectedB
illingState
ID
;
List
<
States
>
get
b
illingState
s
=>
_
b
illingState
s
;
String
?
get
selec
t
edBillingState
Name
=>
_selectedBillingState
Name
;
States
?
get
selece
t
dBillingState
s
=>
_selectedBillingState
s
;
List
<
Districts
>
get
billingDistricts
=>
_billingDistricts
;
String
?
get
selectedBillingStateID
=>
_selectedBillingStateID
;
List
<
SubLocations
>
get
billingSubLocations
=>
_billingSubLocations
;
String
?
get
selectedBillingStateName
=>
_selectedBillingStateName
;
Districts
?
get
selectedB
illingDistricts
=>
_
selectedB
illingDistricts
;
List
<
Districts
>
get
b
illingDistricts
=>
_
b
illingDistricts
;
String
?
get
selectedBillingDistrictId
=>
_selectedBillingDistrictID
;
List
<
SubLocations
>
get
billingSubLocations
=>
_billingSubLocations
;
String
?
get
selectedBillingDistrict
Value
=>
_selectedBillingDistrict
Value
;
Districts
?
get
selectedBillingDistrict
s
=>
_selectedBillingDistrict
s
;
SubLocations
?
get
selectedBilling
SubLocations
=>
_selectedBilling
SubLocations
;
String
?
get
selectedBilling
DistrictId
=>
_selectedBilling
DistrictID
;
String
?
get
selectedBilling
SubLocID
=>
_selectedBilling
SubLocID
;
String
?
get
selectedBilling
DistrictValue
=>
_selectedBilling
DistrictValue
;
String
?
get
selectedBillingSubLoc
Value
=>
_selectedBillingSubLoc
Value
;
SubLocations
?
get
selectedBillingSubLoc
ations
=>
_selectedBillingSubLoc
ations
;
List
<
States
>
get
dispatchStates
=>
_dispatchStates
;
String
?
get
selectedBillingSubLocID
=>
_selectedBillingSubLocID
;
States
?
get
selec
etdDispatchStates
=>
_selectedDispatchStates
;
String
?
get
selec
tedBillingSubLocValue
=>
_selectedBillingSubLocValue
;
String
?
get
selectedD
ispatchState
ID
=>
_
selectedD
ispatchState
ID
;
List
<
States
>
get
d
ispatchState
s
=>
_
d
ispatchState
s
;
String
?
get
selec
t
edDispatchState
Name
=>
_selectedDispatchState
Name
;
States
?
get
selece
t
dDispatchState
s
=>
_selectedDispatchState
s
;
List
<
Districts
>
get
dispatchDistricts
=>
_dispatchDistricts
;
String
?
get
selectedDispatchStateID
=>
_selectedDispatchStateID
;
List
<
SubLocations
>
get
dispatchSubLocations
=>
_dispatchSubLocations
;
String
?
get
selectedDispatchStateName
=>
_selectedDispatchStateName
;
Districts
?
get
selectedD
ispatchDistricts
=>
_
selectedD
ispatchDistricts
;
List
<
Districts
>
get
d
ispatchDistricts
=>
_
d
ispatchDistricts
;
String
?
get
selectedDispatchDistrictId
=>
_selectedDispatchDistrictID
;
List
<
SubLocations
>
get
dispatchSubLocations
=>
_dispatchSubLocations
;
String
?
get
selectedDispatchDistrict
Value
=>
_selectedDispatchDistrict
Value
;
Districts
?
get
selectedDispatchDistrict
s
=>
_selectedDispatchDistrict
s
;
SubLocations
?
get
selectedDispatchSubLocations
=>
_selectedDispatchSubLocations
;
String
?
get
selectedDispatchDistrictId
=>
_selectedDispatchDistrictID
;
String
?
get
selectedDispatch
SubLocID
=>
_selectedDispatch
SubLocID
;
String
?
get
selectedDispatch
DistrictValue
=>
_selectedDispatch
DistrictValue
;
String
?
get
selectedDispatchSubLocValue
=>
_selectedDispatchSubLocValue
;
SubLocations
?
get
selectedDispatchSubLocations
=>
_selectedDispatchSubLocations
;
SaleProducts
?
get
selected
SaleProducts
=>
_selectedSaleProducts
;
String
?
get
selected
DispatchSubLocID
=>
_selectedDispatchSubLocID
;
List
<
String
?
>
get
selected
SaleProductID
=>
_selectedSaleProductID
;
String
?
get
selected
DispatchSubLocValue
=>
_selectedDispatchSubLocValue
;
String
?
get
selectedSaleProduct
Name
=>
_selectedSaleProduct
Name
;
SaleProducts
?
get
selectedSaleProduct
s
=>
_selectedSaleProduct
s
;
String
?
get
selected
UnloadingScope
=>
_selectedUnloadingScope
;
List
<
String
?
>
get
selected
SaleProductID
=>
_selectedSaleProductID
;
String
?
get
selected
FreightScope
=>
_selectedFreightScop
e
;
String
?
get
selected
SaleProductName
=>
_selectedSaleProductNam
e
;
String
?
get
selected
Erection
Scope
=>
_selected
Erection
Scope
;
String
?
get
selected
Unloading
Scope
=>
_selected
Unloading
Scope
;
String
?
get
selected
TpcStatus
=>
_selected
TpcStatus
;
String
?
get
selected
FreightScope
=>
_selected
FreightScope
;
TpcList
?
get
selected
TpcAgent
=>
_selectedTpcAgent
;
String
?
get
selected
ErectionScope
=>
_selectedErectionScope
;
String
?
get
selectedTpc
AgentID
=>
_selectedTpc
AgentID
;
String
?
get
selectedTpc
Status
=>
_selectedTpc
Status
;
String
?
get
selectedTpcAgent
Value
=>
_selectedTpcAgent
Value
;
TpcList
?
get
selectedTpcAgent
=>
_selectedTpcAgent
;
AccountDetails
get
accountDetails
=>
_accountDetails
;
String
?
get
selectedTpcAgentID
=>
_selectedTpcAgentID
;
set
accountList
(
List
<
AccountList
>
value
)
{
_accountList
=
value
;
notifyListeners
();
}
String
?
get
selectedTpcAgentValue
=>
_selectedTpcAgentValue
;
set
selectedAccountList
(
AccountList
?
value
)
{
_selectedAccountList
=
value
;
_selectedAccountID
=
value
!.
id
;
_selectedAccountName
=
value
!.
text
!;
notifyListeners
();
}
AccountDetails
get
accountDetails
=>
_accountDetails
;
set
selectedAccountID
(
String
?
value
)
{
_
selectedA
ccount
ID
=
value
;
notifyListeners
();
}
set
accountList
(
List
<
AccountList
>
value
)
{
_
a
ccount
List
=
value
;
notifyListeners
();
}
set
selectedAccountName
(
String
?
value
)
{
_selectedAccountName
=
value
;
notifyListeners
();
}
set
selectedAccountList
(
AccountList
?
value
)
{
_selectedAccountList
=
value
;
_selectedAccountID
=
value
!.
id
;
_selectedAccountName
=
value
!.
text
!;
notifyListeners
();
}
set
selectedEmployees
(
Employees
?
value
)
{
_selectedEmployees
=
value
;
_selectedEmployeeID
=
value
!.
id
;
_selectedEmployeeName
=
value
!.
name
!;
notifyListeners
();
}
set
selectedAccountID
(
String
?
value
)
{
_selectedAccountID
=
value
;
notifyListeners
();
}
set
selected
EmployeeID
(
String
?
value
)
{
_selected
EmployeeID
=
value
;
notifyListeners
();
}
set
selected
AccountName
(
String
?
value
)
{
_selected
AccountName
=
value
;
notifyListeners
();
}
set
selectedEmployeeName
(
String
?
value
)
{
_selectedEmployeeName
=
value
;
notifyListeners
();
}
set
selectedEmployees
(
Employees
?
value
)
{
_selectedEmployees
=
value
;
_selectedEmployeeID
=
value
!.
id
;
_selectedEmployeeName
=
value
!.
name
!;
notifyListeners
();
}
set
selecetdBillingStates
(
States
?
value
)
{
_selectedBillingStates
=
value
;
_selectedBillingStateID
=
value
!.
id
;
_selectedBillingStateName
=
value
!.
name
!;
notifyListeners
();
}
set
selectedEmployeeID
(
String
?
value
)
{
_selectedEmployeeID
=
value
;
notifyListeners
();
}
set
selected
BillingStateID
(
String
?
value
)
{
_selected
BillingStateID
=
value
;
notifyListeners
();
}
set
selected
EmployeeName
(
String
?
value
)
{
_selected
EmployeeName
=
value
;
notifyListeners
();
}
set
selectedBillingStateName
(
String
?
value
)
{
_selectedBillingStateName
=
value
;
notifyListeners
();
}
set
selecetdBillingStates
(
States
?
value
)
{
_selectedBillingStates
=
value
;
_selectedBillingStateID
=
value
!.
id
;
_selectedBillingStateName
=
value
!.
name
!;
selectedBillingStateError
=
""
;
notifyListeners
();
}
set
selectedBillingDistricts
(
Districts
?
value
)
{
_selectedBillingDistricts
=
value
;
_selectedBillingDistrictID
=
value
!.
id
;
_selectedBillingDistrictValue
=
value
!.
district
;
// districtError = null;
notifyListeners
();
}
set
selectedBillingStateID
(
String
?
value
)
{
_selectedBillingStateID
=
value
;
selectedBillingStateError
=
""
;
notifyListeners
();
}
set
selectedBillingSubLocations
(
SubLocations
?
value
)
{
_selectedBillingSubLocations
=
value
;
_selectedBillingSubLocID
=
value
!.
id
;
_selectedBillingSubLocValue
=
value
!.
subLocality
!;
// localityError = null;
notifyListeners
();
}
set
selectedBillingStateName
(
String
?
value
)
{
_selectedBillingStateName
=
value
;
selectedBillingStateError
=
""
;
notifyListeners
();
}
set
selectedBillingDistrictId
(
value
)
{
_selectedBillingDistrictID
=
value
;
notifyListeners
();
}
set
selectedBillingDistricts
(
Districts
?
value
)
{
_selectedBillingDistricts
=
value
;
_selectedBillingDistrictID
=
value
!.
id
;
_selectedBillingDistrictValue
=
value
!.
district
;
selectedBillingDistrictError
=
""
;
// districtError = null;
notifyListeners
();
}
set
selectedBillingDistrictValue
(
value
)
{
_selectedBillingDistrictValue
=
value
;
notifyListeners
();
}
set
selectedBillingSubLocations
(
SubLocations
?
value
)
{
_selectedBillingSubLocations
=
value
;
_selectedBillingSubLocID
=
value
!.
id
;
_selectedBillingSubLocValue
=
value
!.
subLocality
!;
selectedBillingSubLocError
=
""
;
// localityError = null;
notifyListeners
();
}
set
selectedBilling
SubLocID
(
value
)
{
_selectedBilling
SubLoc
ID
=
value
;
notifyListeners
();
}
set
selectedBilling
DistrictId
(
value
)
{
_selectedBilling
District
ID
=
value
;
notifyListeners
();
}
set
selectedBilling
SubLoc
Value
(
value
)
{
_selectedBilling
SubLoc
Value
=
value
;
notifyListeners
();
}
set
selectedBilling
District
Value
(
value
)
{
_selectedBilling
District
Value
=
value
;
notifyListeners
();
}
set
selecetdDispatchStates
(
States
?
value
)
{
_selectedDispatchStates
=
value
;
_selectedDispatchStateID
=
value
!.
id
;
_selectedDispatchStateName
=
value
!.
name
!;
notifyListeners
();
}
set
selectedBillingSubLocID
(
value
)
{
_selectedBillingSubLocID
=
value
;
notifyListeners
();
}
set
selected
DispatchStateID
(
String
?
value
)
{
_selected
DispatchStateID
=
value
;
notifyListeners
();
}
set
selected
BillingSubLocValue
(
value
)
{
_selected
BillingSubLocValue
=
value
;
notifyListeners
();
}
set
selectedDispatchStateName
(
String
?
value
)
{
_selectedDispatchStateName
=
value
;
notifyListeners
();
}
set
selecetdDispatchStates
(
States
?
value
)
{
_selectedDispatchStates
=
value
;
_selectedDispatchStateID
=
value
!.
id
;
_selectedDispatchStateName
=
value
!.
name
!;
selectedDispatchStateError
=
""
;
notifyListeners
();
}
set
selectedDispatchDistricts
(
Districts
?
value
)
{
_selectedDispatchDistricts
=
value
;
_selectedDispatchDistrictID
=
value
!.
id
;
_selectedDispatchDistrictValue
=
value
!.
district
;
// districtError = null;
notifyListeners
();
}
set
selectedDispatchStateID
(
String
?
value
)
{
_selectedDispatchStateID
=
value
;
notifyListeners
();
}
set
selectedDispatchSubLocations
(
SubLocations
?
value
)
{
_selectedDispatchSubLocations
=
value
;
_selectedDispatchSubLocID
=
value
!.
id
;
_selectedDispatchSubLocValue
=
value
!.
subLocality
!;
// localityError = null;
notifyListeners
();
}
set
selectedDispatchStateName
(
String
?
value
)
{
_selectedDispatchStateName
=
value
;
notifyListeners
();
}
set
selectedDispatchDistrictId
(
value
)
{
_selectedDispatchDistrictID
=
value
;
notifyListeners
();
}
set
selectedDispatchDistricts
(
Districts
?
value
)
{
_selectedDispatchDistricts
=
value
;
_selectedDispatchDistrictID
=
value
!.
id
;
_selectedDispatchDistrictValue
=
value
!.
district
;
selectedDispatchDistrictError
=
""
;
// districtError = null;
notifyListeners
();
}
set
selectedDispatchDistrictValue
(
value
)
{
_selectedDispatchDistrictValue
=
value
;
notifyListeners
();
}
set
selectedDispatchSubLocations
(
SubLocations
?
value
)
{
_selectedDispatchSubLocations
=
value
;
_selectedDispatchSubLocID
=
value
!.
id
;
_selectedDispatchSubLocValue
=
value
!.
subLocality
!;
selectedDispatchSubLocError
=
""
;
// localityError = null;
notifyListeners
();
}
set
selectedDispatch
SubLocID
(
value
)
{
_selectedDispatch
SubLoc
ID
=
value
;
notifyListeners
();
}
set
selectedDispatch
DistrictId
(
value
)
{
_selectedDispatch
District
ID
=
value
;
notifyListeners
();
}
set
selectedDispatch
SubLoc
Value
(
value
)
{
_selectedDispatch
SubLoc
Value
=
value
;
notifyListeners
();
}
set
selectedDispatch
District
Value
(
value
)
{
_selectedDispatch
District
Value
=
value
;
notifyListeners
();
}
set
selectedSaleProducts
(
SaleProducts
?
value
)
{
_selectedSaleProducts
=
value
;
// _selectedSaleProductID = value!.id!;
// _selectedSaleProductName = value!.prodName;
notifyListeners
();
}
set
selectedDispatchSubLocID
(
value
)
{
_selectedDispatchSubLocID
=
value
;
notifyListeners
();
}
set
selected
SaleProductID
(
List
<
String
?>
value
)
{
_selected
SaleProductID
=
value
;
notifyListeners
();
}
set
selected
DispatchSubLocValue
(
value
)
{
_selected
DispatchSubLocValue
=
value
;
notifyListeners
();
}
set
selectedSaleProductName
(
String
?
value
)
{
_selectedSaleProductName
=
value
;
notifyListeners
();
}
set
selectedSaleProducts
(
SaleProducts
?
value
)
{
_selectedSaleProducts
=
value
;
// _selectedSaleProductID = value!.id!;
// _selectedSaleProductName = value!.prodName;
notifyListeners
();
}
set
selected
UnloadingScope
(
String
?
value
)
{
_selected
UnloadingScope
=
value
;
notifyListeners
();
}
set
selected
SaleProductID
(
List
<
String
?
>
value
)
{
_selected
SaleProductID
=
value
;
notifyListeners
();
}
set
selected
FreightScop
e
(
String
?
value
)
{
_selected
FreightScop
e
=
value
;
notifyListeners
();
}
set
selected
SaleProductNam
e
(
String
?
value
)
{
_selected
SaleProductNam
e
=
value
;
notifyListeners
();
}
set
selected
Erection
Scope
(
String
?
value
)
{
_selected
Erection
Scope
=
value
;
notifyListeners
();
}
set
selected
Unloading
Scope
(
String
?
value
)
{
_selected
Unloading
Scope
=
value
;
notifyListeners
();
}
set
selected
TpcStatus
(
String
?
value
)
{
_selected
TpcStatus
=
value
;
notifyListeners
();
}
set
selected
FreightScope
(
String
?
value
)
{
_selected
FreightScope
=
value
;
notifyListeners
();
}
set
selectedTpcAgent
(
TpcList
?
value
)
{
_selectedTpcAgent
=
value
;
_selectedTpcAgentID
=
value
!.
id
;
_selectedTpcAgentValue
=
value
!.
text
;
notifyListeners
();
}
set
selectedErectionScope
(
String
?
value
)
{
_selectedErectionScope
=
value
;
notifyListeners
();
}
set
selectedTpc
AgentID
(
String
?
value
)
{
_selectedTpc
AgentID
=
value
;
notifyListeners
();
}
set
selectedTpc
Status
(
String
?
value
)
{
_selectedTpc
Status
=
value
;
notifyListeners
();
}
set
selectedTpcAgentValue
(
String
?
value
)
{
_selectedTpcAgentValue
=
value
;
notifyListeners
();
}
set
selectedTpcAgent
(
TpcList
?
value
)
{
_selectedTpcAgent
=
value
;
_selectedTpcAgentID
=
value
!.
id
;
_selectedTpcAgentValue
=
value
!.
text
;
notifyListeners
();
}
set
accountDetails
(
AccountDetails
value
)
{
_
accountDetails
=
value
;
notifyListeners
();
}
set
selectedTpcAgentID
(
String
?
value
)
{
_
selectedTpcAgentID
=
value
;
notifyListeners
();
}
set
imagePath
(
File
?
value
)
{
_
imageNam
e
=
value
;
notifyListeners
();
}
set
selectedTpcAgentValue
(
String
?
value
)
{
_
selectedTpcAgentValu
e
=
value
;
notifyListeners
();
}
set
imageFilePath
(
File
?
value
)
{
_
image
=
value
;
notifyListeners
();
}
set
accountDetails
(
AccountDetails
value
)
{
_
accountDetails
=
value
;
notifyListeners
();
}
set
imageP
icked
(
value
)
{
_image
Picked
=
value
;
notifyListeners
();
}
set
imageP
ath
(
File
?
value
)
{
_image
Name
=
value
;
notifyListeners
();
}
set
formattedDate
(
String
?
value
)
{
_formattedDate
=
value
;
orderReceivedDateController
.
text
=
_formattedDate
!;
dateError
=
null
;
notifyListeners
();
}
set
imageFilePath
(
File
?
value
)
{
_image
=
value
;
notifyListeners
();
}
void
setDate
(
DateTime
newDate
)
{
_date
=
newDate
;
_formattedDate
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
newDate
);
orderReceivedDateController
.
text
=
_formattedDate
!;
dateError
=
null
;
notifyListeners
();
}
set
imagePicked
(
value
)
{
_imagePicked
=
value
;
notifyListeners
();
}
dynamic
get
basicAmount
{
double
total
=
0
;
for
(
var
controller
in
TaxableValueControllers
)
{
total
+=
double
.
tryParse
(
controller
.
text
)?.
round
()
??
0.0
;
set
formattedDate
(
String
?
value
)
{
_formattedDate
=
value
;
orderReceivedDateController
.
text
=
_formattedDate
!;
dateError
=
null
;
notifyListeners
();
}
basicAmountReadOnlyController
.
text
=
total
.
toStringAsFixed
(
2
);
return
total
;
}
dynamic
get
cgstAmount
{
double
total
=
0
;
for
(
int
i
=
0
;
i
<
ProductControllers
.
length
;
i
++)
{
final
taxableValue
=
double
.
tryParse
(
TaxableValueControllers
[
i
].
text
)
??
0.0
;
final
cgst
=
double
.
tryParse
(
CGSTControllers
[
i
].
text
)
??
0.0
;
total
+=
(
taxableValue
*
cgst
)
/
100
;
void
setDate
(
DateTime
newDate
)
{
_date
=
newDate
;
_formattedDate
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
newDate
);
orderReceivedDateController
.
text
=
_formattedDate
!;
dateError
=
null
;
notifyListeners
();
}
cgstReadOnlyController
.
text
=
total
.
toStringAsFixed
(
2
);
return
total
;
}
dynamic
get
sgst
Amount
{
double
total
=
0
;
for
(
int
i
=
0
;
i
<
ProductControllers
.
length
;
i
++
)
{
final
taxableValue
=
double
.
tryParse
(
TaxableValueControllers
[
i
].
text
)
??
0.0
;
final
sgst
=
double
.
tryParse
(
SGST
Controller
s
[
i
]
.
text
)
??
0.0
;
total
+=
(
taxableValue
*
sgst
).
round
()
/
100
;
dynamic
get
basic
Amount
{
double
total
=
0
;
for
(
var
controller
in
TaxableValueControllers
)
{
total
+=
double
.
tryParse
(
controller
.
text
)?.
round
()
??
0.0
;
}
basicAmountReadOnly
Controller
.
text
=
total
.
toStringAsFixed
(
2
)
;
return
total
;
}
sgstReadOnlyController
.
text
=
total
.
toStringAsFixed
(
2
);
return
total
;
}
dynamic
get
igstAmount
{
double
total
=
0
;
for
(
int
i
=
0
;
i
<
ProductControllers
.
length
;
i
++)
{
final
taxableValue
=
double
.
tryParse
(
TaxableValueControllers
[
i
].
text
)
??
0.0
;
final
igst
=
double
.
tryParse
(
IGSTControllers
[
i
].
text
)
??
0.0
;
total
+=
(
taxableValue
*
igst
).
round
()
/
100
;
dynamic
get
cgstAmount
{
double
total
=
0
;
for
(
int
i
=
0
;
i
<
ProductControllers
.
length
;
i
++)
{
final
taxableValue
=
double
.
tryParse
(
TaxableValueControllers
[
i
].
text
)
??
0.0
;
final
cgst
=
double
.
tryParse
(
CGSTControllers
[
i
].
text
)
??
0.0
;
total
+=
(
taxableValue
*
cgst
)
/
100
;
}
cgstReadOnlyController
.
text
=
total
.
toStringAsFixed
(
2
);
return
total
;
}
igstReadOnlyController
.
text
=
total
.
toStringAsFixed
(
2
);
return
total
;
}
dynamic
get
totalAmount
{
double
total
=
basicAmount
+
cgstAmount
+
sgstAmount
+
igstAmount
;
totalReadOnlyAmountController
.
text
=
total
.
round
().
toStringAsFixed
(
2
);
return
total
!
;
}
dynamic
get
sgstAmount
{
double
total
=
0
;
for
(
int
i
=
0
;
i
<
ProductControllers
.
length
;
i
++)
{
final
taxableValue
=
double
.
tryParse
(
TaxableValueControllers
[
i
].
text
)
??
0.0
;
final
sgst
=
double
.
tryParse
(
SGSTControllers
[
i
].
text
)
??
0.0
;
total
+=
(
taxableValue
*
sgst
).
round
()
/
100
;
}
sgstReadOnlyController
.
text
=
total
.
toStringAsFixed
(
2
);
return
total
;
}
void
addNewRow
(
)
{
ProductControllers
.
add
(
TextEditingController
());
PriceControllers
.
add
(
TextEditingController
());
QuantityControllers
.
add
(
TextEditingController
(
text:
'1'
));
CGSTControllers
.
add
(
TextEditingController
(
text:
'9'
));
SGSTControllers
.
add
(
TextEditingController
(
text:
'9'
));
IGSTControllers
.
add
(
TextEditingController
(
text:
'0'
));
TaxableValueControllers
.
add
(
TextEditingController
());
selectedSaleProductID
.
add
(
null
);
notifyListeners
();
}
dynamic
get
igstAmount
{
double
total
=
0
;
for
(
int
i
=
0
;
i
<
ProductControllers
.
length
;
i
++)
{
final
taxableValue
=
double
.
tryParse
(
TaxableValueControllers
[
i
].
text
)
??
0.0
;
final
igst
=
double
.
tryParse
(
IGSTControllers
[
i
].
text
)
??
0.0
;
total
+=
(
taxableValue
*
igst
).
round
()
/
100
;
}
igstReadOnlyController
.
text
=
total
.
toStringAsFixed
(
2
);
return
total
;
}
void
removeRow
(
int
index
)
{
if
(
index
>=
0
&&
index
<
ProductControllers
.
length
)
{
ProductControllers
[
index
].
dispose
();
PriceControllers
[
index
].
dispose
();
QuantityControllers
[
index
].
dispose
();
CGSTControllers
[
index
].
dispose
();
SGSTControllers
[
index
].
dispose
();
IGSTControllers
[
index
].
dispose
();
TaxableValueControllers
[
index
].
dispose
();
ProductControllers
.
removeAt
(
index
);
PriceControllers
.
removeAt
(
index
);
QuantityControllers
.
removeAt
(
index
);
CGSTControllers
.
removeAt
(
index
);
SGSTControllers
.
removeAt
(
index
);
IGSTControllers
.
removeAt
(
index
);
TaxableValueControllers
.
removeAt
(
index
);
selectedSaleProductID
.
removeAt
(
index
);
notifyListeners
();
dynamic
get
totalAmount
{
double
total
=
basicAmount
+
cgstAmount
+
sgstAmount
+
igstAmount
;
totalReadOnlyAmountController
.
text
=
total
.
round
().
toStringAsFixed
(
2
);
return
total
!;
}
}
void
updateSelectedProduct
(
int
index
,
SaleProducts
?
product
)
{
if
(
index
>=
0
&&
index
<
_saleProducts
.
length
)
{
_selectedSaleProducts
=
product
;
_selectedSaleProductID
[
index
]
=
product
!.
id
;
PriceControllers
[
index
].
text
=
product
!.
price
!;
updateRowCalculations
(
index
);
void
addNewRow
()
{
ProductControllers
.
add
(
TextEditingController
());
PriceControllers
.
add
(
TextEditingController
());
QuantityControllers
.
add
(
TextEditingController
(
text:
'1'
));
CGSTControllers
.
add
(
TextEditingController
(
text:
'9'
));
SGSTControllers
.
add
(
TextEditingController
(
text:
'9'
));
IGSTControllers
.
add
(
TextEditingController
(
text:
'0'
));
TaxableValueControllers
.
add
(
TextEditingController
());
TotalPriceControllers
.
add
(
TextEditingController
());
selectedSaleProductID
.
add
(
null
);
notifyListeners
();
}
}
void
updateRowCalculations
(
int
index
)
{
if
(
index
>=
0
&&
index
<
PriceControllers
.
length
)
{
final
inclusivePrice
=
double
.
tryParse
(
PriceControllers
[
index
].
text
)
??
0.0
;
final
quantity
=
double
.
tryParse
(
QuantityControllers
[
index
].
text
)
??
1.0
;
final
cgst
=
double
.
tryParse
(
CGSTControllers
[
index
].
text
)
??
0.0
;
final
sgst
=
double
.
tryParse
(
SGSTControllers
[
index
].
text
)
??
0.0
;
final
igst
=
double
.
tryParse
(
IGSTControllers
[
index
].
text
)
??
0.0
;
final
totalTaxRate
=
(
cgst
+
sgst
+
igst
)
/
100
;
// Calculate taxable value per unit
final
taxableValuePerUnit
=
inclusivePrice
/
(
1
+
totalTaxRate
);
// Total taxable value = taxable value per unit * quantity
final
totalTaxableValue
=
taxableValuePerUnit
*
quantity
;
TaxableValueControllers
[
index
].
text
=
totalTaxableValue
.
toStringAsFixed
(
0
,
);
notifyListeners
();
void
removeRow
(
int
index
)
{
if
(
index
>=
0
&&
index
<
ProductControllers
.
length
)
{
ProductControllers
[
index
].
dispose
();
PriceControllers
[
index
].
dispose
();
QuantityControllers
[
index
].
dispose
();
CGSTControllers
[
index
].
dispose
();
SGSTControllers
[
index
].
dispose
();
IGSTControllers
[
index
].
dispose
();
TaxableValueControllers
[
index
].
dispose
();
TotalPriceControllers
[
index
].
dispose
();
ProductControllers
.
removeAt
(
index
);
PriceControllers
.
removeAt
(
index
);
QuantityControllers
.
removeAt
(
index
);
CGSTControllers
.
removeAt
(
index
);
SGSTControllers
.
removeAt
(
index
);
IGSTControllers
.
removeAt
(
index
);
TaxableValueControllers
.
removeAt
(
index
);
TotalPriceControllers
.
removeAt
(
index
);
selectedSaleProductID
.
removeAt
(
index
);
notifyListeners
();
}
}
}
void
updateSelectedProduct
(
int
index
,
SaleProducts
?
product
)
{
if
(
index
>=
0
&&
index
<
_saleProducts
.
length
)
{
_selectedSaleProducts
=
product
;
_selectedSaleProductID
[
index
]
=
product
!.
id
;
PriceControllers
[
index
].
text
=
product
!.
price
!;
updateRowCalculations
(
index
);
notifyListeners
();
}
}
void
updateRowCalculations
(
int
index
)
{
if
(
index
>=
0
&&
index
<
PriceControllers
.
length
)
{
final
inclusivePrice
=
double
.
tryParse
(
PriceControllers
[
index
].
text
)
??
0.0
;
final
quantity
=
double
.
tryParse
(
QuantityControllers
[
index
].
text
)
??
1.0
;
final
cgst
=
double
.
tryParse
(
CGSTControllers
[
index
].
text
)
??
0.0
;
final
sgst
=
double
.
tryParse
(
SGSTControllers
[
index
].
text
)
??
0.0
;
final
igst
=
double
.
tryParse
(
IGSTControllers
[
index
].
text
)
??
0.0
;
final
totalTaxRate
=
(
cgst
+
sgst
+
igst
)
/
100
;
// Calculate taxable value per unit
final
taxableValuePerUnit
=
inclusivePrice
/
(
1
+
totalTaxRate
);
// Total taxable value = taxable value per unit * quantity
final
totalTaxableValue
=
taxableValuePerUnit
*
quantity
;
TaxableValueControllers
[
index
].
text
=
totalTaxableValue
.
toStringAsFixed
(
0
,
);
notifyListeners
();
}
}
///[{"product_id":"1","qty":"1","price":"500","cgst_p":"9","sgst_p":"9","igst_p":"0","total_price":"500"},
///{"product_id":"2","qty":"1","price":"1000","cgst_p":"9","sgst_p":"9","igst_p":"0","total_price":"1000"}]
Map
<
String
,
dynamic
>
getFormData
()
{
final
List
<
Map
<
String
,
dynamic
>>
orders
=
[];
for
(
int
i
=
0
;
i
<
ProductControllers
.
length
;
i
++)
{
orders
.
add
({
'product_id'
:
selectedSaleProductID
[
i
],
'product_name'
:
ProductControllers
[
i
].
text
,
'inclusive_price'
:
PriceControllers
[
i
].
text
,
'quantity'
:
QuantityControllers
[
i
].
text
,
'cgst'
:
CGSTControllers
[
i
].
text
,
'sgst'
:
SGSTControllers
[
i
].
text
,
'igst'
:
IGSTControllers
[
i
].
text
,
'taxable_value'
:
TaxableValueControllers
[
i
].
text
,
'qty'
:
QuantityControllers
[
i
].
text
,
'price'
:
PriceControllers
[
i
].
text
,
'cgst_p'
:
CGSTControllers
[
i
].
text
,
'sgst_p'
:
SGSTControllers
[
i
].
text
,
'igst_p'
:
IGSTControllers
[
i
].
text
,
'total_price'
:
TaxableValueControllers
[
i
].
text
,
});
}
return
{
...
...
@@ -807,14 +825,14 @@ void updateRowCalculations(int index) {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_tpcApplicable
=
[
"Yes"
,
"No"
];
_erectionScope
=
data
.
erectionScope
??[];
_unloadingScope
=
data
.
unloadingScope
??[];
_freightScope
=
data
.
freightScope
??[];
_employees
=
data
.
employees
??[];
_billingStates
=
data
.
states
??[];
_dispatchStates
=
data
.
states
??[];
_saleProducts
=
data
.
saleProducts
??[];
_tpcApplicable
=
[
"Yes"
,
"No"
];
_erectionScope
=
data
.
erectionScope
??
[];
_unloadingScope
=
data
.
unloadingScope
??
[];
_freightScope
=
data
.
freightScope
??
[];
_employees
=
data
.
employees
??
[];
_billingStates
=
data
.
states
??
[];
_dispatchStates
=
data
.
states
??
[];
_saleProducts
=
data
.
saleProducts
??
[];
checkDropdownselected
();
...
...
@@ -839,7 +857,6 @@ void updateRowCalculations(int index) {
!
_billingStates
.
contains
(
_selectedBillingStates
))
{
_selectedBillingStateID
=
null
;
_selectedBillingStateName
=
""
;
}
if
(
_selectedBillingDistricts
!=
null
&&
!
_billingDistricts
.
contains
(
_selectedBillingDistricts
))
{
...
...
@@ -884,8 +901,7 @@ void updateRowCalculations(int index) {
_selectedTpcStatus
=
null
;
}
if
(
_selectedTpcAgent
!=
null
&&
!
_tpcAgent
.
contains
(
_selectedTpcAgent
))
{
if
(
_selectedTpcAgent
!=
null
&&
!
_tpcAgent
.
contains
(
_selectedTpcAgent
))
{
_selectedTpcAgentID
=
null
;
_selectedTpcAgentValue
=
""
;
}
...
...
@@ -941,6 +957,7 @@ void updateRowCalculations(int index) {
}
}
catch
(
e
,
s
)
{}
}
Future
<
void
>
getDispatchDistrictAPI
(
context
,
stateID
)
async
{
try
{
var
homeProv
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -980,6 +997,7 @@ void updateRowCalculations(int index) {
}
}
catch
(
e
,
s
)
{}
}
Future
<
void
>
getDispatchSubLocationAPI
(
context
,
districtID
)
async
{
try
{
var
homeProv
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
...
...
@@ -1000,7 +1018,7 @@ void updateRowCalculations(int index) {
}
catch
(
e
,
s
)
{}
}
Future
<
void
>
ordersAddOrderTPCAgentFunction
(
context
,
mode
,
text
)
async
{
Future
<
void
>
ordersAddOrderTPCAgentFunction
(
context
,
mode
,
text
)
async
{
try
{
final
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
addOrderTPCAgentListAPI
(
...
...
@@ -1037,6 +1055,9 @@ void updateRowCalculations(int index) {
order_products
,
)
async
{
try
{
if
(!
validateAddOrder
())
{
return
;
}
_submitClicked
=
true
;
final
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
addOrderSubmitAPI
(
...
...
@@ -1311,6 +1332,112 @@ void updateRowCalculations(int index) {
notifyListeners
();
}
bool
validateAddOrder
()
{
bool
isValid
=
true
;
selectAccountError
=
""
;
billingNameError
=
""
;
orderDateError
=
""
;
billingAddressError
=
""
;
billingPincodeError
=
""
;
dispatchAddressError
=
""
;
dispatchPincodeError
=
""
;
gstError
=
""
;
tpcAmountError
=
""
;
selectedBillingStateError
=
""
;
selectedBillingDistrictError
=
""
;
selectedBillingSubLocError
=
""
;
selectedDispatchStateError
=
""
;
selectedDispatchDistrictError
=
""
;
selectedDispatchSubLocError
=
""
;
if
(
_selectedAccountList
==
null
||
_selectedAccountID
==
null
)
{
selectAccountError
=
"Please select an Account"
;
isValid
=
false
;
}
if
(
_selectedAccountList
==
null
||
_selectedAccountID
==
null
)
{
selectAccountError
=
"Please select an Account"
;
isValid
=
false
;
}
if
(
_selectedBillingStates
==
null
||
_selectedBillingStateID
==
null
)
{
selectedBillingStateError
=
"Please select a State"
;
isValid
=
false
;
}
if
(
_selectedBillingDistricts
==
null
||
_selectedBillingDistrictID
==
null
)
{
selectedBillingDistrictError
=
"Please select a District"
;
isValid
=
false
;
}
if
(
_selectedBillingSubLocations
==
null
||
_selectedBillingSubLocID
==
null
)
{
selectedBillingSubLocError
=
"Please select a Location"
;
isValid
=
false
;
}
if
(
_selectedDispatchStates
==
null
||
_selectedDispatchStateID
==
null
)
{
selectedDispatchStateError
=
"Please select a State"
;
isValid
=
false
;
}
if
(
_selectedDispatchDistricts
==
null
||
_selectedDispatchDistrictID
==
null
)
{
selectedDispatchDistrictError
=
"Please select a District"
;
isValid
=
false
;
}
if
(
_selectedDispatchSubLocations
==
null
||
_selectedDispatchSubLocID
==
null
)
{
selectedDispatchSubLocError
=
"Please select a Location"
;
isValid
=
false
;
}
if
(
orderReceivedDateController
.
text
.
trim
().
isEmpty
)
{
orderDateError
=
"Please Enter Date"
;
isValid
=
false
;
notifyListeners
();
}
if
(
billingNameController
.
text
.
trim
().
isEmpty
)
{
isValid
=
false
;
billingNameError
=
"Please Enter Your Name"
;
notifyListeners
();
}
if
(
billingAddressController
.
text
.
trim
().
isEmpty
)
{
isValid
=
false
;
billingAddressError
=
"Please Enter Address"
;
notifyListeners
();
}
if
(
billingPincodeController
.
text
.
trim
().
isEmpty
)
{
isValid
=
false
;
billingPincodeError
=
"Please Enter Pin Code"
;
notifyListeners
();
}
if
(
dispatchAddressController
.
text
.
trim
().
isEmpty
)
{
dispatchAddressError
=
"Please Enter Dispatch Address"
;
isValid
=
false
;
notifyListeners
();
}
if
(
dispatchPincodeController
.
text
.
trim
().
isEmpty
)
{
dispatchPincodeError
=
"Please Enter Dispatch Pin Code"
;
isValid
=
false
;
notifyListeners
();
}
if
(
gstController
.
text
.
trim
().
isEmpty
)
{
gstError
=
"Please Enter GST Number"
;
isValid
=
false
;
notifyListeners
();
}
if
(
_selectedTpcStatus
==
"Yes"
)
{
if
(
tpcAmountController
.
text
.
trim
().
isEmpty
)
{
isValid
=
false
;
tpcAmountError
=
"Please Enter Amount"
;
notifyListeners
();
}
}
notifyListeners
();
return
isValid
;
}
void
resetForm
()
{
_submitClicked
=
false
;
dropDownSearchController
.
clear
();
...
...
@@ -1331,7 +1458,6 @@ void updateRowCalculations(int index) {
gstController
.
clear
();
orderReceivedDateController
.
clear
();
tpcAmountController
.
clear
();
gstController
.
clear
();
orderReceivedDateController
.
clear
();
noteController
.
clear
();
...
...
@@ -1367,7 +1493,12 @@ void updateRowCalculations(int index) {
billingPincodeError
=
""
;
dispatchAddressError
=
""
;
dispatchPincodeError
=
""
;
selectedBillingStateError
=
""
;
selectedBillingDistrictError
=
""
;
selectedBillingSubLocError
=
""
;
selectedDispatchStateError
=
""
;
selectedDispatchDistrictError
=
""
;
selectedDispatchSubLocError
=
""
;
_selectedAccountList
=
null
;
_selectedEmployees
=
null
;
_selectedBillingStates
=
null
;
...
...
lib/Notifiers/ordersProvider/addPaymentProvider.dart
View file @
1a2ae52a
...
...
@@ -6,6 +6,7 @@ import 'package:dropdown_button2/dropdown_button2.dart';
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:generp/Notifiers/HomeScreenNotifier.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/services/api_calling.dart'
;
import
'package:image_picker/image_picker.dart'
;
import
'package:intl/intl.dart'
;
...
...
@@ -15,6 +16,8 @@ import '../../Models/ordersModels/AddOrderPaymentSelectAccountResponse.dart';
import
'../../Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart'
;
class
Addpaymentprovider
extends
ChangeNotifier
{
bool
_submitClicked
=
false
;
TextEditingController
dropDownSearchController
=
TextEditingController
();
TextEditingController
amountController
=
TextEditingController
();
...
...
@@ -65,7 +68,7 @@ class Addpaymentprovider extends ChangeNotifier{
bool
get
submitClicked
=>
_submitClicked
;
List
<
String
>
get
paymentMode
=>
_paymentMode
;
List
<
String
>
get
description
=>
_description
;
bool
get
isLoading
=>
_isLoading
;
...
...
@@ -90,6 +93,11 @@ class Addpaymentprovider extends ChangeNotifier{
File
?
get
imageFilePath
=>
_image
;
int
get
imagePicked
=>
_imagePicked
;
set
submitClicked
(
bool
value
){
_submitClicked
=
value
;
notifyListeners
();
}
set
accountList
(
List
<
AccountList
>
value
){
_accountList
=
value
;
notifyListeners
();
...
...
@@ -130,7 +138,7 @@ class Addpaymentprovider extends ChangeNotifier{
}
void
updateSelectedOrderId
(
int
index
,
OrderList
?
value
)
{
_selectedOrderLists
=
value
!;
_updateAdjustedAmount
();
_selectedOrderIds
[
index
]
=
value
!.
orderId
;
print
(
_selectedOrderIds
[
index
]);
notifyListeners
();
...
...
@@ -212,11 +220,18 @@ class Addpaymentprovider extends ChangeNotifier{
tempAdjustAmount
+=
int
.
tryParse
(
text
)
??
0
;
}
}
int
amountControllerAmount
=
int
.
parse
(
amountController
.
text
.
toString
());
if
(
tempAdjustAmount
>
amountControllerAmount
){
orderAdjustedAmountError
=
"Amount Should not be greater than Total Amount"
;
}
else
{
orderAdjustedAmountError
=
""
;
}
orderAdjustedAmountController
.
text
=
tempAdjustAmount
.
toString
();
notifyListeners
();
}
void
updateAdjustedAmount
()
=>
_updateAdjustedAmount
();
List
<
Map
<
String
,
String
>>
getFormData
()
{
_selectedOrders
=
[];
...
...
@@ -225,18 +240,17 @@ class Addpaymentprovider extends ChangeNotifier{
for
(
int
i
=
0
;
i
<
orderAmountControllers
.
length
;
i
++)
{
if
(
_selectedOrderIds
[
i
]
!=
null
&&
orderAmountControllers
[
i
].
text
.
isNotEmpty
)
{
latestEntries
[
_selectedOrderIds
[
i
]!]
=
orderAmountControllers
[
i
].
text
;
// latestEntries[_selectedOrderIds[i]!] = orderAmountControllers[i].text;
_selectedOrders
.
add
({
"order_id"
:
_selectedOrderIds
[
i
]!,
"amount"
:
orderAmountControllers
[
i
].
text
,
});
tempAdjustAmount
=
tempAdjustAmount
+
int
.
parse
(
double
.
parse
(
orderAmountControllers
[
i
].
text
).
round
().
toString
());
}
}
_selectedOrders
=
latestEntries
.
entries
.
map
((
entry
)
=>
{
"order_id"
:
entry
.
key
,
"amount"
:
entry
.
value
,
})
.
toList
();
print
(
"Form Data:
$_selectedOrders
"
);
orderAdjustedAmountController
.
text
=
tempAdjustAmount
.
toString
();
...
...
@@ -369,6 +383,12 @@ class Addpaymentprovider extends ChangeNotifier{
accountId
,
selDescription
,
selectedOrders
,
paymentMode
,)
async
{
try
{
if
(!
validateAddPayment
())
{
return
;
}
_submitClicked
=
true
;
notifyListeners
();
final
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
addOrderpaymentListSubmitAPI
(
provider
.
empId
,
provider
.
session
,
accountId
,
selDescription
,
...
...
@@ -377,20 +397,26 @@ class Addpaymentprovider extends ChangeNotifier{
paymentMode
,
paymentRefController
.
text
,
_image
);
if
(
data
!=
null
){
if
(
data
.
error
==
"0"
){
_submitClicked
=
false
;
resetForm
();
Navigator
.
pop
(
context
);
toast
(
context
,
data
.
message
);
notifyListeners
();
}
else
{
_submitClicked
=
false
;
notifyListeners
();
toast
(
context
,
data
.
message
);
}
}
else
{
submitClicked
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
){
submitClicked
=
false
;
notifyListeners
();
}
}
...
...
@@ -437,11 +463,13 @@ class Addpaymentprovider extends ChangeNotifier{
}
void
onChangeAmount
(
value
){
_updateAdjustedAmount
();
amountError
=
""
;
notifyListeners
();
}
void
onChangeorderAdjustedAmount
(
value
){
orderAdjustedAmountError
=
""
;
_updateAdjustedAmount
();
notifyListeners
();
}
void
onChangeDescription
(
value
){
...
...
@@ -453,6 +481,51 @@ class Addpaymentprovider extends ChangeNotifier{
paymentRefError
=
""
;
notifyListeners
();
}
bool
validateAddPayment
(){
bool
isValid
=
true
;
selectAccountError
=
""
;
amountError
=
""
;
orderAdjustedAmountError
=
""
;
descriptionError
=
""
;
paymentModeError
=
""
;
paymentRefError
=
""
;
if
(
_selectedAccountList
==
null
||
_selectedAccountID
==
null
)
{
selectAccountError
=
"Please select an Account"
;
isValid
=
false
;
}
if
(
amountController
.
text
.
trim
().
isEmpty
){
isValid
=
false
;
amountError
=
"Please Enter the Amount"
;
notifyListeners
();
}
if
(
orderAdjustedAmountController
.
text
.
trim
().
isEmpty
){
isValid
=
false
;
orderAdjustedAmountError
=
"Please Enter the Amount"
;
notifyListeners
();
}
if
(
descriptionController
.
text
.
trim
().
isEmpty
){
isValid
=
false
;
descriptionError
=
"Please Enter the Description"
;
notifyListeners
();
}
if
(
paymentReceivedDateController
.
text
.
trim
().
isEmpty
){
isValid
=
false
;
paymentModeError
=
"Please Enter the Amount"
;
notifyListeners
();
}
if
(
_paymentMode
==
null
||
_selectedPaymentMode
==
null
)
{
paymentModeError
=
"Please select an Account"
;
isValid
=
false
;
}
if
(
paymentRefController
.
text
.
trim
().
isEmpty
){
isValid
=
false
;
paymentRefError
=
"Please Enter the Payment reference"
;
notifyListeners
();
}
notifyListeners
();
return
isValid
;
}
void
resetForm
()
{
...
...
lib/Notifiers/ordersProvider/dispatchOrderProvider.dart
0 → 100644
View file @
1a2ae52a
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Utils/commonServices.dart'
;
import
'../../services/api_calling.dart'
;
import
'../HomeScreenNotifier.dart'
;
import
'package:generp/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart'
;
class
Dispatchorderprovider
extends
ChangeNotifier
{
bool
_submitClicked
=
false
;
TextEditingController
invoiceNumberController
=
TextEditingController
();
TextEditingController
vehicleNumberController
=
TextEditingController
();
TextEditingController
driverNameController
=
TextEditingController
();
TextEditingController
driverMobileNumberController
=
TextEditingController
();
String
?
invoiceNumberError
;
String
?
vehicleNumberError
;
String
?
driverNameError
;
String
?
driverMobileNumberError
;
List
<
Products
>
_leadProductsList
=
[];
Products
?
_selectedProducts
;
List
<
TextEditingController
>
engineNumberControllers
=
[];
List
<
TextEditingController
>
pdiIDControllers
=
[];
List
<
String
?>
_selectedProductIds
=
[];
List
<
String
?>
_selectedProductValues
=
[];
List
<
Products
>
get
productsList
=>
_leadProductsList
;
List
<
Products
>
get
leadProductsList
=>
_leadProductsList
;
Products
?
get
selectedProducts
=>
_selectedProducts
;
List
<
String
?>
get
selectedProductIds
=>
_selectedProductIds
;
List
<
String
?>
get
selectedProductValues
=>
_selectedProductValues
;
bool
get
submitClicked
=>
_submitClicked
;
set
submitClicked
(
bool
value
){
_submitClicked
=
value
;
notifyListeners
();
}
void
initializeForm
(
BuildContext
context
)
{
// Clear existing controllers
engineNumberControllers
.
clear
();
pdiIDControllers
.
clear
();
_selectedProductIds
.
clear
();
_selectedProductValues
.
clear
();
// Initialize controllers for each lead product
for
(
var
product
in
_leadProductsList
)
{
engineNumberControllers
.
add
(
TextEditingController
());
pdiIDControllers
.
add
(
TextEditingController
(
text:
product
.
pdiId
?.
toString
()
??
''
));
_selectedProductIds
.
add
(
product
.
id
);
_selectedProductValues
.
add
(
product
.
productName
);
}
// Add one empty row if the list is empty
if
(
_leadProductsList
.
isEmpty
)
{
editAddNewRow
();
}
notifyListeners
();
}
void
editAddNewRow
()
{
engineNumberControllers
.
add
(
TextEditingController
());
pdiIDControllers
.
add
(
TextEditingController
());
_selectedProductIds
.
add
(
null
);
_selectedProductValues
.
add
(
null
);
notifyListeners
();
}
void
editRemoveRow
(
int
index
)
{
engineNumberControllers
[
index
].
dispose
();
pdiIDControllers
[
index
].
dispose
();
engineNumberControllers
.
removeAt
(
index
);
pdiIDControllers
.
removeAt
(
index
);
_selectedProductIds
.
removeAt
(
index
);
_selectedProductValues
.
removeAt
(
index
);
notifyListeners
();
}
void
updateSelectedProductIds
(
int
index
,
Products
value
)
{
_selectedProductIds
[
index
]
=
value
.
id
;
_selectedProductValues
[
index
]
=
value
.
productName
;
notifyListeners
();
}
void
updateTotalAmount
(
int
index
)
{
final
price
=
double
.
tryParse
(
engineNumberControllers
[
index
].
text
)
??
0
;
final
qty
=
int
.
tryParse
(
pdiIDControllers
[
index
].
text
)
??
0
;
// editTotalAmountControllers[index].text = (price * qty).toString();
notifyListeners
();
}
List
<
Map
<
String
,
String
>>
getFormData
()
{
final
List
<
Map
<
String
,
String
>>
insertData
=
[];
for
(
int
i
=
0
;
i
<
engineNumberControllers
.
length
;
i
++)
{
if
(
_selectedProductIds
[
i
]
!=
null
)
{
final
rowData
=
{
"product_id"
:
_selectedProductIds
[
i
]!,
"engine_number"
:
engineNumberControllers
[
i
].
text
,
"pdi_id"
:
pdiIDControllers
[
i
].
text
,
};
insertData
.
add
(
rowData
);
}
}
return
insertData
;
}
Future
<
void
>
ordersDetailsDispatchOrderViewFunction
(
context
,
orderID
)
async
{
try
{
final
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
ordersDetailsDispatchOrderViewAPI
(
provider
.
empId
,
provider
.
session
,
orderID
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_leadProductsList
=
data
.
products
!;
notifyListeners
();
}
else
{}
}
else
{}
}
catch
(
e
,
s
)
{}
}
Future
<
void
>
approvalRejectionAPIFunction
(
context
,
status
,
orderId
,
type
,
feedback
,
tpc_applicable
,
tpc_approved_amount
,
sale_order_number
,
edit_company_name
,
crm_order_p_id
,
)
async
{
try
{
if
(!
validateApproveRejectForm
())
{
// _submitClicked = false;
return
;
}
_submitClicked
=
true
;
notifyListeners
();
var
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
ordersDetailsApproveRejectAPI
(
provider
.
empId
,
provider
.
session
,
status
,
type
,
orderId
,
feedback
,
tpc_applicable
,
tpc_approved_amount
,
sale_order_number
,
edit_company_name
,
invoiceNumberController
.
text
,
vehicleNumberController
.
text
,
driverNameController
.
text
,
driverMobileNumberController
.
text
,
crm_order_p_id
,
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_submitClicked
=
false
;
toast
(
context
,
"
${data.message}
"
);
resetForm
();
Navigator
.
pop
(
context
,
true
);
notifyListeners
();
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
)
{
_submitClicked
=
false
;
notifyListeners
();
}
}
bool
validateApproveRejectForm
(
){
bool
isValid
=
true
;
if
(
invoiceNumberController
.
text
.
trim
().
isEmpty
){
invoiceNumberError
=
"Enter Invoice Number"
;
isValid
=
false
;
}
if
(
vehicleNumberController
.
text
.
trim
().
isEmpty
){
vehicleNumberError
=
"Enter Vehicle Number"
;
isValid
=
false
;
}
if
(
driverNameController
.
text
.
trim
().
isEmpty
){
driverNameError
=
"Enter Driver Name"
;
isValid
=
false
;
}
if
(
driverMobileNumberController
.
text
.
trim
().
isEmpty
){
driverMobileNumberError
=
"Enter Driver Number"
;
isValid
=
false
;
}
notifyListeners
();
return
isValid
;
}
resetForm
(){
invoiceNumberController
.
clear
();
vehicleNumberController
.
clear
();
driverNameController
.
clear
();
driverMobileNumberController
.
clear
();
engineNumberControllers
.
clear
();
pdiIDControllers
.
clear
();
_selectedProductIds
.
clear
();
_selectedProductValues
.
clear
();
_leadProductsList
.
clear
();
invoiceNumberError
=
null
;
vehicleNumberError
=
null
;
driverNameError
=
null
;
driverMobileNumberError
=
null
;
notifyListeners
();
}
onChangedinvoiceNumber
(
value
){
invoiceNumberError
=
null
;
notifyListeners
();
}
onChangedvehicleNumber
(
value
){
vehicleNumberError
=
null
;
notifyListeners
();
}
onChangeddriverName
(
value
){
driverNameError
=
null
;
notifyListeners
();
}
onChangeddriverMobileNumber
(
value
){
driverMobileNumberError
=
null
;
notifyListeners
();
}
}
lib/Notifiers/ordersProvider/pagesDashboardProvider.dart
View file @
1a2ae52a
...
...
@@ -14,6 +14,7 @@ import '../../services/api_calling.dart';
import
'../HomeScreenNotifier.dart'
;
class
Pagesdashboardprovider
extends
ChangeNotifier
{
bool
_submitClicked
=
false
;
TextEditingController
feedbackController
=
TextEditingController
();
TextEditingController
approveRejectFeedbackController
=
TextEditingController
();
...
...
@@ -49,6 +50,12 @@ class Pagesdashboardprovider extends ChangeNotifier {
File
?
_image
;
File
?
_imageName
;
bool
get
submitClicked
=>
_submitClicked
;
set
submitClicked
(
bool
value
){
_submitClicked
=
value
;
notifyListeners
();
}
String
get
approvalSheetHeading
=>
_approvalSheetHeading
;
String
get
rejecetionSheetHeading
=>
_rejecetionSheetHeading
;
...
...
@@ -459,6 +466,8 @@ class Pagesdashboardprovider extends ChangeNotifier {
// _submitClicked = false;
return
;
}
_submitClicked
=
true
;
notifyListeners
();
var
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
ordersDetailsFeedbackSubmissionAPI
(
provider
.
empId
,
...
...
@@ -470,14 +479,23 @@ class Pagesdashboardprovider extends ChangeNotifier {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_submitClicked
=
false
;
toast
(
context
,
"Submitted Successfully"
);
resetForm
();
Navigator
.
pop
(
context
,
true
);
notifyListeners
();
}
else
{}
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
)
{}
}
catch
(
e
,
s
)
{
_submitClicked
=
false
;
notifyListeners
();
}
}
Future
<
void
>
approvalRejectionAPIFunction
(
...
...
@@ -499,6 +517,8 @@ class Pagesdashboardprovider extends ChangeNotifier {
// _submitClicked = false;
return
;
}
_submitClicked
=
true
;
notifyListeners
();
var
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
ordersDetailsApproveRejectAPI
(
provider
.
empId
,
...
...
@@ -519,12 +539,12 @@ class Pagesdashboardprovider extends ChangeNotifier {
);
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_submitClicked
=
false
;
toast
(
context
,
"
${data.message}
"
);
resetForm
();
Navigator
.
pop
(
context
,
true
);
notifyListeners
();
}
else
{}
notifyListeners
();
}
}
catch
(
e
,
s
)
{}
}
...
...
@@ -548,10 +568,18 @@ class Pagesdashboardprovider extends ChangeNotifier {
resetForm
();
Navigator
.
pop
(
context
,
true
);
notifyListeners
();
}
else
{}
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
)
{}
}
catch
(
e
,
s
)
{
_submitClicked
=
false
;
notifyListeners
();
}
}
void
onChangeFeedback
(
value
)
{
...
...
lib/Notifiers/ordersProvider/tpcAgentsProvider.dart
View file @
1a2ae52a
...
...
@@ -14,6 +14,7 @@ import '../../services/api_calling.dart';
import
'../HomeScreenNotifier.dart'
;
class
Tpcagentsprovider
extends
ChangeNotifier
{
bool
_submitClicked
=
false
;
TextEditingController
tpcNameController
=
TextEditingController
();
TextEditingController
tpcMobileNumberController
=
TextEditingController
();
...
...
@@ -34,6 +35,7 @@ class Tpcagentsprovider extends ChangeNotifier{
String
?
tpcBankAccountNumberError
=
""
;
String
?
tpcBankIFSCError
=
""
;
String
?
tpcNoteError
=
""
;
String
?
imageError
=
""
;
String
?
tpcPaymentModeError
=
""
;
String
?
tpcPaymentReferenceNoError
=
""
;
...
...
@@ -53,6 +55,7 @@ class Tpcagentsprovider extends ChangeNotifier{
File
?
_image
;
File
?
_imageName
;
bool
get
submitClicked
=>
_submitClicked
;
List
<
String
>
get
Headings
=>
_headings
;
List
<
String
>
get
subHeadings
=>
_subHeadings
;
...
...
@@ -69,6 +72,11 @@ class Tpcagentsprovider extends ChangeNotifier{
get
imagePicked
=>
_image_picked
;
set
submitClicked
(
bool
value
){
_submitClicked
=
value
;
notifyListeners
();
}
set
imagePath
(
File
?
value
)
{
_imageName
=
value
;
notifyListeners
();
...
...
@@ -188,6 +196,8 @@ class Tpcagentsprovider extends ChangeNotifier{
// _submitClicked = false;
return
;
}
_submitClicked
=
true
;
notifyListeners
();
var
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
TpcIssueListApprovalAPI
(
provider
.
empId
,
...
...
@@ -201,13 +211,26 @@ class Tpcagentsprovider extends ChangeNotifier{
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_submitClicked
=
false
;
toast
(
context
,
"Submitted Successfully"
);
resetAll
();
resetApprovalForm
();
Navigator
.
pop
(
context
,
true
);
notifyListeners
();
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
)
{}
}
catch
(
e
,
s
)
{
_submitClicked
=
false
;
notifyListeners
();
}
}
Future
<
void
>
addTPCAgentAPIFunction
(
context
)
async
{
...
...
@@ -216,6 +239,8 @@ class Tpcagentsprovider extends ChangeNotifier{
// _submitClicked = false;
return
;
}
_submitClicked
=
true
;
notifyListeners
();
var
provider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
data
=
await
ApiCalling
.
ordersAddTPCAgentAPI
(
provider
.
empId
,
...
...
@@ -233,13 +258,24 @@ class Tpcagentsprovider extends ChangeNotifier{
if
(
data
!=
null
)
{
if
(
data
.
error
==
"0"
)
{
_submitClicked
=
false
;
toast
(
context
,
"Submitted Successfully"
);
resetAll
();
resetAddTPCAgentForm
();
Navigator
.
pop
(
context
,
true
);
notifyListeners
();
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
else
{
_submitClicked
=
false
;
notifyListeners
();
}
}
catch
(
e
,
s
)
{}
}
catch
(
e
,
s
)
{
_submitClicked
=
false
;
notifyListeners
();
}
}
bool
validateAddTPCAgentForm
(
BuildContext
context
)
{
...
...
@@ -262,6 +298,11 @@ class Tpcagentsprovider extends ChangeNotifier{
tpcMobileNumberError
=
"PLease Enter Your Mobile Number"
;
isValid
=
false
;
}
if
(
_image_picked
==
0
){
imageError
=
"Please select ID Proof"
;
isValid
=
false
;
}
if
(
tpcBankNameController
.
text
.
trim
().
isEmpty
){
tpcBankNameError
=
"Please Enter Bank Name"
;
isValid
=
false
;
...
...
@@ -278,7 +319,7 @@ class Tpcagentsprovider extends ChangeNotifier{
tpcBankIFSCError
=
"Please Enter IFSC"
;
isValid
=
false
;
}
_submitClicked
=
false
;
notifyListeners
();
return
isValid
;
...
...
@@ -305,6 +346,7 @@ class Tpcagentsprovider extends ChangeNotifier{
orderTpcFeedbackError
=
"Please enter a description"
;
isValid
=
false
;
}
_submitClicked
=
false
;
notifyListeners
();
return
isValid
;
}
...
...
@@ -367,6 +409,9 @@ class Tpcagentsprovider extends ChangeNotifier{
tpcBankAccountNumberController
.
clear
();
tpcBankIFSCController
.
clear
();
tpcNoteController
.
clear
();
tpcPaymentModeController
.
clear
();
tpcPaymentReferenceNoController
.
clear
();
orderTpcFeedbackController
.
clear
();
tpcNameError
=
""
;
tpcMobileNumberError
=
""
;
tpcBankNameError
=
""
;
...
...
@@ -376,7 +421,9 @@ class Tpcagentsprovider extends ChangeNotifier{
tpcNoteError
=
""
;
_image
=
null
;
_imageName
=
null
;
imageError
=
null
;
_image_picked
=
0
;
notifyListeners
();
}
void
resetApprovalForm
()
{
...
...
@@ -388,7 +435,9 @@ class Tpcagentsprovider extends ChangeNotifier{
orderTpcFeedbackError
=
""
;
_image
=
null
;
_imageName
=
null
;
imageError
=
null
;
_image_picked
=
0
;
notifyListeners
();
}
void
resetAll
(){
...
...
@@ -415,6 +464,8 @@ class Tpcagentsprovider extends ChangeNotifier{
_image
=
null
;
_imageName
=
null
;
_image_picked
=
0
;
imageError
=
null
;
notifyListeners
();
}
imgFromCamera
(
context
)
async
{
...
...
@@ -429,6 +480,7 @@ class Tpcagentsprovider extends ChangeNotifier{
_image
=
File
(
galleryImage
!.
path
);
_imageName
=
File
(
galleryImage
!.
name
);
_image_picked
=
1
;
imageError
=
null
;
notifyListeners
();
}
catch
(
e
)
{
debugPrint
(
"mmmm:
${e.toString()}
"
);
...
...
@@ -450,6 +502,7 @@ class Tpcagentsprovider extends ChangeNotifier{
_image
=
File
(
galleryImage
!.
path
);
_imageName
=
File
(
galleryImage
!.
name
);
_image_picked
=
1
;
imageError
=
null
;
notifyListeners
();
// var file = FlutterImageCompress.compressWithFile(galleryImage!.path);
}
catch
(
e
)
{
...
...
lib/main.dart
View file @
1a2ae52a
...
...
@@ -216,6 +216,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider
(
create:
(
_
)
=>
Crmeditprospectaccountprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Addprospectleadsprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Editorderprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Dispatchorderprovider
()),
],
child:
Builder
(
builder:
(
BuildContext
context
)
{
...
...
lib/screens/crm/LeadDetailsByMode.dart
View file @
1a2ae52a
...
...
@@ -54,7 +54,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
"Lead Details (
${widget.mode}
)"
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
...
...
lib/screens/notifierExports.dart
View file @
1a2ae52a
...
...
@@ -40,6 +40,8 @@ export 'package:generp/Notifiers/ordersProvider/addPaymentProvider.dart';
export
'package:generp/Notifiers/ordersProvider/addOrderProvider.dart'
;
export
'package:generp/Notifiers/ordersProvider/editPaymentProvider.dart'
;
export
'package:generp/Notifiers/ordersProvider/editOrderProvider.dart'
;
export
'package:generp/Notifiers/ordersProvider/dispatchOrderProvider.dart'
;
export
'package:generp/Notifiers/crmProvider/crmDashboardProvider.dart'
;
export
'package:generp/Notifiers/crmProvider/LeadListProvider.dart'
;
...
...
lib/screens/order/addOrder.dart
View file @
1a2ae52a
...
...
@@ -26,7 +26,8 @@ class _AddorderScreenState extends State<AddorderScreen> {
FocusNode
focusNode
=
FocusNode
();
FocusNode
focusNodetpc
=
FocusNode
();
List
<
FocusNode
>
focusNodes
=
List
.
generate
(
10
,
(
index
)
=>
FocusNode
());
Dropdowntheme
ddtheme
=
Dropdowntheme
();
Dropdowntheme
ddtheme
=
Dropdowntheme
();
@override
void
initState
()
{
// TODO: implement initState
...
...
@@ -44,7 +45,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
@override
void
dispose
()
{
focusNodes
.
map
((
e
)=>
e
.
dispose
());
focusNodes
.
map
((
e
)
=>
e
.
dispose
());
focusNode
.
dispose
();
focusNodetpc
.
dispose
();
super
.
dispose
();
...
...
@@ -95,7 +96,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
ListTile
(
onTap:
(){
onTap:
()
{
if
(
focusNode
.
hasFocus
)
{
focusNode
.
unfocus
();
}
else
{
...
...
@@ -162,7 +163,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
margin:
EdgeInsets
.
symmetric
(
horizontal:
0
),
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
height:
widget
.
mode
==
"self"
?
50
:
150
,
height:
widget
.
mode
==
"self"
?
50
:
150
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
16
),
),
...
...
@@ -317,7 +318,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
),
),
errorWidget
(
context
,
provider
.
d
ateError
),
errorWidget
(
context
,
provider
.
orderD
ateError
),
textControllerWidget
(
context
,
...
...
@@ -329,7 +330,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
null
,
focusNodes
[
0
],
null
,
TextInputAction
.
done
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
billingNameError
),
TextWidget
(
context
,
"Billing State"
),
...
...
@@ -381,40 +382,39 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
billingStateSearchController
,
searchController:
provider
.
billingStateSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingStateSearchController
,
provider
.
billingStateSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sate...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
billingStateSearchController
.
clear
();
provider
.
billingStateSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
...
...
@@ -426,6 +426,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
),
),
errorWidget
(
context
,
provider
.
selectedBillingStateError
),
TextWidget
(
context
,
"Billing District"
),
//dd
DropdownButtonHideUnderline
(
...
...
@@ -474,33 +475,34 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
billingDistrictSearchController
,
searchController:
provider
.
billingDistrictSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingDistrictSearchController
,
provider
.
billingDistrictSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search District...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
district
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
...
...
@@ -519,6 +521,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
),
),
errorWidget
(
context
,
provider
.
selectedBillingDistrictError
),
TextWidget
(
context
,
"Billing Sub Location"
),
//dd
DropdownButtonHideUnderline
(
...
...
@@ -555,33 +558,33 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
billingSubLocSearchController
,
searchController:
provider
.
billingSubLocSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingSubLocSearchController
,
provider
.
billingSubLocSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sub Location...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
subLocality
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
...
...
@@ -600,6 +603,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
),
),
errorWidget
(
context
,
provider
.
selectedBillingSubLocError
),
textControllerWidget
(
context
,
provider
.
billingAddressController
,
...
...
@@ -608,9 +612,9 @@ Dropdowntheme ddtheme = Dropdowntheme();
TextInputType
.
text
,
false
,
null
,
focusNodes
[
1
],
focusNodes
[
2
],
TextInputAction
.
next
focusNodes
[
1
],
focusNodes
[
2
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
billingAddressError
),
...
...
@@ -622,10 +626,10 @@ Dropdowntheme ddtheme = Dropdowntheme();
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
2
],
null
,
TextInputAction
.
done
,
6
focusNodes
[
2
],
null
,
TextInputAction
.
done
,
6
,
),
errorWidget
(
context
,
provider
.
billingPincodeError
),
...
...
@@ -676,33 +680,33 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchStateSearchController
,
searchController:
provider
.
dispatchStateSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
dispatchStateSearchController
,
provider
.
dispatchStateSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sate...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
...
...
@@ -721,6 +725,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
),
),
errorWidget
(
context
,
provider
.
selectedDispatchStateError
),
//dd
TextWidget
(
context
,
"Dispatch District"
),
//dd
...
...
@@ -773,33 +778,34 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchDistrictSearchController
,
searchController:
provider
.
dispatchDistrictSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
dispatchDistrictSearchController
,
provider
.
dispatchDistrictSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search District...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
district
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
...
...
@@ -818,6 +824,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
),
),
errorWidget
(
context
,
provider
.
selectedDispatchDistrictError
),
TextWidget
(
context
,
"Dispatch Sub Location"
),
DropdownButtonHideUnderline
(
child:
Row
(
...
...
@@ -854,33 +861,33 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchSubLocSearchController
,
searchController:
provider
.
dispatchSubLocSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
dispatchSubLocSearchController
,
provider
.
dispatchSubLocSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sub Location...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
subLocality
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
...
...
@@ -899,6 +906,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
),
),
errorWidget
(
context
,
provider
.
selectedDispatchSubLocError
),
//dd
textControllerWidget
(
context
,
...
...
@@ -908,9 +916,9 @@ Dropdowntheme ddtheme = Dropdowntheme();
TextInputType
.
text
,
false
,
null
,
focusNodes
[
3
],
focusNodes
[
4
],
TextInputAction
.
next
focusNodes
[
3
],
focusNodes
[
4
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
dispatchAddressError
),
...
...
@@ -922,10 +930,10 @@ Dropdowntheme ddtheme = Dropdowntheme();
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
4
],
focusNodes
[
5
],
TextInputAction
.
next
,
6
focusNodes
[
4
],
focusNodes
[
5
],
TextInputAction
.
next
,
6
,
),
errorWidget
(
context
,
provider
.
dispatchPincodeError
),
...
...
@@ -936,10 +944,10 @@ Dropdowntheme ddtheme = Dropdowntheme();
provider
.
onChangedGst
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
5
],
null
,
TextInputAction
.
done
null
,
focusNodes
[
5
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
gstError
),
...
...
@@ -1331,9 +1339,9 @@ Dropdowntheme ddtheme = Dropdowntheme();
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
6
],
focusNodes
[
7
],
TextInputAction
.
next
focusNodes
[
6
],
focusNodes
[
7
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
tpcAmountError
),
],
...
...
@@ -1355,6 +1363,10 @@ Dropdowntheme ddtheme = Dropdowntheme();
provider
.
submitClicked
=
true
;
var
order_prod_data
=
provider
.
getFormData
();
print
(
order_prod_data
);
print
(
order_prod_data
[
'orders'
]);
///[{"product_id":"1","qty":"1","price":"500","cgst_p":"9","sgst_p":"9","igst_p":"0","total_price":"500"},
///{"product_id":"2","qty":"1","price":"1000","cgst_p":"9","sgst_p":"9","igst_p":"0","total_price":"1000"}]
provider
.
getCurrentLocation
();
provider
.
ordersAddOrderAPISubmitFunction
(
context
,
...
...
@@ -1372,7 +1384,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
provider
.
selectedBillingDistrictId
,
provider
.
selectedBillingSubLocID
,
provider
.
selectedTpcAgentID
,
order_prod_data
,
order_prod_data
[
'orders'
]
,
);
},
child:
Container
(
...
...
@@ -1388,7 +1400,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blu
e
,
AppColors
.
whit
e
,
),
)
:
Text
(
...
...
@@ -1495,9 +1507,9 @@ Dropdowntheme ddtheme = Dropdowntheme();
}
class
OrderForm
extends
StatelessWidget
{
OrderForm
({
super
.
key
});
OrderForm
({
super
.
key
});
FocusNode
focusNode
=
FocusNode
();
FocusNode
focusNode
=
FocusNode
();
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -1603,10 +1615,16 @@ class OrderForm extends StatelessWidget {
)
.
toList
(),
value:
provider
.
saleProducts
.
contains
(
provider
.
selectedSaleProducts
)?
provider
.
saleProducts
.
firstWhere
(
(
product
)
=>
product
.
id
==
provider
.
selectedSaleProductID
[
index
],
):
null
,
provider
.
saleProducts
.
contains
(
provider
.
selectedSaleProducts
,
)
?
provider
.
saleProducts
.
firstWhere
(
(
product
)
=>
product
.
id
==
provider
.
selectedSaleProductID
[
index
],
)
:
null
,
onChanged:
(
SaleProducts
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
...
...
@@ -1624,10 +1642,13 @@ class OrderForm extends StatelessWidget {
}
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
),
...
...
@@ -1647,10 +1668,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
next
null
,
null
,
TextInputAction
.
next
,
),
),
const
SizedBox
(
width:
8.0
),
...
...
@@ -1684,9 +1704,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
next
null
,
null
,
TextInputAction
.
next
,
),
),
],
...
...
@@ -1723,9 +1743,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
next
null
,
null
,
TextInputAction
.
next
,
),
),
const
SizedBox
(
width:
8.0
),
...
...
@@ -1758,9 +1778,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
next
null
,
null
,
TextInputAction
.
next
,
),
),
const
SizedBox
(
width:
8.0
),
...
...
@@ -1793,9 +1813,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
next
null
,
null
,
TextInputAction
.
next
,
),
),
],
...
...
@@ -1828,9 +1848,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
number
,
true
,
null
,
null
,
null
,
TextInputAction
.
next
null
,
null
,
TextInputAction
.
next
,
),
),
// const SizedBox(width: 8.0),
...
...
@@ -1871,7 +1891,7 @@ class OrderForm extends StatelessWidget {
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
none
TextInputAction
.
none
,
),
textControllerWidget
(
context
,
...
...
@@ -1881,9 +1901,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
text
,
true
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
none
null
,
null
,
TextInputAction
.
none
,
),
textControllerWidget
(
context
,
...
...
@@ -1893,9 +1913,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
text
,
true
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
none
null
,
null
,
TextInputAction
.
none
,
),
textControllerWidget
(
context
,
...
...
@@ -1905,9 +1925,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
text
,
true
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
none
null
,
null
,
TextInputAction
.
none
,
),
textControllerWidget
(
context
,
...
...
@@ -1917,9 +1937,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
text
,
true
,
FilteringTextInputFormatter
.
digitsOnly
,
null
,
null
,
TextInputAction
.
none
null
,
null
,
TextInputAction
.
none
,
),
textControllerWidget
(
context
,
...
...
@@ -1929,9 +1949,9 @@ class OrderForm extends StatelessWidget {
TextInputType
.
text
,
false
,
null
,
focusNode
,
null
,
TextInputAction
.
done
focusNode
,
null
,
TextInputAction
.
done
,
),
],
),
...
...
@@ -2010,10 +2030,11 @@ class OrderForm extends StatelessWidget {
style:
const
TextStyle
(
fontWeight:
FontWeight
.
bold
),
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
value
.
toString
())),
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
value
.
toString
()),
),
],
);
}
}
lib/screens/order/addPayment.dart
View file @
1a2ae52a
...
...
@@ -120,11 +120,11 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
focusedBorder:
InputBorder
.
none
,
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
1
0
,
horizontal:
0
,
vertical:
8
,
),
hintText:
'Select Account Type'
,
hintStyle:
const
TextStyle
(
fontSize:
1
2
),
hintStyle:
const
TextStyle
(
fontSize:
1
4
),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
...
...
@@ -154,7 +154,7 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
margin:
EdgeInsets
.
symmetric
(
horizontal:
0
),
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
height:
150
,
height:
widget
.
mode
==
"self"
?
50
:
150
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
16
),
),
...
...
@@ -211,298 +211,7 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
),
),
],
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<AccountList>(
// isExpanded: true,
// hint: Text(
// 'Select Account Type',
// style: TextStyle(fontSize: 14),
// overflow: TextOverflow.ellipsis,
// ),
//
// items: provider.accountList.isEmpty
// ? [
// DropdownMenuItem(
// enabled: false,
// value: null,
// child: Text(
// 'Select Account Type',
// style: TextStyle(
// fontSize: 14,
// color: Colors.grey,
// ),
// ),
// ),
// ]
// :provider.accountList
// .map(
// (accs) => DropdownMenuItem(
// value: accs,
// child: Text(
// accs.text ?? '',
// style: const TextStyle(
// fontSize: 14,
// ),
// overflow: TextOverflow.ellipsis,
// ),
// ),
// )
// .toList(),
// value: provider.accountList.contains(provider.selectedAccountList)
// ? provider.selectedAccountList
// : null,
//
// onChanged: (AccountList? value) {
// if (value != null) {
// if (provider.accountList.isNotEmpty) {
// provider.selectedAccountList = value;
//
// print("Selected Complaint Type: ${value.text}, ID: ${value.id}");
// provider.selectedAccountID = value.id!;
// provider.selectedAccountName = value.text!;
// print("hfjkshfg" + provider.selectedAccountID.toString());
// }
// provider.ordersAddPaymentSelectOrderAPIFunction(context, provider.selectedAccountID);
// }
// },
// buttonStyleData: ButtonStyleData(
// height: 50,
// width: 160,
// padding: const EdgeInsets.only(
// left: 14,
// right: 14,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(14),
// color: AppColors.text_field_color,
// ),
// ),
// iconStyleData: IconStyleData(
// icon: SvgPicture.asset(
// "assets/svg/arrow_dropdown.svg",
// height: 25,
// width: 20,
// ),
// iconSize: 12,
// iconEnabledColor: Color(0xFF2D2D2D),
// iconDisabledColor: Colors.grey,
// ),
// dropdownStyleData: DropdownStyleData(
// maxHeight: 200,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(14),
// color: AppColors.text_field_color,
// ),
// scrollbarTheme: ScrollbarThemeData(
// radius: const Radius.circular(15),
// thickness: MaterialStateProperty.all<double>(6),
// thumbVisibility: MaterialStateProperty.all<bool>(true),
// ),
// ),
// menuItemStyleData: const MenuItemStyleData(
// height: 40,
// padding: EdgeInsets.only(left: 14, right: 14),
// ),
// dropdownSearchData: DropdownSearchData(
//
// searchController: provider.dropDownSearchController,
// searchInnerWidgetHeight: 50,
// searchInnerWidget: Container(
// height: 50,
// padding: const EdgeInsets.only(
// top: 8,
// bottom: 4,
// right: 8,
// left: 8,
// ),
// child: TextFormField(
// controller: provider.dropDownSearchController,
// onChanged: (value) async {
// Future.delayed(Durations.short2,() async {
// await provider.ordersAddPaymentSelectAccountAPIFunction(
// context,
// widget.mode,
// provider.selectedAccountID,
// value,
// );
// },);
//
//
//
// },
// decoration: InputDecoration(
// isDense: true,
// contentPadding: const EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 8,
// ),
// hintText: 'Search account type...',
// hintStyle: const TextStyle(fontSize: 12),
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(8),
// ),
// ),
// ),
// ),
// searchMatchFn: (item, searchValue) {
// if (item.value == null || searchValue.isEmpty) return false;
// return item.value!.text!
// .toLowerCase()
// .contains(searchValue.toLowerCase());
// },
// // searchMatchFn: (item, searchValue) {
// // if (item.value == null) return false; //
// // return item.value!.text!.toLowerCase().contains(searchValue.toLowerCase());
// // },
// ),
//
// onMenuStateChange: (isOpen) {
// print("isOpen:${isOpen}");
// if (isOpen) {
// provider.ordersAddPaymentSelectAccountAPIFunction(
// context,
// widget.mode,
// provider.selectedAccountID,
// provider.dropDownSearchController.text,
// );
//
// } else {
// provider.dropDownSearchController.clear();
// }
// },
// ),
// ),
// ],
// ),
// ),
///enwewe
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<AccountList>(
// isExpanded: true,
// hint: Text(
// 'Select Account Type',
// style: TextStyle(fontSize: 14),
// overflow: TextOverflow.ellipsis,
// ),
// items: provider.accountList
// .map(
// (accs) => DropdownMenuItem<AccountList>(
// value: accs,
// child: Text(
// accs.text ?? '',
// style: const TextStyle(
// fontSize: 14,
// ),
// overflow: TextOverflow.ellipsis,
// ),
// ),
// )
// .toList(),
// value: provider.selectedAccountList,
// onChanged: (AccountList? value) {
// if (value != null) {
// if (provider.accountList.isNotEmpty) {
// provider.selectedAccountList = value;
// print("Selected Complaint Type: ${value.text}, ID: ${value.id}");
// provider.selectedAccountID = value.id!;
// provider.selectedAccountName = value.text!;
// print("hfjkshfg" + provider.selectedAccountID.toString());
// }
// provider.ordersAddPaymentSelectOrderAPIFunction(context, provider.selectedAccountID);
// }
// },
// buttonStyleData: ButtonStyleData(
// height: 50,
// width: 160,
// padding: const EdgeInsets.only(
// left: 14,
// right: 14,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(14),
// color: AppColors.text_field_color,
// ),
// ),
// iconStyleData: IconStyleData(
// icon: SvgPicture.asset(
// "assets/svg/arrow_dropdown.svg",
// height: 25,
// width: 20,
// ),
// iconSize: 12,
// iconEnabledColor: Color(0xFF2D2D2D),
// iconDisabledColor: Colors.grey,
// ),
// dropdownStyleData: DropdownStyleData(
// maxHeight: 200,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(14),
// color: AppColors.text_field_color,
// ),
// scrollbarTheme: ScrollbarThemeData(
// radius: const Radius.circular(15),
// thickness: MaterialStateProperty.all<double>(6),
// thumbVisibility: MaterialStateProperty.all<bool>(true),
// ),
// ),
// menuItemStyleData: const MenuItemStyleData(
// height: 40,
// padding: EdgeInsets.only(left: 14, right: 14),
// ),
// dropdownSearchData: DropdownSearchData(
// searchController: provider.dropDownSearchController,
// searchInnerWidgetHeight: 50,
// searchInnerWidget: Container(
// height: 50,
// padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
// child: TextFormField(
// controller: provider.dropDownSearchController,
// onChanged: (searchTerm) {
// onSearchChanged(searchTerm);
// },
// decoration: InputDecoration(
// isDense: true,
// contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
// hintText: 'Search account type...',
// hintStyle: const TextStyle(fontSize: 12),
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(8),
// ),
// ),
// ),
// ),
// // You can omit or always return true since we're doing server-side filtering
// searchMatchFn: (item, searchValue) => true,
// ),
//
// onMenuStateChange: (isOpen) {
// if (!isOpen) {
// print("is called"); // Clear search when menu closes
// // Optionally reset accountList to initial state
// setState(() {
// provider.ordersAddPaymentSelectAccountAPIFunction(context, widget.mode,provider.selectedAccountID,provider.dropDownSearchController.text);
// });
// } else {
// print("is called2");
// // Fetch initial data when menu opens
// setState(() {
// provider.ordersAddPaymentSelectAccountAPIFunction(context, widget.mode,provider.selectedAccountID,provider.dropDownSearchController.text);
// });
// }
// },
// ),
// ),
// ],
// ),
// ),
errorWidget
(
context
,
provider
.
selectAccountError
),
textControllerWidget
(
...
...
@@ -520,7 +229,7 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
errorWidget
(
context
,
provider
.
amountError
),
///Addorderbutton
if
(
provider
.
selectedAccountID
!
.
isNotEmpty
)
...[
if
(
provider
.
selectedAccountID
!
=
null
)
...[
InkResponse
(
onTap:
()
{
// if (provider.selectedOrderIds.length < provider.orderList.length) {
...
...
@@ -617,7 +326,8 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
)
.
toList
(),
// value: provider.selectedOrderLists,
value:
provider
value:
provider
.
selectedOrderIds
[
index
]
!=
null
?
provider
.
orderList
.
firstWhere
(
(
product
)
=>
...
...
@@ -625,7 +335,7 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
.
orderId
==
provider
.
selectedOrderIds
[
index
],
),
)
:
null
,
onChanged:
(
OrderList
?
value
,
)
{
...
...
@@ -684,7 +394,9 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
provider
.
orderAmountControllers
[
index
],
"Enter Order Amount"
,
(
p0
)
{},
(
p0
)
{
provider
.
updateAdjustedAmount
();
},
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
...
...
@@ -708,6 +420,7 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
],
),
],
],
textControllerWidget
(
...
...
@@ -959,10 +672,11 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
bottomNavigationBar:
InkResponse
(
bottomNavigationBar:
provider
.
submitClicked
?
null
:
InkResponse
(
onTap:
()
{
provider
.
submitClicked
=
true
;
provider
.
selectedOrders
=
provider
.
getFormData
();
print
(
provider
.
selectedOrders
);
provider
.
ordersAddPaymentAPISubmitFunction
(
context
,
provider
.
selectedAccountID
,
...
...
@@ -980,7 +694,9 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
Text
(
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
),
):
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
...
...
lib/screens/order/addTpcAgent.dart
View file @
1a2ae52a
...
...
@@ -155,6 +155,7 @@ class _AddtpcagentScreenState extends State<AddtpcagentScreen> {
),
),
],
errorWidget
(
context
,
provider
.
imageError
),
textControllerWidget
(
context
,
...
...
@@ -212,7 +213,8 @@ class _AddtpcagentScreenState extends State<AddtpcagentScreen> {
TextInputType
.
text
,
false
,
null
,
focusNodes
[
5
],
focusNodes
[
6
],
TextInputAction
.
next
focusNodes
[
5
],
focusNodes
[
6
],
TextInputAction
.
next
),
if
(
provider
.
tpcBankIFSCError
!=
null
)
...[
errorWidget
(
context
,
provider
.
tpcBankIFSCError
),
...
...
@@ -232,7 +234,8 @@ class _AddtpcagentScreenState extends State<AddtpcagentScreen> {
errorWidget
(
context
,
provider
.
tpcNoteError
),
],
InkWell
(
onTap:
()
{
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
provider
.
addTPCAgentAPIFunction
(
context
);
},
...
...
@@ -250,7 +253,9 @@ class _AddtpcagentScreenState extends State<AddtpcagentScreen> {
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
),
):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
...
...
lib/screens/order/ordersDetailsByModes.dart
View file @
1a2ae52a
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/ordersProvider/dispatchOrderProvider.dart'
;
import
'package:generp/Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'package:generp/Utils/dropdownTheme.dart'
;
import
'package:generp/screens/screensExports.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -9,6 +12,7 @@ import '../../Utils/app_colors.dart';
import
'../../Utils/commonWidgets.dart'
;
import
'../finance/FileViewer.dart'
;
import
'editOrderAccountDetails.dart'
;
import
'package:generp/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart'
;
class
Ordersdetailsbymodes
extends
StatefulWidget
{
final
pageTitleName
;
...
...
@@ -27,6 +31,7 @@ class Ordersdetailsbymodes extends StatefulWidget {
}
class
_OrdersdetailsbymodesState
extends
State
<
Ordersdetailsbymodes
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
@override
void
initState
()
{
// TODO: implement initState
...
...
@@ -36,6 +41,8 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
context
,
listen:
false
,
);
var
disproved
=
Provider
.
of
<
Dispatchorderprovider
>(
context
,
listen:
false
);
disproved
.
ordersDetailsDispatchOrderViewFunction
(
context
,
widget
.
orderId
);
provider
.
ordersDetailsByModeAPIFunction
(
context
,
widget
.
orderId
,
...
...
@@ -46,8 +53,8 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Consumer
2
<
Pagesdashboardprovider
,
Dispatchorderprovider
>(
builder:
(
context
,
provider
,
disProvider
,
child
)
{
var
orderDetails
=
provider
.
orderDetails
;
return
WillPopScope
(
...
...
@@ -333,7 +340,34 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
),
),
],
if
(
widget
.
mode
==
"dispatched"
)
...[],
if
(
widget
.
mode
==
"dispatched"
)
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
disProvider
.
initializeForm
(
context
);
_showDispatchSheet
(
context
,
"Dispatch"
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Dispatch"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
),
),
),
),
),
],
],
),
),
...
...
@@ -401,12 +435,14 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Editorderaccountdetails
(
mode:
widget
.
mode
,
pageTitleName:
"Edit Order (
${widget.mode}
)"
,
orderID:
provider
.
orderDetails
.
id
,
),
(
context
,
)
=>
Editorderaccountdetails
(
mode:
widget
.
mode
,
pageTitleName:
"Edit Order (
${widget.mode}
)"
,
orderID:
provider
.
orderDetails
.
id
,
),
),
);
break
;
...
...
@@ -693,7 +729,8 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
),
],
InkWell
(
onTap:
()
{
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
provider
.
approvalRejectionAPIFunction
(
context
,
details
.
status
,
...
...
@@ -736,7 +773,286 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
),
):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
Future
<
void
>
_showDispatchSheet
(
BuildContext
context
,
type
)
{
return
showModalBottomSheet
(
useSafeArea:
true
,
isDismissible:
true
,
isScrollControlled:
true
,
showDragHandle:
true
,
backgroundColor:
Colors
.
white
,
enableDrag:
true
,
context:
context
,
builder:
(
context
)
{
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
return
SafeArea
(
child:
Consumer2
<
Pagesdashboardprovider
,
Dispatchorderprovider
>(
builder:
(
context
,
provider
,
disProvider
,
child
)
{
final
details
=
provider
.
orderDetails
;
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
topLeft
,
child:
Text
(
"Dispatch"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
),
),
),
textControllerWidget
(
context
,
disProvider
.
invoiceNumberController
,
"Enter Invoice Number"
,
disProvider
.
onChangedinvoiceNumber
,
TextInputType
.
text
,
false
,
null
,
),
errorWidget
(
context
,
disProvider
.
invoiceNumberError
),
textControllerWidget
(
context
,
disProvider
.
vehicleNumberController
,
"Enter Vehicle Number"
,
disProvider
.
onChangedvehicleNumber
,
TextInputType
.
text
,
false
,
null
,
),
errorWidget
(
context
,
disProvider
.
vehicleNumberError
),
textControllerWidget
(
context
,
disProvider
.
driverNameController
,
"Enter Driver Name"
,
disProvider
.
onChangeddriverName
,
TextInputType
.
text
,
false
,
null
,
),
errorWidget
(
context
,
disProvider
.
driverNameError
),
textControllerWidget
(
context
,
disProvider
.
driverMobileNumberController
,
"Enter Driver Mobile Number"
,
disProvider
.
onChangeddriverMobileNumber
,
TextInputType
.
text
,
false
,
null
,
),
errorWidget
(
context
,
disProvider
.
driverMobileNumberError
),
InkResponse
(
onTap:
()
{
disProvider
.
editAddNewRow
();
},
child:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
const
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"+ Add Product"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
),
),
),
if
(
disProvider
.
leadProductsList
.
isNotEmpty
||
disProvider
.
engineNumberControllers
.
isNotEmpty
)...[
ListView
.
builder
(
itemCount:
disProvider
.
engineNumberControllers
.
length
,
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemBuilder:
(
context
,
j
)
{
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
margin:
const
EdgeInsets
.
symmetric
(
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Product"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Products
>(
isExpanded:
true
,
hint:
const
Text
(
'Select Product'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
disProvider
.
productsList
.
map
((
ord
)
=>
DropdownMenuItem
<
Products
>(
value:
ord
,
child:
Text
(
"(Product Name:
${ord.productName}
)"
,
style:
const
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
))
.
toList
(),
value:
disProvider
.
selectedProductIds
[
j
]
!=
null
?
disProvider
.
productsList
.
firstWhere
(
(
ord
)
=>
ord
.
id
==
disProvider
.
selectedProductIds
[
j
],
orElse:
()
=>
disProvider
.
productsList
[
0
],
)
:
null
,
onChanged:
(
Products
?
value
)
{
if
(
value
!=
null
)
{
disProvider
.
updateSelectedProductIds
(
j
,
value
);
disProvider
.
selectedProductIds
[
j
]
=
value
.
id
?.
toString
()
??
''
;
disProvider
.
updateTotalAmount
(
j
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
const
SizedBox
(
height:
10
),
Row
(
children:
[
Expanded
(
flex:
2
,
child:
textControllerWidget
(
context
,
disProvider
.
engineNumberControllers
[
j
],
"Enter Engine Number"
,
(
value
)
=>
disProvider
.
updateTotalAmount
(
j
),
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
),
),
],
),
const
SizedBox
(
height:
10
),
Row
(
children:
[
Expanded
(
flex:
2
,
child:
textControllerWidget
(
context
,
disProvider
.
pdiIDControllers
[
j
],
"Enter PDI ID"
,
(
value
)
=>
disProvider
.
updateTotalAmount
(
j
),
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
),
),
],
),
const
SizedBox
(
height:
10
),
// IconButton(
// icon: const Icon(Icons.delete),
// onPressed: disProvider.editProductPriceControllers.length > 1
// ? () => disProvider.editRemoveRow(j)
// : null,
// ),
],
),
);
},
),
],
InkWell
(
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
false
;
final
data
=
disProvider
.
getFormData
();
print
(
data
);
// disProvider.approvalRejectionAPIFunction(
// context,
// details.status,
// details.id,
// type == "Dispatch",
// provider.approveRejectFeedbackController.text,
// details.tpcApplicable,
// details.tpcApplicable == "Yes"
// ? (widget.mode == "level_one_approval"
// ? details.level1TpcApprovedAmount
// : details.level2TpcApprovedAmount)
// : "",
// provider.saleOrderNumberController.text,
// provider.editCompanyController.text,
// data,
// );
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
margin:
EdgeInsets
.
only
(
left:
5.0
,
right:
5.0
,
top:
5.0
,
bottom:
5.0
,
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
//1487C9
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
),
):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
...
...
@@ -857,7 +1173,8 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
),
],
InkWell
(
onTap:
()
{
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
provider
.
delectionAPIFunction
(
context
,
provider
.
orderDetails
.
id
,
...
...
@@ -877,7 +1194,9 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
),
):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
...
...
lib/services/api_calling.dart
View file @
1a2ae52a
...
...
@@ -90,6 +90,7 @@ import '../Models/ordersModels/addOrderTpcAgentListResponse.dart';
import
'../Models/ordersModels/commonResponse.dart'
;
import
'../Models/ordersModels/ordersAccessiblePagesResponse.dart'
;
import
'../Models/ordersModels/ordersDetailsByModeResponse.dart'
;
import
'../Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart'
;
import
'../Models/ordersModels/ordersDetailsEditOrderViewResponse.dart'
;
import
'../Models/ordersModels/ordersListByModeFilterResponse.dart'
;
import
'../Models/ordersModels/ordersListByModeResponse.dart'
;
...
...
@@ -2485,6 +2486,33 @@ class ApiCalling {
}
}
static
Future
<
ordersDetailsDispatchOrderViewResponse
?>
ordersDetailsDispatchOrderViewAPI
(
empId
,
session
,
order_id
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'empId,'
:
empId
.
toString
(),
'session,'
:
session
.
toString
(),
'order_id,'
:
order_id
.
toString
(),
};
final
res
=
await
post
(
data
,
ordersOrderDetailsDispatchProductsUrl
,
{});
if
(
res
!=
null
){
return
ordersDetailsDispatchOrderViewResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
CommonResponse
?>
ordersDetailsApproveRejectAPI
(
empId
,
session
,
...
...
pubspec.lock
View file @
1a2ae52a
...
...
@@ -146,7 +146,7 @@ packages:
source: hosted
version: "1.1.2"
collection:
dependency:
transitive
dependency:
"direct main"
description:
name: collection
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
...
...
pubspec.yaml
View file @
1a2ae52a
...
...
@@ -79,6 +79,7 @@ dependencies:
printing
:
^5.14.2
interactive_slider
:
^0.5.1
tuple
:
^2.0.2
collection
:
^1.19.1
dev_dependencies
:
flutter_test
:
...
...
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