|
|
|
@ -19,6 +19,7 @@ import 'package:mohem_flutter_app/models/worklist_response_model.dart';
|
|
|
|
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
|
|
|
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class WorkListScreen extends StatefulWidget {
|
|
|
|
class WorkListScreen extends StatefulWidget {
|
|
|
|
WorkListScreen({Key? key}) : super(key: key);
|
|
|
|
WorkListScreen({Key? key}) : super(key: key);
|
|
|
|
@ -41,14 +42,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
key: 'HRSSA',
|
|
|
|
key: 'HRSSA',
|
|
|
|
disable: false),
|
|
|
|
disable: false),
|
|
|
|
WorkListItemTypeModelData(
|
|
|
|
WorkListItemTypeModelData(
|
|
|
|
value: 0,
|
|
|
|
value: 0, name: 'MR', fullName: LocaleKeys.moveOrder.tr(), active: false, color: [Color(0xff58DCFA), Color(0xff3CB9D5)], icon: "assets/images/miss_swipe.svg", key: 'INVMOA', disable: false),
|
|
|
|
name: 'MR',
|
|
|
|
|
|
|
|
fullName: LocaleKeys.moveOrder.tr(),
|
|
|
|
|
|
|
|
active: false,
|
|
|
|
|
|
|
|
color: [Color(0xff58DCFA), Color(0xff3CB9D5)],
|
|
|
|
|
|
|
|
icon: "assets/images/miss_swipe.svg",
|
|
|
|
|
|
|
|
key: 'INVMOA',
|
|
|
|
|
|
|
|
disable: false),
|
|
|
|
|
|
|
|
WorkListItemTypeModelData(
|
|
|
|
WorkListItemTypeModelData(
|
|
|
|
value: 0,
|
|
|
|
value: 0,
|
|
|
|
name: 'PR',
|
|
|
|
name: 'PR',
|
|
|
|
@ -112,6 +106,8 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
|
|
|
|
|
|
|
late DashboardProviderModel providerData;
|
|
|
|
late DashboardProviderModel providerData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final RefreshController _refreshController = RefreshController(initialRefresh: false);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
@ -180,6 +176,11 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _onRefresh() async {
|
|
|
|
|
|
|
|
getWorkList();
|
|
|
|
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
@ -200,11 +201,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor),
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
height: 1,
|
|
|
|
|
|
|
|
color: MyColors.lightGreyEFColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 40,
|
|
|
|
height: 40,
|
|
|
|
child: ListView.separated(
|
|
|
|
child: ListView.separated(
|
|
|
|
@ -230,6 +227,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
workListItemIndex = index;
|
|
|
|
workListItemIndex = index;
|
|
|
|
if (workListItemTypes[index].value == 0) {
|
|
|
|
if (workListItemTypes[index].value == 0) {
|
|
|
|
workList = [];
|
|
|
|
workList = [];
|
|
|
|
|
|
|
|
itgRequestTypeIndex = null;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
workList = null;
|
|
|
|
workList = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -247,84 +245,71 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21),
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).paddingOnly(top: 21, bottom: 21),
|
|
|
|
).paddingOnly(top: 21, bottom: 21),
|
|
|
|
workListItemTypes[workListItemIndex]
|
|
|
|
workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21),
|
|
|
|
.fullName
|
|
|
|
SmartRefresher(
|
|
|
|
.toSectionHeading()
|
|
|
|
enablePullDown: true,
|
|
|
|
.paddingOnly(left: 21, right: 21),
|
|
|
|
enablePullUp: false,
|
|
|
|
if (itgRequestTypeIndex != null)
|
|
|
|
header: const MaterialClassicHeader(
|
|
|
|
SizedBox(
|
|
|
|
color: MyColors.gradiantEndColor,
|
|
|
|
height: 40,
|
|
|
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
|
|
|
RequestType type = itgFormsModel!.requestType![index];
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
|
|
|
left: 21, right: 21, top: 8, bottom: 8),
|
|
|
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
|
|
|
|
color: itgRequestTypeIndex == index
|
|
|
|
|
|
|
|
? MyColors.darkIconColor
|
|
|
|
|
|
|
|
: MyColors.lightGreyEAColor),
|
|
|
|
|
|
|
|
child: ("${type.requestTypeName}").toText12(
|
|
|
|
|
|
|
|
color: itgRequestTypeIndex == index
|
|
|
|
|
|
|
|
? MyColors.white
|
|
|
|
|
|
|
|
: MyColors.black),
|
|
|
|
|
|
|
|
).onPress(() {
|
|
|
|
|
|
|
|
if (itgRequestTypeIndex != index) {
|
|
|
|
|
|
|
|
itgRequestTypeIndex = index;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
separatorBuilder: (context, index) => 8.width,
|
|
|
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
|
|
|
itemCount: itgFormsModel?.requestType?.length ?? 0,
|
|
|
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).paddingOnly(top: 16, bottom: 16),
|
|
|
|
controller: _refreshController,
|
|
|
|
itgRequestTypeIndex != null
|
|
|
|
onRefresh: _onRefresh,
|
|
|
|
? Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: ListView.separated(
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: itgRequestTypeIndex != null
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
? Column(
|
|
|
|
return itgRowItem(
|
|
|
|
children: [
|
|
|
|
workListItemTypes[workListItemIndex],
|
|
|
|
SizedBox(
|
|
|
|
itgFormsModel!.requestType![itgRequestTypeIndex!]
|
|
|
|
height: 40,
|
|
|
|
.requestDetails![index],
|
|
|
|
child: ListView.separated(
|
|
|
|
index);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
|
|
|
itemCount: itgFormsModel!
|
|
|
|
|
|
|
|
.requestType![itgRequestTypeIndex!]
|
|
|
|
|
|
|
|
.requestDetails
|
|
|
|
|
|
|
|
?.length ??
|
|
|
|
|
|
|
|
0,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: Expanded(
|
|
|
|
|
|
|
|
child: workList != null
|
|
|
|
|
|
|
|
? ((workList!).isEmpty
|
|
|
|
|
|
|
|
? LocaleKeys.noHistoryAvailable
|
|
|
|
|
|
|
|
.tr()
|
|
|
|
|
|
|
|
.toText16()
|
|
|
|
|
|
|
|
.center
|
|
|
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return rowItem(
|
|
|
|
RequestType type = itgFormsModel!.requestType![index];
|
|
|
|
workListItemTypes[workListItemIndex],
|
|
|
|
return Container(
|
|
|
|
workList![index],
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
|
|
|
|
index);
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor),
|
|
|
|
|
|
|
|
child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black),
|
|
|
|
|
|
|
|
).onPress(() {
|
|
|
|
|
|
|
|
if (itgRequestTypeIndex != index) {
|
|
|
|
|
|
|
|
itgRequestTypeIndex = index;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
separatorBuilder: (context, index) => 8.width,
|
|
|
|
itemCount: workList?.length ?? 0,
|
|
|
|
shrinkWrap: true,
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
itemCount: itgFormsModel?.requestType?.length ?? 0,
|
|
|
|
))
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
: const SizedBox(),
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
).paddingOnly(top: 16, bottom: 16),
|
|
|
|
|
|
|
|
ListView.separated(
|
|
|
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
|
|
|
return itgRowItem(workListItemTypes[workListItemIndex], itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails![index], index);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
|
|
|
itemCount: itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails?.length ?? 0,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: workList != null
|
|
|
|
|
|
|
|
? ((workList!).isEmpty
|
|
|
|
|
|
|
|
? Utils.getNoDataWidget(context).paddingOnly(top: 100)
|
|
|
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
|
|
|
return rowItem(workListItemTypes[workListItemIndex], workList![index], index);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
|
|
|
itemCount: workList?.length ?? 0,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
: const SizedBox(),
|
|
|
|
|
|
|
|
)).expanded,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -411,17 +396,8 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
10.height,
|
|
|
|
10.height,
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
DateUtil.formatDateToDate(
|
|
|
|
DateUtil.formatDateToDate(DateUtil.convertStringToDate(requestDetails.modifiedDate!), false).toText10(color: MyColors.lightTextColor).expanded,
|
|
|
|
DateUtil.convertStringToDate(
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)),
|
|
|
|
requestDetails.modifiedDate!),
|
|
|
|
|
|
|
|
false)
|
|
|
|
|
|
|
|
.toText10(color: MyColors.lightTextColor)
|
|
|
|
|
|
|
|
.expanded,
|
|
|
|
|
|
|
|
RotatedBox(
|
|
|
|
|
|
|
|
quarterTurns: AppState().isArabic(context) ? 2 : 4,
|
|
|
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
|
|
|
"assets/images/arrow_next.svg",
|
|
|
|
|
|
|
|
color: MyColors.darkIconColor)),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -512,17 +488,8 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
10.height,
|
|
|
|
10.height,
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
DateUtil.formatDateToDate(
|
|
|
|
DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDate(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded,
|
|
|
|
DateUtil.convertSimpleStringDateToDate(
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)),
|
|
|
|
workData.bEGINDATE!),
|
|
|
|
|
|
|
|
false)
|
|
|
|
|
|
|
|
.toText10(color: MyColors.lightTextColor)
|
|
|
|
|
|
|
|
.expanded,
|
|
|
|
|
|
|
|
RotatedBox(
|
|
|
|
|
|
|
|
quarterTurns: AppState().isArabic(context) ? 2 : 4,
|
|
|
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
|
|
|
"assets/images/arrow_next.svg",
|
|
|
|
|
|
|
|
color: MyColors.darkIconColor)),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|