- Implemented AttendenceLogScreen to display employee attendance logs. - Created RegularizationRequestsTab to manage regularization requests. - Added TodaysAttendanceTab for viewing today's attendance. - Removed outdated dashboard chart implementation. - Updated dashboard screen to integrate new attendance overview and project progress charts. - Refactored employee detail and employee screens to use updated controllers. - Organized expense-related imports and components for better structure. - Adjusted daily progress report to use the correct controller.
128 lines
5.7 KiB
Dart
128 lines
5.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:marco/controller/attendance/attendance_screen_controller.dart';
|
|
import 'package:marco/helpers/utils/date_time_utils.dart';
|
|
import 'package:marco/helpers/widgets/avatar.dart';
|
|
import 'package:marco/helpers/widgets/my_card.dart';
|
|
import 'package:marco/helpers/widgets/my_container.dart';
|
|
import 'package:marco/helpers/widgets/my_spacing.dart';
|
|
import 'package:marco/helpers/widgets/my_text.dart';
|
|
import 'package:marco/helpers/widgets/my_custom_skeleton.dart';
|
|
import 'package:marco/model/attendance/log_details_view.dart';
|
|
import 'package:marco/model/attendance/attendence_action_button.dart';
|
|
|
|
class TodaysAttendanceTab extends StatelessWidget {
|
|
final AttendanceController controller;
|
|
|
|
const TodaysAttendanceTab({super.key, required this.controller});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Obx(() {
|
|
final isLoading = controller.isLoadingEmployees.value;
|
|
final employees = controller.employees;
|
|
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: MyText.titleMedium("Today's Attendance", fontWeight: 600),
|
|
),
|
|
MyText.bodySmall(
|
|
DateTimeUtils.formatDate(DateTime.now(), 'dd MMM yyyy'),
|
|
fontWeight: 600,
|
|
color: Colors.grey[700],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (isLoading)
|
|
SkeletonLoaders.employeeListSkeletonLoader()
|
|
else if (employees.isEmpty)
|
|
const SizedBox(height: 120, child: Center(child: Text("No Employees Assigned")))
|
|
else
|
|
MyCard.bordered(
|
|
paddingAll: 8,
|
|
child: Column(
|
|
children: List.generate(employees.length, (index) {
|
|
final employee = employees[index];
|
|
return Column(
|
|
children: [
|
|
MyContainer(
|
|
paddingAll: 5,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Avatar(firstName: employee.firstName, lastName: employee.lastName, size: 31),
|
|
MySpacing.width(16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Wrap(
|
|
spacing: 6,
|
|
children: [
|
|
MyText.bodyMedium(employee.name, fontWeight: 600),
|
|
MyText.bodySmall('(${employee.designation})', fontWeight: 600, color: Colors.grey[700]),
|
|
],
|
|
),
|
|
MySpacing.height(8),
|
|
if (employee.checkIn != null || employee.checkOut != null)
|
|
Row(
|
|
children: [
|
|
if (employee.checkIn != null)
|
|
Row(
|
|
children: [
|
|
const Icon(Icons.arrow_circle_right, size: 16, color: Colors.green),
|
|
MySpacing.width(4),
|
|
Text(DateTimeUtils.formatDate(employee.checkIn!, 'hh:mm a')),
|
|
],
|
|
),
|
|
if (employee.checkOut != null) ...[
|
|
MySpacing.width(16),
|
|
const Icon(Icons.arrow_circle_left, size: 16, color: Colors.red),
|
|
MySpacing.width(4),
|
|
Text(DateTimeUtils.formatDate(employee.checkOut!, 'hh:mm a')),
|
|
],
|
|
],
|
|
),
|
|
MySpacing.height(12),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
AttendanceActionButton(
|
|
employee: employee,
|
|
attendanceController: controller,
|
|
),
|
|
if (employee.checkIn != null) ...[
|
|
MySpacing.width(8),
|
|
AttendanceLogViewButton(
|
|
employee: employee,
|
|
attendanceController: controller,
|
|
),
|
|
],
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (index != employees.length - 1)
|
|
Divider(color: Colors.grey.withOpacity(0.3)),
|
|
],
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
});
|
|
}
|
|
}
|