a85890f30a
- mobile/: Flutter/Dart merchant mobile app skeleton - .github/: GitHub Actions CI workflows - .dockerignore: exclude host node_modules from build context - .cursorrules: Cursor IDE project rules - .claude/: Claude Code project settings and launch config Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
32 lines
987 B
Dart
32 lines
987 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../../core/sync/sync_engine.dart';
|
|
import '../cart/cart_state.dart' show apiClientProvider;
|
|
import 'hr_api.dart';
|
|
|
|
class HrSession {
|
|
const HrSession({required this.cafeId, required this.employeeId});
|
|
final String cafeId;
|
|
final String employeeId;
|
|
}
|
|
|
|
const _demoCafeId = 'cafe_demo_001';
|
|
const _demoEmployeeId = 'emp_demo_owner';
|
|
|
|
final hrApiProvider = Provider<HrApi>((ref) => HrApi(ref.watch(apiClientProvider)));
|
|
|
|
final syncEngineProvider = Provider<SyncEngine>((ref) => SyncEngine());
|
|
|
|
final hrSessionProvider = Provider<HrSession?>(
|
|
(_) => const HrSession(cafeId: _demoCafeId, employeeId: _demoEmployeeId),
|
|
);
|
|
|
|
final todayShiftProvider = FutureProvider<Map<String, dynamic>?>((ref) async {
|
|
final session = ref.watch(hrSessionProvider);
|
|
if (session == null) return null;
|
|
return ref.watch(hrApiProvider).fetchTodayShift(
|
|
cafeId: session.cafeId,
|
|
employeeId: session.employeeId,
|
|
);
|
|
});
|