|
|
|
@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
|
|
|
|
import 'package:mohem_flutter_app/classes/date_uitl.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
@ -28,7 +29,7 @@ class ApprovalLevelfragment extends StatelessWidget {
|
|
|
|
itemCount: wFHistory.length,
|
|
|
|
itemCount: wFHistory.length,
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return showItem(context, wFHistory[index]);
|
|
|
|
return showItem(context, wFHistory[index], index);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
return 12.height;
|
|
|
|
return 12.height;
|
|
|
|
@ -37,7 +38,7 @@ class ApprovalLevelfragment extends StatelessWidget {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget showItem(BuildContext context, WFHistory history) {
|
|
|
|
Widget showItem(BuildContext context, WFHistory history, int index) {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
@ -89,7 +90,9 @@ class ApprovalLevelfragment extends StatelessWidget {
|
|
|
|
8.width,
|
|
|
|
8.width,
|
|
|
|
if (history.date!.isNotEmpty) history.date!.toText12(color: MyColors.lightTextColor),
|
|
|
|
if (history.date!.isNotEmpty) history.date!.toText12(color: MyColors.lightTextColor),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
10.height,
|
|
|
|
|
|
|
|
getActionDuration(index).toText11(maxLine: 1, color: const Color(0xff1FA269))
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -143,8 +146,34 @@ class ApprovalLevelfragment extends StatelessWidget {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String getActionDuration(int index) {
|
|
|
|
|
|
|
|
if (wFHistory[index].action!.toLowerCase() == "submit" || wFHistory[index].action!.toLowerCase() == "submitted") {
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
// DateTime dateTimeFrom = DateUtil.convertSimpleStringDateToDate(wFHistory[index].date!);
|
|
|
|
|
|
|
|
// Duration duration = DateTime.now().difference(dateTimeFrom);
|
|
|
|
|
|
|
|
// return "Action duration: " + DateUtil.formatDuration(duration);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (wFHistory[index].employeeID == AppState().memberInformationList?.eMPLOYEENUMBER) {
|
|
|
|
|
|
|
|
// if (wFHistory[index + 1].date!.isEmpty) {
|
|
|
|
|
|
|
|
// return "";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
DateTime dateTimeFrom = DateUtil.convertSimpleStringDateToDate(wFHistory[index + 1].date!, isITG: true);
|
|
|
|
|
|
|
|
Duration duration = DateTime.now().difference(dateTimeFrom);
|
|
|
|
|
|
|
|
return "Action duration: " + DateUtil.formatDuration(duration);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (wFHistory[index].date!.isEmpty || wFHistory[index].action!.toLowerCase() == "NO ACTION") {
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
DateTime dateTimeTo = DateUtil.convertSimpleStringDateToDate(wFHistory[index].date!);
|
|
|
|
|
|
|
|
DateTime dateTimeFrom = DateUtil.convertSimpleStringDateToDate(wFHistory[index + 1].date!);
|
|
|
|
|
|
|
|
Duration duration = dateTimeTo.difference(dateTimeFrom);
|
|
|
|
|
|
|
|
return "Action duration: " + DateUtil.formatDuration(duration);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Color getStatusColor(String code) {
|
|
|
|
Color getStatusColor(String code) {
|
|
|
|
if (code.toLowerCase() == "submit") {
|
|
|
|
if (code.toLowerCase() == "submit" || code.toLowerCase() == "submitted") {
|
|
|
|
return MyColors.grey3AColor;
|
|
|
|
return MyColors.grey3AColor;
|
|
|
|
} else if (code.toLowerCase() == "pending") {
|
|
|
|
} else if (code.toLowerCase() == "pending") {
|
|
|
|
return MyColors.yellowColor;
|
|
|
|
return MyColors.yellowColor;
|
|
|
|
@ -152,7 +181,7 @@ class ApprovalLevelfragment extends StatelessWidget {
|
|
|
|
return MyColors.redColor;
|
|
|
|
return MyColors.redColor;
|
|
|
|
} else if (code.toLowerCase() == "approved" || code.toLowerCase() == "auto-approve" || code.toLowerCase() == "auto-approved" || code.toLowerCase() == "doable" || code.toLowerCase() == "answer") {
|
|
|
|
} else if (code.toLowerCase() == "approved" || code.toLowerCase() == "auto-approve" || code.toLowerCase() == "auto-approved" || code.toLowerCase() == "doable" || code.toLowerCase() == "answer") {
|
|
|
|
return MyColors.greenColor;
|
|
|
|
return MyColors.greenColor;
|
|
|
|
} else if (code.toLowerCase() == "requested information" || code.toLowerCase() == "assign" || code.toLowerCase() == "reassign") {
|
|
|
|
} else if (code.toLowerCase() == "requested information" || code.toLowerCase() == "request information" || code.toLowerCase() == "assign" || code.toLowerCase() == "reassign") {
|
|
|
|
return MyColors.orange;
|
|
|
|
return MyColors.orange;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return MyColors.whiteColor;
|
|
|
|
return MyColors.whiteColor;
|
|
|
|
|