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) {
|
Widget _buildOrganizationSelector(BuildContext context) {
|
||||||
|
final orgNames = [
|
||||||
|
"All Organizations",
|
||||||
|
...widget.controller.organizations.map((e) => e.name)
|
||||||
|
];
|
||||||
|
|
||||||
return _popupSelector(
|
return _popupSelector(
|
||||||
currentValue:
|
currentValue:
|
||||||
widget.controller.selectedOrganization?.name ?? "Select Organization",
|
widget.controller.selectedOrganization?.name ?? "All Organizations",
|
||||||
items: widget.controller.organizations.map((e) => e.name).toList(),
|
items: orgNames,
|
||||||
onSelected: (name) {
|
onSelected: (name) {
|
||||||
final selectedOrg = widget.controller.organizations
|
if (name == "All Organizations") {
|
||||||
.firstWhere((org) => org.name == name);
|
setState(() {
|
||||||
setState(() {
|
widget.controller.selectedOrganization = null;
|
||||||
widget.controller.selectedOrganization = selectedOrg;
|
});
|
||||||
});
|
} 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/log_details_view.dart';
|
||||||
import 'package:marco/model/attendance/attendence_action_button.dart';
|
import 'package:marco/model/attendance/attendence_action_button.dart';
|
||||||
import 'package:marco/helpers/utils/attendance_actions.dart';
|
import 'package:marco/helpers/utils/attendance_actions.dart';
|
||||||
import 'package:marco/helpers/services/app_logger.dart';
|
|
||||||
|
|
||||||
class AttendanceLogsTab extends StatefulWidget {
|
class AttendanceLogsTab extends StatefulWidget {
|
||||||
final AttendanceController controller;
|
final AttendanceController controller;
|
||||||
@ -94,16 +93,6 @@ class _AttendanceLogsTabState extends State<AttendanceLogsTab> {
|
|||||||
} else {
|
} else {
|
||||||
priority = 5;
|
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;
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user