|
|
|
@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:easy_localization/src/public_ext.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/painting.dart';
|
|
|
|
|
import 'package:flutter/scheduler.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/api/monthlyAttendance_api_client.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
@ -17,6 +18,10 @@ import 'package:syncfusion_flutter_calendar/calendar.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:pie_chart/pie_chart.dart';
|
|
|
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:month_year_picker/month_year_picker.dart';
|
|
|
|
|
import 'package:month_picker_dialog/month_picker_dialog.dart';
|
|
|
|
|
|
|
|
|
|
class MonthlyAttendance extends StatefulWidget {
|
|
|
|
|
MonthlyAttendance({Key? key}) : super(key: key);
|
|
|
|
@ -28,12 +33,12 @@ class MonthlyAttendance extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
bool isPresent = true;
|
|
|
|
|
bool isAbsent = true;
|
|
|
|
|
bool isMissingDays = true;
|
|
|
|
|
bool isOffDays = true;
|
|
|
|
|
bool isPresent = false;
|
|
|
|
|
bool isAbsent = false;
|
|
|
|
|
bool isMissing = false;
|
|
|
|
|
bool isOff = false;
|
|
|
|
|
DateTime date = DateTime.now();
|
|
|
|
|
late var formattedDate;
|
|
|
|
|
late DateTime formattedDate;
|
|
|
|
|
var currentMonth = DateTime.now().month;
|
|
|
|
|
String searchMonth = getMonth(DateTime.now().month);
|
|
|
|
|
int searchYear = DateTime.now().year;
|
|
|
|
@ -41,84 +46,42 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
|
|
|
|
|
List<GetDayHoursTypeDetailsList> getDayHoursTypeDetailsList = [];
|
|
|
|
|
GetTimeCardSummaryList? getTimeCardSummaryList;
|
|
|
|
|
|
|
|
|
|
// GetDayHoursTypeDetailsList? getDayHoursTypeDetailsList;
|
|
|
|
|
GetScheduleShiftsDetailsList? getScheduleShiftsDetailsList;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
getTimeCardSummary(searchMonth, searchYear);
|
|
|
|
|
getDayHoursTypeDetails(date.day, searchMonth, searchYear);
|
|
|
|
|
formattedDate = DateFormat('MMM-yyyy').format(date);
|
|
|
|
|
formattedDate = date;
|
|
|
|
|
callTimeCardAndHourDetails(date.day, searchMonth, searchYear);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void getTimeCardSummary(searchMonth, searchYear) async {
|
|
|
|
|
void callTimeCardAndHourDetails(index, searchMonth, searchYear) async {
|
|
|
|
|
try {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
getTimeCardSummaryList = await MonthlyAttendanceApiClient().getTimeCardSummary(searchMonth, searchYear);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void getDayHoursTypeDetails(index, searchMonth, searchYear) async {
|
|
|
|
|
try {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
getDayHoursTypeDetailsList = await MonthlyAttendanceApiClient().getDayHoursTypeDetails(searchMonth, searchYear);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
pRTPID = getDayHoursTypeDetailsList[index].rTPID;
|
|
|
|
|
_calendarController.displayDate = formattedDate;
|
|
|
|
|
setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
countAllAttendDays();
|
|
|
|
|
getScheduleShiftsDetails(pRTPID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getScheduleShiftsDetails(pRTPID) async {
|
|
|
|
|
|
|
|
|
|
Future getScheduleShiftsDetails(index, pRTPID) async {
|
|
|
|
|
try {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
getScheduleShiftsDetailsList = await MonthlyAttendanceApiClient().getScheduleShiftsDetails(pRTPID);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
//setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
countAllAttendDays() {
|
|
|
|
|
// print(getDayHoursTypeDetailsList.length);
|
|
|
|
|
for (int i = 0; i < getDayHoursTypeDetailsList.length; i++) {
|
|
|
|
|
if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'Y') {
|
|
|
|
|
isPresent = true;
|
|
|
|
|
isAbsent = false;
|
|
|
|
|
isMissingDays = false;
|
|
|
|
|
isOffDays = false;
|
|
|
|
|
} else if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[i].aBSENTFLAG == 'Y') {
|
|
|
|
|
isPresent = false;
|
|
|
|
|
isAbsent = true;
|
|
|
|
|
isMissingDays = false;
|
|
|
|
|
isOffDays = false;
|
|
|
|
|
} else if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[i].dAYTYPE == 'OFF') {
|
|
|
|
|
isPresent = false;
|
|
|
|
|
isAbsent = false;
|
|
|
|
|
isMissingDays = false;
|
|
|
|
|
isOffDays = true;
|
|
|
|
|
} else {
|
|
|
|
|
isPresent = false;
|
|
|
|
|
isAbsent = false;
|
|
|
|
|
isMissingDays = true;
|
|
|
|
|
isOffDays = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final CalendarController _calendarController = CalendarController();
|
|
|
|
|
|
|
|
|
|
final List<Color> _colorList = [Color(0xff2AB2AB), Color(0xff202529)];
|
|
|
|
@ -126,8 +89,8 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
Map<String, double> dataMap = {
|
|
|
|
|
"Present": getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble(),
|
|
|
|
|
"Absent": getTimeCardSummaryList!.aBSENTDAYS!.toDouble(),
|
|
|
|
|
"Present": getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble() : 0,
|
|
|
|
|
"Absent": getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList!.aBSENTDAYS!.toDouble() : 0,
|
|
|
|
|
};
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
@ -150,61 +113,42 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Attendance".toText24(isBold: true, color: MyColors.darkIconColor),
|
|
|
|
|
LocaleKeys.attendance.tr().toText24(isBold: true, color: MyColors.darkIconColor),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(formattedDate),
|
|
|
|
|
"${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.greyACColor),
|
|
|
|
|
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor),
|
|
|
|
|
],
|
|
|
|
|
).onPress(() async {
|
|
|
|
|
await showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
|
firstDate: DateTime(2021),
|
|
|
|
|
showMonthPicker(
|
|
|
|
|
context: context, //locale: EasyLocalization.of(context)?.locale,
|
|
|
|
|
initialDate: formattedDate,
|
|
|
|
|
firstDate: DateTime(searchYear - 2),
|
|
|
|
|
lastDate: DateTime.now(),
|
|
|
|
|
builder: (context, child) {
|
|
|
|
|
return Theme(
|
|
|
|
|
data: ThemeData.dark().copyWith(
|
|
|
|
|
colorScheme: const ColorScheme.dark(
|
|
|
|
|
primary: MyColors.lightGreenColor,
|
|
|
|
|
onPrimary: MyColors.white,
|
|
|
|
|
surface: MyColors.lightGreenColor,
|
|
|
|
|
onSurface: MyColors.darkTextColor,
|
|
|
|
|
),
|
|
|
|
|
dialogBackgroundColor: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
child: child!,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
).then((selectedDate) {
|
|
|
|
|
if (selectedDate != null) {
|
|
|
|
|
var selectedMonth = DateFormat('MMMM').format(selectedDate);
|
|
|
|
|
var selectedYear = DateFormat('yyyy').format(selectedDate);
|
|
|
|
|
searchMonth = selectedMonth;
|
|
|
|
|
searchYear = int.parse(selectedYear);
|
|
|
|
|
setState(() {
|
|
|
|
|
// date = selectedDate;
|
|
|
|
|
formattedDate = DateFormat('MMMM-yyyy').format(selectedDate);
|
|
|
|
|
getTimeCardSummary(searchMonth, searchYear);
|
|
|
|
|
getDayHoursTypeDetails(selectedDate.day, searchMonth, searchYear);
|
|
|
|
|
});
|
|
|
|
|
searchMonth = getMonth(selectedDate.month);
|
|
|
|
|
searchYear = selectedDate.year;
|
|
|
|
|
formattedDate = selectedDate; //DateFormat('MMMM-yyyy').format(selectedDate);
|
|
|
|
|
// _calendarController.selectedDate = formattedDate;
|
|
|
|
|
callTimeCardAndHourDetails(selectedDate.day, searchMonth, searchYear);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, right: 21),
|
|
|
|
|
18.height,
|
|
|
|
|
AspectRatio(aspectRatio: 333 / 270, child: calendarWidget()).paddingOnly(left: 21, right: 21),
|
|
|
|
|
AspectRatio(aspectRatio: 333 / 270, child: calendarWidget()).paddingOnly(left: 18, right: 25),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
optionUI("Schedule\nDays", "${getTimeCardSummaryList!.sCHEDULEDAYS}"),
|
|
|
|
|
optionUI(LocaleKeys.scheduleDays.tr(), "${getTimeCardSummaryList?.sCHEDULEDAYS}"),
|
|
|
|
|
6.width,
|
|
|
|
|
optionUI("Off\nDays", "${getTimeCardSummaryList!.oFFDAYS}"),
|
|
|
|
|
optionUI(LocaleKeys.offDays.tr(), "${getTimeCardSummaryList?.oFFDAYS}"),
|
|
|
|
|
6.width,
|
|
|
|
|
optionUI("Non\nAnalyzed", "${getTimeCardSummaryList!.uNAUTHORIZEDLEAVE}"),
|
|
|
|
|
optionUI(LocaleKeys.nonAnalyzed.tr(), "${getTimeCardSummaryList?.uNAUTHORIZEDLEAVE}"),
|
|
|
|
|
6.width,
|
|
|
|
|
optionUI("Shortage\nHour", "${getTimeCardSummaryList!.sHORTAGEHRS}"),
|
|
|
|
|
optionUI(LocaleKeys.shortageHour.tr(), "${getTimeCardSummaryList?.sHORTAGEHRS}"),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, right: 21),
|
|
|
|
|
35.height,
|
|
|
|
@ -229,10 +173,10 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
"Attendance".toText12(isBold: true, color: MyColors.grey3AColor),
|
|
|
|
|
"Stats".toText24(isBold: true, color: MyColors.grey3AColor),
|
|
|
|
|
LocaleKeys.attendance.tr().toText12(isBold: true, color: MyColors.grey3AColor),
|
|
|
|
|
LocaleKeys.stats.tr().toText24(isBold: true, color: MyColors.grey3AColor),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, top: 29, bottom: 36),
|
|
|
|
|
).paddingOnly(left: 21, top: 29, bottom: 36, right: 23),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
@ -245,7 +189,7 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.only(left: 5, right: 5),
|
|
|
|
|
child: "PRESENT ${getTimeCardSummaryList!.aTTENDEDDAYS}".toText16(isBold: true, color: MyColors.lightGreenColor),
|
|
|
|
|
child: "${LocaleKeys.present.tr()} ${getTimeCardSummaryList!.aTTENDEDDAYS}".toText16(isBold: true, color: MyColors.lightGreenColor),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, right: 23),
|
|
|
|
@ -262,13 +206,13 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.only(left: 5, right: 5),
|
|
|
|
|
child: "ABSENT ${getTimeCardSummaryList!.aBSENTDAYS}".toText16(
|
|
|
|
|
child: "${LocaleKeys.absent.tr()} ${getTimeCardSummaryList!.aBSENTDAYS}".toText16(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: MyColors.backgroundBlackColor,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, top: 8),
|
|
|
|
|
).paddingOnly(left: 21, top: 8, right: 23),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
@ -342,70 +286,116 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
Widget calendarWidget() {
|
|
|
|
|
return SfCalendar(
|
|
|
|
|
view: CalendarView.month,
|
|
|
|
|
// onViewChanged: viewChanged,
|
|
|
|
|
showDatePickerButton: false,
|
|
|
|
|
controller: _calendarController,
|
|
|
|
|
headerHeight: 0,
|
|
|
|
|
todayHighlightColor: MyColors.grey3AColor,
|
|
|
|
|
showNavigationArrow: false,
|
|
|
|
|
showCurrentTimeIndicator: false,
|
|
|
|
|
showWeekNumber: false,
|
|
|
|
|
cellBorderColor: Colors.white,
|
|
|
|
|
selectionDecoration: BoxDecoration(
|
|
|
|
|
border: Border.all(color: MyColors.white, width: 10),
|
|
|
|
|
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
dataSource: MeetingDataSource(_getDataSource()),
|
|
|
|
|
onTap: calendarTapped,
|
|
|
|
|
monthViewSettings: const MonthViewSettings(
|
|
|
|
|
dayFormat: 'EEE',
|
|
|
|
|
showTrailingAndLeadingDates: false,
|
|
|
|
|
showAgenda: false,
|
|
|
|
|
navigationDirection: MonthNavigationDirection.horizontal,
|
|
|
|
|
monthCellStyle: MonthCellStyle(
|
|
|
|
|
textStyle: TextStyle(
|
|
|
|
|
fontStyle: FontStyle.normal,
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
viewHeaderStyle: const ViewHeaderStyle(
|
|
|
|
|
dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
monthCellBuilder: (cxt, build) {
|
|
|
|
|
int val = build.date.day;
|
|
|
|
|
val == countAllAttendDays();
|
|
|
|
|
if (isPresent) {
|
|
|
|
|
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],
|
|
|
|
|
monthCellBuilder: (build, details) {
|
|
|
|
|
if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) {
|
|
|
|
|
int val = details.date.day;
|
|
|
|
|
//check day is off
|
|
|
|
|
if (getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[val - 1].dAYTYPE == 'OFF') {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: const EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: MyColors.greyACColor.withOpacity(.12),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
offset: const Offset(0, 2),
|
|
|
|
|
blurRadius: 26,
|
|
|
|
|
color: MyColors.blackColor.withOpacity(0.100),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
"${val}",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: MyColors.greyA5Color,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
"${build.date.day}",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else if (isAbsent) {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: const EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: MyColors.backgroundBlackColor,
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
offset: const Offset(0, 2),
|
|
|
|
|
blurRadius: 26,
|
|
|
|
|
color: MyColors.blackColor.withOpacity(0.100),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//check day is Present
|
|
|
|
|
else if (getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'Y') {
|
|
|
|
|
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],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
"${build.date.day}",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
offset: const Offset(0, 2),
|
|
|
|
|
blurRadius: 26,
|
|
|
|
|
color: MyColors.blackColor.withOpacity(0.100),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else if (isMissingDays) {
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
"${val}",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//check day is Absent
|
|
|
|
|
else if (getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[val - 1].aBSENTFLAG == 'Y') {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: const EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: MyColors.backgroundBlackColor,
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
offset: const Offset(0, 2),
|
|
|
|
|
blurRadius: 26,
|
|
|
|
|
color: MyColors.blackColor.withOpacity(0.100),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
"${val}",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return Container(
|
|
|
|
|
margin: const EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
@ -421,7 +411,7 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
"${build.date.day}",
|
|
|
|
|
"${val}",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
@ -429,66 +419,35 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else if (isOffDays) {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: const EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: MyColors.greyACColor.withOpacity(.12),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
"${build.date.day}",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: MyColors.greyA5Color,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
// return Container(
|
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
|
// child: Text("$val"),
|
|
|
|
|
// );
|
|
|
|
|
} else {
|
|
|
|
|
return Container();
|
|
|
|
|
return const SizedBox();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthViewSettings: const MonthViewSettings(
|
|
|
|
|
dayFormat: 'EEE',
|
|
|
|
|
showTrailingAndLeadingDates: false,
|
|
|
|
|
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
|
|
|
|
|
showAgenda: false,
|
|
|
|
|
navigationDirection: MonthNavigationDirection.horizontal,
|
|
|
|
|
monthCellStyle: MonthCellStyle(
|
|
|
|
|
textStyle: TextStyle(
|
|
|
|
|
fontStyle: FontStyle.normal,
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
showNavigationArrow: false,
|
|
|
|
|
showDatePickerButton: false,
|
|
|
|
|
showCurrentTimeIndicator: false,
|
|
|
|
|
showWeekNumber: false,
|
|
|
|
|
cellBorderColor: Colors.white,
|
|
|
|
|
selectionDecoration: BoxDecoration(
|
|
|
|
|
border: Border.all(color: MyColors.white, width: 10),
|
|
|
|
|
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
dataSource: MeetingDataSource(_getDataSource()),
|
|
|
|
|
onTap: calendarTapped,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
calendarTapped(CalendarTapDetails details) {
|
|
|
|
|
dynamic string = getScheduleShiftsDetailsList!.pERCENTAGE;
|
|
|
|
|
dynamic percentage = string!.indexOf('%');
|
|
|
|
|
print(percentage);
|
|
|
|
|
print(details.date?.day.toString());
|
|
|
|
|
int? index = details.date?.day;
|
|
|
|
|
calendarTapped(CalendarTapDetails details) async {
|
|
|
|
|
dynamic index = details.date?.day;
|
|
|
|
|
if (index != null) {
|
|
|
|
|
index = index - 1;
|
|
|
|
|
}
|
|
|
|
|
getDayHoursTypeDetails(index, getMonth(details.date!.month), details.date?.year);
|
|
|
|
|
pRTPID = getDayHoursTypeDetailsList[index].rTPID;
|
|
|
|
|
await getScheduleShiftsDetails(index, pRTPID);
|
|
|
|
|
dynamic value = getScheduleShiftsDetailsList!.pERCENTAGE;
|
|
|
|
|
dynamic percentage;
|
|
|
|
|
if (value!.indexOf('%') == 3) {
|
|
|
|
|
percentage = int.parse(value!.substring(0, 3));
|
|
|
|
|
} else if (value!.indexOf('%') == 2) {
|
|
|
|
|
percentage = int.parse(value!.substring(0, 2));
|
|
|
|
|
} else if (value!.indexOf('%') == 1 && value!.indexOf('%') != 0 && value!.indexOf('%') != "") {
|
|
|
|
|
percentage = int.parse(value!.substring(0, 1));
|
|
|
|
|
} else if (value!.indexOf('%') == 0 || value!.indexOf('%') == "") {
|
|
|
|
|
percentage = 0;
|
|
|
|
|
}
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
|
|
|
|
@ -499,6 +458,8 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
maxChildSize: 0.9,
|
|
|
|
|
expand: false,
|
|
|
|
|
builder: (_, controller) {
|
|
|
|
|
dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE;
|
|
|
|
|
DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss a").parse(dmyString);
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
@ -524,11 +485,12 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(children: [
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sCHEDULEDATE!.substring(0, 9)}".toText24(isBold: true, color: Colors.white),
|
|
|
|
|
"Attendance Details".tr().toText16(color: MyColors.lightGreyEFColor),
|
|
|
|
|
21.height,
|
|
|
|
|
]).paddingOnly(top: 25, left: 21, right: 21, bottom: 10),
|
|
|
|
|
Container(child:
|
|
|
|
|
"${DateFormat("MMMM-dd-yyyy").format(dateTime1).replaceAll('-', " ")}".toText24(isBold: true, color: Colors.white),
|
|
|
|
|
).paddingOnly(top: 26, left: 21, right: 21),
|
|
|
|
|
Container(
|
|
|
|
|
child: LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.greyACColor).paddingOnly(left: 21,bottom: 16),
|
|
|
|
|
),
|
|
|
|
|
Center(
|
|
|
|
|
child: CircularStepProgressBar(
|
|
|
|
|
totalSteps: 16 * 4,
|
|
|
|
@ -542,9 +504,9 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
"${getScheduleShiftsDetailsList!.pERCENTAGE}".toText44(color: Colors.white, isBold: true),
|
|
|
|
|
"Completed".tr().toText11(color: MyColors.greyACColor),
|
|
|
|
|
LocaleKeys.completed.tr().toText11(color: MyColors.greyACColor),
|
|
|
|
|
19.height,
|
|
|
|
|
"Shift Time".tr().toText11(color: MyColors.greyACColor),
|
|
|
|
|
LocaleKeys.shiftTime.tr().toText11(color: MyColors.greyACColor),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sHTNAME}".toText22(color: Colors.white, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
@ -574,11 +536,13 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Actual Check In ".tr().toText11(
|
|
|
|
|
LocaleKeys.actualCheckIn.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}" !=""
|
|
|
|
|
? "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true)
|
|
|
|
|
: "__".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -586,11 +550,13 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Actual Check Out".tr().toText11(
|
|
|
|
|
LocaleKeys.actualCheckOut.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}" != ""
|
|
|
|
|
? "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true)
|
|
|
|
|
: "__".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -609,11 +575,13 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Approved Check In".tr().toText11(
|
|
|
|
|
LocaleKeys.approvedCheckIn.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}" !=""
|
|
|
|
|
? "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true)
|
|
|
|
|
:"__".toText22(color: MyColors.greenColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -621,11 +589,13 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Approved Check Out".tr().toText11(
|
|
|
|
|
LocaleKeys.approvedCheckOut.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}"!= ""
|
|
|
|
|
? "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true)
|
|
|
|
|
:"__".toText22(color: MyColors.greenColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -644,11 +614,11 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Late In".tr().toText11(
|
|
|
|
|
LocaleKeys.lateIn.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${getDayHoursTypeDetailsList[i].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true),
|
|
|
|
|
"${getDayHoursTypeDetailsList[index].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -656,11 +626,11 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Excess".tr().toText11(
|
|
|
|
|
LocaleKeys.excess.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${getDayHoursTypeDetailsList[i].eXCESSHRS}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
"${getDayHoursTypeDetailsList[index].eXCESSHRS}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -679,11 +649,11 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Shortage".tr().toText11(
|
|
|
|
|
LocaleKeys.shortage.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${getDayHoursTypeDetailsList[i].sHORTAGEHRS}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
"${getDayHoursTypeDetailsList[index].sHORTAGEHRS}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -691,11 +661,11 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Early Out".tr().toText11(
|
|
|
|
|
LocaleKeys.earlyOut.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${getDayHoursTypeDetailsList[i].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
"${getDayHoursTypeDetailsList[index].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -752,6 +722,35 @@ class _MonthlyAttendanceState extends State<MonthlyAttendance> {
|
|
|
|
|
return "December";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getMonthAr(int month){
|
|
|
|
|
switch (month) {
|
|
|
|
|
case 1:
|
|
|
|
|
return 'يناير';
|
|
|
|
|
case 2:
|
|
|
|
|
return ' فبراير';
|
|
|
|
|
case 3:
|
|
|
|
|
return 'مارس';
|
|
|
|
|
case 4:
|
|
|
|
|
return 'أبريل';
|
|
|
|
|
case 5:
|
|
|
|
|
return 'مايو';
|
|
|
|
|
case 6:
|
|
|
|
|
return 'يونيو';
|
|
|
|
|
case 7:
|
|
|
|
|
return 'يوليو';
|
|
|
|
|
case 8:
|
|
|
|
|
return 'أغسطس';
|
|
|
|
|
case 9:
|
|
|
|
|
return 'سبتمبر';
|
|
|
|
|
case 10:
|
|
|
|
|
return ' اكتوبر';
|
|
|
|
|
case 11:
|
|
|
|
|
return ' نوفمبر';
|
|
|
|
|
case 12:
|
|
|
|
|
return 'ديسمبر';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class MeetingDataSource extends CalendarDataSource {
|
|
|
|
|