|
|
|
|
@ -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,7 +222,9 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
appBar: AppBarWidget(context, title: LocaleKeys.workList.tr(), showWorkListSettingButton: true),
|
|
|
|
|
body: SizedBox(
|
|
|
|
|
body: workListItemIndex == null
|
|
|
|
|
? Utils.getNoDataWidget(context)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
@ -262,7 +270,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21),
|
|
|
|
|
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)
|
|
|
|
|
@ -311,7 +319,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return itgRowItem(workListItemTypes[workListItemIndex], itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails![index], index);
|
|
|
|
|
return itgRowItem(workListItemTypes[workListItemIndex!], itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails![index], index);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
itemCount: itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails?.length ?? 0,
|
|
|
|
|
@ -326,7 +334,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return rowItem(workListItemTypes[workListItemIndex], workList![index], index);
|
|
|
|
|
return rowItem(workListItemTypes[workListItemIndex!], workList![index], index);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
itemCount: workList?.length ?? 0,
|
|
|
|
|
@ -350,8 +358,11 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
if (shouldReloadData.toString() == "delegate_reload") {
|
|
|
|
|
providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1;
|
|
|
|
|
calculateCounter();
|
|
|
|
|
setState(() {});
|
|
|
|
|
if (workListItemIndex != null) {
|
|
|
|
|
getWorkList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// workList!.remove(data);
|
|
|
|
|
// AppState().setWorkList = workList;
|
|
|
|
|
// if (data.iTEMTYPE == "ITG") {
|
|
|
|
|
|