feat: sales page
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/presentation/home/models/order_model.dart';
|
||||
@@ -12,9 +11,14 @@ class DaySalesBloc extends Bloc<DaySalesEvent, DaySalesState> {
|
||||
final ProductLocalDatasource datasource;
|
||||
DaySalesBloc(this.datasource) : super(const _Initial()) {
|
||||
on<_GetDaySales>((event, emit) async {
|
||||
emit(const _Loading());
|
||||
final result = await datasource.getAllOrder(event.date);
|
||||
emit(_Loaded(result));
|
||||
});
|
||||
on<_GetRangeDateSales>((event, emit) async {
|
||||
emit(const _Loading());
|
||||
final result =
|
||||
await datasource.getAllOrder(event.date);
|
||||
await datasource.getAllOrderByRange(event.startDate, event.endDate);
|
||||
emit(_Loaded(result));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user