feat: Enhance organization selector to include 'All Organizations' option and improve selection logic
This commit is contained in:
parent
8ed67dcdf1
commit
637426aea4
@ -84,16 +84,27 @@ class _AttendanceFilterBottomSheetState
|
||||
}
|
||||
|
||||
Widget _buildOrganizationSelector(BuildContext context) {
|
||||
final orgNames = [
|
||||
"All Organizations",
|
||||
...widget.controller.organizations.map((e) => e.name)
|
||||
];
|
||||
|
||||
return _popupSelector(
|
||||
currentValue:
|
||||
widget.controller.selectedOrganization?.name ?? "Select Organization",
|
||||
items: widget.controller.organizations.map((e) => e.name).toList(),
|
||||
widget.controller.selectedOrganization?.name ?? "All Organizations",
|
||||
items: orgNames,
|
||||
onSelected: (name) {
|
||||
final selectedOrg = widget.controller.organizations
|
||||
.firstWhere((org) => org.name == name);
|
||||
setState(() {
|
||||
widget.controller.selectedOrganization = selectedOrg;
|
||||
});
|
||||
if (name == "All Organizations") {
|
||||
setState(() {
|
||||
widget.controller.selectedOrganization = null;
|
||||
});
|
||||
} else {
|
||||
final selectedOrg = widget.controller.organizations
|
||||
.firstWhere((org) => org.name == name);
|
||||
setState(() {
|
||||
widget.controller.selectedOrganization = selectedOrg;
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ 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';
|
||||
import 'package:marco/helpers/utils/attendance_actions.dart';
|
||||
import 'package:marco/helpers/services/app_logger.dart';
|
||||
|
||||
class AttendanceLogsTab extends StatefulWidget {
|
||||
final AttendanceController controller;
|
||||
@ -94,16 +93,6 @@ class _AttendanceLogsTabState extends State<AttendanceLogsTab> {
|
||||
} else {
|
||||
priority = 5;
|
||||
}
|
||||
|
||||
// ✅ Use AppLogger instead of print
|
||||
logSafe(
|
||||
"[AttendanceLogs] Priority calculated "
|
||||
"name=${employee.name}, activity=${employee.activity}, "
|
||||
"checkIn=${employee.checkIn}, checkOut=${employee.checkOut}, "
|
||||
"buttonText=$text, priority=$priority",
|
||||
level: LogLevel.debug,
|
||||
);
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user