- 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.
158 lines
7.0 KiB
Dart
158 lines
7.0 KiB
Dart
// lib/view/attendance/tabs/regularization_requests_tab.dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:marco/controller/attendance/attendance_screen_controller.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/regualrize_action_button.dart';
|
|
|
|
class RegularizationRequestsTab extends StatelessWidget {
|
|
final AttendanceController controller;
|
|
|
|
const RegularizationRequestsTab({super.key, required this.controller});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 4.0),
|
|
child: MyText.titleMedium("Regularization Requests", fontWeight: 600),
|
|
),
|
|
Obx(() {
|
|
final employees = controller.regularizationLogs;
|
|
|
|
if (controller.isLoadingRegularizationLogs.value) {
|
|
return SkeletonLoaders.employeeListSkeletonLoader();
|
|
}
|
|
|
|
if (employees.isEmpty) {
|
|
return const SizedBox(
|
|
height: 120,
|
|
child: Center(
|
|
child: Text("No Regularization Requests Found for this Project"),
|
|
),
|
|
);
|
|
}
|
|
|
|
return MyCard.bordered(
|
|
paddingAll: 8,
|
|
child: Column(
|
|
children: List.generate(employees.length, (index) {
|
|
final employee = employees[index];
|
|
return Column(
|
|
children: [
|
|
MyContainer(
|
|
paddingAll: 8,
|
|
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: [
|
|
Row(
|
|
children: [
|
|
Flexible(
|
|
child: MyText.bodyMedium(
|
|
employee.name,
|
|
fontWeight: 600,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
MySpacing.width(6),
|
|
Flexible(
|
|
child: MyText.bodySmall(
|
|
'(${employee.role})',
|
|
fontWeight: 600,
|
|
overflow: TextOverflow.ellipsis,
|
|
color: Colors.grey[700],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
MySpacing.height(8),
|
|
if (employee.checkIn != null ||
|
|
employee.checkOut != null)
|
|
Row(
|
|
children: [
|
|
if (employee.checkIn != null) ...[
|
|
const Icon(Icons.arrow_circle_right,
|
|
size: 16, color: Colors.green),
|
|
MySpacing.width(4),
|
|
MyText.bodySmall(
|
|
DateFormat('hh:mm a')
|
|
.format(employee.checkIn!),
|
|
fontWeight: 600,
|
|
),
|
|
MySpacing.width(16),
|
|
],
|
|
if (employee.checkOut != null) ...[
|
|
const Icon(Icons.arrow_circle_left,
|
|
size: 16, color: Colors.red),
|
|
MySpacing.width(4),
|
|
MyText.bodySmall(
|
|
DateFormat('hh:mm a')
|
|
.format(employee.checkOut!),
|
|
fontWeight: 600,
|
|
),
|
|
],
|
|
],
|
|
),
|
|
MySpacing.height(12),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
RegularizeActionButton(
|
|
attendanceController: controller,
|
|
log: employee,
|
|
uniqueLogKey: employee.employeeId,
|
|
action: ButtonActions.approve,
|
|
),
|
|
const SizedBox(width: 8),
|
|
RegularizeActionButton(
|
|
attendanceController: controller,
|
|
log: employee,
|
|
uniqueLogKey: employee.employeeId,
|
|
action: ButtonActions.reject,
|
|
),
|
|
const SizedBox(width: 8),
|
|
if (employee.checkIn != null)
|
|
AttendanceLogViewButton(
|
|
employee: employee,
|
|
attendanceController: controller,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (index != employees.length - 1)
|
|
Divider(color: Colors.grey.withOpacity(0.3)),
|
|
],
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
}),
|
|
],
|
|
);
|
|
}
|
|
}
|