dev merge

This commit is contained in:
2026-03-19 15:25:37 +05:30
parent e671827dc4
commit 230942e776
12 changed files with 156 additions and 24 deletions

View File

@@ -39,7 +39,10 @@ class ClientCreateOrderRepositoryImpl
@override
Future<void> createRapidOrder(String description) async {
throw UnimplementedError('Rapid order creation is not connected yet.');
await _api.post(
ClientEndpoints.ordersRapid,
data: <String, dynamic>{'description': description},
);
}
@override

View File

@@ -2,7 +2,6 @@ import 'package:krow_core/core.dart';
/// Represents the arguments required for the [ClockInUseCase].
class ClockInArguments extends UseCaseArgument {
/// Creates a [ClockInArguments] instance.
const ClockInArguments({
required this.shiftId,
@@ -18,6 +17,7 @@ class ClockInArguments extends UseCaseArgument {
this.proofTimestamp,
this.attestationProvider,
this.attestationToken,
this.sourceType = 'GEO',
});
/// The ID of the shift to clock in to.
@@ -59,14 +59,16 @@ class ClockInArguments extends UseCaseArgument {
/// Signed attestation token from the device integrity API.
final String? attestationToken;
/// The source type of the clock-in (e.g. 'GEO', 'NFC', 'QR').
final String sourceType;
/// Serializes the arguments to a JSON map for the V2 API request body.
///
/// Only includes non-null fields. The `sourceType` is inferred from
/// whether [nfcTagId] is present.
/// Only includes non-null fields.
Map<String, dynamic> toJson() {
return <String, dynamic>{
'shiftId': shiftId,
'sourceType': nfcTagId != null ? 'NFC' : 'GEO',
'sourceType': sourceType,
if (notes != null && notes!.isNotEmpty) 'notes': notes,
if (deviceId != null) 'deviceId': deviceId,
if (latitude != null) 'latitude': latitude,
@@ -101,5 +103,6 @@ class ClockInArguments extends UseCaseArgument {
proofTimestamp,
attestationProvider,
attestationToken,
sourceType,
];
}

View File

@@ -18,6 +18,7 @@ class ClockOutArguments extends UseCaseArgument {
this.proofTimestamp,
this.attestationProvider,
this.attestationToken,
this.sourceType = 'GEO',
});
/// Optional notes provided by the user during clock-out.
@@ -62,14 +63,16 @@ class ClockOutArguments extends UseCaseArgument {
/// Signed attestation token from the device integrity API.
final String? attestationToken;
/// The source type of the clock-out (e.g. 'GEO', 'NFC', 'QR').
final String sourceType;
/// Serializes the arguments to a JSON map for the V2 API request body.
///
/// Only includes non-null fields. The `sourceType` is inferred from
/// whether [nfcTagId] is present.
/// Only includes non-null fields.
Map<String, dynamic> toJson() {
return <String, dynamic>{
if (shiftId != null) 'shiftId': shiftId,
'sourceType': nfcTagId != null ? 'NFC' : 'GEO',
'sourceType': sourceType,
if (notes != null && notes!.isNotEmpty) 'notes': notes,
if (breakTimeMinutes != null) 'breakMinutes': breakTimeMinutes,
if (deviceId != null) 'deviceId': deviceId,
@@ -106,5 +109,6 @@ class ClockOutArguments extends UseCaseArgument {
proofTimestamp,
attestationProvider,
attestationToken,
sourceType,
];
}

View File

@@ -213,6 +213,7 @@ class ClockInBloc extends Bloc<ClockInEvent, ClockInState>
longitude: location?.longitude,
accuracyMeters: location?.accuracy,
capturedAt: location?.timestamp,
sourceType: event.sourceType,
overrideReason: geofenceState.isGeofenceOverridden
? geofenceState.overrideNotes
: null,
@@ -291,6 +292,7 @@ class ClockInBloc extends Bloc<ClockInEvent, ClockInState>
longitude: location?.longitude,
accuracyMeters: location?.accuracy,
capturedAt: location?.timestamp,
sourceType: event.sourceType,
overrideReason: currentGeofence.isGeofenceOverridden
? currentGeofence.overrideNotes
: null,

View File

@@ -47,6 +47,7 @@ class CheckInRequested extends ClockInEvent {
this.clockInGreetingBody = '',
this.leftGeofenceTitle = '',
this.leftGeofenceBody = '',
this.sourceType = 'GEO',
});
/// The ID of the shift to clock into.
@@ -67,6 +68,9 @@ class CheckInRequested extends ClockInEvent {
/// Localized body for the left-geofence background notification.
final String leftGeofenceBody;
/// The source type of the clock-in (e.g. 'GEO', 'NFC', 'QR').
final String sourceType;
@override
List<Object?> get props => <Object?>[
shiftId,
@@ -75,6 +79,7 @@ class CheckInRequested extends ClockInEvent {
clockInGreetingBody,
leftGeofenceTitle,
leftGeofenceBody,
sourceType,
];
}
@@ -85,6 +90,7 @@ class CheckOutRequested extends ClockInEvent {
this.breakTimeMinutes,
this.clockOutTitle = '',
this.clockOutBody = '',
this.sourceType = 'GEO',
});
/// Optional notes provided by the user.
@@ -99,12 +105,16 @@ class CheckOutRequested extends ClockInEvent {
/// Localized body for the clock-out notification.
final String clockOutBody;
/// The source type of the clock-out (e.g. 'GEO', 'NFC', 'QR').
final String sourceType;
@override
List<Object?> get props => <Object?>[
notes,
breakTimeMinutes,
clockOutTitle,
clockOutBody,
sourceType,
];
}

View File

@@ -2,6 +2,7 @@ import 'package:core_localization/core_localization.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:geolocator/geolocator.dart';
import 'package:intl/intl.dart';
import 'package:krow_core/core.dart';
import 'package:krow_domain/krow_domain.dart';
@@ -147,8 +148,6 @@ class _FindShiftsTabState extends State<FindShiftsTab> {
return DateFormat('EEE, MMM d').format(date);
}
}
Widget _buildFilterTab(String id, String label) {
final bool isSelected = _jobType == id;
return GestureDetector(
@@ -421,7 +420,6 @@ class _FindShiftsTabState extends State<FindShiftsTab> {
),
),
),
),
],
),
),

View File

@@ -29,6 +29,7 @@ dependencies:
url_launcher: ^6.3.1
bloc: ^8.1.4
meta: ^1.17.0
google_maps_flutter: ^2.5.3
dev_dependencies:
flutter_test: