|
|
|
@ -81,7 +81,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
value: 0, name: 'COC', fullName: LocaleKeys.itemCreation.tr(), active: false, color: [Color(0xff787299), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'COC', disable: true)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
int workListItemIndex = 0;
|
|
|
|
|
int? workListItemIndex;
|
|
|
|
|
|
|
|
|
|
List<WorkListResponseModel>? workList;
|
|
|
|
|
int pageNumber = 1;
|
|
|
|
@ -99,7 +99,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
super.initState();
|
|
|
|
|
providerData = Provider.of<DashboardProviderModel>(context, listen: false);
|
|
|
|
|
calculateCounter();
|
|
|
|
|
getWorkList();
|
|
|
|
|
if (workListItemIndex != null) getWorkList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void calculateCounter() {
|
|
|
|
@ -115,11 +115,17 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
workListItemTypes.removeWhere((element) => element.value == 0);
|
|
|
|
|
if (workListItemTypes.isNotEmpty) {
|
|
|
|
|
workListItemIndex = 0;
|
|
|
|
|
} else {
|
|
|
|
|
workListItemIndex = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void verifyWorkListCounter() {
|
|
|
|
|
workListItemTypes.forEach((workListElement) {
|
|
|
|
|
if (workListElement.key == "ITG" && workListItemTypes[workListItemIndex].key == "ITG") {
|
|
|
|
|
if (workListElement.key == "ITG" && workListItemTypes[workListItemIndex!].key == "ITG") {
|
|
|
|
|
workListElement.value = providerData.itgFormsModel?.totalCount ?? 0;
|
|
|
|
|
if ((AppState().requestAllList?.length ?? 0) != workListElement.value) {
|
|
|
|
|
workListElement.value = AppState().requestAllList?.length ?? 0;
|
|
|
|
@ -132,7 +138,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
workListElement.value = providerData.cocFinalCount;
|
|
|
|
|
} else {
|
|
|
|
|
providerData.getOpenNotificationsList?.forEach((element) {
|
|
|
|
|
if ((element.itemType == workListItemTypes[workListItemIndex].key) && element.itemType == workListElement.key) {
|
|
|
|
|
if ((element.itemType == workListItemTypes[workListItemIndex!].key) && element.itemType == workListElement.key) {
|
|
|
|
|
if ((AppState().workList?.length ?? 0) != (element.openNtfNumber ?? 0)) {
|
|
|
|
|
workListElement.value = AppState().workList?.length ?? 0;
|
|
|
|
|
providerData.workListCounter = providerData.workListCounter - ((element.openNtfNumber ?? 0) - (AppState().workList?.length ?? 0));
|
|
|
|
@ -162,7 +168,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
Future<void> getWorkList({bool showLoading = true}) async {
|
|
|
|
|
try {
|
|
|
|
|
if (showLoading) Utils.showLoading(context);
|
|
|
|
|
if (workListItemTypes[workListItemIndex].key == "ITG") {
|
|
|
|
|
if (workListItemTypes[workListItemIndex!].key == "ITG") {
|
|
|
|
|
itgFormsModel = await WorkListApiClient().getITGTaskCountRequestType();
|
|
|
|
|
List<RequestDetails> requestAllList = [];
|
|
|
|
|
for (int i = 0; i < (itgFormsModel?.requestType!.length ?? 0); i++) {
|
|
|
|
@ -178,7 +184,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
itgRequestTypeIndex = null;
|
|
|
|
|
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key, pNotificationType.toString());
|
|
|
|
|
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex!].key, pNotificationType.toString());
|
|
|
|
|
AppState().setWorkList = workList;
|
|
|
|
|
}
|
|
|
|
|
if (showLoading) Utils.hideLoading(context);
|
|
|
|
@ -216,127 +222,129 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
appBar: AppBarWidget(context, title: LocaleKeys.workList.tr(), showWorkListSettingButton: true),
|
|
|
|
|
body: SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(6), color: workListItemIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor),
|
|
|
|
|
child: ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}")
|
|
|
|
|
.toText12(color: workListItemIndex == index ? MyColors.white : MyColors.black),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (pNotificationType != 1) {
|
|
|
|
|
pNotificationType = 1;
|
|
|
|
|
}
|
|
|
|
|
if (workListItemIndex != index && !workListItemTypes[index].disable) {
|
|
|
|
|
workListItemIndex = index;
|
|
|
|
|
if (workListItemTypes[index].value == 0) {
|
|
|
|
|
workList = [];
|
|
|
|
|
itgRequestTypeIndex = null;
|
|
|
|
|
} else {
|
|
|
|
|
workList = null;
|
|
|
|
|
}
|
|
|
|
|
setState(() {});
|
|
|
|
|
if (workListItemTypes[index].value > 0) {
|
|
|
|
|
getWorkList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 8.width,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: workListItemTypes.length,
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21),
|
|
|
|
|
body: workListItemIndex == null
|
|
|
|
|
? Utils.getNoDataWidget(context)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(6), color: workListItemIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor),
|
|
|
|
|
child: ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}")
|
|
|
|
|
.toText12(color: workListItemIndex == index ? MyColors.white : MyColors.black),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (pNotificationType != 1) {
|
|
|
|
|
pNotificationType = 1;
|
|
|
|
|
}
|
|
|
|
|
if (workListItemIndex != index && !workListItemTypes[index].disable) {
|
|
|
|
|
workListItemIndex = index;
|
|
|
|
|
if (workListItemTypes[index].value == 0) {
|
|
|
|
|
workList = [];
|
|
|
|
|
itgRequestTypeIndex = null;
|
|
|
|
|
} else {
|
|
|
|
|
workList = null;
|
|
|
|
|
}
|
|
|
|
|
setState(() {});
|
|
|
|
|
if (workListItemTypes[index].value > 0) {
|
|
|
|
|
getWorkList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 8.width,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: workListItemTypes.length,
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21),
|
|
|
|
|
),
|
|
|
|
|
).paddingOnly(top: 21, bottom: 21),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
workListItemTypes[workListItemIndex!].fullName.toSectionHeading().paddingOnly(left: 21, right: 21),
|
|
|
|
|
LocaleKeys.advancedSearch.tr().toText14(isUnderLine: true, color: MyColors.textMixColor).onPress(() {
|
|
|
|
|
openBottomSheet(context);
|
|
|
|
|
}).paddingOnly(left: 21, right: 21)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SmartRefresher(
|
|
|
|
|
enablePullDown: true,
|
|
|
|
|
enablePullUp: false,
|
|
|
|
|
header: const MaterialClassicHeader(
|
|
|
|
|
color: MyColors.gradiantEndColor,
|
|
|
|
|
),
|
|
|
|
|
controller: _refreshController,
|
|
|
|
|
onRefresh: _onRefresh,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
|
child: itgRequestTypeIndex != null
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// todo this is commented for temporary purpose, have issue when selecting any itg category and click any item showing wrong details
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// 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),
|
|
|
|
|
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,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).paddingOnly(top: 21, bottom: 21),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21),
|
|
|
|
|
LocaleKeys.advancedSearch.tr().toText14(isUnderLine: true, color: MyColors.textMixColor).onPress(() {
|
|
|
|
|
openBottomSheet(context);
|
|
|
|
|
}).paddingOnly(left: 21, right: 21)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SmartRefresher(
|
|
|
|
|
enablePullDown: true,
|
|
|
|
|
enablePullUp: false,
|
|
|
|
|
header: const MaterialClassicHeader(
|
|
|
|
|
color: MyColors.gradiantEndColor,
|
|
|
|
|
),
|
|
|
|
|
controller: _refreshController,
|
|
|
|
|
onRefresh: _onRefresh,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
|
child: itgRequestTypeIndex != null
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// todo this is commented for temporary purpose, have issue when selecting any itg category and click any item showing wrong details
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// 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),
|
|
|
|
|
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,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -350,7 +358,10 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
if (shouldReloadData.toString() == "delegate_reload") {
|
|
|
|
|
providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1;
|
|
|
|
|
calculateCounter();
|
|
|
|
|
getWorkList();
|
|
|
|
|
setState(() {});
|
|
|
|
|
if (workListItemIndex != null) {
|
|
|
|
|
getWorkList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// workList!.remove(data);
|
|
|
|
|
// AppState().setWorkList = workList;
|
|
|
|
|