Merge branch 'master' into Fatima

merge-requests/1/merge
Fatimah Alshammari 2 years ago
commit 48e582af82

@ -14,6 +14,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart';
import 'package:month_picker_dialog/month_picker_dialog.dart';
import 'package:pie_chart/pie_chart.dart';
@ -28,8 +29,6 @@ class MonthlyAttendanceScreen extends StatefulWidget {
}
}
// todo '@fatima' use extension methods for widgets
class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
bool isPresent = false;
bool isAbsent = false;
@ -86,29 +85,25 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
@override
Widget build(BuildContext context) {
Map<String, double> dataMap = {
"Present": getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble() : 0,
"Absent": getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList!.aBSENTDAYS!.toDouble() : 0,
"Present": getTimeCardSummaryList?.aTTENDEDDAYS?.toDouble() ?? 75,
"Absent": getTimeCardSummaryList?.aBSENTDAYS?.toDouble() ?? 25,
};
return Scaffold(
backgroundColor: MyColors.backgroundColor,
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
// title: LocaleKeys.mowadhafhiRequest.tr(),
title: "",
// showHomeButton: true,
),
body: ListView(
scrollDirection: Axis.vertical,
children: [
Column(
children: [
Container(
color: Colors.white,
child: Column(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconButton(
icon: const Icon(
Icons.arrow_back_ios,
color: MyColors.backgroundBlackColor,
),
onPressed: () => Navigator.pop(context),
),
20.height,
LocaleKeys.attendance.tr().toText24(isBold: true, color: MyColors.grey3AColor),
Row(
children: [
@ -133,8 +128,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
18.height,
AspectRatio(aspectRatio: 304 / 244, child: calendarWidget()),
],
).paddingOnly(left: 21, right: 21, top:40),
),
).paddingOnly(left: 21, right: 21, top: 21),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
@ -148,7 +142,10 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
],
).paddingOnly(left: 21, right: 21),
38.height,
Container(
AspectRatio(
aspectRatio: 375 / 226,
child: Container(
padding: const EdgeInsets.only(top: 28, bottom: 28, left: 21, right: 21),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: const BorderRadius.only(
@ -159,7 +156,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
BoxShadow(
offset: const Offset(0, 1),
blurRadius: 26,
color: Color(0xff000014).withOpacity(0.1),
color: MyColors.darkColor.withOpacity(0.1),
),
],
),
@ -181,8 +178,8 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
),
),
7.width,
"${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList?.aTTENDEDDAYS : 0}".toText16(
isBold: true, color: MyColors.lightGreenColor),
"${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList?.aTTENDEDDAYS : 0}"
.toText16(isBold: true, color: MyColors.lightGreenColor),
],
),
8.height,
@ -197,23 +194,27 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
),
),
7.width,
"${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList?.aBSENTDAYS : 0 }".toText16(
isBold: true, color: MyColors.backgroundBlackColor,
"${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList?.aBSENTDAYS : 0}".toText16(
isBold: true,
color: MyColors.backgroundBlackColor,
)
],
),
],
).expanded,
44.width,
AspectRatio(aspectRatio: 1/1,
//44.width,
SizedBox(
height: 170,
width: 170,
child: PieChart(
dataMap: dataMap,
animationDuration: const Duration(milliseconds: 800),
chartLegendSpacing: 0,
chartRadius: MediaQuery.of(context).size.width / 5.2,
colorList: _colorList,
initialAngleInDegree: 0,
initialAngleInDegree: 270,
chartType: ChartType.ring,
emptyColor: MyColors.greyACColor,
ringStrokeWidth: 80,
legendOptions: const LegendOptions(
showLegendsInRow: false,
@ -223,17 +224,20 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
showChartValueBackground: false,
showChartValues: true,
showChartValuesInPercentage: true,
showChartValuesOutside: false,
decimalPlaces: 1,
showChartValuesOutside: true,
decimalPlaces: 0,
chartValueStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
letterSpacing: -0.64,
color: MyColors.white,
)),
),
).expanded,
),
),
),
],
).paddingOnly(left: 21, right: 21, top: 29, bottom: 28),
),
),
),
],
),
@ -298,29 +302,24 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) {
int val = details.date.day;
//check day is off
if(getDayHoursTypeDetailsList.isNotEmpty)
if (getDayHoursTypeDetailsList.isNotEmpty) {
bool isDayIsOff = getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[val - 1].dAYTYPE == 'OFF';
bool isDayIsPresent = getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'Y';
bool isDayIsAbsent = getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[val - 1].aBSENTFLAG == 'Y';
{
if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList?[val - 1].dAYTYPE == 'OFF') {
if (isDayIsOff) {
return Container(
margin: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: MyColors.greyACColor.withOpacity(.12),
shape: BoxShape.circle,
),
decoration: BoxDecoration(color: MyColors.greyACColor.withOpacity(.12), shape: BoxShape.circle),
alignment: Alignment.center,
child: Text(
"$val",
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: MyColors.greyA5Color,
),
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.greyA5Color),
),
);
}
//check day is Present
else if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'Y') {
else if (isDayIsPresent) {
return Container(
margin: const EdgeInsets.all(4),
decoration: BoxDecoration(
@ -342,16 +341,12 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
alignment: Alignment.center,
child: Text(
"$val",
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: MyColors.white,
),
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: MyColors.white),
),
);
}
//check day is Absent
else if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList?[val - 1].aBSENTFLAG == 'Y') {
else if (isDayIsAbsent) {
return Container(
margin: const EdgeInsets.all(4),
decoration: BoxDecoration(
@ -368,11 +363,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
alignment: Alignment.center,
child: Text(
"$val",
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: MyColors.white,
),
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.white),
),
);
}
@ -395,7 +386,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
"$val",
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
fontWeight: FontWeight.w500,
color: Color(0xff1F2428),
),
),
@ -491,8 +482,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
children: [
Container(
width: double.infinity,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white),
decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white),
padding: const EdgeInsets.only(left: 31, right: 31, top: 30, bottom: 29),
child: Column(
children: [
@ -501,7 +491,9 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.actualCheckIn.tr().toText11(color: MyColors.grey67Color,),
LocaleKeys.actualCheckIn.tr().toText11(
color: MyColors.grey67Color,
),
"${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}" != ""
? "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true)
: "__".toText22(color: Colors.black, isBold: true),
@ -510,7 +502,9 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.actualCheckOut.tr().toText11(color: MyColors.grey67Color,),
LocaleKeys.actualCheckOut.tr().toText11(
color: MyColors.grey67Color,
),
"${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}" != ""
? "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true)
: "__".toText22(color: Colors.black, isBold: true),
@ -530,7 +524,9 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.approvedCheckIn.tr().toText11(color: MyColors.grey67Color,),
LocaleKeys.approvedCheckIn.tr().toText11(
color: MyColors.grey67Color,
),
"${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}" != ""
? "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true)
: "__".toText22(color: MyColors.greenColor, isBold: true),
@ -539,7 +535,9 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.approvedCheckOut.tr().toText11(color: MyColors.grey67Color,),
LocaleKeys.approvedCheckOut.tr().toText11(
color: MyColors.grey67Color,
),
"${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}" != ""
? "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true)
: "__".toText22(color: MyColors.greenColor, isBold: true),
@ -559,14 +557,18 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.lateIn.tr().toText11(color: MyColors.grey67Color,),
LocaleKeys.lateIn.tr().toText11(
color: MyColors.grey67Color,
),
"${getDayHoursTypeDetailsList[index].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true),
],
).expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.excess.tr().toText11(color: MyColors.grey67Color,),
LocaleKeys.excess.tr().toText11(
color: MyColors.grey67Color,
),
"${getDayHoursTypeDetailsList[index].eXCESSHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true),
],
).expanded,
@ -584,14 +586,18 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.shortage.tr().toText11(color: MyColors.grey67Color,),
LocaleKeys.shortage.tr().toText11(
color: MyColors.grey67Color,
),
"${getDayHoursTypeDetailsList[index].sHORTAGEHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true),
],
).expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.earlyOut.tr().toText11(color: MyColors.grey67Color,),
LocaleKeys.earlyOut.tr().toText11(
color: MyColors.grey67Color,
),
"${getDayHoursTypeDetailsList[index].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true),
],
).expanded,

@ -35,8 +35,8 @@ class _ViewAttendanceState extends State<ViewAttendance> {
int searchYear = DateTime.now().year;
int? pRTPID;
String searchEmpEmail ="";
String searchEmpName ="";
String searchEmpEmail = "";
String searchEmpName = "";
String searchEmpNo = "";
String? empId;
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
@ -52,12 +52,11 @@ class _ViewAttendanceState extends State<ViewAttendance> {
callTimeCardAndHourDetails(date.day, searchMonth, searchYear);
}
void callTimeCardAndHourDetails(index, searchMonth, searchYear) async {
try {
Utils.showLoading(context);
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
getTimeCardSummaryList = await MyTeamApiClient().getTimeCardSummary(searchMonth, searchYear,getEmployeeSubordinates?.eMPLOYEENUMBER);
getTimeCardSummaryList = await MyTeamApiClient().getTimeCardSummary(searchMonth, searchYear, getEmployeeSubordinates?.eMPLOYEENUMBER);
getDayHoursTypeDetailsList = await MyTeamApiClient().getDayHoursTypeDetails(searchMonth, searchYear, getEmployeeSubordinates?.eMPLOYEENUMBER);
attendanceTracking = await MyTeamApiClient().getAttendanceTracking(getEmployeeSubordinates?.eMPLOYEENUMBER);
Utils.hideLoading(context);
@ -69,8 +68,6 @@ class _ViewAttendanceState extends State<ViewAttendance> {
}
}
final CalendarController _calendarController = CalendarController();
final List<Color> _colorList = [Color(0xff2AB2AB), Color(0xff202529)];
@ -103,11 +100,11 @@ class _ViewAttendanceState extends State<ViewAttendance> {
crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Column( crossAxisAlignment: CrossAxisAlignment.start,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.checkIn.tr().toText10(color: MyColors.green69Color),
"${(attendanceTracking?.pSwipeIn)?? "- - : - -"}".toText14(color: MyColors.grey57Color),
"${(attendanceTracking?.pSwipeIn) ?? "- - : - -"}".toText14(color: MyColors.grey57Color),
],
).expanded,
Row(
@ -117,7 +114,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
Column(
children: [
LocaleKeys.checkOut.tr().toText10(color: MyColors.redA3Color),
"${(attendanceTracking?.pSwipeOut)?? "- - : - -"}".toText14( color: MyColors.grey57Color),
"${(attendanceTracking?.pSwipeOut) ?? "- - : - -"}".toText14(color: MyColors.grey57Color),
],
),
],
@ -129,7 +126,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
Column(
children: [
LocaleKeys.lateIn.tr().toText10(color: MyColors.darkGreyColor),
"${(attendanceTracking?.pLateInHours)?? "- - : - -"}".toText14(color: MyColors.grey57Color),
"${(attendanceTracking?.pLateInHours) ?? "- - : - -"}".toText14(color: MyColors.grey57Color),
],
),
],
@ -137,7 +134,10 @@ class _ViewAttendanceState extends State<ViewAttendance> {
],
)
],
).paddingOnly(top:15, left: 14, right: 14, bottom: 20).objectContainerView(disablePadding: true, radius: 10,),
).paddingOnly(top: 15, left: 14, right: 14, bottom: 20).objectContainerView(
disablePadding: true,
radius: 10,
),
12.height,
Column(
children: [
@ -146,21 +146,25 @@ class _ViewAttendanceState extends State<ViewAttendance> {
"${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.grey3AColor),
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.grey3AColor),
],
).onPress(() async {
).onPress(
() async {
showMonthPicker(
context: context, //locale: EasyLocalization.of(context)?.locale,
initialDate: formattedDate,
firstDate: DateTime(searchYear - 2),
lastDate: DateTime.now(),
).then((selectedDate) {
).then(
(selectedDate) {
if (selectedDate != null) {
searchMonth = getMonth(selectedDate.month);
searchYear = selectedDate.year;
formattedDate = selectedDate; //DateFormat('MMMM-yyyy').format(selectedDate);
callTimeCardAndHourDetails(selectedDate.day, searchMonth, searchYear);
}
});
}),
},
);
},
),
8.height,
AspectRatio(aspectRatio: 304 / 244, child: calendarWidget()),
// 45.height,
@ -182,8 +186,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
),
),
7.width,
"${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList?.aTTENDEDDAYS : 0}".toText16(
isBold: true, color: MyColors.lightGreenColor),
"${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS ?? 0}".toText16(isBold: true, color: MyColors.lightGreenColor),
],
),
8.height,
@ -198,15 +201,17 @@ class _ViewAttendanceState extends State<ViewAttendance> {
),
),
7.width,
"${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList?.aBSENTDAYS : 0 }".toText16(
isBold: true, color: MyColors.backgroundBlackColor,
"${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS ?? 0}".toText16(
isBold: true,
color: MyColors.backgroundBlackColor,
)
],
),
],
).expanded,
44.width,
AspectRatio(aspectRatio: 1/1,
AspectRatio(
aspectRatio: 1 / 1,
child: PieChart(
dataMap: dataMap,
animationDuration: const Duration(milliseconds: 800),
@ -236,11 +241,11 @@ class _ViewAttendanceState extends State<ViewAttendance> {
],
),
],
).paddingOnly(top:17, left: 14, right: 14, bottom: 35).objectContainerView(disablePadding: true, radius: 10,),
]
).paddingOnly(top: 17, left: 14, right: 14, bottom: 35).objectContainerView(disablePadding: true, radius: 10),
],
),
),
]
],
),
);
}
@ -383,7 +388,6 @@ class _ViewAttendanceState extends State<ViewAttendance> {
);
}
List<Meeting> _getDataSource() {
List<Meeting> meetings = <Meeting>[];
return meetings;

Loading…
Cancel
Save