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
de740138
Commit
de740138
authored
Jun 13, 2025
by
Sai Srinivas
Browse files
13-06-2025 By Sai Srinivas
Order Modules: Screens, Providers and Models
parent
75c5b679
Changes
60
Hide whitespace changes
Inline
Side-by-side
lib/screens/notifierExports.dart
View file @
de740138
...
...
@@ -26,4 +26,7 @@ export 'package:generp/Notifiers/financeProvider/DashboardProvider.dart';
export
'package:generp/Notifiers/financeProvider/RequestionListProvider.dart'
;
export
'package:generp/Notifiers/financeProvider/paymentReceiptsProvider.dart'
;
export
'package:generp/Notifiers/financeProvider/paymentRequisitionPaymentsListProvider.dart'
;
export
'package:generp/Notifiers/financeProvider/RequesitionLidtDetailsProvider.dart'
;
\ No newline at end of file
export
'package:generp/Notifiers/financeProvider/RequesitionLidtDetailsProvider.dart'
;
export
'package:generp/Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
export
'package:generp/Notifiers/ordersProvider/paymentsProvider.dart'
;
export
'package:generp/Notifiers/ordersProvider/tpcAgentsProvider.dart'
;
\ No newline at end of file
lib/screens/order/addPayment.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
class
AddpaymentScreen
extends
StatefulWidget
{
const
AddpaymentScreen
({
super
.
key
});
@override
State
<
AddpaymentScreen
>
createState
()
=>
_AddpaymentScreenState
();
}
class
_AddpaymentScreenState
extends
State
<
AddpaymentScreen
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
const
Placeholder
();
}
}
lib/screens/order/addTpcAgent.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Notifiers/ordersProvider/tpcAgentsProvider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
class
AddtpcagentScreen
extends
StatefulWidget
{
const
AddtpcagentScreen
({
super
.
key
});
@override
State
<
AddtpcagentScreen
>
createState
()
=>
_AddtpcagentScreenState
();
}
class
_AddtpcagentScreenState
extends
State
<
AddtpcagentScreen
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Tpcagentsprovider
>(
context
,
listen:
false
,
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Add TPC Agent"
,
provider
.
resetAll
,
SizedBox
(
width:
0
,),),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Column
(
children:
[
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
textControllerWidget
(
context
,
provider
.
tpcNameController
,
"Enter Name"
,
provider
.
onChangetpcName
),
if
(
provider
.
tpcNameError
!=
null
)...[
ErrorWidget
(
context
,
provider
.
tpcNameError
)
],
textControllerWidget
(
context
,
provider
.
tpcMobileNumberController
,
"Enter Mobile Number"
,
provider
.
onChangetpcMobileNumber
),
if
(
provider
.
tpcMobileNumberError
!=
null
)...[
ErrorWidget
(
context
,
provider
.
tpcMobileNumberError
)
],
InkResponse
(
onTap:
()
{
_showAttachmentSheet
(
context
);
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"ID Proof"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
),
),
),
if
(
provider
.
imagePicked
==
1
&&
provider
.
imagePath
!=
null
)...[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
"
${provider.imagePath}
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
),),
InkResponse
(
onTap:
()
{
provider
.
imagePicked
=
0
;
provider
.
imagePath
=
null
;
provider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,))
],
),
)
],
textControllerWidget
(
context
,
provider
.
tpcBankNameController
,
"Enter Bank Name"
,
provider
.
onChangetpcBankName
),
if
(
provider
.
tpcBankNameError
!=
null
)...[
ErrorWidget
(
context
,
provider
.
tpcBankNameError
)
],
textControllerWidget
(
context
,
provider
.
tpcBankBeneficiaryNameController
,
"Enter Bank Beneficiary Name"
,
provider
.
onChangetpcBankBeneficiaryName
),
if
(
provider
.
tpcBankBeneficiaryNameError
!=
null
)...[
ErrorWidget
(
context
,
provider
.
tpcBankBeneficiaryNameError
)
],
textControllerWidget
(
context
,
provider
.
tpcBankAccountNumberController
,
"Enter Bank Account Number"
,
provider
.
onChangetpcBankAccountNumber
),
if
(
provider
.
tpcBankAccountNumberError
!=
null
)...[
ErrorWidget
(
context
,
provider
.
tpcBankAccountNumberError
)
],
textControllerWidget
(
context
,
provider
.
tpcBankIFSCController
,
"Enter Bank IFSC"
,
provider
.
onChangetpcBankIFSC
),
if
(
provider
.
tpcBankIFSCError
!=
null
)...[
ErrorWidget
(
context
,
provider
.
tpcBankIFSCError
)
],
textControllerWidget
(
context
,
provider
.
tpcNoteController
,
"Enter Description"
,
provider
.
onChangetpcNote
),
if
(
provider
.
tpcNoteError
!=
null
)...[
ErrorWidget
(
context
,
provider
.
tpcNoteError
)
],
InkWell
(
onTap:
()
{
provider
.
addTPCAgentAPIFunction
(
context
);
},
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:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
],
),
),
),
),
onWillPop:
()
{
return
onBackPressed
(
context
);
},
);
},
);
}
Widget
TextWidget
(
context
,
text
)
{
return
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
text
),
);
}
Widget
ErrorWidget
(
context
,
text
)
{
if
(
text
!=
null
)
return
Text
(
text
!,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
12
));
else
return
SizedBox
(
height:
10
);
}
Widget
textControllerWidget
(
context
,
controller
,
hintText
,
Function
(
String
)?
onChanged
,)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
hintText
),
),
Container
(
height:
hintText
==
"Enter Description"
?
150
:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
controller
,
keyboardType:
TextInputType
.
text
,
maxLines:
hintText
==
"Enter Description"
?
60
:
1
,
onChanged:
onChanged
,
decoration:
InputDecoration
(
hintText:
hintText
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
],
);
}
Future
<
void
>
_showAttachmentSheet
(
BuildContext
context
)
{
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:
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
tcpProvider
,
child
)
{
return
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
,
)
.
viewInsets
.
bottom
,
// This handles keyboard
),
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
center
,
child:
Text
(
"Select Source"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
),
),
),
SizedBox
(
height:
15
,),
InkWell
(
onTap:
()
{
Navigator
.
of
(
context
).
pop
(
false
);
tcpProvider
.
imgFromGallery
(
context
);
},
child:
Container
(
height:
35
,
child:
Text
(
"Select photo from gallery"
),
),
),
SizedBox
(
height:
10
),
InkWell
(
onTap:
()
{
Navigator
.
of
(
context
).
pop
(
false
);
tcpProvider
.
imgFromCamera
(
context
);
},
child:
Container
(
height:
35
,
child:
Text
(
"Capture photo from camera"
),
),
),
],
),
),
),
);
},
),
);
},
);
},
);
}
}
lib/screens/order/orderDetailsFeedbackHistory.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
class
Orderdetailsfeedbackhistory
extends
StatefulWidget
{
const
Orderdetailsfeedbackhistory
({
super
.
key
});
@override
State
<
Orderdetailsfeedbackhistory
>
createState
()
=>
_OrderdetailsfeedbackhistoryState
();
}
class
_OrderdetailsfeedbackhistoryState
extends
State
<
Orderdetailsfeedbackhistory
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
var
details
=
Provider
.
of
<
Pagesdashboardprovider
>(
context
,
listen:
false
,
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
feedbackHistory
=
provider
.
feedbackHistory
;
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Feedback History"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
feedbackHistory
.
isNotEmpty
?
Container
(
child:
ListView
.
builder
(
scrollDirection:
Axis
.
vertical
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemCount:
feedbackHistory
.
length
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
6
,
(
j
)
{
final
textheads
=
[
"<th>Employee</th>"
,
"<th>Feedback</th>"
,
"<th>Attachment</th>"
,
"<th>Status</th>"
,
"<th>Date</th>"
,
];
final
textSubheads
=
[
"
${feedbackHistory[index].employeNaem}
"
,
"
${feedbackHistory[index].feedback}
"
,
"
${feedbackHistory[index].attachmentDirFilePath}
"
,
"
${feedbackHistory[index].status}
"
,
"
${feedbackHistory[index].createdDatetime}
"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,),
),
Expanded
(
child:
SizedBox
(
// height:45,
width:
MediaQuery
.
of
(
context
,
).
size
.
width
*
0.75
,
child:
Text
(
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
),
],
),
);
}),
),
);
}
),
):
Emptywidget
(
context
),
floatingActionButton:
Align
(
alignment:
Alignment
.
bottomCenter
,
child:
InkWell
(
onTap:
()
{
_showFeedbackSheet
(
context
);
},
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
"Feedback Update"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontFamily:
"JakartaMedium"
),
),
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
),
);
},
);
}
Future
<
void
>
_showFeedbackSheet
(
BuildContext
context
)
{
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:
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
orderDetails
=
provider
.
orderDetails
;
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
topLeft
,
child:
Text
(
"Feedback Update"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
),
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"Remarks"
),
),
Container
(
height:
150
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
provider
.
feedbackController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
60
,
onChanged:
provider
.
onChangeFeedback
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Write Remarks"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
provider
.
feedbackError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${provider.feedbackError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
],
InkResponse
(
onTap:
()
{
_showAttachmentSheet
(
context
);
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Add Attachment"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
),
),
),
if
(
provider
.
imagePicked
==
1
&&
provider
.
imagePath
!=
null
)...[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
"
${provider.imagePath}
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
),),
InkResponse
(
onTap:
()
{
provider
.
imagePicked
=
0
;
provider
.
imagePath
=
null
;
provider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,))
],
),
)
],
InkWell
(
onTap:
()
{
provider
.
ordersDetailsFeedbackSubmissionAPIFunction
(
context
,
orderDetails
.
id
,
orderDetails
.
status
);
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
//1487C9
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
Future
<
void
>
_showAttachmentSheet
(
BuildContext
context
)
{
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:
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
,
).
viewInsets
.
bottom
,
// This handles keyboard
),
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
center
,
child:
Text
(
"Select Source"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
),
),
),
SizedBox
(
height:
15
),
InkWell
(
onTap:
()
{
Navigator
.
of
(
context
).
pop
(
false
);
provider
.
imgFromGallery
(
context
);
},
child:
Container
(
height:
35
,
child:
Text
(
"Select photo from gallery"
),
),
),
SizedBox
(
height:
10
),
InkWell
(
onTap:
()
{
Navigator
.
of
(
context
).
pop
(
false
);
provider
.
imgFromCamera
(
context
);
},
child:
Container
(
height:
35
,
child:
Text
(
"Capture photo from camera"
),
),
),
],
),
),
),
);
},
),
);
},
);
},
);
}
}
lib/screens/order/orderDetailsPaymentHistory.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
class
Orderdetailspaymenthistory
extends
StatefulWidget
{
const
Orderdetailspaymenthistory
({
super
.
key
});
@override
State
<
Orderdetailspaymenthistory
>
createState
()
=>
_OrderdetailspaymenthistoryState
();
}
class
_OrderdetailspaymenthistoryState
extends
State
<
Orderdetailspaymenthistory
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
var
details
=
Provider
.
of
<
Pagesdashboardprovider
>(
context
,
listen:
false
,
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
paymentHistory
=
provider
.
paymentHistory
;
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Payment History"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
paymentHistory
.
isNotEmpty
?
Container
(
child:
ListView
.
builder
(
scrollDirection:
Axis
.
vertical
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemCount:
paymentHistory
.
length
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
7
,
(
j
)
{
final
textheads
=
[
"Mode of Payment"
,
"Payment Reference"
,
"Payment Amount"
,
"Adjusted Amount"
,
"Entered By Employee"
,
"Payment Received Date"
,
"Action"
,
];
final
textSubheads
=
[
"
${paymentHistory[index].paymentType}
"
,
"
${paymentHistory[index].refNo}
"
,
"
${paymentHistory[index].amount}
"
,
"
${paymentHistory[index].adjustedAmount}
"
,
"
${paymentHistory[index].enteredEmployee}
"
,
"
${paymentHistory[index].paymentDate}
"
,
"
${paymentHistory[index].approvalStatus}
"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,),
),
Expanded
(
child:
SizedBox
(
// height:45,
width:
MediaQuery
.
of
(
context
,
).
size
.
width
*
0.75
,
child:
Text
(
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
),
],
),
);
}),
),
);
}
),
):
Emptywidget
(
context
),
),
);
},
);
}
}
lib/screens/order/orderDetailsProductsHistory.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
class
Orderdetailsproductshistory
extends
StatefulWidget
{
const
Orderdetailsproductshistory
({
super
.
key
});
@override
State
<
Orderdetailsproductshistory
>
createState
()
=>
_OrderdetailsproductshistoryState
();
}
class
_OrderdetailsproductshistoryState
extends
State
<
Orderdetailsproductshistory
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
var
details
=
Provider
.
of
<
Pagesdashboardprovider
>(
context
,
listen:
false
,
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
productsHistory
=
provider
.
productsHistory
;
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Products"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
productsHistory
.
isNotEmpty
?
Container
(
child:
ListView
.
builder
(
scrollDirection:
Axis
.
vertical
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemCount:
productsHistory
.
length
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
7
,
(
j
)
{
final
textheads
=
[
"Product Name"
,
"Product Price"
,
"Quantity"
,
"CGST %"
,
"SGST %"
,
"IGST %"
,
"Total Price"
,
];
final
textSubheads
=
[
"
${productsHistory[index].productName}
"
,
"
${productsHistory[index].unitPrice}
"
,
"
${productsHistory[index].qty}
"
,
"
${productsHistory[index].cgstPercentage}
"
,
"
${productsHistory[index].sgstPercentage}
"
,
"
${productsHistory[index].igstPercentage}
"
,
"
${productsHistory[index].totalPrice}
"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,),
),
Expanded
(
child:
SizedBox
(
// height:45,
width:
MediaQuery
.
of
(
context
,
).
size
.
width
*
0.75
,
child:
Text
(
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
),
],
),
);
}),
),
);
}
),
):
Emptywidget
(
context
),
),
);
},
);
}
}
lib/screens/order/orderModuleDashboard.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/screens/order/ordersListByModes.dart'
;
import
'package:generp/screens/order/paymentListsByMode.dart'
;
import
'package:generp/screens/order/tpcAgentIssueList.dart'
;
import
'package:generp/screens/order/tpcAgentListByMode.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'addTpcAgent.dart'
;
class
Ordermoduledashboard
extends
StatefulWidget
{
const
Ordermoduledashboard
({
super
.
key
});
@override
State
<
Ordermoduledashboard
>
createState
()
=>
_OrdermoduledashboardState
();
}
class
_OrdermoduledashboardState
extends
State
<
Ordermoduledashboard
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Pagesdashboardprovider
>(
context
,
listen:
false
);
provider
.
ordersAccessiblePagesAPIFunction
(
context
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
pages
=
provider
.
ordersAccessiblePagesList
;
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
appBar:
appbar
(
context
,
"Orders"
),
body:
Container
(
child:
SingleChildScrollView
(
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
pages
.
length
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
Widget
?
SvgIcon
;
switch
(
pages
[
index
].
mode
)
{
case
"level_one_approval"
:
SvgIcon
=
SvgPicture
.
asset
(
"assets/svg/fin_lv1.svg"
,
);
break
;
case
"level_two_approval"
:
case
"level_two_rejected"
:
SvgIcon
=
SvgPicture
.
asset
(
"assets/svg/fin_lv2.svg"
,
);
break
;
default
:
SvgIcon
=
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
);
break
;
};
return
InkResponse
(
onTap:
()
async
{
var
navigate
;
if
(
pages
[
index
].
pageName
!.
contains
(
"Add Order"
)
)
{
print
(
"navigate to Add Order"
);
}
if
(
pages
[
index
].
pageName
!.
contains
(
"Add Payment"
)
)
{
print
(
"navigate to Add Payment"
);
}
else
if
(
pages
[
index
].
pageName
!.
contains
(
"Payments List"
))
{
navigate
=
Paymentlistsbymode
(
mode:
pages
[
index
].
mode
!,
pageTitleName:
pages
[
index
]
.
pageName
!,
);
}
else
if
(
pages
[
index
].
pageName
!.
contains
(
"Order List"
)){
navigate
=
OrderslistbyModes
(
mode:
pages
[
index
].
mode
!,
pageTitleName:
pages
[
index
]
.
pageName
!,
);
}
else
if
(
pages
[
index
].
pageName
==
"Add TPC Agent"
){
navigate
=
AddtpcagentScreen
();
}
else
if
(
pages
[
index
].
pageName
==
"TPC Agent List (Admin)"
){
navigate
=
Tpcagentlistbymode
(
mode:
pages
[
index
].
mode
!,
pageTitleName:
pages
[
index
]
.
pageName
!,
);
}
else
if
(
pages
[
index
].
pageName
==
"Pending TPC Issue List"
){
navigate
=
Tpcagentissuelist
(
mode:
pages
[
index
].
mode
!,
pageTitleName:
pages
[
index
]
.
pageName
!,
);
}
if
(
navigate
!=
null
){
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
navigate
),
);
}
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Row
(
children:
[
Expanded
(
flex:
1
,
child:
SvgIcon
),
Expanded
(
flex:
5
,
child:
Text
(
"
${pages[index].pageName}
"
,
),
),
Expanded
(
flex:
1
,
child:
SvgPicture
.
asset
(
"assets/svg/arrow_right_new.svg"
,
),
),
],
),
),
);
},
),
],
),
),
),
),
);
},
);
}
}
lib/screens/order/ordersDetailsByModes.dart
0 → 100644
View file @
de740138
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'package:generp/screens/order/orderDetailsFeedbackHistory.dart'
;
import
'package:generp/screens/order/orderDetailsPaymentHistory.dart'
;
import
'package:generp/screens/order/orderDetailsProductsHistory.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'../finance/FileViewer.dart'
;
class
Ordersdetailsbymodes
extends
StatefulWidget
{
final
pageTitleName
;
final
orderId
;
final
mode
;
const
Ordersdetailsbymodes
(
{
super
.
key
,
required
this
.
pageTitleName
,
required
this
.
orderId
,
required
this
.
mode
});
@override
State
<
Ordersdetailsbymodes
>
createState
()
=>
_OrdersdetailsbymodesState
();
}
class
_OrdersdetailsbymodesState
extends
State
<
Ordersdetailsbymodes
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Pagesdashboardprovider
>(
context
,
listen:
false
,
);
provider
.
ordersDetailsByModeAPIFunction
(
context
,
widget
.
orderId
,
widget
.
mode
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
var
orderDetails
=
provider
.
orderDetails
;
return
WillPopScope
(
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_more.svg"
,
height:
30
,),
),),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
orderDetails
.
accountName
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"₹
${orderDetails.balanceAmount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
Expanded
(
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
orderDetails
.
status
??
"-"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
provider
.
subHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
provider
.
Headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
if
(
provider
.
Headings
[
j
]
==
"Purchase Order"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Fileviewer
(
fileName:
orderDetails
.
tpcPaymentAttachementViewFileName
!,
fileUrl:
orderDetails
.
tpcPaymentAttachmentDirFilePath
!,
),
),
);
}
},
child:
Text
(
provider
.
Headings
[
j
]
==
"Purchase Order"
?
"View"
:
"
${provider.subHeadings[j]}
"
,
style:
TextStyle
(
fontSize:
14
,
color:
provider
.
Headings
[
j
]
==
"Purchase Order"
?
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
provider
.
Headings
[
j
]
==
"Purchase Order"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
provider
.
Headings
[
j
]
==
"Purchase Order"
?
AppColors
.
app_blue
:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
],
),
),
),
),
bottomNavigationBar:
[
"self"
,
"pending_approval"
].
contains
(
widget
.
mode
)
?
Container
(
height:
0
)
:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
alignment:
Alignment
.
bottomCenter
,
height:
60
,
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
10
),
alignment:
Alignment
.
center
,
height:
45
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
if
([
"level_one_approval"
,
"level_two_approval"
,
"level_two_rejected"
].
contains
(
widget
.
mode
))...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
_showLevelApprovalRejectionSheet
(
context
,
"Reject"
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Reject"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
),
),
),
),
),
],
SizedBox
(
width:
10
),
if
([
"level_one_approval"
,
"level_two_approval"
,
"level_two_rejected"
,
"sales_order_registered"
].
contains
(
widget
.
mode
))...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
_showLevelApprovalRejectionSheet
(
context
,
"Approve"
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE7FFE5
),
border:
Border
.
all
(
color:
Color
(
0xFF0D9C00
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Approve"
,
style:
TextStyle
(
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
),
],
if
([
"admin"
].
contains
(
widget
.
mode
))...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
_showLevelDeletionSheet
(
context
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Delete"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
),
),
),
),
),
],
if
(
widget
.
mode
==
"dispatched"
)...[
]
],
),
),
),
),
onWillPop:
()
{
return
onBackPressed
(
context
);
},
);
},
);
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
,)
{
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:
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
SizedBox
(
height:
15
),
...
List
.
generate
(
3
,
(
index
)
{
final
assetnames
=
[
"order_list_svg_1"
,
"order_list_svg_2"
,
"order_list_svg_3"
,
];
final
Headingnames
=
[
"Payment History"
,
"Products Details"
,
"Feedback History"
,
];
return
ListTile
(
onTap:
()
async
{
switch
(
index
)
{
case
0
:
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Orderdetailspaymenthistory
(
),
),
);
break
;
case
1
:
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Orderdetailsproductshistory
(
),
),
);
break
;
case
2
:
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Orderdetailsfeedbackhistory
(
),
),
);
break
;
}
},
leading:
SvgPicture
.
asset
(
"assets/svg/
${assetnames[index]}
.svg"
,
),
title:
Text
(
Headingnames
[
index
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
),),
trailing:
SvgPicture
.
asset
(
"assets/svg/arrow_right_new.svg"
,
),
);
}),
],
),
),
);
},
),
);
},
);
},
);
}
Widget
TextWidget
(
context
,
text
)
{
return
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
text
),
);
}
Widget
ErrorWidget
(
context
,
text
)
{
if
(
text
!=
null
)
return
Text
(
text
!,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
12
));
else
return
SizedBox
(
height:
10
);
}
Widget
textControllerWidget
(
context
,
controller
,
hintText
,
Function
(
String
)?
onChanged
,)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
hintText
),
),
Container
(
height:
hintText
==
"Enter Description"
?
150
:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
controller
,
keyboardType:
TextInputType
.
text
,
maxLines:
hintText
==
"Enter Description"
?
60
:
1
,
onChanged:
onChanged
,
decoration:
InputDecoration
(
hintText:
hintText
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
],
);
}
Future
<
void
>
_showLevelApprovalRejectionSheet
(
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:
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
details
=
provider
.
orderDetails
;
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
topLeft
,
child:
Text
(
type
==
"Approve"
?
"
${provider
.approvalSheetHeading}
"
:
"
${provider
.rejecetionSheetHeading}
"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
),
),
),
if
(
widget
.
mode
==
"sales_order_registered"
)...[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"Company Name"
),
),
Container
(
height:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
provider
.
editCompanyController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
1
,
onChanged:
provider
.
onChangeEditCompanyName
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Enter Company Name"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
provider
.
companyNameError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${provider.companyNameError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
],
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"Sale Order Number"
),
),
Container
(
height:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
provider
.
saleOrderNumberController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
1
,
onChanged:
provider
.
onChangeSaleOrderNumber
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Enter Order Number"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
provider
.
saleOrderNumberError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${provider.saleOrderNumberError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
]
],
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"Remarks"
),
),
Container
(
height:
150
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
provider
.
approveRejectFeedbackController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
60
,
onChanged:
provider
.
onChangeApproveRejection
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Write Remarks"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
provider
.
approveRejectFeedbackError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${provider.approveRejectFeedbackError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
],
InkWell
(
onTap:
()
{
provider
.
approvalRejectionAPIFunction
(
context
,
details
.
status
,
details
.
id
,
type
==
"Approve"
?
"Approved"
:
"Rejected"
,
details
.
tpcApplicable
,
details
.
tpcApplicable
==
"Yes"
?(
widget
.
mode
==
"level_one_approval"
?
details
.
level1TpcApprovedAmount
:
details
.
level2TpcApprovedAmount
):
""
,
widget
.
mode
==
"dispatched"
?
details
.
invoiceNumber
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
vehicleNumber
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
driverName
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
driverMobileNumber
:
""
,
widget
.
mode
==
"dispatched"
?[]:[],
widget
.
mode
);
},
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:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
Future
<
void
>
_showLevelDeletionSheet
(
BuildContext
context
)
{
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:
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
topLeft
,
child:
Text
(
"
${provider.deletionSheetHeading}
"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
),
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"Remarks"
),
),
Container
(
height:
150
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
provider
.
deleteFeedbackController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
60
,
onChanged:
provider
.
onChangeDeletion
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Write Remarks"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
provider
.
deleteFeedbackError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${provider.deleteFeedbackError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
],
InkWell
(
onTap:
()
{
provider
.
delectionAPIFunction
(
context
,
provider
.
orderDetails
.
id
);
},
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:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
}
lib/screens/order/ordersListByModes.dart
0 → 100644
View file @
de740138
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/screens/order/ordersDetailsByModes.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Models/ordersModels/ordersListByModeFilterResponse.dart'
;
import
'../../Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'../commonDateRangeFilter.dart'
;
class
OrderslistbyModes
extends
StatefulWidget
{
final
mode
;
final
pageTitleName
;
const
OrderslistbyModes
({
super
.
key
,
required
this
.
mode
,
required
this
.
pageTitleName
});
@override
State
<
OrderslistbyModes
>
createState
()
=>
_OrderslistbyModesState
();
}
class
_OrderslistbyModesState
extends
State
<
OrderslistbyModes
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Pagesdashboardprovider
>(
context
,
listen:
false
,
);
provider
.
ordersListByModeFilterAPIFunction
(
context
,
widget
.
mode
);
provider
.
ordersListByModeAPIFunction
(
context
,
widget
.
mode
,
""
,
""
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
ordersList
=
provider
.
ordersList
;
return
WillPopScope
(
onWillPop:
()
{
provider
.
resetAll
();
return
onBackPressed
(
context
);
},
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
Row
(
children:
[
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_download.svg"
,),
),
InkResponse
(
onTap:
()
async
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
,),
),
],
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
)
))
:
ordersList
.
isNotEmpty
?
SingleChildScrollView
(
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
ordersList
.
length
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
if
(
ordersList
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
);
}
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
ordersList
[
index
].
accountName
!,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"₹"
"
${ordersList[index].balanceAmount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
Expanded
(
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
ordersList
[
index
].
status
!,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
),
),
...
List
.
generate
(
5
,
(
j
)
{
final
headings
=
[
"Entered Employee"
,
"Sales Person"
,
"Date"
,
"Paid Amount"
,
"Balance Amount"
,
];
final
subHeadings
=
[
ordersList
[
index
].
enteredEmpName
,
ordersList
[
index
].
salesPersonEmpName
,
ordersList
[
index
].
createdDatetime
,
ordersList
[
index
].
paidAmount
,
ordersList
[
index
].
balanceAmount
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
child:
Text
(
subHeadings
[
j
]!,
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
,
),
decoration:
TextDecoration
.
none
,
decorationColor:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
InkResponse
(
onTap:
()
async
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Ordersdetailsbymodes
(
pageTitleName:
widget
.
pageTitleName
,
orderId:
ordersList
[
index
].
orderId
,
mode:
widget
.
mode
,
),
),
);
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Text
(
"View Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
SizedBox
(
width:
5
),
SvgPicture
.
asset
(
"assets/svg/next_button.svg"
,
),
],
),
),
),
],
),
);
},
),
],
),
):
Emptywidget
(
context
),
),
);
},
);
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
)
{
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:
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
SizedBox
(
height:
15
),
...
List
.
generate
(
5
,
(
index
)
{
final
assetnames
=
[
"se_locate_customer"
,
"se_locate_customer"
,
"se_update_complaint"
,
"se_payment_details"
,
"se_payment_details"
,
];
final
Headingnames
=
[
"Copy to Clipboard"
,
"Download CSV"
,
"Download XLSX"
,
"Download PDF"
,
"Print Data"
,
];
return
ListTile
(
onTap:
()
{
// switch (index) {
// case 0:
// provider.copyToClipboard(context);
// break;
// case 1:
// provider.downloadCSV(context);
// break;
// case 2:
// provider.downloadXLS(context);
// break;
// case 3:
// provider.downloadPDF(context);
// break;
// case 4:
// provider.printData(context);
// break;
// }
},
leading:
SvgPicture
.
asset
(
"assets/svg/
${assetnames[index]}
.svg"
,
),
title:
Text
(
Headingnames
[
index
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
),
),
trailing:
SvgPicture
.
asset
(
"assets/svg/arrow_right_new.svg"
,
),
);
}),
],
),
),
);
},
),
);
},
);
},
);
}
Future
<
void
>
_showFilterSheet
(
BuildContext
context
)
{
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:
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Padding
(
padding:
EdgeInsets
.
symmetric
(
vertical:
10
),
child:
Text
(
"Filter"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
),
if
([
"admin"
,
"teamleader"
].
contains
(
widget
.
mode
))...[
Text
(
"Select Status"
,
style:
TextStyle
(
color:
Color
(
0xFF2D2D2D
)),
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Account'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
),
],
),
items:
provider
.
leadStatus
.
map
(
(
status
)
=>
DropdownMenuItem
<
String
>(
value:
status
,
child:
Text
(
status
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedLeadType
,
onChanged:
(
value
)
{
if
(
value
!=
null
)
{
provider
.
selectedLeadType
=
value
;
print
(
"statusId:
${provider.selectedLeadType}
"
,
);
}
},
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:
14
,
iconEnabledColor:
Color
(
0xFF2D2D2D
),
iconDisabledColor:
Colors
.
grey
,
),
dropdownStyleData:
DropdownStyleData
(
maxHeight:
200
,
width:
350
,
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
),
),
),
),
],
),
),
],
Text
(
"Select Employee"
,
style:
TextStyle
(
color:
Color
(
0xFF2D2D2D
)),
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Employees
>(
isExpanded:
true
,
hint:
Text
(
'Select Account Type'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
employeesList
.
map
(
(
emps
)
=>
DropdownMenuItem
<
Employees
>(
value:
emps
,
child:
Text
(
emps
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedEmployee
,
onChanged:
(
Employees
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
employeesList
.
isNotEmpty
)
{
provider
.
selectedEmployee
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
selectedEmpID
=
value
.
id
!;
provider
.
selectedEmpName
=
value
.
name
!;
print
(
"hfjkshfg"
+
provider
.
selectedEmpID
.
toString
(),
);
}
}
},
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
,
),
),
),
),
],
),
),
InkResponse
(
onTap:
()
{
Navigator
.
pop
(
context
);
provider
.
ordersListByModeAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedEmpID
,
provider
.
selectedLeadType
);
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
Text
(
"Search"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
}
lib/screens/order/paymentDetailsByMode.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/ordersProvider/paymentsProvider.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'../finance/FileViewer.dart'
;
import
'ordersDetailsByModes.dart'
;
class
Paymentdetailsbymode
extends
StatefulWidget
{
final
pageTitleName
;
final
paymentId
;
final
mode
;
const
Paymentdetailsbymode
({
super
.
key
,
required
this
.
pageTitleName
,
required
this
.
paymentId
,
required
this
.
mode
});
@override
State
<
Paymentdetailsbymode
>
createState
()
=>
_PaymentdetailsbymodeState
();
}
class
_PaymentdetailsbymodeState
extends
State
<
Paymentdetailsbymode
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Paymentsprovider
>(
context
,
listen:
false
,
);
provider
.
paymentsDetailsByModeAPIFunction
(
context
,
widget
.
paymentId
,
widget
.
mode
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
var
paymentDetails
=
provider
.
paymentDetails
;
var
adjustList
=
provider
.
paidLists
;
return
WillPopScope
(
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
SizedBox
(
width:
0
,),),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Column
(
children:
[
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
paymentDetails
.
accountName
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"₹
${paymentDetails.amount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
Expanded
(
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
paymentDetails
.
status
??
"-"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
provider
.
subHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
provider
.
Headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
if
(
provider
.
Headings
[
j
]
==
"Attachment"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Fileviewer
(
fileName:
paymentDetails
.
attachmentViewFileName
!,
fileUrl:
paymentDetails
.
attachmentDirFilePath
!,
),
),
);
}
},
child:
Text
(
provider
.
Headings
[
j
]
==
"Attachment"
?
"View"
:
"
${provider.subHeadings[j]}
"
,
style:
TextStyle
(
fontSize:
14
,
color:
provider
.
Headings
[
j
]
==
"Attachment"
?
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
provider
.
Headings
[
j
]
==
"Attachment"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
provider
.
Headings
[
j
]
==
"Attachment"
?
AppColors
.
app_blue
:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
],
),
),
Container
(
alignment:
Alignment
.
topLeft
,
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
horizontal:
10
),
child:
Text
(
"Adjusted Order List"
,
style:
TextStyle
(
fontSize:
14
,
color:
AppColors
.
grey_thick
),)),
ListView
.
builder
(
scrollDirection:
Axis
.
vertical
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemCount:
adjustList
.
length
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
7
,
(
j
)
{
final
textheads
=
[
"Order Number"
,
"Order Amount"
,
"Paid Amount"
,
"Balance Amount"
,
"Adjusted Amount"
,
"DateTime"
,
"Actions"
,
];
final
textSubheads
=
[
"
${adjustList[index].orderNumber}
"
,
"
${adjustList[index].totalAmount}
"
,
"
${adjustList[index].paidAmount}
"
,
"
${adjustList[index].balanceAmount}
"
,
"
${adjustList[index].adjustedAmount}
"
,
"
${adjustList[index].datetime}
"
,
"View"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,),
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
if
(
textheads
[
j
]
==
"Actions"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Ordersdetailsbymodes
(
pageTitleName:
"CRM Order Details"
,
mode:
widget
.
mode
,
orderId:
adjustList
[
index
].
id
,
),
),
);
}
},
child:
SizedBox
(
// height:45,
width:
MediaQuery
.
of
(
context
,
).
size
.
width
*
0.75
,
child:
Text
(
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
textheads
[
j
]
==
"Actions"
?
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
textheads
[
j
]
==
"Actions"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
textheads
[
j
]
==
"Actions"
?
AppColors
.
app_blue
:
AppColors
.
white
,
),
),
),
),
),
],
),
);
}),
),
);
}
),
],
),
),
),
bottomNavigationBar:
widget
.
mode
==
"self"
?
Container
(
height:
0
,)
:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
alignment:
Alignment
.
bottomCenter
,
height:
60
,
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
10
),
alignment:
Alignment
.
center
,
height:
45
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
if
(![
"self"
,
"admin"
].
contains
(
widget
.
mode
))...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
_showLevelApprovalRejectionSheet
(
context
,
"Reject"
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Reject"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
),
),
),
),
),
SizedBox
(
width:
10
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
_showLevelApprovalRejectionSheet
(
context
,
"Approve"
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE7FFE5
),
border:
Border
.
all
(
color:
Color
(
0xFF0D9C00
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Approve"
,
style:
TextStyle
(
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
),
]
else
if
(
widget
.
mode
==
"admin"
)...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
_showLevelDeletionSheet
(
context
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Delete"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
),
),
),
),
),
]
],
),
),
),
),
onWillPop:
()
{
return
onBackPressed
(
context
);
},
);
},
);
}
Widget
TextWidget
(
context
,
text
)
{
return
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
text
),
);
}
Widget
ErrorWidget
(
context
,
text
)
{
if
(
text
!=
null
)
return
Text
(
text
!,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
12
));
else
return
SizedBox
(
height:
10
);
}
Widget
textControllerWidget
(
context
,
controller
,
hintText
,
Function
(
String
)?
onChanged
,)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
hintText
),
),
Container
(
height:
hintText
==
"Enter Description"
?
150
:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
controller
,
keyboardType:
TextInputType
.
text
,
maxLines:
hintText
==
"Enter Description"
?
60
:
1
,
onChanged:
onChanged
,
decoration:
InputDecoration
(
hintText:
hintText
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
],
);
}
Future
<
void
>
_showLevelApprovalRejectionSheet
(
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:
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
details
=
provider
.
paymentDetails
;
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
topLeft
,
child:
Text
(
type
==
"Approve"
?
"
${"Payment Approval"}
"
:
"
${"Payment Reject"}
"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
),
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"Remarks"
),
),
Container
(
height:
150
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
provider
.
approvalRejectionController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
60
,
onChanged:
provider
.
onChangeApprovalRejection
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Write Remarks"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
provider
.
approvalRejectionError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${provider.approvalRejectionError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
],
InkWell
(
onTap:
()
{
provider
.
paymentApprovalRejectionAPIFunction
(
context
,
provider
.
paymentDetails
.
paymentId
,
type
);
},
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:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
Future
<
void
>
_showLevelDeletionSheet
(
BuildContext
context
)
{
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:
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
topLeft
,
child:
Text
(
"Delete Payment"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
),
),
),
InkWell
(
onTap:
()
{
_confirmDeletionSheet
(
context
);
},
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:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
Future
<
void
>
_confirmDeletionSheet
(
BuildContext
context
)
{
return
showModalBottomSheet
(
useSafeArea:
true
,
isDismissible:
true
,
isScrollControlled:
true
,
showDragHandle:
true
,
enableDrag:
true
,
context:
context
,
builder:
(
context
)
{
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
return
SafeArea
(
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
30
,
),
child:
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
SingleChildScrollView
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Text
(
"Are you sure you want
\n
to Delete the Payment ?"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
semi_black
,
fontSize:
18
,
),
),
],
),
SizedBox
(
height:
20
),
InkWell
(
onTap:
()
{
// LoginApiFunction();
var
f
=
FocusScope
.
of
(
context
);
if
(!
f
.
hasPrimaryFocus
)
{
f
.
unfocus
();
}
provider
.
paymentDeletionAPIFunction
(
context
,
provider
.
paymentDetails
.
paymentId
);
// Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
},
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
(
15.0
),
),
child:
Center
(
child:
Text
(
"Yes, Logout"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontFamily:
"JakartaMedium"
,
),
),
),
),
),
InkWell
(
onTap:
()
{
// LoginApiFunction();
var
f
=
FocusScope
.
of
(
context
);
if
(!
f
.
hasPrimaryFocus
)
{
f
.
unfocus
();
}
Navigator
.
pop
(
context
);
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
margin:
EdgeInsets
.
only
(
left:
5.0
,
right:
5.0
,
top:
5.0
,
bottom:
5.0
,
),
child:
Center
(
child:
Text
(
"Cancel"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontFamily:
"JakartaMedium"
,
),
),
),
),
),
],
),
);
},
),
),
);
},
);
},
);
}
}
lib/screens/order/paymentListsByMode.dart
0 → 100644
View file @
de740138
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/ordersProvider/paymentsProvider.dart'
;
import
'package:generp/screens/order/paymentDetailsByMode.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Models/ordersModels/paymentListByModeFilterResponse.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
class
Paymentlistsbymode
extends
StatefulWidget
{
final
mode
;
final
pageTitleName
;
const
Paymentlistsbymode
(
{
super
.
key
,
required
this
.
mode
,
required
this
.
pageTitleName
});
@override
State
<
Paymentlistsbymode
>
createState
()
=>
_PaymentlistsbymodeState
();
}
class
_PaymentlistsbymodeState
extends
State
<
Paymentlistsbymode
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Paymentsprovider
>(
context
,
listen:
false
,
);
provider
.
paymentsListsByModeFilterAPIFunction
(
context
,
widget
.
mode
);
provider
.
paymentsListsByModeAPIFunction
(
context
,
widget
.
mode
,
""
,);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
paymentLists
=
provider
.
paymentsList
;
return
WillPopScope
(
onWillPop:
()
{
provider
.
resetAll
();
return
onBackPressed
(
context
);
},
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
Row
(
children:
[
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_download.svg"
,),
),
InkResponse
(
onTap:
()
async
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
,),
),
],
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
)
))
:
paymentLists
.
isNotEmpty
?
SingleChildScrollView
(
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
paymentLists
.
length
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
if
(
paymentLists
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
);
}
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
paymentLists
[
index
].
ename
!,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"₹"
"
${paymentLists[index].amount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
Expanded
(
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
paymentLists
[
index
].
status
!,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
),
),
...
List
.
generate
(
4
,
(
j
)
{
final
headings
=
[
"Customer Name"
,
"Order Number"
,
"Date"
,
"Description"
,
];
final
subHeadings
=
[
paymentLists
[
index
].
aname
,
paymentLists
[
index
].
orderNumber
,
paymentLists
[
index
].
datetime
,
paymentLists
[
index
].
description
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
child:
Text
(
"
${subHeadings[j]}
"
,
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
,
),
decoration:
TextDecoration
.
none
,
decorationColor:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
InkResponse
(
onTap:
()
async
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Paymentdetailsbymode
(
mode:
widget
.
mode
,
pageTitleName:
widget
.
pageTitleName
,
paymentId:
paymentLists
[
index
].
paymentId
,
),));
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Text
(
"View Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
SizedBox
(
width:
5
),
SvgPicture
.
asset
(
"assets/svg/next_button.svg"
,
),
],
),
),
),
],
),
);
},
),
],
),
)
:
Emptywidget
(
context
),
),
);
},
);
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
)
{
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:
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
SizedBox
(
height:
15
),
...
List
.
generate
(
5
,
(
index
)
{
final
assetnames
=
[
"se_locate_customer"
,
"se_locate_customer"
,
"se_update_complaint"
,
"se_payment_details"
,
"se_payment_details"
,
];
final
Headingnames
=
[
"Copy to Clipboard"
,
"Download CSV"
,
"Download XLSX"
,
"Download PDF"
,
"Print Data"
,
];
return
ListTile
(
onTap:
()
{
// switch (index) {
// case 0:
// provider.copyToClipboard(context);
// break;
// case 1:
// provider.downloadCSV(context);
// break;
// case 2:
// provider.downloadXLS(context);
// break;
// case 3:
// provider.downloadPDF(context);
// break;
// case 4:
// provider.printData(context);
// break;
// }
},
leading:
SvgPicture
.
asset
(
"assets/svg/
${assetnames[index]}
.svg"
,
),
title:
Text
(
Headingnames
[
index
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
),
),
trailing:
SvgPicture
.
asset
(
"assets/svg/arrow_right_new.svg"
,
),
);
}),
],
),
),
);
},
),
);
},
);
},
);
}
Future
<
void
>
_showFilterSheet
(
BuildContext
context
)
{
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:
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
)
.
viewInsets
.
bottom
,
),
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Padding
(
padding:
EdgeInsets
.
symmetric
(
vertical:
10
),
child:
Text
(
"Filter"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
),
Text
(
"Select Employee"
,
style:
TextStyle
(
color:
Color
(
0xFF2D2D2D
)),
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Employees
>(
isExpanded:
true
,
hint:
Text
(
'Select Account Type'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
employeesList
.
map
(
(
emps
)
=>
DropdownMenuItem
<
Employees
>(
value:
emps
,
child:
Text
(
emps
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedEmployee
,
onChanged:
(
Employees
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
employeesList
.
isNotEmpty
)
{
provider
.
selectedEmployee
=
value
;
print
(
"Selected Complaint Type:
${value
.name}
, ID:
${value.id}
"
,
);
provider
.
selectedEmpID
=
value
.
id
!;
provider
.
selectedEmpName
=
value
.
name
!;
print
(
"hfjkshfg"
+
provider
.
selectedEmpID
.
toString
(),
);
}
}
},
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
,
),
),
),
),
],
),
),
InkResponse
(
onTap:
()
{
Navigator
.
pop
(
context
);
provider
.
paymentsListsByModeAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedEmpID
);
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
Text
(
"Search"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
}
lib/screens/order/tpcAgentDetailsByMode.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/ordersProvider/tpcAgentsProvider.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'../finance/FileViewer.dart'
;
import
'ordersDetailsByModes.dart'
;
class
Tpcagentdetailsbymode
extends
StatefulWidget
{
final
tpcAgentId
;
final
pageTitleName
;
final
mode
;
const
Tpcagentdetailsbymode
({
super
.
key
,
this
.
tpcAgentId
,
this
.
pageTitleName
,
this
.
mode
});
@override
State
<
Tpcagentdetailsbymode
>
createState
()
=>
_TpcagentdetailsbymodeState
();
}
class
_TpcagentdetailsbymodeState
extends
State
<
Tpcagentdetailsbymode
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Tpcagentsprovider
>(
context
,
listen:
false
,
);
provider
.
TPCAgentsDetailsAPIFunction
(
context
,
widget
.
tpcAgentId
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
var
tpcAgentDetails
=
provider
.
TPCAgentsDetails
;
var
tpcReqAmt
=
provider
.
TPCRequestedAmounts
;
return
WillPopScope
(
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
SizedBox
(
width:
0
,),),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Column
(
children:
[
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
tpcAgentDetails
.
name
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"
${tpcAgentDetails.mobileNumber}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
provider
.
subHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
provider
.
Headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
if
(
provider
.
Headings
[
j
]
==
"ID Proof"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Fileviewer
(
fileName:
tpcAgentDetails
.
idProofViewFileName
!,
fileUrl:
tpcAgentDetails
.
idProofDirFilePath
!,
),
),
);
}
},
child:
Text
(
"
${provider.subHeadings[j]}
"
,
style:
TextStyle
(
fontSize:
14
,
color:
provider
.
Headings
[
j
]
==
"ID Proof"
?
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
provider
.
Headings
[
j
]
==
"ID Proof"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
provider
.
Headings
[
j
]
==
"ID Proof"
?
AppColors
.
app_blue
:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
],
),
),
Container
(
alignment:
Alignment
.
topLeft
,
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
horizontal:
10
),
child:
Text
(
"TPC Amounts Requested"
,
style:
TextStyle
(
fontSize:
14
,
color:
AppColors
.
grey_thick
),)),
ListView
.
builder
(
scrollDirection:
Axis
.
vertical
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemCount:
tpcReqAmt
.
length
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
6
,
(
j
)
{
final
textheads
=
[
"Customer Name"
,
"Order Number"
,
"Order Amount"
,
"Level 2 Approved Amount"
,
"Status"
,
"Action"
,
];
final
textSubheads
=
[
"
${tpcReqAmt[index].customerName}
"
,
"
${tpcReqAmt[index].orderNumber}
"
,
"
${tpcReqAmt[index].totalAmount}
"
,
"
${tpcReqAmt[index].level2TpcApprovedAmount}
"
,
"
${tpcReqAmt[index].tpcStatus}
"
,
"View"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,),
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
if
(
textheads
[
j
]
==
"Action"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Ordersdetailsbymodes
(
pageTitleName:
"CRM Order Details"
,
mode:
widget
.
mode
,
orderId:
tpcReqAmt
[
index
].
orderId
,
),
),
);
}
},
child:
SizedBox
(
// height:45,
width:
MediaQuery
.
of
(
context
,
).
size
.
width
*
0.75
,
child:
Text
(
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
textheads
[
j
]
==
"Action"
?
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
textheads
[
j
]
==
"Action"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
textheads
[
j
]
==
"Action"
?
AppColors
.
app_blue
:
AppColors
.
white
,
),
),
),
),
),
],
),
);
}),
),
);
}
),
],
),
),
),
),
onWillPop:
()
{
return
onBackPressed
(
context
);
},
);
},
);
}
Widget
TextWidget
(
context
,
text
)
{
return
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
text
),
);
}
Widget
ErrorWidget
(
context
,
text
)
{
if
(
text
!=
null
)
return
Text
(
text
!,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
12
));
else
return
SizedBox
(
height:
10
);
}
Widget
textControllerWidget
(
context
,
controller
,
hintText
,
Function
(
String
)?
onChanged
,)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
hintText
),
),
Container
(
height:
hintText
==
"Enter Description"
?
150
:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
controller
,
keyboardType:
TextInputType
.
text
,
maxLines:
hintText
==
"Enter Description"
?
60
:
1
,
onChanged:
onChanged
,
decoration:
InputDecoration
(
hintText:
hintText
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
],
);
}
}
lib/screens/order/tpcAgentIssueList.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/screens/order/tpcAgentIssueListDetails.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Notifiers/ordersProvider/tpcAgentsProvider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'ordersDetailsByModes.dart'
;
class
Tpcagentissuelist
extends
StatefulWidget
{
final
pageTitleName
;
final
mode
;
const
Tpcagentissuelist
({
super
.
key
,
required
this
.
pageTitleName
,
required
this
.
mode
});
@override
State
<
Tpcagentissuelist
>
createState
()
=>
_TpcagentissuelistState
();
}
class
_TpcagentissuelistState
extends
State
<
Tpcagentissuelist
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Tpcagentsprovider
>(
context
,
listen:
false
,
);
provider
.
TPCAgentsIssueListAPIFunction
(
context
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
tpcAgentsIssueList
=
provider
.
tpcAgentsIssueList
;
return
WillPopScope
(
onWillPop:
()
{
provider
.
resetAll
();
return
onBackPressed
(
context
);
},
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
Row
(
children:
[
InkResponse
(
onTap:
()
{
// _showOptionsSheet(context);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_download.svg"
,),
),
],
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
)
))
:
tpcAgentsIssueList
.
isNotEmpty
?
SingleChildScrollView
(
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
tpcAgentsIssueList
.
length
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
if
(
tpcAgentsIssueList
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
);
}
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFEAF7FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/tpc_ic.svg"
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
tpcAgentsIssueList
[
index
].
name
!,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"
${tpcAgentsIssueList[index].aname}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
),
),
...
List
.
generate
(
4
,
(
j
)
{
final
headings
=
[
"Sales Person"
,
"Order Number"
,
"Order Amount"
,
"Order Status"
,
];
final
subHeadings
=
[
tpcAgentsIssueList
[
index
].
ename
,
tpcAgentsIssueList
[
index
].
orderNumber
,
tpcAgentsIssueList
[
index
].
totalAmount
,
tpcAgentsIssueList
[
index
].
status
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
child:
Text
(
"
${subHeadings[j]}
"
,
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
,
),
decoration:
TextDecoration
.
none
,
decorationColor:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
InkResponse
(
onTap:
()
async
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Tpcagentissuelistdetails
(
pageTitleName:
"CRM Order Details"
,
mode:
widget
.
mode
,
orderId:
tpcAgentsIssueList
[
index
].
orderId
,
),
),
);
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Text
(
"View Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
SizedBox
(
width:
5
),
SvgPicture
.
asset
(
"assets/svg/next_button.svg"
,
),
],
),
),
),
],
),
);
},
),
],
),
)
:
Emptywidget
(
context
),
),
);
},
);
}
}
lib/screens/order/tpcAgentIssueListDetails.dart
0 → 100644
View file @
de740138
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'package:generp/Notifiers/ordersProvider/tpcAgentsProvider.dart'
;
import
'package:generp/screens/order/orderDetailsFeedbackHistory.dart'
;
import
'package:generp/screens/order/orderDetailsPaymentHistory.dart'
;
import
'package:generp/screens/order/orderDetailsProductsHistory.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'../finance/FileViewer.dart'
;
class
Tpcagentissuelistdetails
extends
StatefulWidget
{
final
pageTitleName
;
final
orderId
;
final
mode
;
const
Tpcagentissuelistdetails
(
{
super
.
key
,
required
this
.
pageTitleName
,
required
this
.
orderId
,
required
this
.
mode
});
@override
State
<
Tpcagentissuelistdetails
>
createState
()
=>
_TpcagentissuelistdetailsState
();
}
class
_TpcagentissuelistdetailsState
extends
State
<
Tpcagentissuelistdetails
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Pagesdashboardprovider
>(
context
,
listen:
false
,
);
provider
.
ordersDetailsByModeAPIFunction
(
context
,
widget
.
orderId
,
widget
.
mode
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer2
<
Pagesdashboardprovider
,
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
tpcProvider
,
child
)
{
var
orderDetails
=
provider
.
orderDetails
;
return
WillPopScope
(
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_more.svg"
,
height:
30
,),
),),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
orderDetails
.
accountName
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"₹
${orderDetails.balanceAmount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
Expanded
(
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
orderDetails
.
status
??
"-"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
provider
.
subHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
provider
.
Headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
if
(
provider
.
Headings
[
j
]
==
"Purchase Order"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Fileviewer
(
fileName:
orderDetails
.
tpcPaymentAttachementViewFileName
!,
fileUrl:
orderDetails
.
tpcPaymentAttachmentDirFilePath
!,
),
),
);
}
},
child:
Text
(
provider
.
Headings
[
j
]
==
"Purchase Order"
?
"View"
:
"
${provider.subHeadings[j]}
"
,
style:
TextStyle
(
fontSize:
14
,
color:
provider
.
Headings
[
j
]
==
"Purchase Order"
?
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
provider
.
Headings
[
j
]
==
"Purchase Order"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
provider
.
Headings
[
j
]
==
"Purchase Order"
?
AppColors
.
app_blue
:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
],
),
),
),
),
bottomNavigationBar:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
alignment:
Alignment
.
bottomCenter
,
height:
60
,
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
10
),
alignment:
Alignment
.
center
,
height:
45
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Expanded
(
child:
InkResponse
(
onTap:
()
{
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
_showLevelApprovalSheet
(
context
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE7FFE5
),
border:
Border
.
all
(
color:
Color
(
0xFF0D9C00
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Approve"
,
style:
TextStyle
(
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
),
],
),
),
),
),
onWillPop:
()
{
return
onBackPressed
(
context
);
},
);
},
);
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
,)
{
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
,
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
tpcProvider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
SizedBox
(
height:
15
),
...
List
.
generate
(
3
,
(
index
)
{
final
assetnames
=
[
"order_list_svg_1"
,
"order_list_svg_2"
,
"order_list_svg_3"
,
];
final
Headingnames
=
[
"Payment History"
,
"Products Details"
,
"Feedback History"
,
];
return
ListTile
(
onTap:
()
async
{
switch
(
index
)
{
case
0
:
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Orderdetailspaymenthistory
(
),
),
);
break
;
case
1
:
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Orderdetailsproductshistory
(
),
),
);
break
;
case
2
:
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Orderdetailsfeedbackhistory
(
),
),
);
break
;
}
},
leading:
SvgPicture
.
asset
(
"assets/svg/
${assetnames[index]}
.svg"
,
),
title:
Text
(
Headingnames
[
index
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
),),
trailing:
SvgPicture
.
asset
(
"assets/svg/arrow_right_new.svg"
,
),
);
}),
],
),
),
);
},
),
);
},
);
},
);
}
Widget
TextWidget
(
context
,
text
)
{
return
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
text
),
);
}
Widget
ErrorWidget
(
context
,
text
)
{
if
(
text
!=
null
)
return
Text
(
text
!,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
12
));
else
return
SizedBox
(
height:
10
);
}
Widget
textControllerWidget
(
context
,
controller
,
hintText
,
Function
(
String
)?
onChanged
,)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
hintText
),
),
Container
(
height:
hintText
==
"Enter Description"
?
150
:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
controller
,
keyboardType:
TextInputType
.
text
,
maxLines:
hintText
==
"Enter Description"
?
60
:
1
,
onChanged:
onChanged
,
decoration:
InputDecoration
(
hintText:
hintText
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
],
);
}
Future
<
void
>
_showLevelApprovalSheet
(
BuildContext
context
)
{
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:
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
tcpProvider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
topLeft
,
child:
Text
(
"Update Issue"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
),
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"TPC Payment Mode"
),
),
Container
(
height:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
tcpProvider
.
tpcPaymentModeController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
1
,
onChanged:
tcpProvider
.
onChangeTPCPayment
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Enter Company Name"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
tcpProvider
.
tpcPaymentModeError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${tcpProvider.tpcPaymentModeError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
],
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"TPC Payment Reference No. /Cheque No. / UTR No."
),
),
Container
(
height:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
tcpProvider
.
tpcPaymentModeController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
1
,
onChanged:
tcpProvider
.
onChangeTPCPaymentReference
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Enter Order Number"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
tcpProvider
.
tpcPaymentReferenceNoError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${tcpProvider.tpcPaymentReferenceNoError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
],
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
top:
8.0
),
child:
Text
(
"Remarks"
),
),
Container
(
height:
150
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE9E9E9
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
tcpProvider
.
orderTpcFeedbackController
,
readOnly:
true
,
keyboardType:
TextInputType
.
text
,
maxLines:
60
,
onChanged:
tcpProvider
.
onChangeTpcFeedback
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
decoration:
InputDecoration
(
hintText:
"Write Remarks"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
if
(
tcpProvider
.
orderTpcFeedbackError
!=
null
)...[
Container
(
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
top:
2.5
,
left:
25
),
child:
Text
(
"
${tcpProvider.orderTpcFeedbackError}
"
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
),
),
),
],
InkResponse
(
onTap:
()
{
_showAttachmentSheet
(
context
);
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Add Attachment"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
),
),
),
if
(
tcpProvider
.
imagePicked
==
1
&&
tcpProvider
.
imagePath
!=
null
)...[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
"
${tcpProvider.imagePath}
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
),),
InkResponse
(
onTap:
()
{
tcpProvider
.
imagePicked
=
0
;
tcpProvider
.
imagePath
=
null
;
tcpProvider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,))
],
),
)
],
InkWell
(
onTap:
()
{
tcpProvider
.
TPCAgentsIssueApprovalAPIFunction
(
context
,
widget
.
orderId
);
},
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:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
Future
<
void
>
_showAttachmentSheet
(
BuildContext
context
)
{
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:
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
tcpProvider
,
child
)
{
return
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
,
)
.
viewInsets
.
bottom
,
// This handles keyboard
),
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Align
(
alignment:
Alignment
.
center
,
child:
Text
(
"Select Source"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
),
),
),
SizedBox
(
height:
15
,),
InkWell
(
onTap:
()
{
Navigator
.
of
(
context
).
pop
(
false
);
tcpProvider
.
imgFromGallery
(
context
);
},
child:
Container
(
height:
35
,
child:
Text
(
"Select photo from gallery"
),
),
),
SizedBox
(
height:
10
),
InkWell
(
onTap:
()
{
Navigator
.
of
(
context
).
pop
(
false
);
tcpProvider
.
imgFromCamera
(
context
);
},
child:
Container
(
height:
35
,
child:
Text
(
"Capture photo from camera"
),
),
),
],
),
),
),
);
},
),
);
},
);
},
);
}
}
lib/screens/order/tpcAgentListByMode.dart
0 → 100644
View file @
de740138
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/ordersProvider/tpcAgentsProvider.dart'
;
import
'package:generp/screens/order/tpcAgentDetailsByMode.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
class
Tpcagentlistbymode
extends
StatefulWidget
{
final
pageTitleName
;
final
mode
;
const
Tpcagentlistbymode
({
super
.
key
,
required
this
.
pageTitleName
,
required
this
.
mode
});
@override
State
<
Tpcagentlistbymode
>
createState
()
=>
_TpcagentlistbymodeState
();
}
class
_TpcagentlistbymodeState
extends
State
<
Tpcagentlistbymode
>
{
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Tpcagentsprovider
>(
context
,
listen:
false
,
);
provider
.
TPCAgentsListAPIFunction
(
context
,
widget
.
mode
);
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
tpcAgentsLists
=
provider
.
tpcAgentsList
;
return
WillPopScope
(
onWillPop:
()
{
provider
.
resetAll
();
return
onBackPressed
(
context
);
},
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
Row
(
children:
[
InkResponse
(
onTap:
()
{
// _showOptionsSheet(context);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_download.svg"
,),
),
],
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
)
))
:
tpcAgentsLists
.
isNotEmpty
?
SingleChildScrollView
(
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
tpcAgentsLists
.
length
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
if
(
tpcAgentsLists
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
);
}
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFEAF7FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/tpc_ic.svg"
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
tpcAgentsLists
[
index
].
name
!,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"
${tpcAgentsLists[index].createdDatetime}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
),
),
...
List
.
generate
(
4
,
(
j
)
{
final
headings
=
[
"Mobile Number"
,
"Entered Employee"
,
"Issued Amount"
,
"Description"
,
];
final
subHeadings
=
[
tpcAgentsLists
[
index
].
mobileNumber
,
tpcAgentsLists
[
index
].
enteredEmpName
,
tpcAgentsLists
[
index
].
issuedAmount
,
tpcAgentsLists
[
index
].
note
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
child:
Text
(
"
${subHeadings[j]}
"
,
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
,
),
decoration:
TextDecoration
.
none
,
decorationColor:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
InkResponse
(
onTap:
()
async
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Tpcagentdetailsbymode
(
mode:
widget
.
mode
,
pageTitleName:
widget
.
pageTitleName
,
tpcAgentId:
tpcAgentsLists
[
index
].
tpcAgentId
,
),));
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Text
(
"View Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
SizedBox
(
width:
5
),
SvgPicture
.
asset
(
"assets/svg/next_button.svg"
,
),
],
),
),
),
],
),
);
},
),
],
),
)
:
Emptywidget
(
context
),
),
);
},
);
}
}
lib/screens/serviceEngineer/MonthlyCollection.dart
View file @
de740138
...
...
@@ -55,7 +55,7 @@ class _MonthlycollectionState extends State<Monthlycollection> {
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
appBar:
appbar2
(
context
,
"Payment Collection"
,
sendWidget
),
appBar:
appbar2
(
context
,
"Payment Collection"
,
provider
.
resetAll
,
sendWidget
),
body:
provider
.
paymenCollectionList
.
isNotEmpty
?
Container
(
child:
ListView
.
builder
(
scrollDirection:
Axis
.
vertical
,
...
...
lib/screens/serviceEngineer/NearbyGenerators.dart
View file @
de740138
...
...
@@ -211,7 +211,7 @@ class _NearbygeneratorsState extends State<Nearbygenerators> {
onWillPop:
()
=>
onBackPressed
(
context
),
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Nearby Generators"
,
sendWidget
),
appBar:
appbar2
(
context
,
"Nearby Generators"
,
provider
.
resetAll
,
sendWidget
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
...
...
lib/screens/serviceEngineer/PendingComplaints.dart
View file @
de740138
...
...
@@ -42,6 +42,7 @@ class _PendingcomplaintsState extends State<Pendingcomplaints> {
appBar:
appbar2
(
context
,
"Pending Complaints"
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
Navigator
.
push
(
...
...
lib/services/api_calling.dart
View file @
de740138
...
...
@@ -8,6 +8,9 @@ import 'package:generp/Models/commonModels/commonAccessiblePagesResponse.dart';
import
'package:generp/Models/commonModels/commonAddAccountsViewResponse.dart'
;
import
'package:generp/Models/financeModels/addDirectPaymentResponse.dart'
;
import
'package:generp/Models/financeModels/paymentRequisitionPaymentsListResponse.dart'
;
import
'package:generp/Models/ordersModels/PendingTPCAgentListResponse.dart'
;
import
'package:generp/Models/ordersModels/TPCAgentDetailsResponse.dart'
;
import
'package:generp/Models/ordersModels/TPCListResponse.dart'
;
import
'package:generp/services/api_names.dart'
;
import
'package:generp/services/api_post_request.dart'
;
import
'package:path_provider/path_provider.dart'
;
...
...
@@ -57,6 +60,17 @@ import '../Models/financeModels/paymentRequisitionPaymentsReceiptsListResponse.d
import
'../Models/generatorComplaintResponse.dart'
;
import
'../Models/loadGeneratorDetailsResponse.dart'
;
import
'../Models/financeModels/financeDashboardPagesResponse.dart'
;
import
'../Models/ordersModels/AddOrderPaymentSelectAccountResponse.dart'
;
import
'../Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart'
;
import
'../Models/ordersModels/addOrderPaymentViewResponse.dart'
;
import
'../Models/ordersModels/commonResponse.dart'
;
import
'../Models/ordersModels/ordersAccessiblePagesResponse.dart'
;
import
'../Models/ordersModels/ordersDetailsByModeResponse.dart'
;
import
'../Models/ordersModels/ordersListByModeFilterResponse.dart'
;
import
'../Models/ordersModels/ordersListByModeResponse.dart'
;
import
'../Models/ordersModels/paymentDetailsByModeFilterResponse.dart'
;
import
'../Models/ordersModels/paymentListByModeFilterResponse.dart'
;
import
'../Models/ordersModels/paymentListByModeResponse.dart'
;
import
'../Notifiers/financeProvider/approveRejectPaymentRequestResponse.dart'
;
import
'../Utils/commonServices.dart'
;
...
...
@@ -1241,7 +1255,7 @@ class ApiCalling {
}
}
static
Future
<
addReceiptPaymentResponse
?>
addPaymentRequestionSubmitAPI
(
static
Future
<
addReceiptPaymentResponse
?>
addPaymentRequestionSubmitAPI
(
emp_id
,
session_id
,
type
,
...
...
@@ -1303,7 +1317,7 @@ class ApiCalling {
}
}
static
Future
<
addDirectPaymentResponse
?>
addDirectPaymentRequestionSubmitAPI
(
static
Future
<
addDirectPaymentResponse
?>
addDirectPaymentRequestionSubmitAPI
(
emp_id
,
session_id
,
from_account_id
,
...
...
@@ -1356,8 +1370,6 @@ class ApiCalling {
res
=
jsonDecode
(
res
.
body
);
print
(
res
);
return
addDirectPaymentResponse
.
fromJson
(
res
);
}
if
(
res
!=
null
)
{
return
res
;
...
...
@@ -1371,7 +1383,8 @@ class ApiCalling {
}
}
static
Future
<
addReceiptPaymentResponse
?>
addReceiptPaymentRequestionSubmitAPI
(
static
Future
<
addReceiptPaymentResponse
?>
addReceiptPaymentRequestionSubmitAPI
(
emp_id
,
session_id
,
from_account_id
,
...
...
@@ -1802,8 +1815,11 @@ class ApiCalling {
}
}
static
Future
<
SubLocationsResponse
?>
commonAddAccountViewSubLocationAPI
(
empId
,
session
,
district_id
)
async
{
static
Future
<
SubLocationsResponse
?>
commonAddAccountViewSubLocationAPI
(
empId
,
session
,
district_id
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
...
...
@@ -1876,23 +1892,23 @@ class ApiCalling {
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'type'
:
type
.
toString
(),
'name'
:
name
.
toString
(),
'mob1'
:
mob1
.
toString
(),
'mob2'
:
mob2
.
toString
(),
'tel'
:
tel
.
toString
(),
'email'
:
email
.
toString
(),
'designation'
:
designation
.
toString
(),
'address'
:
address
.
toString
(),
'state'
:
state
.
toString
(),
'district'
:
district
.
toString
(),
'sub_locality'
:
sub_locality
.
toString
(),
'bank_name'
:
bank_name
.
toString
(),
'bank_branch_name'
:
bank_branch_name
.
toString
(),
'bank_ifsc_code'
:
bank_ifsc_code
.
toString
(),
'bank_account_holder_name'
:
bank_account_holder_name
.
toString
(),
'bank_account_number'
:
bank_account_number
.
toString
(),
'bank_upi_id'
:
bank_upi_id
.
toString
(),
'type'
:
type
.
toString
(),
'name'
:
name
.
toString
(),
'mob1'
:
mob1
.
toString
(),
'mob2'
:
mob2
.
toString
(),
'tel'
:
tel
.
toString
(),
'email'
:
email
.
toString
(),
'designation'
:
designation
.
toString
(),
'address'
:
address
.
toString
(),
'state'
:
state
.
toString
(),
'district'
:
district
.
toString
(),
'sub_locality'
:
sub_locality
.
toString
(),
'bank_name'
:
bank_name
.
toString
(),
'bank_branch_name'
:
bank_branch_name
.
toString
(),
'bank_ifsc_code'
:
bank_ifsc_code
.
toString
(),
'bank_account_holder_name'
:
bank_account_holder_name
.
toString
(),
'bank_account_number'
:
bank_account_number
.
toString
(),
'bank_upi_id'
:
bank_upi_id
.
toString
(),
};
final
res
=
await
post
(
data
,
commonAddAccountSubmit
,
{});
if
(
res
!=
null
)
{
...
...
@@ -1909,18 +1925,19 @@ class ApiCalling {
}
static
Future
<
commonAccountlistResponse
?>
commonAccountListAPI
(
empId
,
session
,
page_number
,
company_name
,
mobile_number
)
async
{
empId
,
session
,
page_number
,
company_name
,
mobile_number
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'page_number'
:
page_number
.
toString
(),
'company_name'
:
company_name
.
toString
(),
'mobile_number'
:
mobile_number
.
toString
()
'page_number'
:
page_number
.
toString
(),
'company_name'
:
company_name
.
toString
(),
'mobile_number'
:
mobile_number
.
toString
()
,
};
final
res
=
await
post
(
data
,
commonAccountListUrl
,
{});
if
(
res
!=
null
)
{
...
...
@@ -1937,14 +1954,15 @@ class ApiCalling {
}
static
Future
<
commonAccountdetailsResponse
?>
commonAccountDetailsAPI
(
empId
,
session
,
account_id
)
async
{
empId
,
session
,
account_id
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'account_id'
:
account_id
.
toString
(),
'account_id'
:
account_id
.
toString
(),
};
final
res
=
await
post
(
data
,
commonAccountLedgerAccountDetails
,
{});
if
(
res
!=
null
)
{
...
...
@@ -1960,20 +1978,122 @@ class ApiCalling {
}
}
static
Future
<
commonAccountLedgerFilterResponse
?>
commonAccountLedgerDropDownAPI
(
static
Future
<
commonAccountLedgerFilterResponse
?>
commonAccountLedgerDropDownAPI
(
empId
,
session
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
};
final
res
=
await
post
(
data
,
commonAccountLedgerDropDownUrl
,
{});
if
(
res
!=
null
)
{
debugPrint
(
res
.
body
);
return
commonAccountLedgerFilterResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
commonAccountLedgerResponse
?>
commonAccountLedgerListAPI
(
empId
,
session
,
account_id
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'account_id'
:
account_id
.
toString
(),
};
print
(
data
);
final
res
=
await
post
(
data
,
commonAccountLedgerListWithFilterUrl
,
{});
if
(
res
!=
null
)
{
debugPrint
(
res
.
body
);
return
commonAccountLedgerResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
///Orders Module
static
Future
<
ordersAccessiblePagesResponse
?>
ordersDashboardAPI
(
empId
,
session
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersAccessiblePagesUrl
,
{});
if
(
res
!=
null
)
{
debugPrint
(
res
.
body
);
return
ordersAccessiblePagesResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
ordersListByModeFilterResponse
?>
ordersListByModeFilterAPI
(
empId
,
session
,
mode
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'mode'
:
(
mode
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersOrderListByModeUrl
,
{});
if
(
res
!=
null
)
{
debugPrint
(
res
.
body
);
return
ordersListByModeFilterResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
ordersListByModeResponse
?>
ordersListByModeAPI
(
empId
,
session
,
mode
,
teamemployee
,
status
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'mode'
:
(
mode
).
toString
(),
'teamemployee'
:
(
teamemployee
).
toString
(),
'status'
:
(
status
).
toString
(),
};
final
res
=
await
post
(
data
,
commonAccountLedgerDropDown
Url
,
{});
final
res
=
await
post
(
data
,
ordersOrderListFilter
Url
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
commonAccountLedgerFilter
Response
.
fromJson
(
jsonDecode
(
res
.
body
));
return
ordersListByMode
Response
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
...
...
@@ -1984,21 +2104,395 @@ class ApiCalling {
}
}
static
Future
<
commonAccountLedgerResponse
?>
commonAccountLedgerListAPI
(
static
Future
<
ordersDetailsByModeResponse
?>
ordersDetailsByModeAPI
(
empId
,
session
,
order_id
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'order_id'
:
(
order_id
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersOrderDetailsUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
ordersDetailsByModeResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
CommonResponse
?>
ordersDetailsFeedbackSubmissionAPI
(
empId
,
session
,
account_id
session
,
order_id
,
feedback
,
status
,
attachment_file
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'order_id'
:
order_id
.
toString
(),
'feedback'
:
(
feedback
).
toString
(),
'status'
:
status
,
};
var
res
;
if
(
attachment_file
!=
null
)
{
res
=
await
postImageNew
(
data
,
{},
ordersOrderDetailsFeedbackSubmitUrl
,
attachment_file
,
"attachment_file"
,
);
res
=
jsonDecode
(
res
);
}
else
{
res
=
await
post
(
data
,
ordersOrderDetailsFeedbackSubmitUrl
,
{});
res
=
jsonDecode
(
res
.
body
);
return
CommonResponse
.
fromJson
(
res
);
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
CommonResponse
?>
ordersDetailsApproveRejectAPI
(
empId
,
session
,
status
,
type
,
order_id
,
feedback
,
tpc_applicable
,
tpc_approved_amount
,
sale_order_number
,
edit_company_name
,
invoice_number
,
vehicle_number
,
driver_name
,
driver_mobile_no
,
crm_order_p_id
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
"status"
:
status
.
toString
(),
"type"
:
type
.
toString
(),
"order_id"
:
order_id
.
toString
(),
"feedback"
:
feedback
.
toString
(),
"tpc_applicable"
:
tpc_applicable
.
toString
(),
"tpc_approved_amount"
:
tpc_approved_amount
.
toString
(),
"sale_order_number"
:
sale_order_number
.
toString
(),
"edit_company_name"
:
edit_company_name
.
toString
(),
"invoice_number"
:
invoice_number
.
toString
(),
"vehicle_number"
:
vehicle_number
.
toString
(),
"driver_name"
:
driver_name
.
toString
(),
"driver_mobile_no"
:
driver_mobile_no
.
toString
(),
"crm_order_p_id"
:
crm_order_p_id
.
toString
()
};
final
res
=
await
post
(
data
,
ordersOrderApproveRejectUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
CommonResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
CommonResponse
?>
ordersDetailsDeleteAPI
(
empId
,
session
,
order_id
,
feedback
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
"order_id"
:
order_id
.
toString
(),
"feedback"
:
feedback
.
toString
(),
};
final
res
=
await
post
(
data
,
ordersOrderLDeleteUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
CommonResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
addOrderPaymentViewResponse
?>
AddOrderpaymentListViewAPI
(
empId
,
session
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersAddPaymentViewUrl
,
{});
if
(
res
!=
null
)
{
debugPrint
(
res
.
body
);
return
addOrderPaymentViewResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
CommonResponse
?>
AddOrderpaymentListSubmitAPI
(
empId
,
session
,
account_id
,
description
,
selected_orders
,
payment_amount
,
payment_date
,
payment_type
,
ref_no
,
attachment
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'account_id'
:
account_id
.
toString
(),
'description'
:
description
.
toString
(),
'selected_orders'
:
selected_orders
.
toString
(),
'payment_amount'
:
payment_amount
.
toString
(),
'payment_date'
:
payment_date
.
toString
(),
'payment_type'
:
payment_type
.
toString
(),
'ref_no'
:
ref_no
.
toString
(),
};
print
(
data
);
final
res
=
await
post
(
data
,
commonAccountLedgerListWithFilterUrl
,
{});
var
res
;
if
(
attachment
!=
null
)
{
res
=
await
postImageNew
(
data
,
{},
ordersAddPaymentSubmitUrl
,
attachment
,
"attachment"
,
);
res
=
jsonDecode
(
res
);
}
else
{
res
=
await
post
(
data
,
ordersAddPaymentSubmitUrl
,
{});
res
=
jsonDecode
(
res
.
body
);
return
CommonResponse
.
fromJson
(
res
);
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
AddOrderPaymentSelectAccountResponse
?>
AddOrderPaymentSelectAccountAPI
(
empId
,
session
,
mode
,
search_term
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'mode'
:
mode
.
toString
(),
'search_term'
:
search_term
.
toString
(),
};
final
res
=
await
post
(
data
,
ordersAddPaymentSelectAccountForOrderUrl
,
{});
if
(
res
!=
null
)
{
debugPrint
(
res
.
body
);
return
commonAccountLedgerResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
return
AddOrderPaymentSelectAccountResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
AddOrderPaymentSelectOrderResponse
?>
AddOrderPaymentSelectOrderAPI
(
empId
,
session
,
account_id
,
x
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'account_id'
:
account_id
.
toString
(),
};
final
res
=
await
post
(
data
,
ordersAddPaymentSelectOrderUrl
,
{});
if
(
res
!=
null
)
{
debugPrint
(
res
.
body
);
return
AddOrderPaymentSelectOrderResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
paymentListByModeFilterResponse
?>
paymentListByModeFilterAPI
(
empId
,
session
,
mode
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'mode'
:
(
mode
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersPaymentListFilterUrl
,
{});
if
(
res
!=
null
)
{
debugPrint
(
res
.
body
);
return
paymentListByModeFilterResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
paymentListByModeResponse
?>
paymentListsByModeAPI
(
empId
,
session
,
mode
,
teamemployee
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'mode'
:
(
mode
).
toString
(),
'teamemployee'
:
(
teamemployee
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersPaymentListByModeUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
paymentListByModeResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
CommonResponse
?>
paymentOrderApproveRejectAPI
(
empId
,
session
,
payment_id
,
type
,
remarks
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
"payment_id"
:
payment_id
.
toString
(),
"type"
:
type
.
toString
(),
"remarks"
:
remarks
.
toString
()
};
final
res
=
await
post
(
data
,
ordersPaymentListApproveRejectUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
CommonResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
CommonResponse
?>
paymentOrderDeleteAPI
(
empId
,
session
,
payment_id
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
"payment_id"
:
payment_id
.
toString
(),
};
final
res
=
await
post
(
data
,
ordersPaymentListDeleteUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
CommonResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
paymentDetailsByModeFilterResponse
?>
paymentsDetailsByModeAPI
(
empId
,
session
,
payment_id
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'payment_id'
:
(
payment_id
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersPaymentDetailsUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
paymentDetailsByModeFilterResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
...
...
@@ -2008,4 +2502,167 @@ class ApiCalling {
return
null
;
}
}
static
Future
<
CommonResponse
?>
ordersAddTPCAgentAPI
(
empId
,
session
,
agent_name
,
mobile_number
,
bank_name
,
bank_account_no
,
bank_ifsc_code
,
bank_beneficiary_name
,
note
,
id_proof
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'agent_name'
:
agent_name
.
toString
(),
'mobile_number'
:
mobile_number
.
toString
(),
'bank_name'
:
bank_name
.
toString
(),
'bank_account_no'
:
bank_account_no
.
toString
(),
'bank_ifsc_code'
:
bank_ifsc_code
.
toString
(),
'bank_beneficiary_name'
:
bank_beneficiary_name
.
toString
(),
'note'
:
note
.
toString
(),
};
var
res
;
if
(
id_proof
!=
null
)
{
res
=
await
postImageNew
(
data
,
{},
ordersAddTPCAgentUrl
,
id_proof
,
"id_proof"
,
);
res
=
jsonDecode
(
res
);
}
else
{
res
=
await
post
(
data
,
ordersAddTPCAgentUrl
,
{});
res
=
jsonDecode
(
res
.
body
);
return
CommonResponse
.
fromJson
(
res
);
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
TPCListResponse
?>
TPCAgentListAPI
(
empId
,
session
,
mode
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'mode'
:
(
mode
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersTPCAgentListUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
TPCListResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
TPCAgentDetailsResponse
?>
TPCAgentDetailsAPI
(
empId
,
session
,
tpc_agent_id
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'tpc_agent_id'
:
(
tpc_agent_id
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersTPCAgentDetailsUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
TPCAgentDetailsResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
PendingTPCAgentListResponse
?>
pendingTPCAgentIssueListAPI
(
empId
,
session
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
};
final
res
=
await
post
(
data
,
ordersPendingTPCIssueListUrl
,
{});
if
(
res
!=
null
)
{
print
(
data
);
debugPrint
(
res
.
body
);
return
PendingTPCAgentListResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
static
Future
<
CommonResponse
?>
TpcIssueListApprovalAPI
(
empId
,
session
,
tpc_payment_mode
,
tpc_payment_reference_no
,
order_id
,
order_tpc_feedback
,
tpc_paym_attachment
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
'emp_id'
:
(
empId
).
toString
(),
'session_id'
:
(
session
).
toString
(),
'tpc_payment_mode'
:
tpc_payment_mode
.
toString
(),
'tpc_payment_reference_no'
:
tpc_payment_reference_no
.
toString
(),
'order_id'
:
order_id
.
toString
(),
'order_tpc_feedback'
:
order_tpc_feedback
.
toString
(),
};
var
res
;
if
(
tpc_paym_attachment
!=
null
)
{
res
=
await
postImageNew
(
data
,
{},
ordersApprovePendingTPCIssueListUrl
,
tpc_paym_attachment
,
"tpc_paym_attachment"
,
);
res
=
jsonDecode
(
res
);
}
else
{
res
=
await
post
(
data
,
ordersApprovePendingTPCIssueListUrl
,
{});
res
=
jsonDecode
(
res
.
body
);
return
CommonResponse
.
fromJson
(
res
);
}
}
catch
(
e
)
{
debugPrint
(
'hello bev=bug
$e
'
);
return
null
;
}
}
}
lib/services/api_names.dart
View file @
de740138
...
...
@@ -78,9 +78,41 @@ const commonAddAccountViewgetDistrictUrl = "${baseUrl_test}get_district_on_state
const
commonAddAccountViewgetSubLocationUrl
=
"
${baseUrl_test}
get_sublocation_on_district"
;
const
commonAddAccountCheckInputsUrl
=
"
${baseUrl_test}
check_common_add_account_fields"
;
const
commonAddAccountSubmit
=
"
${baseUrl_test}
common_add_account_submit"
;
const
commonAccountListUrl
=
"
${baseUrl_test}
common_account_list"
;
const
commonAccountLedgerDropDownUrl
=
"
${baseUrl_test}
common_account_ledger_list_view"
;
const
commonAccountLedgerListWithFilterUrl
=
"
${baseUrl_test}
common_account_ledger_list_submit_filter"
;
const
commonAccountLedgerAccountDetails
=
"
${baseUrl_test}
common_account_details"
;
\ No newline at end of file
const
commonAccountLedgerAccountDetails
=
"
${baseUrl_test}
common_account_details"
;
///order Module
const
ordersAccessiblePagesUrl
=
"
${baseUrl_test}
crm_order_accessible_pages"
;
const
ordersOrderListByModeUrl
=
"
${baseUrl_test}
crm_order_list_view"
;
const
ordersOrderListFilterUrl
=
"
${baseUrl_test}
crm_order_list_filter_submit"
;
const
ordersOrderApproveRejectUrl
=
"
${baseUrl_test}
approve_reject_crm_order"
;
const
ordersOrderLDeleteUrl
=
"
${baseUrl_test}
delete_crm_order"
;
const
ordersOrderDetailsUrl
=
"
${baseUrl_test}
crm_order_details"
;
const
ordersOrderDetailsFeedbackSubmitUrl
=
"
${baseUrl_test}
crm_order_details_add_feedback"
;
const
ordersOrderDetailsEditOrderUrl
=
"
${baseUrl_test}
crm_edit_order_view"
;
const
ordersOrderDetailsEditOrderSubmitUrl
=
"
${baseUrl_test}
crm_edit_order_submit"
;
const
ordersOrderDetailsDispatchProductsUrl
=
"
${baseUrl_test}
crm_dispatch_products_data"
;
const
ordersAddPaymentViewUrl
=
"
${baseUrl_test}
crm_add_order_payment_view"
;
const
ordersAddPaymentSubmitUrl
=
"
${baseUrl_test}
crm_add_order_payment_submit"
;
const
ordersAddPaymentSelectAccountForOrderUrl
=
"
${baseUrl_test}
select_account_for_order_payment"
;
const
ordersAddPaymentSelectOrderUrl
=
"
${baseUrl_test}
select_order_for_order_payment"
;
const
ordersPaymentListFilterUrl
=
"
${baseUrl_test}
crm_payments_list_view"
;
const
ordersPaymentListByModeUrl
=
"
${baseUrl_test}
crm_payments_list_filter_submit"
;
const
ordersPaymentListDeleteUrl
=
"
${baseUrl_test}
delete_crm_order_payment"
;
const
ordersPaymentListApproveRejectUrl
=
"
${baseUrl_test}
crm_approve_reject_payment"
;
const
ordersPaymentDetailsUrl
=
"
${baseUrl_test}
crm_payment_details"
;
const
ordersAddTPCAgentUrl
=
"
${baseUrl_test}
add_tpc_agent_submit"
;
const
ordersTPCAgentListUrl
=
"
${baseUrl_test}
tpc_agent_list"
;
const
ordersTPCAgentDetailsUrl
=
"
${baseUrl_test}
tpc_agent_details"
;
const
ordersPendingTPCIssueListUrl
=
"
${baseUrl_test}
pending_tpc_issue_list"
;
const
ordersApprovePendingTPCIssueListUrl
=
"
${baseUrl_test}
update_pending_tpc_issue_list"
;
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment