refactor(clock_in): rename error handling variable for clarity in check-in interactions
This commit is contained in:
@@ -47,6 +47,7 @@ If any of these files are missing or unreadable, notify the user before proceedi
|
|||||||
- Skip tests for business logic
|
- Skip tests for business logic
|
||||||
|
|
||||||
### ALWAYS:
|
### ALWAYS:
|
||||||
|
- **Use `package:` imports everywhere inside `lib/`** for consistency and robustness. Use relative imports only in `test/` and `bin/` directories. Example: `import 'package:staff_clock_in/src/presentation/bloc/clock_in/clock_in_bloc.dart';` not `import '../bloc/clock_in/clock_in_bloc.dart';`
|
||||||
- Place reusable utility functions (math, geo, formatting, etc.) in `apps/mobile/packages/core/lib/src/utils/` and export from `core.dart` — never keep them as private methods in feature packages
|
- Place reusable utility functions (math, geo, formatting, etc.) in `apps/mobile/packages/core/lib/src/utils/` and export from `core.dart` — never keep them as private methods in feature packages
|
||||||
- Use feature-first packaging: `domain/`, `data/`, `presentation/`
|
- Use feature-first packaging: `domain/`, `data/`, `presentation/`
|
||||||
- Export public API via barrel files
|
- Export public API via barrel files
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ abstract class CheckInInteraction {
|
|||||||
required bool isCheckedIn,
|
required bool isCheckedIn,
|
||||||
required bool isDisabled,
|
required bool isDisabled,
|
||||||
required bool isLoading,
|
required bool isLoading,
|
||||||
required bool hasError,
|
required bool hasClockinError,
|
||||||
required VoidCallback onCheckIn,
|
required VoidCallback onCheckIn,
|
||||||
required VoidCallback onCheckOut,
|
required VoidCallback onCheckOut,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class NfcCheckInInteraction implements CheckInInteraction {
|
|||||||
required bool isCheckedIn,
|
required bool isCheckedIn,
|
||||||
required bool isDisabled,
|
required bool isDisabled,
|
||||||
required bool isLoading,
|
required bool isLoading,
|
||||||
required bool hasError,
|
required bool hasClockinError,
|
||||||
required VoidCallback onCheckIn,
|
required VoidCallback onCheckIn,
|
||||||
required VoidCallback onCheckOut,
|
required VoidCallback onCheckOut,
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class SwipeCheckInInteraction implements CheckInInteraction {
|
|||||||
required bool isCheckedIn,
|
required bool isCheckedIn,
|
||||||
required bool isDisabled,
|
required bool isDisabled,
|
||||||
required bool isLoading,
|
required bool isLoading,
|
||||||
required bool hasError,
|
required bool hasClockinError,
|
||||||
required VoidCallback onCheckIn,
|
required VoidCallback onCheckIn,
|
||||||
required VoidCallback onCheckOut,
|
required VoidCallback onCheckOut,
|
||||||
}) {
|
}) {
|
||||||
@@ -24,7 +24,7 @@ class SwipeCheckInInteraction implements CheckInInteraction {
|
|||||||
isCheckedIn: isCheckedIn,
|
isCheckedIn: isCheckedIn,
|
||||||
isDisabled: isDisabled,
|
isDisabled: isDisabled,
|
||||||
isLoading: isLoading,
|
isLoading: isLoading,
|
||||||
hasError: hasError,
|
hasClockinError: hasClockinError,
|
||||||
onCheckIn: onCheckIn,
|
onCheckIn: onCheckIn,
|
||||||
onCheckOut: onCheckOut,
|
onCheckOut: onCheckOut,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:flutter_modular/flutter_modular.dart';
|
import 'package:flutter_modular/flutter_modular.dart';
|
||||||
import 'package:krow_core/core.dart';
|
import 'package:krow_core/core.dart';
|
||||||
import 'package:krow_domain/krow_domain.dart';
|
import 'package:krow_domain/krow_domain.dart';
|
||||||
|
import 'package:staff_clock_in/src/presentation/widgets/early_check_in_banner.dart';
|
||||||
|
|
||||||
import '../../domain/validators/clock_in_validation_context.dart';
|
import '../../domain/validators/clock_in_validation_context.dart';
|
||||||
import '../../domain/validators/validators/time_window_validator.dart';
|
import '../../domain/validators/validators/time_window_validator.dart';
|
||||||
@@ -34,7 +35,7 @@ class ClockInActionSection extends StatelessWidget {
|
|||||||
required this.checkOutTime,
|
required this.checkOutTime,
|
||||||
required this.checkInMode,
|
required this.checkInMode,
|
||||||
required this.isActionInProgress,
|
required this.isActionInProgress,
|
||||||
this.hasError = false,
|
this.hasClockinError = false,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ class ClockInActionSection extends StatelessWidget {
|
|||||||
final bool isActionInProgress;
|
final bool isActionInProgress;
|
||||||
|
|
||||||
/// Whether the last action attempt resulted in an error.
|
/// Whether the last action attempt resulted in an error.
|
||||||
final bool hasError;
|
final bool hasClockinError;
|
||||||
|
|
||||||
/// Resolves the [CheckInInteraction] for the current mode.
|
/// Resolves the [CheckInInteraction] for the current mode.
|
||||||
///
|
///
|
||||||
@@ -84,21 +85,21 @@ class ClockInActionSection extends StatelessWidget {
|
|||||||
|
|
||||||
/// Builds the action widget for an active (not completed) shift.
|
/// Builds the action widget for an active (not completed) shift.
|
||||||
Widget _buildActiveShiftAction(BuildContext context) {
|
Widget _buildActiveShiftAction(BuildContext context) {
|
||||||
// if (!isCheckedIn && !_isCheckInAllowed(selectedShift!)) {
|
if (!isCheckedIn && !_isCheckInAllowed(selectedShift!)) {
|
||||||
// return Column(
|
return Column(
|
||||||
// mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
// children: <Widget>[
|
children: <Widget>[
|
||||||
// const GeofenceStatusBanner(),
|
const GeofenceStatusBanner(),
|
||||||
// const SizedBox(height: UiConstants.space3),
|
const SizedBox(height: UiConstants.space3),
|
||||||
// EarlyCheckInBanner(
|
EarlyCheckInBanner(
|
||||||
// availabilityTime: _getAvailabilityTimeText(
|
availabilityTime: _getAvailabilityTimeText(
|
||||||
// selectedShift!,
|
selectedShift!,
|
||||||
// context,
|
context,
|
||||||
// ),
|
),
|
||||||
// ),
|
),
|
||||||
// ],
|
],
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
|
|
||||||
return BlocBuilder<GeofenceBloc, GeofenceState>(
|
return BlocBuilder<GeofenceBloc, GeofenceState>(
|
||||||
builder: (BuildContext context, GeofenceState geofenceState) {
|
builder: (BuildContext context, GeofenceState geofenceState) {
|
||||||
@@ -122,7 +123,7 @@ class ClockInActionSection extends StatelessWidget {
|
|||||||
isCheckedIn: isCheckedIn,
|
isCheckedIn: isCheckedIn,
|
||||||
isDisabled: isGeofenceBlocking,
|
isDisabled: isGeofenceBlocking,
|
||||||
isLoading: isActionInProgress,
|
isLoading: isActionInProgress,
|
||||||
hasError: hasError,
|
hasClockinError: hasClockinError,
|
||||||
onCheckIn: () => _handleCheckIn(context),
|
onCheckIn: () => _handleCheckIn(context),
|
||||||
onCheckOut: () => _handleCheckOut(context),
|
onCheckOut: () => _handleCheckOut(context),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class _ClockInBodyState extends State<ClockInBody> {
|
|||||||
checkInMode: state.checkInMode,
|
checkInMode: state.checkInMode,
|
||||||
isActionInProgress:
|
isActionInProgress:
|
||||||
state.status == ClockInStatus.actionInProgress,
|
state.status == ClockInStatus.actionInProgress,
|
||||||
hasError: state.status == ClockInStatus.failure,
|
hasClockinError: state.status == ClockInStatus.failure,
|
||||||
),
|
),
|
||||||
|
|
||||||
// checked-in banner (only when checked in to the selected shift)
|
// checked-in banner (only when checked in to the selected shift)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class SwipeToCheckIn extends StatefulWidget {
|
|||||||
this.isLoading = false,
|
this.isLoading = false,
|
||||||
this.isCheckedIn = false,
|
this.isCheckedIn = false,
|
||||||
this.isDisabled = false,
|
this.isDisabled = false,
|
||||||
this.hasError = false,
|
this.hasClockinError = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Called when the user completes the swipe to check in.
|
/// Called when the user completes the swipe to check in.
|
||||||
@@ -36,7 +36,7 @@ class SwipeToCheckIn extends StatefulWidget {
|
|||||||
final bool isDisabled;
|
final bool isDisabled;
|
||||||
|
|
||||||
/// Whether an error occurred during the last action attempt.
|
/// Whether an error occurred during the last action attempt.
|
||||||
final bool hasError;
|
final bool hasClockinError;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SwipeToCheckIn> createState() => _SwipeToCheckInState();
|
State<SwipeToCheckIn> createState() => _SwipeToCheckInState();
|
||||||
@@ -62,7 +62,7 @@ class _SwipeToCheckInState extends State<SwipeToCheckIn>
|
|||||||
if (_isComplete &&
|
if (_isComplete &&
|
||||||
widget.isCheckedIn == oldWidget.isCheckedIn &&
|
widget.isCheckedIn == oldWidget.isCheckedIn &&
|
||||||
((oldWidget.isLoading && !widget.isLoading) ||
|
((oldWidget.isLoading && !widget.isLoading) ||
|
||||||
(!oldWidget.hasError && widget.hasError))) {
|
(!oldWidget.hasClockinError && widget.hasClockinError))) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isComplete = false;
|
_isComplete = false;
|
||||||
_dragValue = 0.0;
|
_dragValue = 0.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user