|
|
|
|
@ -62,14 +62,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
key: 'POAPPRV',
|
|
|
|
|
disable: false),
|
|
|
|
|
WorkListItemTypeModelData(
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'ITG',
|
|
|
|
|
fullName: LocaleKeys.ITGForms.tr(),
|
|
|
|
|
active: false,
|
|
|
|
|
color: [Color(0xffEB8C90), Color(0xffDE6C70)],
|
|
|
|
|
icon: "assets/images/miss_swipe.svg",
|
|
|
|
|
key: 'ITG',
|
|
|
|
|
disable: false),
|
|
|
|
|
value: 0, name: 'ITG', fullName: LocaleKeys.ITGForms.tr(), active: false, color: [Color(0xffEB8C90), Color(0xffDE6C70)], icon: "assets/images/miss_swipe.svg", key: 'ITG', disable: false),
|
|
|
|
|
WorkListItemTypeModelData(
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'IC',
|
|
|
|
|
@ -80,23 +73,9 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
key: 'INVITEM',
|
|
|
|
|
disable: false),
|
|
|
|
|
WorkListItemTypeModelData(
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'STAMP',
|
|
|
|
|
fullName: LocaleKeys.stamp.tr(),
|
|
|
|
|
active: false,
|
|
|
|
|
color: [Color(0xff32D892), Color(0xff1AB170)],
|
|
|
|
|
icon: "assets/images/miss_swipe.svg",
|
|
|
|
|
key: 'STAMP',
|
|
|
|
|
disable: false),
|
|
|
|
|
value: 0, name: 'STAMP', fullName: LocaleKeys.stamp.tr(), active: false, color: [Color(0xff32D892), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'STAMP', disable: false),
|
|
|
|
|
WorkListItemTypeModelData(
|
|
|
|
|
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)
|
|
|
|
|
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;
|
|
|
|
|
@ -111,7 +90,6 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
|
|
providerData = Provider.of<DashboardProviderModel>(context, listen: false);
|
|
|
|
|
calculateCounter();
|
|
|
|
|
getWorkList();
|
|
|
|
|
@ -124,10 +102,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
} else if (workListElement.key == "COC") {
|
|
|
|
|
workListElement.value = providerData.cocFinalCount;
|
|
|
|
|
} else {
|
|
|
|
|
var tempList = providerData.getOpenNotificationsList
|
|
|
|
|
?.where((notificationElement) =>
|
|
|
|
|
notificationElement.itemType == workListElement.key)
|
|
|
|
|
.toList();
|
|
|
|
|
var tempList = providerData.getOpenNotificationsList?.where((notificationElement) => notificationElement.itemType == workListElement.key).toList();
|
|
|
|
|
if (tempList!.isNotEmpty) {
|
|
|
|
|
workListElement.value = tempList.first.openNtfNumber ?? 0;
|
|
|
|
|
}
|
|
|
|
|
@ -138,47 +113,50 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
ItgFormsModel? itgFormsModel;
|
|
|
|
|
int? itgRequestTypeIndex;
|
|
|
|
|
|
|
|
|
|
void getWorkList() async {
|
|
|
|
|
Future<void> getWorkList({bool showLoading = true}) async {
|
|
|
|
|
try {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
if (showLoading) Utils.showLoading(context);
|
|
|
|
|
if (workListItemTypes[workListItemIndex].key == "ITG") {
|
|
|
|
|
itgFormsModel = await WorkListApiClient().getITGTaskCountRequestType();
|
|
|
|
|
List<RequestDetails> requestAllList = [];
|
|
|
|
|
for (int i = 0; i < (itgFormsModel?.requestType!.length ?? 0); i++) {
|
|
|
|
|
itgFormsModel?.requestType![i].requestDetails?.forEach((element) {
|
|
|
|
|
element.requestType =
|
|
|
|
|
itgFormsModel?.requestType![i].requestTypeCode;
|
|
|
|
|
element.requestType = itgFormsModel?.requestType![i].requestTypeCode;
|
|
|
|
|
});
|
|
|
|
|
requestAllList = requestAllList +
|
|
|
|
|
(itgFormsModel?.requestType![i].requestDetails ?? []);
|
|
|
|
|
requestAllList = requestAllList + (itgFormsModel?.requestType![i].requestDetails ?? []);
|
|
|
|
|
}
|
|
|
|
|
AppState().setRequestAllList = requestAllList;
|
|
|
|
|
itgFormsModel?.requestType!.insert(
|
|
|
|
|
0,
|
|
|
|
|
RequestType(
|
|
|
|
|
requestDetails: requestAllList,
|
|
|
|
|
requestTypeCode: "all",
|
|
|
|
|
requestTypeName: "All"));
|
|
|
|
|
itgFormsModel?.requestType!.insert(0, RequestType(requestDetails: requestAllList, requestTypeCode: "all", requestTypeName: "All"));
|
|
|
|
|
if ((itgFormsModel?.requestType?.length ?? 0) > 0) {
|
|
|
|
|
itgRequestTypeIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
itgRequestTypeIndex = null;
|
|
|
|
|
workList = await WorkListApiClient()
|
|
|
|
|
.getWorkList(pageNumber, workListItemTypes[workListItemIndex].key);
|
|
|
|
|
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key);
|
|
|
|
|
AppState().setWorkList = workList;
|
|
|
|
|
}
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
if (showLoading) Utils.hideLoading(context);
|
|
|
|
|
if (showLoading) setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
if (showLoading) Utils.hideLoading(context);
|
|
|
|
|
if (showLoading) Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _onRefresh() async {
|
|
|
|
|
getWorkList();
|
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
|
try {
|
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
List dataOnRefresh = await Future.wait([
|
|
|
|
|
providerData.fetchWorkListCounter(context, showLoading: false),
|
|
|
|
|
getWorkList(showLoading: false),
|
|
|
|
|
]);
|
|
|
|
|
calculateCounter();
|
|
|
|
|
setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -207,23 +185,13 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 21, right: 21, top: 8, bottom: 8),
|
|
|
|
|
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),
|
|
|
|
|
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 (workListItemIndex != index &&
|
|
|
|
|
!workListItemTypes[index].disable) {
|
|
|
|
|
if (workListItemIndex != index && !workListItemTypes[index].disable) {
|
|
|
|
|
workListItemIndex = index;
|
|
|
|
|
if (workListItemTypes[index].value == 0) {
|
|
|
|
|
workList = [];
|
|
|
|
|
@ -316,17 +284,14 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget itgRowItem(WorkListItemTypeModelData data,
|
|
|
|
|
RequestDetails requestDetails, int index) {
|
|
|
|
|
Widget itgRowItem(WorkListItemTypeModelData data, RequestDetails requestDetails, int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
AppState().setItgWorkListIndex = index;
|
|
|
|
|
var shouldReloadData =
|
|
|
|
|
await Navigator.pushNamed(context, AppRoutes.itgDetail);
|
|
|
|
|
var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.itgDetail);
|
|
|
|
|
if (shouldReloadData != null) {
|
|
|
|
|
if (shouldReloadData.toString() == "delegate_reload") {
|
|
|
|
|
providerData.itgFormsModel!.totalCount =
|
|
|
|
|
providerData.itgFormsModel!.totalCount! - 1;
|
|
|
|
|
providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1;
|
|
|
|
|
calculateCounter();
|
|
|
|
|
getWorkList();
|
|
|
|
|
}
|
|
|
|
|
@ -350,8 +315,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
|
|
|
|
|
padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
@ -370,20 +334,11 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
transform: GradientRotation(.218),
|
|
|
|
|
begin: Alignment.topRight,
|
|
|
|
|
end: Alignment.bottomRight,
|
|
|
|
|
colors: data.color),
|
|
|
|
|
gradient: LinearGradient(transform: GradientRotation(.218), begin: Alignment.topRight, end: Alignment.bottomRight, colors: data.color),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
SvgPicture.asset("assets/images/miss_swipe.svg",
|
|
|
|
|
width: 20, height: 20, color: Colors.white),
|
|
|
|
|
2.height,
|
|
|
|
|
data.name.toText10(color: Colors.white)
|
|
|
|
|
],
|
|
|
|
|
children: [SvgPicture.asset("assets/images/miss_swipe.svg", width: 20, height: 20, color: Colors.white), 2.height, data.name.toText10(color: Colors.white)],
|
|
|
|
|
).paddingAll(6),
|
|
|
|
|
),
|
|
|
|
|
8.width,
|
|
|
|
|
@ -409,15 +364,12 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData,
|
|
|
|
|
int index) {
|
|
|
|
|
Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
AppState().setWorkListIndex = index;
|
|
|
|
|
var data = workList![index];
|
|
|
|
|
var shouldReloadData = await Navigator.pushNamed(
|
|
|
|
|
context, AppRoutes.workListDetail,
|
|
|
|
|
arguments: workData);
|
|
|
|
|
var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.workListDetail, arguments: workData);
|
|
|
|
|
if (shouldReloadData != null) {
|
|
|
|
|
if (shouldReloadData.toString() == "delegate_reload") {
|
|
|
|
|
calculateCounter();
|
|
|
|
|
@ -442,8 +394,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
|
|
|
|
|
padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
@ -462,20 +413,11 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
transform: GradientRotation(.218),
|
|
|
|
|
begin: Alignment.topRight,
|
|
|
|
|
end: Alignment.bottomRight,
|
|
|
|
|
colors: data.color),
|
|
|
|
|
gradient: LinearGradient(transform: GradientRotation(.218), begin: Alignment.topRight, end: Alignment.bottomRight, colors: data.color),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
SvgPicture.asset("assets/images/miss_swipe.svg",
|
|
|
|
|
width: 20, height: 20, color: Colors.white),
|
|
|
|
|
2.height,
|
|
|
|
|
data.name.toText10(color: Colors.white)
|
|
|
|
|
],
|
|
|
|
|
children: [SvgPicture.asset("assets/images/miss_swipe.svg", width: 20, height: 20, color: Colors.white), 2.height, data.name.toText10(color: Colors.white)],
|
|
|
|
|
).paddingAll(6),
|
|
|
|
|
),
|
|
|
|
|
8.width,
|
|
|
|
|
|