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_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_schedule_shifts_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_time_card_summary_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:mohem_flutter_app/widgets/circular_step_progress_bar.dart';
import 'package:month_picker_dialog/month_picker_dialog.dart'; import 'package:month_picker_dialog/month_picker_dialog.dart';
import 'package:pie_chart/pie_chart.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> { class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
bool isPresent = false; bool isPresent = false;
bool isAbsent = false; bool isAbsent = false;
@ -86,55 +85,50 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Map<String, double> dataMap = { Map<String, double> dataMap = {
"Present": getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble() : 0, "Present": getTimeCardSummaryList?.aTTENDEDDAYS?.toDouble() ?? 75,
"Absent": getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList!.aBSENTDAYS!.toDouble() : 0, "Absent": getTimeCardSummaryList?.aBSENTDAYS?.toDouble() ?? 25,
}; };
return Scaffold( return Scaffold(
backgroundColor: MyColors.backgroundColor, backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
// title: LocaleKeys.mowadhafhiRequest.tr(),
title: "",
// showHomeButton: true,
),
body: ListView( body: ListView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
children: [ children: [
Column( Column(
children: [ children: [
Container( Column(
color: Colors.white, crossAxisAlignment: CrossAxisAlignment.start,
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, LocaleKeys.attendance.tr().toText24(isBold: true, color: MyColors.grey3AColor),
children: [ Row(
IconButton( children: [
icon: const Icon( "${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.greyACColor),
Icons.arrow_back_ios, const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor),
color: MyColors.backgroundBlackColor, ],
), ).onPress(() async {
onPressed: () => Navigator.pop(context), showMonthPicker(
), context: context, //locale: EasyLocalization.of(context)?.locale,
20.height, initialDate: formattedDate,
LocaleKeys.attendance.tr().toText24(isBold: true, color: MyColors.grey3AColor), firstDate: DateTime(searchYear - 2),
Row( lastDate: DateTime.now(),
children: [ ).then((selectedDate) {
"${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.greyACColor), if (selectedDate != null) {
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), searchMonth = getMonth(selectedDate.month);
], searchYear = selectedDate.year;
).onPress(() async { formattedDate = selectedDate; //DateFormat('MMMM-yyyy').format(selectedDate);
showMonthPicker( callTimeCardAndHourDetails(selectedDate.day, searchMonth, searchYear);
context: context, //locale: EasyLocalization.of(context)?.locale, }
initialDate: formattedDate, });
firstDate: DateTime(searchYear - 2), }),
lastDate: DateTime.now(), 18.height,
).then((selectedDate) { AspectRatio(aspectRatio: 304 / 244, child: calendarWidget()),
if (selectedDate != null) { ],
searchMonth = getMonth(selectedDate.month); ).paddingOnly(left: 21, right: 21, top: 21),
searchYear = selectedDate.year;
formattedDate = selectedDate; //DateFormat('MMMM-yyyy').format(selectedDate);
callTimeCardAndHourDetails(selectedDate.day, searchMonth, searchYear);
}
});
}),
18.height,
AspectRatio(aspectRatio: 304 / 244, child: calendarWidget()),
],
).paddingOnly(left: 21, right: 21, top:40),
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
@ -148,92 +142,102 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
], ],
).paddingOnly(left: 21, right: 21), ).paddingOnly(left: 21, right: 21),
38.height, 38.height,
Container( AspectRatio(
decoration: BoxDecoration( aspectRatio: 375 / 226,
color: Colors.white, child: Container(
borderRadius: const BorderRadius.only( padding: const EdgeInsets.only(top: 28, bottom: 28, left: 21, right: 21),
topLeft: Radius.circular(25.0), decoration: BoxDecoration(
topRight: Radius.circular(25.0), color: Colors.white,
), borderRadius: const BorderRadius.only(
boxShadow: [ topLeft: Radius.circular(25.0),
BoxShadow( topRight: Radius.circular(25.0),
offset: const Offset(0, 1),
blurRadius: 26,
color: Color(0xff000014).withOpacity(0.1),
), ),
], boxShadow: [
), BoxShadow(
child: Row( offset: const Offset(0, 1),
children: [ blurRadius: 26,
Column( color: MyColors.darkColor.withOpacity(0.1),
crossAxisAlignment: CrossAxisAlignment.start, ),
children: <Widget>[ ],
"${LocaleKeys.attendance.tr()} ${LocaleKeys.stats.tr()}".toSectionHeading(), ),
29.height, child: Row(
Row( children: [
children: [ Column(
Container( crossAxisAlignment: CrossAxisAlignment.start,
height: 9, children: <Widget>[
width: 9, "${LocaleKeys.attendance.tr()} ${LocaleKeys.stats.tr()}".toSectionHeading(),
decoration: BoxDecoration( 29.height,
color: MyColors.lightGreenColor, Row(
borderRadius: BorderRadius.circular(100), children: [
Container(
height: 9,
width: 9,
decoration: BoxDecoration(
color: MyColors.lightGreenColor,
borderRadius: BorderRadius.circular(100),
),
), ),
), 7.width,
7.width, "${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList?.aTTENDEDDAYS : 0}"
"${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList?.aTTENDEDDAYS : 0}".toText16( .toText16(isBold: true, color: MyColors.lightGreenColor),
isBold: true, color: MyColors.lightGreenColor), ],
], ),
), 8.height,
8.height, Row(
Row( children: [
children: [ Container(
Container( height: 9,
height: 9, width: 9,
width: 9, decoration: BoxDecoration(
decoration: BoxDecoration( color: MyColors.backgroundBlackColor,
color: MyColors.backgroundBlackColor, borderRadius: BorderRadius.circular(100),
borderRadius: BorderRadius.circular(100), ),
), ),
), 7.width,
7.width, "${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList?.aBSENTDAYS : 0}".toText16(
"${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList?.aBSENTDAYS : 0 }".toText16( isBold: true,
isBold: true, color: MyColors.backgroundBlackColor, color: MyColors.backgroundBlackColor,
) )
], ],
), ),
], ],
).expanded, ).expanded,
44.width, //44.width,
AspectRatio(aspectRatio: 1/1, SizedBox(
child: PieChart( height: 170,
dataMap: dataMap, width: 170,
animationDuration: const Duration(milliseconds: 800), child: PieChart(
chartLegendSpacing: 0, dataMap: dataMap,
chartRadius: MediaQuery.of(context).size.width / 5.2, animationDuration: const Duration(milliseconds: 800),
colorList: _colorList, chartLegendSpacing: 0,
initialAngleInDegree: 0, chartRadius: MediaQuery.of(context).size.width / 5.2,
chartType: ChartType.ring, colorList: _colorList,
ringStrokeWidth: 80, initialAngleInDegree: 270,
legendOptions: const LegendOptions( chartType: ChartType.ring,
showLegendsInRow: false, emptyColor: MyColors.greyACColor,
showLegends: false, ringStrokeWidth: 80,
), legendOptions: const LegendOptions(
chartValuesOptions: const ChartValuesOptions( showLegendsInRow: false,
showLegends: false,
),
chartValuesOptions: const ChartValuesOptions(
showChartValueBackground: false, showChartValueBackground: false,
showChartValues: true, showChartValues: true,
showChartValuesInPercentage: true, showChartValuesInPercentage: true,
showChartValuesOutside: false, showChartValuesOutside: true,
decimalPlaces: 1, decimalPlaces: 0,
chartValueStyle: TextStyle( chartValueStyle: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 16, fontSize: 16,
letterSpacing: -0.64,
color: MyColors.white, color: MyColors.white,
)), ),
),
),
), ),
).expanded, ],
], ),
).paddingOnly(left: 21, right: 21, top: 29, bottom: 28), ),
), ),
], ],
), ),
@ -298,85 +302,72 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) { if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) {
int val = details.date.day; int val = details.date.day;
//check day is off //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 (isDayIsOff) {
if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList?[val - 1].dAYTYPE == 'OFF') { return Container(
return Container( margin: const EdgeInsets.all(4),
margin: const EdgeInsets.all(4), decoration: BoxDecoration(color: MyColors.greyACColor.withOpacity(.12), shape: BoxShape.circle),
decoration: BoxDecoration( alignment: Alignment.center,
color: MyColors.greyACColor.withOpacity(.12), child: Text(
shape: BoxShape.circle, "$val",
), style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.greyA5Color),
alignment: Alignment.center, ),
child: Text( );
"$val", }
style: const TextStyle( //check day is Present
fontSize: 13, else if (isDayIsPresent) {
fontWeight: FontWeight.w500, return Container(
color: MyColors.greyA5Color, margin: const EdgeInsets.all(4),
), decoration: BoxDecoration(
), gradient: const LinearGradient(
); transform: GradientRotation(.46),
} begin: Alignment.topRight,
//check day is Present end: Alignment.bottomLeft,
else if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'Y') { colors: [MyColors.gradiantEndColor, MyColors.gradiantStartColor],
return Container(
margin: const EdgeInsets.all(4),
decoration: BoxDecoration(
gradient: const LinearGradient(
transform: GradientRotation(.46),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [MyColors.gradiantEndColor, MyColors.gradiantStartColor],
),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
offset: const Offset(0, 2),
blurRadius: 26,
color: MyColors.blackColor.withOpacity(0.100),
),
],
), ),
alignment: Alignment.center, shape: BoxShape.circle,
child: Text( boxShadow: [
"$val", BoxShadow(
style: const TextStyle( offset: const Offset(0, 2),
fontSize: 12, blurRadius: 26,
fontWeight: FontWeight.w500, color: MyColors.blackColor.withOpacity(0.100),
color: MyColors.white,
), ),
), ],
); ),
} alignment: Alignment.center,
//check day is Absent child: Text(
else if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList?[val - 1].aBSENTFLAG == 'Y') { "$val",
return Container( style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: MyColors.white),
margin: const EdgeInsets.all(4), ),
decoration: BoxDecoration( );
color: MyColors.backgroundBlackColor, }
shape: BoxShape.circle, //check day is Absent
boxShadow: [ else if (isDayIsAbsent) {
BoxShadow( return Container(
offset: const Offset(0, 2), margin: const EdgeInsets.all(4),
blurRadius: 26, decoration: BoxDecoration(
color: MyColors.blackColor.withOpacity(0.100), color: MyColors.backgroundBlackColor,
), shape: BoxShape.circle,
], boxShadow: [
), BoxShadow(
alignment: Alignment.center, offset: const Offset(0, 2),
child: Text( blurRadius: 26,
"$val", color: MyColors.blackColor.withOpacity(0.100),
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: MyColors.white,
), ),
), ],
); ),
} alignment: Alignment.center,
child: Text(
"$val",
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.white),
),
);
} }
}
return Container( return Container(
margin: const EdgeInsets.all(4), margin: const EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -395,7 +386,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
"$val", "$val",
style: const TextStyle( style: const TextStyle(
fontSize: 13, fontSize: 13,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w500,
color: Color(0xff1F2428), color: Color(0xff1F2428),
), ),
), ),
@ -491,8 +482,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
children: [ children: [
Container( Container(
width: double.infinity, width: double.infinity,
decoration: const BoxDecoration( decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white),
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), padding: const EdgeInsets.only(left: 31, right: 31, top: 30, bottom: 29),
child: Column( child: Column(
children: [ children: [
@ -501,16 +491,20 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.actualCheckIn.tr().toText11(color: MyColors.grey67Color,), LocaleKeys.actualCheckIn.tr().toText11(
color: MyColors.grey67Color,
),
"${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}" != "" "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}" != ""
? "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true) ? "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true)
: "__".toText22(color: Colors.black, isBold: true), : "__".toText22(color: Colors.black, isBold: true),
], ],
).expanded, ).expanded,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.actualCheckOut.tr().toText11(color: MyColors.grey67Color,), LocaleKeys.actualCheckOut.tr().toText11(
color: MyColors.grey67Color,
),
"${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}" != "" "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}" != ""
? "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true) ? "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true)
: "__".toText22(color: Colors.black, isBold: true), : "__".toText22(color: Colors.black, isBold: true),
@ -530,7 +524,9 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.approvedCheckIn.tr().toText11(color: MyColors.grey67Color,), LocaleKeys.approvedCheckIn.tr().toText11(
color: MyColors.grey67Color,
),
"${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}" != "" "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}" != ""
? "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true) ? "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true)
: "__".toText22(color: MyColors.greenColor, isBold: true), : "__".toText22(color: MyColors.greenColor, isBold: true),
@ -539,7 +535,9 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.approvedCheckOut.tr().toText11(color: MyColors.grey67Color,), LocaleKeys.approvedCheckOut.tr().toText11(
color: MyColors.grey67Color,
),
"${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}" != "" "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}" != ""
? "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true) ? "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true)
: "__".toText22(color: MyColors.greenColor, isBold: true), : "__".toText22(color: MyColors.greenColor, isBold: true),
@ -559,15 +557,19 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.lateIn.tr().toText11(color: MyColors.grey67Color,), LocaleKeys.lateIn.tr().toText11(
color: MyColors.grey67Color,
),
"${getDayHoursTypeDetailsList[index].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true), "${getDayHoursTypeDetailsList[index].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true),
], ],
).expanded, ).expanded,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.excess.tr().toText11(color: MyColors.grey67Color,), LocaleKeys.excess.tr().toText11(
"${getDayHoursTypeDetailsList[index].eXCESSHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true), color: MyColors.grey67Color,
),
"${getDayHoursTypeDetailsList[index].eXCESSHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true),
], ],
).expanded, ).expanded,
], ],
@ -584,14 +586,18 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.shortage.tr().toText11(color: MyColors.grey67Color,), LocaleKeys.shortage.tr().toText11(
color: MyColors.grey67Color,
),
"${getDayHoursTypeDetailsList[index].sHORTAGEHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true), "${getDayHoursTypeDetailsList[index].sHORTAGEHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true),
], ],
).expanded, ).expanded,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.earlyOut.tr().toText11(color: MyColors.grey67Color,), LocaleKeys.earlyOut.tr().toText11(
color: MyColors.grey67Color,
),
"${getDayHoursTypeDetailsList[index].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true), "${getDayHoursTypeDetailsList[index].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true),
], ],
).expanded, ).expanded,

@ -35,8 +35,8 @@ class _ViewAttendanceState extends State<ViewAttendance> {
int searchYear = DateTime.now().year; int searchYear = DateTime.now().year;
int? pRTPID; int? pRTPID;
String searchEmpEmail =""; String searchEmpEmail = "";
String searchEmpName =""; String searchEmpName = "";
String searchEmpNo = ""; String searchEmpNo = "";
String? empId; String? empId;
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = []; List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
@ -52,12 +52,11 @@ class _ViewAttendanceState extends State<ViewAttendance> {
callTimeCardAndHourDetails(date.day, searchMonth, searchYear); callTimeCardAndHourDetails(date.day, searchMonth, searchYear);
} }
void callTimeCardAndHourDetails(index, searchMonth, searchYear) async { void callTimeCardAndHourDetails(index, searchMonth, searchYear) async {
try { try {
Utils.showLoading(context); Utils.showLoading(context);
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); 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); getDayHoursTypeDetailsList = await MyTeamApiClient().getDayHoursTypeDetails(searchMonth, searchYear, getEmployeeSubordinates?.eMPLOYEENUMBER);
attendanceTracking = await MyTeamApiClient().getAttendanceTracking(getEmployeeSubordinates?.eMPLOYEENUMBER); attendanceTracking = await MyTeamApiClient().getAttendanceTracking(getEmployeeSubordinates?.eMPLOYEENUMBER);
Utils.hideLoading(context); Utils.hideLoading(context);
@ -69,8 +68,6 @@ class _ViewAttendanceState extends State<ViewAttendance> {
} }
} }
final CalendarController _calendarController = CalendarController(); final CalendarController _calendarController = CalendarController();
final List<Color> _colorList = [Color(0xff2AB2AB), Color(0xff202529)]; final List<Color> _colorList = [Color(0xff2AB2AB), Color(0xff202529)];
@ -90,157 +87,165 @@ class _ViewAttendanceState extends State<ViewAttendance> {
backgroundColor: MyColors.backgroundColor, backgroundColor: MyColors.backgroundColor,
body: ListView( body: ListView(
children: [ children: [
Container( Container(
margin: EdgeInsets.all(21), margin: EdgeInsets.all(21),
child: Column( child: Column(
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.todayAttendance.tr().toText16(color: MyColors.darkTextColor),
7.height,
Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Column( crossAxisAlignment: CrossAxisAlignment.start, LocaleKeys.todayAttendance.tr().toText16(color: MyColors.darkTextColor),
7.height,
children: [
LocaleKeys.checkIn.tr().toText10(color: MyColors.green69Color),
"${(attendanceTracking?.pSwipeIn)?? "- - : - -"}".toText14(color: MyColors.grey57Color),
],
).expanded,
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Container(height: 30, width: 1, color: const Color(0xffF0F0F0)),
11.width,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.checkIn.tr().toText10(color: MyColors.green69Color),
"${(attendanceTracking?.pSwipeIn) ?? "- - : - -"}".toText14(color: MyColors.grey57Color),
],
).expanded,
Row(
children: [ children: [
LocaleKeys.checkOut.tr().toText10(color: MyColors.redA3Color), Container(height: 30, width: 1, color: const Color(0xffF0F0F0)),
"${(attendanceTracking?.pSwipeOut)?? "- - : - -"}".toText14( color: MyColors.grey57Color), 11.width,
Column(
children: [
LocaleKeys.checkOut.tr().toText10(color: MyColors.redA3Color),
"${(attendanceTracking?.pSwipeOut) ?? "- - : - -"}".toText14(color: MyColors.grey57Color),
],
),
], ],
), ).expanded,
Row(
children: [
Container(height: 30, width: 1, color: const Color(0xffF0F0F0)),
11.width,
Column(
children: [
LocaleKeys.lateIn.tr().toText10(color: MyColors.darkGreyColor),
"${(attendanceTracking?.pLateInHours) ?? "- - : - -"}".toText14(color: MyColors.grey57Color),
],
),
],
).expanded,
], ],
).expanded, )
],
).paddingOnly(top: 15, left: 14, right: 14, bottom: 20).objectContainerView(
disablePadding: true,
radius: 10,
),
12.height,
Column(
children: [
Row(
children: [
"${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.grey3AColor),
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.grey3AColor),
],
).onPress(
() async {
showMonthPicker(
context: context, //locale: EasyLocalization.of(context)?.locale,
initialDate: formattedDate,
firstDate: DateTime(searchYear - 2),
lastDate: DateTime.now(),
).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,
Row( Row(
children: [ children: [
Container(height: 30, width: 1, color: const Color(0xffF0F0F0)),
11.width,
Column( Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.lateIn.tr().toText10(color: MyColors.darkGreyColor), children: <Widget>[
"${(attendanceTracking?.pLateInHours)?? "- - : - -"}".toText14(color: MyColors.grey57Color), "${LocaleKeys.attendance.tr()} ${LocaleKeys.stats.tr()}".toSectionHeading(),
29.height,
Row(
children: [
Container(
height: 9,
width: 9,
decoration: BoxDecoration(
color: MyColors.lightGreenColor,
borderRadius: BorderRadius.circular(100),
),
),
7.width,
"${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS ?? 0}".toText16(isBold: true, color: MyColors.lightGreenColor),
],
),
8.height,
Row(
children: [
Container(
height: 9,
width: 9,
decoration: BoxDecoration(
color: MyColors.backgroundBlackColor,
borderRadius: BorderRadius.circular(100),
),
),
7.width,
"${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS ?? 0}".toText16(
isBold: true,
color: MyColors.backgroundBlackColor,
)
],
),
], ],
), ).expanded,
44.width,
AspectRatio(
aspectRatio: 1 / 1,
child: PieChart(
dataMap: dataMap,
animationDuration: const Duration(milliseconds: 800),
chartLegendSpacing: 0,
chartRadius: MediaQuery.of(context).size.width / 5.2,
colorList: _colorList,
initialAngleInDegree: 0,
chartType: ChartType.ring,
ringStrokeWidth: 80,
legendOptions: const LegendOptions(
showLegendsInRow: false,
showLegends: false,
),
chartValuesOptions: const ChartValuesOptions(
showChartValueBackground: false,
showChartValues: true,
showChartValuesInPercentage: true,
showChartValuesOutside: false,
decimalPlaces: 1,
chartValueStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: MyColors.white,
)),
),
).expanded,
], ],
).expanded, ),
], ],
) ).paddingOnly(top: 17, left: 14, right: 14, bottom: 35).objectContainerView(disablePadding: true, radius: 10),
], ],
).paddingOnly(top:15, left: 14, right: 14, bottom: 20).objectContainerView(disablePadding: true, radius: 10,), ),
12.height, ),
Column( ],
children: [
Row(
children: [
"${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.grey3AColor),
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.grey3AColor),
],
).onPress(() async {
showMonthPicker(
context: context, //locale: EasyLocalization.of(context)?.locale,
initialDate: formattedDate,
firstDate: DateTime(searchYear - 2),
lastDate: DateTime.now(),
).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,
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
"${LocaleKeys.attendance.tr()} ${LocaleKeys.stats.tr()}".toSectionHeading(),
29.height,
Row(
children: [
Container(
height: 9,
width: 9,
decoration: BoxDecoration(
color: MyColors.lightGreenColor,
borderRadius: BorderRadius.circular(100),
),
),
7.width,
"${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList?.aTTENDEDDAYS : 0}".toText16(
isBold: true, color: MyColors.lightGreenColor),
],
),
8.height,
Row(
children: [
Container(
height: 9,
width: 9,
decoration: BoxDecoration(
color: MyColors.backgroundBlackColor,
borderRadius: BorderRadius.circular(100),
),
),
7.width,
"${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList?.aBSENTDAYS : 0 }".toText16(
isBold: true, color: MyColors.backgroundBlackColor,
)
],
),
],
).expanded,
44.width,
AspectRatio(aspectRatio: 1/1,
child: PieChart(
dataMap: dataMap,
animationDuration: const Duration(milliseconds: 800),
chartLegendSpacing: 0,
chartRadius: MediaQuery.of(context).size.width / 5.2,
colorList: _colorList,
initialAngleInDegree: 0,
chartType: ChartType.ring,
ringStrokeWidth: 80,
legendOptions: const LegendOptions(
showLegendsInRow: false,
showLegends: false,
),
chartValuesOptions: const ChartValuesOptions(
showChartValueBackground: false,
showChartValues: true,
showChartValuesInPercentage: true,
showChartValuesOutside: false,
decimalPlaces: 1,
chartValueStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: MyColors.white,
)),
),
).expanded,
],
),
],
).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> _getDataSource() {
List<Meeting> meetings = <Meeting>[]; List<Meeting> meetings = <Meeting>[];
return meetings; return meetings;

Loading…
Cancel
Save