|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/api/monthly_attendance_api_client.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/api/my_team/my_team_api_client.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
|
@ -9,9 +10,11 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_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_time_card_summary_list_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.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';
|
|
|
|
|
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
|
|
|
|
@ -44,6 +47,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
|
|
|
|
|
GetTimeCardSummaryList? getTimeCardSummaryList;
|
|
|
|
|
GetAttendanceTracking? attendanceTracking;
|
|
|
|
|
GetEmployeeSubordinatesList? getEmployeeSubordinates;
|
|
|
|
|
GetScheduleShiftsDetailsList? getScheduleShiftsDetailsList;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
@ -68,6 +72,18 @@ class _ViewAttendanceState extends State<ViewAttendance> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getScheduleShiftsDetails(index, pRTPID) async {
|
|
|
|
|
try {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
getScheduleShiftsDetailsList = await MonthlyAttendanceApiClient().getScheduleShiftsDetails(pRTPID);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
//setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final CalendarController _calendarController = CalendarController();
|
|
|
|
|
final List<Color> _colorList = [Color(0xff2AB2AB), Color(0xff202529)];
|
|
|
|
|
|
|
|
|
|
@ -269,6 +285,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
dataSource: MeetingDataSource(_getDataSource()),
|
|
|
|
|
onTap: calendarTapped,
|
|
|
|
|
monthViewSettings: const MonthViewSettings(
|
|
|
|
|
dayFormat: 'EEE',
|
|
|
|
|
showTrailingAndLeadingDates: false,
|
|
|
|
|
@ -388,6 +405,229 @@ class _ViewAttendanceState extends State<ViewAttendance> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void calendarTapped(CalendarTapDetails details) async {
|
|
|
|
|
dynamic index = details.date?.day;
|
|
|
|
|
if (index != null) {
|
|
|
|
|
index = index - 1;
|
|
|
|
|
}
|
|
|
|
|
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)),
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
backgroundColor: MyColors.backgroundBlackColor,
|
|
|
|
|
builder: (_) {
|
|
|
|
|
return DraggableScrollableSheet(
|
|
|
|
|
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(
|
|
|
|
|
width: 49,
|
|
|
|
|
height: 7,
|
|
|
|
|
margin: const EdgeInsets.symmetric(vertical: 10),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(25),
|
|
|
|
|
color: MyColors.darkGreyColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
controller: controller,
|
|
|
|
|
itemCount: 1,
|
|
|
|
|
itemBuilder: (_, i) => Container(
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.vertical(
|
|
|
|
|
top: Radius.circular(25.0),
|
|
|
|
|
),
|
|
|
|
|
color: MyColors.backgroundBlackColor,
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"${DateFormat("MMMM-dd-yyyy").format(dateTime1).replaceAll('-', " ")}".toText24(isBold: true, color: Colors.white),
|
|
|
|
|
LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.greyACColor),
|
|
|
|
|
12.height,
|
|
|
|
|
CircularStepProgressBar(
|
|
|
|
|
totalSteps: 16 * 4,
|
|
|
|
|
currentStep: percentage,
|
|
|
|
|
width: 224,
|
|
|
|
|
height: 236,
|
|
|
|
|
selectedColor: MyColors.gradiantEndColor,
|
|
|
|
|
unselectedColor: MyColors.grey70Color,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
"${getScheduleShiftsDetailsList!.pERCENTAGE}".toText44(color: Colors.white, isBold: true),
|
|
|
|
|
LocaleKeys.completed.tr().toText11(color: MyColors.greyACColor),
|
|
|
|
|
28.height,
|
|
|
|
|
LocaleKeys.shiftTime.tr().toText11(color: MyColors.greyACColor),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sHTNAME}".toText22(color: Colors.white, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).center,
|
|
|
|
|
).center,
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 27, bottom: 37),
|
|
|
|
|
Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
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: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.actualCheckIn.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}" != ""
|
|
|
|
|
? "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true)
|
|
|
|
|
: "__".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.actualCheckOut.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}" != ""
|
|
|
|
|
? "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true)
|
|
|
|
|
: "__".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
25.height,
|
|
|
|
|
const Divider(
|
|
|
|
|
height: 1,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
color: MyColors.lightGreyEFColor,
|
|
|
|
|
),
|
|
|
|
|
25.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.approvedCheckIn.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}" != ""
|
|
|
|
|
? "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true)
|
|
|
|
|
: "__".toText22(color: MyColors.greenColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.approvedCheckOut.tr().toText11(
|
|
|
|
|
color: MyColors.grey67Color,
|
|
|
|
|
),
|
|
|
|
|
"${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}" != ""
|
|
|
|
|
? "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true)
|
|
|
|
|
: "__".toText22(color: MyColors.greenColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
25.height,
|
|
|
|
|
const Divider(
|
|
|
|
|
height: 1,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
color: MyColors.lightGreyEFColor,
|
|
|
|
|
),
|
|
|
|
|
25.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
"${getDayHoursTypeDetailsList[index].eXCESSHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
25.height,
|
|
|
|
|
const Divider(
|
|
|
|
|
height: 1,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
color: MyColors.lightGreyEFColor,
|
|
|
|
|
),
|
|
|
|
|
25.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
"${getDayHoursTypeDetailsList[index].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
List<Meeting> _getDataSource() {
|
|
|
|
|
List<Meeting> meetings = <Meeting>[];
|
|
|
|
|
return meetings;
|
|
|
|
|
|