Compare commits
No commits in common. "571ba9802e72e823a9479b44940722f7aaf34bf7" and "617b5c54f2b071e05a6415e1895217aa29f1f24f" have entirely different histories.
571ba9802e
...
617b5c54f2
@ -14,7 +14,7 @@ class CustomTextField extends StatelessWidget {
|
|||||||
final Widget? prefixIcon;
|
final Widget? prefixIcon;
|
||||||
final Widget? suffixIcon;
|
final Widget? suffixIcon;
|
||||||
final bool readOnly;
|
final bool readOnly;
|
||||||
final int maxLines;
|
final int? maxLines;
|
||||||
final String? Function(String?)? validator;
|
final String? Function(String?)? validator;
|
||||||
|
|
||||||
const CustomTextField({
|
const CustomTextField({
|
||||||
@ -30,7 +30,7 @@ class CustomTextField extends StatelessWidget {
|
|||||||
this.prefixIcon,
|
this.prefixIcon,
|
||||||
this.suffixIcon,
|
this.suffixIcon,
|
||||||
this.readOnly = false,
|
this.readOnly = false,
|
||||||
this.maxLines = 1,
|
this.maxLines,
|
||||||
this.validator,
|
this.validator,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -358,19 +358,19 @@ class ProductLocalDatasource {
|
|||||||
|
|
||||||
// generate table managent with count
|
// generate table managent with count
|
||||||
Future<void> createTableManagement(String tableName, Offset position) async {
|
Future<void> createTableManagement(String tableName, Offset position) async {
|
||||||
// final db = await instance.database;
|
final db = await instance.database;
|
||||||
// TableModel newTable = TableModel(
|
TableModel newTable = TableModel(
|
||||||
// tableName: tableName,
|
tableName: tableName,
|
||||||
// status: 'available',
|
status: 'available',
|
||||||
// orderId: 0,
|
orderId: 0,
|
||||||
// paymentAmount: 0,
|
paymentAmount: 0,
|
||||||
// startTime: DateTime.now().toIso8601String(),
|
startTime: DateTime.now().toIso8601String(),
|
||||||
// position: position,
|
position: position,
|
||||||
// );
|
);
|
||||||
// await db.insert(
|
await db.insert(
|
||||||
// tableManagement,
|
tableManagement,
|
||||||
// newTable.toMap(),
|
newTable.toMap(),
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// change position table
|
// change position table
|
||||||
|
|||||||
@ -1,134 +0,0 @@
|
|||||||
import 'dart:developer';
|
|
||||||
import 'dart:ui';
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:enaklo_pos/core/network/dio_client.dart';
|
|
||||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
|
||||||
import '../../core/constants/variables.dart';
|
|
||||||
import 'auth_local_datasource.dart';
|
|
||||||
|
|
||||||
class TableRemoteDataSource {
|
|
||||||
final Dio dio = DioClient.instance;
|
|
||||||
|
|
||||||
Future<Either<String, bool>> createTable({
|
|
||||||
required String tableName,
|
|
||||||
required int capacity,
|
|
||||||
required String location,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final authData = await AuthLocalDataSource().getAuthData();
|
|
||||||
final url = '${Variables.baseUrl}/api/v1/tables';
|
|
||||||
|
|
||||||
final response = await dio.post(
|
|
||||||
url,
|
|
||||||
data: {
|
|
||||||
"outlet_id": authData.user?.outletId,
|
|
||||||
"table_name": tableName,
|
|
||||||
"capacity": capacity,
|
|
||||||
"location": location,
|
|
||||||
"status": "available",
|
|
||||||
"is_active": true,
|
|
||||||
"position_x": 200,
|
|
||||||
"position_y": 200,
|
|
||||||
},
|
|
||||||
options: Options(
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Bearer ${authData.token}',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200 || response.statusCode == 201) {
|
|
||||||
return Right(true);
|
|
||||||
} else {
|
|
||||||
return const Left('Failed to create table');
|
|
||||||
}
|
|
||||||
} on DioException catch (e) {
|
|
||||||
log("Dio error: ${e.message}");
|
|
||||||
return Left(e.response?.data['message'] ?? 'Gagal membuat table');
|
|
||||||
} catch (e) {
|
|
||||||
log("Unexpected error: $e");
|
|
||||||
return const Left('Unexpected error occurred');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Either<String, TableResponseModel>> getTable({
|
|
||||||
int page = 1,
|
|
||||||
int limit = 10,
|
|
||||||
String? status,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final authData = await AuthLocalDataSource().getAuthData();
|
|
||||||
final url = '${Variables.baseUrl}/api/v1/tables';
|
|
||||||
|
|
||||||
Map<String, dynamic> queryParameters = {
|
|
||||||
'page': page,
|
|
||||||
'limit': limit,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (status != null) {
|
|
||||||
queryParameters['status'] = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
final response = await dio.get(
|
|
||||||
url,
|
|
||||||
queryParameters: queryParameters,
|
|
||||||
options: Options(
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Bearer ${authData.token}',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
return Right(TableResponseModel.fromMap(response.data));
|
|
||||||
} else {
|
|
||||||
return const Left('Failed to get tables');
|
|
||||||
}
|
|
||||||
} on DioException catch (e) {
|
|
||||||
log("Dio error: ${e.message}");
|
|
||||||
return Left(e.response?.data['message'] ?? 'Gagal mengambil data meja');
|
|
||||||
} catch (e) {
|
|
||||||
log("Unexpected error: $e");
|
|
||||||
return const Left('Unexpected error occurred');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Either<String, bool>> updatePosition({
|
|
||||||
required String tableId,
|
|
||||||
required Offset position,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final authData = await AuthLocalDataSource().getAuthData();
|
|
||||||
final url = '${Variables.baseUrl}/api/v1/tables/$tableId';
|
|
||||||
|
|
||||||
final response = await dio.put(
|
|
||||||
url,
|
|
||||||
data: {
|
|
||||||
"position_x": position.dx.round(),
|
|
||||||
"position_y": position.dy.round(),
|
|
||||||
},
|
|
||||||
options: Options(
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Bearer ${authData.token}',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200 || response.statusCode == 201) {
|
|
||||||
return Right(true);
|
|
||||||
} else {
|
|
||||||
return const Left('Failed to create table');
|
|
||||||
}
|
|
||||||
} on DioException catch (e) {
|
|
||||||
log("Dio error: ${e.message}");
|
|
||||||
return Left(e.response?.data['message'] ?? 'Gagal membuat table');
|
|
||||||
} catch (e) {
|
|
||||||
log("Unexpected error: $e");
|
|
||||||
return const Left('Unexpected error occurred');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,132 +1,74 @@
|
|||||||
import 'dart:convert';
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
|
import 'dart:ui';
|
||||||
class TableResponseModel {
|
|
||||||
final bool? success;
|
|
||||||
final TableData? data;
|
|
||||||
final dynamic errors;
|
|
||||||
|
|
||||||
TableResponseModel({
|
|
||||||
this.success,
|
|
||||||
this.data,
|
|
||||||
this.errors,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory TableResponseModel.fromJson(String str) =>
|
|
||||||
TableResponseModel.fromMap(json.decode(str));
|
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
|
||||||
|
|
||||||
factory TableResponseModel.fromMap(Map<String, dynamic> json) =>
|
|
||||||
TableResponseModel(
|
|
||||||
success: json["success"],
|
|
||||||
data: json["data"] == null ? null : TableData.fromMap(json["data"]),
|
|
||||||
errors: json["errors"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() => {
|
|
||||||
"success": success,
|
|
||||||
"data": data?.toMap(),
|
|
||||||
"errors": errors,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class TableData {
|
|
||||||
final List<TableModel>? tables;
|
|
||||||
final int? totalCount;
|
|
||||||
final int? page;
|
|
||||||
final int? limit;
|
|
||||||
final int? totalPages;
|
|
||||||
|
|
||||||
TableData({
|
|
||||||
this.tables,
|
|
||||||
this.totalCount,
|
|
||||||
this.page,
|
|
||||||
this.limit,
|
|
||||||
this.totalPages,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory TableData.fromMap(Map<String, dynamic> json) => TableData(
|
|
||||||
tables: json["tables"] == null
|
|
||||||
? []
|
|
||||||
: List<TableModel>.from(
|
|
||||||
json["tables"].map((x) => TableModel.fromMap(x))),
|
|
||||||
totalCount: json["total_count"],
|
|
||||||
page: json["page"],
|
|
||||||
limit: json["limit"],
|
|
||||||
totalPages: json["total_pages"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() => {
|
|
||||||
"tables": tables == null
|
|
||||||
? []
|
|
||||||
: List<dynamic>.from(tables!.map((x) => x.toMap())),
|
|
||||||
"total_count": totalCount,
|
|
||||||
"page": page,
|
|
||||||
"limit": limit,
|
|
||||||
"total_pages": totalPages,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class TableModel {
|
class TableModel {
|
||||||
final String? id;
|
int? id;
|
||||||
final String? organizationId;
|
final String tableName;
|
||||||
final String? outletId;
|
final String startTime;
|
||||||
final String? tableName;
|
final String status;
|
||||||
final String? status;
|
final int orderId;
|
||||||
final int? paymentAmount;
|
final int paymentAmount;
|
||||||
final double? positionX;
|
final Offset position;
|
||||||
final double? positionY;
|
|
||||||
final int? capacity;
|
|
||||||
final bool? isActive;
|
|
||||||
final DateTime? createdAt;
|
|
||||||
final DateTime? updatedAt;
|
|
||||||
|
|
||||||
TableModel({
|
TableModel({
|
||||||
this.id,
|
this.id,
|
||||||
this.organizationId,
|
required this.tableName,
|
||||||
this.outletId,
|
required this.startTime,
|
||||||
this.tableName,
|
required this.status,
|
||||||
this.status,
|
required this.orderId,
|
||||||
this.paymentAmount,
|
required this.paymentAmount,
|
||||||
this.positionX,
|
required this.position,
|
||||||
this.positionY,
|
|
||||||
this.capacity,
|
|
||||||
this.isActive,
|
|
||||||
this.createdAt,
|
|
||||||
this.updatedAt,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
factory TableModel.fromMap(Map<String, dynamic> json) => TableModel(
|
@override
|
||||||
id: json["id"],
|
|
||||||
organizationId: json["organization_id"],
|
|
||||||
outletId: json["outlet_id"],
|
|
||||||
tableName: json["table_name"],
|
|
||||||
status: json["status"],
|
|
||||||
paymentAmount: json["payment_amount"],
|
|
||||||
positionX: json["position_x"]?.toDouble(),
|
|
||||||
positionY: json["position_y"]?.toDouble(),
|
|
||||||
capacity: json["capacity"],
|
|
||||||
isActive: json["is_active"],
|
|
||||||
createdAt: json["created_at"] == null
|
|
||||||
? null
|
|
||||||
: DateTime.parse(json["created_at"]),
|
|
||||||
updatedAt: json["updated_at"] == null
|
|
||||||
? null
|
|
||||||
: DateTime.parse(json["updated_at"]),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() => {
|
// from map
|
||||||
"id": id,
|
factory TableModel.fromMap(Map<String, dynamic> map) {
|
||||||
"organization_id": organizationId,
|
return TableModel(
|
||||||
"outlet_id": outletId,
|
id: map['id'],
|
||||||
"table_name": tableName,
|
tableName: map['table_name'],
|
||||||
"status": status,
|
startTime: map['start_time'],
|
||||||
"payment_amount": paymentAmount,
|
status: map['status'],
|
||||||
"position_x": positionX,
|
orderId: map['order_id'],
|
||||||
"position_y": positionY,
|
paymentAmount: map['payment_amount'],
|
||||||
"capacity": capacity,
|
position: Offset(map['x_position'], map['y_position']),
|
||||||
"is_active": isActive,
|
);
|
||||||
"created_at": createdAt?.toIso8601String(),
|
}
|
||||||
"updated_at": updatedAt?.toIso8601String(),
|
|
||||||
|
// to map
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
'table_name': tableName,
|
||||||
|
'status': status,
|
||||||
|
'start_time': startTime,
|
||||||
|
'order_id': orderId,
|
||||||
|
'payment_amount': paymentAmount,
|
||||||
|
'x_position': position.dx,
|
||||||
|
'y_position': position.dy,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(covariant TableModel other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
|
return other.id == id &&
|
||||||
|
other.tableName == tableName &&
|
||||||
|
other.startTime == startTime &&
|
||||||
|
other.status == status &&
|
||||||
|
other.orderId == orderId &&
|
||||||
|
other.paymentAmount == paymentAmount &&
|
||||||
|
other.position == position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return id.hashCode ^
|
||||||
|
tableName.hashCode ^
|
||||||
|
startTime.hashCode ^
|
||||||
|
status.hashCode ^
|
||||||
|
orderId.hashCode ^
|
||||||
|
paymentAmount.hashCode ^
|
||||||
|
position.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'dart:developer';
|
|||||||
import 'package:enaklo_pos/core/constants/theme.dart';
|
import 'package:enaklo_pos/core/constants/theme.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/customer_remote_datasource.dart';
|
import 'package:enaklo_pos/data/datasources/customer_remote_datasource.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/outlet_remote_data_source.dart';
|
import 'package:enaklo_pos/data/datasources/outlet_remote_data_source.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/table_remote_datasource.dart';
|
|
||||||
import 'package:enaklo_pos/presentation/customer/bloc/customer_form/customer_form_bloc.dart';
|
import 'package:enaklo_pos/presentation/customer/bloc/customer_form/customer_form_bloc.dart';
|
||||||
import 'package:enaklo_pos/presentation/customer/bloc/customer_loader/customer_loader_bloc.dart';
|
import 'package:enaklo_pos/presentation/customer/bloc/customer_loader/customer_loader_bloc.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/bloc/order_form/order_form_bloc.dart';
|
import 'package:enaklo_pos/presentation/home/bloc/order_form/order_form_bloc.dart';
|
||||||
@ -148,13 +147,13 @@ class _MyAppState extends State<MyApp> {
|
|||||||
create: (context) => TransactionReportBloc(OrderRemoteDatasource()),
|
create: (context) => TransactionReportBloc(OrderRemoteDatasource()),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => CreateTableBloc(TableRemoteDataSource()),
|
create: (context) => CreateTableBloc(),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => ChangePositionTableBloc(TableRemoteDataSource()),
|
create: (context) => ChangePositionTableBloc(),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => GetTableBloc(TableRemoteDataSource()),
|
create: (context) => GetTableBloc(),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => UpdateTableBloc(),
|
create: (context) => UpdateTableBloc(),
|
||||||
@ -167,7 +166,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
LastOrderTableBloc(ProductLocalDatasource.instance),
|
LastOrderTableBloc(ProductLocalDatasource.instance),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => GetTableStatusBloc(TableRemoteDataSource()),
|
create: (context) => GetTableStatusBloc(),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => AddProductBloc(ProductRemoteDatasource()),
|
create: (context) => AddProductBloc(ProductRemoteDatasource()),
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import 'package:enaklo_pos/data/datasources/table_remote_datasource.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
@ -9,17 +9,12 @@ part 'get_table_status_bloc.freezed.dart';
|
|||||||
|
|
||||||
class GetTableStatusBloc
|
class GetTableStatusBloc
|
||||||
extends Bloc<GetTableStatusEvent, GetTableStatusState> {
|
extends Bloc<GetTableStatusEvent, GetTableStatusState> {
|
||||||
final TableRemoteDataSource _tableRemoteDataSource;
|
GetTableStatusBloc() : super(_Initial()) {
|
||||||
GetTableStatusBloc(this._tableRemoteDataSource) : super(_Initial()) {
|
|
||||||
on<_GetTablesStatus>((event, emit) async {
|
on<_GetTablesStatus>((event, emit) async {
|
||||||
emit(_Loading());
|
emit(_Loading());
|
||||||
final tables =
|
final tables =
|
||||||
await _tableRemoteDataSource.getTable(status: event.status);
|
await ProductLocalDatasource.instance.getTableByStatus(event.status);
|
||||||
|
emit(_Success(tables));
|
||||||
tables.fold(
|
|
||||||
(failure) => emit(_Error(failure)),
|
|
||||||
(tableResponse) => emit(_Success(tableResponse.data!.tables!)),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -330,7 +330,6 @@ mixin _$GetTableStatusState {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -338,7 +337,6 @@ mixin _$GetTableStatusState {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -346,7 +344,6 @@ mixin _$GetTableStatusState {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -355,7 +352,6 @@ mixin _$GetTableStatusState {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -363,7 +359,6 @@ mixin _$GetTableStatusState {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -371,7 +366,6 @@ mixin _$GetTableStatusState {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -442,7 +436,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial();
|
return initial();
|
||||||
}
|
}
|
||||||
@ -453,7 +446,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial?.call();
|
return initial?.call();
|
||||||
}
|
}
|
||||||
@ -464,7 +456,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -479,7 +470,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial(this);
|
return initial(this);
|
||||||
}
|
}
|
||||||
@ -490,7 +480,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial?.call(this);
|
return initial?.call(this);
|
||||||
}
|
}
|
||||||
@ -501,7 +490,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -559,7 +547,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading();
|
return loading();
|
||||||
}
|
}
|
||||||
@ -570,7 +557,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading?.call();
|
return loading?.call();
|
||||||
}
|
}
|
||||||
@ -581,7 +567,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -596,7 +581,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading(this);
|
return loading(this);
|
||||||
}
|
}
|
||||||
@ -607,7 +591,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading?.call(this);
|
return loading?.call(this);
|
||||||
}
|
}
|
||||||
@ -618,7 +601,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -709,7 +691,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return success(tables);
|
return success(tables);
|
||||||
}
|
}
|
||||||
@ -720,7 +701,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return success?.call(tables);
|
return success?.call(tables);
|
||||||
}
|
}
|
||||||
@ -731,7 +711,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -746,7 +725,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return success(this);
|
return success(this);
|
||||||
}
|
}
|
||||||
@ -757,7 +735,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return success?.call(this);
|
return success?.call(this);
|
||||||
}
|
}
|
||||||
@ -768,7 +745,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -789,155 +765,3 @@ abstract class _Success implements GetTableStatusState {
|
|||||||
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$ErrorImplCopyWith<$Res> {
|
|
||||||
factory _$$ErrorImplCopyWith(
|
|
||||||
_$ErrorImpl value, $Res Function(_$ErrorImpl) then) =
|
|
||||||
__$$ErrorImplCopyWithImpl<$Res>;
|
|
||||||
@useResult
|
|
||||||
$Res call({String message});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$ErrorImplCopyWithImpl<$Res>
|
|
||||||
extends _$GetTableStatusStateCopyWithImpl<$Res, _$ErrorImpl>
|
|
||||||
implements _$$ErrorImplCopyWith<$Res> {
|
|
||||||
__$$ErrorImplCopyWithImpl(
|
|
||||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
|
||||||
: super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of GetTableStatusState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? message = null,
|
|
||||||
}) {
|
|
||||||
return _then(_$ErrorImpl(
|
|
||||||
null == message
|
|
||||||
? _value.message
|
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$ErrorImpl implements _Error {
|
|
||||||
const _$ErrorImpl(this.message);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'GetTableStatusState.error(message: $message)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$ErrorImpl &&
|
|
||||||
(identical(other.message, message) || other.message == message));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, message);
|
|
||||||
|
|
||||||
/// Create a copy of GetTableStatusState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
__$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() initial,
|
|
||||||
required TResult Function() loading,
|
|
||||||
required TResult Function(List<TableModel> tables) success,
|
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
|
||||||
return error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? initial,
|
|
||||||
TResult? Function()? loading,
|
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
|
||||||
return error?.call(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? initial,
|
|
||||||
TResult Function()? loading,
|
|
||||||
TResult Function(List<TableModel> tables)? success,
|
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (error != null) {
|
|
||||||
return error(message);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Initial value) initial,
|
|
||||||
required TResult Function(_Loading value) loading,
|
|
||||||
required TResult Function(_Success value) success,
|
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
|
||||||
return error(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Initial value)? initial,
|
|
||||||
TResult? Function(_Loading value)? loading,
|
|
||||||
TResult? Function(_Success value)? success,
|
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
|
||||||
return error?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Initial value)? initial,
|
|
||||||
TResult Function(_Loading value)? loading,
|
|
||||||
TResult Function(_Success value)? success,
|
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (error != null) {
|
|
||||||
return error(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _Error implements GetTableStatusState {
|
|
||||||
const factory _Error(final String message) = _$ErrorImpl;
|
|
||||||
|
|
||||||
String get message;
|
|
||||||
|
|
||||||
/// Create a copy of GetTableStatusState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,5 +5,4 @@ class GetTableStatusState with _$GetTableStatusState {
|
|||||||
const factory GetTableStatusState.initial() = _Initial;
|
const factory GetTableStatusState.initial() = _Initial;
|
||||||
const factory GetTableStatusState.loading() = _Loading;
|
const factory GetTableStatusState.loading() = _Loading;
|
||||||
const factory GetTableStatusState.success(List<TableModel> tables) = _Success;
|
const factory GetTableStatusState.success(List<TableModel> tables) = _Success;
|
||||||
const factory GetTableStatusState.error(String message) = _Error;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart';
|
|||||||
import 'package:enaklo_pos/data/datasources/order_remote_datasource.dart';
|
import 'package:enaklo_pos/data/datasources/order_remote_datasource.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/order_response_model.dart';
|
import 'package:enaklo_pos/data/models/response/order_response_model.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
|
||||||
import 'package:enaklo_pos/presentation/home/models/order_request.dart';
|
import 'package:enaklo_pos/presentation/home/models/order_request.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/models/order_type.dart';
|
import 'package:enaklo_pos/presentation/home/models/order_type.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/models/product_quantity.dart';
|
import 'package:enaklo_pos/presentation/home/models/product_quantity.dart';
|
||||||
@ -34,8 +33,7 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
|||||||
customerName: event.customerName,
|
customerName: event.customerName,
|
||||||
notes: '',
|
notes: '',
|
||||||
orderType: event.orderType.name,
|
orderType: event.orderType.name,
|
||||||
tableId: event.table.id,
|
tableNumber: event.tableNumber.toString(),
|
||||||
tableNumber: event.table.tableName,
|
|
||||||
outletId: userData.user?.outletId,
|
outletId: userData.user?.outletId,
|
||||||
userId: userData.user?.id,
|
userId: userData.user?.id,
|
||||||
orderItems: event.items
|
orderItems: event.items
|
||||||
@ -75,8 +73,7 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
|||||||
customerName: event.customerName,
|
customerName: event.customerName,
|
||||||
notes: '',
|
notes: '',
|
||||||
orderType: event.orderType.name,
|
orderType: event.orderType.name,
|
||||||
tableId: event.table.id,
|
tableNumber: event.tableNumber.toString(),
|
||||||
tableNumber: event.table.tableName,
|
|
||||||
outletId: userData.user?.outletId,
|
outletId: userData.user?.outletId,
|
||||||
userId: userData.user?.id,
|
userId: userData.user?.id,
|
||||||
orderItems: event.items
|
orderItems: event.items
|
||||||
|
|||||||
@ -20,10 +20,14 @@ mixin _$OrderFormEvent {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)
|
OrderType orderType, String tableNumber)
|
||||||
create,
|
create,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -34,10 +38,14 @@ mixin _$OrderFormEvent {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -48,10 +56,14 @@ mixin _$OrderFormEvent {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -183,10 +195,14 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)
|
OrderType orderType, String tableNumber)
|
||||||
create,
|
create,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -200,10 +216,14 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -217,10 +237,14 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -299,7 +323,7 @@ abstract class _$$CreateImplCopyWith<$Res> {
|
|||||||
{List<ProductQuantity> items,
|
{List<ProductQuantity> items,
|
||||||
String customerName,
|
String customerName,
|
||||||
OrderType orderType,
|
OrderType orderType,
|
||||||
TableModel table});
|
String tableNumber});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -318,7 +342,7 @@ class __$$CreateImplCopyWithImpl<$Res>
|
|||||||
Object? items = null,
|
Object? items = null,
|
||||||
Object? customerName = null,
|
Object? customerName = null,
|
||||||
Object? orderType = null,
|
Object? orderType = null,
|
||||||
Object? table = freezed,
|
Object? tableNumber = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$CreateImpl(
|
return _then(_$CreateImpl(
|
||||||
items: null == items
|
items: null == items
|
||||||
@ -333,10 +357,10 @@ class __$$CreateImplCopyWithImpl<$Res>
|
|||||||
? _value.orderType
|
? _value.orderType
|
||||||
: orderType // ignore: cast_nullable_to_non_nullable
|
: orderType // ignore: cast_nullable_to_non_nullable
|
||||||
as OrderType,
|
as OrderType,
|
||||||
table: freezed == table
|
tableNumber: null == tableNumber
|
||||||
? _value.table
|
? _value.tableNumber
|
||||||
: table // ignore: cast_nullable_to_non_nullable
|
: tableNumber // ignore: cast_nullable_to_non_nullable
|
||||||
as TableModel,
|
as String,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,7 +372,7 @@ class _$CreateImpl implements _Create {
|
|||||||
{required final List<ProductQuantity> items,
|
{required final List<ProductQuantity> items,
|
||||||
required this.customerName,
|
required this.customerName,
|
||||||
required this.orderType,
|
required this.orderType,
|
||||||
required this.table})
|
required this.tableNumber})
|
||||||
: _items = items;
|
: _items = items;
|
||||||
|
|
||||||
final List<ProductQuantity> _items;
|
final List<ProductQuantity> _items;
|
||||||
@ -364,11 +388,11 @@ class _$CreateImpl implements _Create {
|
|||||||
@override
|
@override
|
||||||
final OrderType orderType;
|
final OrderType orderType;
|
||||||
@override
|
@override
|
||||||
final TableModel table;
|
final String tableNumber;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'OrderFormEvent.create(items: $items, customerName: $customerName, orderType: $orderType, table: $table)';
|
return 'OrderFormEvent.create(items: $items, customerName: $customerName, orderType: $orderType, tableNumber: $tableNumber)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -381,7 +405,8 @@ class _$CreateImpl implements _Create {
|
|||||||
other.customerName == customerName) &&
|
other.customerName == customerName) &&
|
||||||
(identical(other.orderType, orderType) ||
|
(identical(other.orderType, orderType) ||
|
||||||
other.orderType == orderType) &&
|
other.orderType == orderType) &&
|
||||||
const DeepCollectionEquality().equals(other.table, table));
|
(identical(other.tableNumber, tableNumber) ||
|
||||||
|
other.tableNumber == tableNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -390,7 +415,7 @@ class _$CreateImpl implements _Create {
|
|||||||
const DeepCollectionEquality().hash(_items),
|
const DeepCollectionEquality().hash(_items),
|
||||||
customerName,
|
customerName,
|
||||||
orderType,
|
orderType,
|
||||||
const DeepCollectionEquality().hash(table));
|
tableNumber);
|
||||||
|
|
||||||
/// Create a copy of OrderFormEvent
|
/// Create a copy of OrderFormEvent
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -405,16 +430,20 @@ class _$CreateImpl implements _Create {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)
|
OrderType orderType, String tableNumber)
|
||||||
create,
|
create,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
required TResult Function() refund,
|
required TResult Function() refund,
|
||||||
}) {
|
}) {
|
||||||
return create(items, customerName, orderType, table);
|
return create(items, customerName, orderType, tableNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -422,16 +451,20 @@ class _$CreateImpl implements _Create {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
TResult? Function()? refund,
|
TResult? Function()? refund,
|
||||||
}) {
|
}) {
|
||||||
return create?.call(items, customerName, orderType, table);
|
return create?.call(items, customerName, orderType, tableNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -439,10 +472,14 @@ class _$CreateImpl implements _Create {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -450,7 +487,7 @@ class _$CreateImpl implements _Create {
|
|||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (create != null) {
|
if (create != null) {
|
||||||
return create(items, customerName, orderType, table);
|
return create(items, customerName, orderType, tableNumber);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -504,12 +541,12 @@ abstract class _Create implements OrderFormEvent {
|
|||||||
{required final List<ProductQuantity> items,
|
{required final List<ProductQuantity> items,
|
||||||
required final String customerName,
|
required final String customerName,
|
||||||
required final OrderType orderType,
|
required final OrderType orderType,
|
||||||
required final TableModel table}) = _$CreateImpl;
|
required final String tableNumber}) = _$CreateImpl;
|
||||||
|
|
||||||
List<ProductQuantity> get items;
|
List<ProductQuantity> get items;
|
||||||
String get customerName;
|
String get customerName;
|
||||||
OrderType get orderType;
|
OrderType get orderType;
|
||||||
TableModel get table;
|
String get tableNumber;
|
||||||
|
|
||||||
/// Create a copy of OrderFormEvent
|
/// Create a copy of OrderFormEvent
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -529,7 +566,7 @@ abstract class _$$CreateWithPaymentMethodImplCopyWith<$Res> {
|
|||||||
{List<ProductQuantity> items,
|
{List<ProductQuantity> items,
|
||||||
String customerName,
|
String customerName,
|
||||||
OrderType orderType,
|
OrderType orderType,
|
||||||
TableModel table,
|
String tableNumber,
|
||||||
PaymentMethod paymentMethod});
|
PaymentMethod paymentMethod});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,7 +587,7 @@ class __$$CreateWithPaymentMethodImplCopyWithImpl<$Res>
|
|||||||
Object? items = null,
|
Object? items = null,
|
||||||
Object? customerName = null,
|
Object? customerName = null,
|
||||||
Object? orderType = null,
|
Object? orderType = null,
|
||||||
Object? table = freezed,
|
Object? tableNumber = null,
|
||||||
Object? paymentMethod = null,
|
Object? paymentMethod = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$CreateWithPaymentMethodImpl(
|
return _then(_$CreateWithPaymentMethodImpl(
|
||||||
@ -566,10 +603,10 @@ class __$$CreateWithPaymentMethodImplCopyWithImpl<$Res>
|
|||||||
? _value.orderType
|
? _value.orderType
|
||||||
: orderType // ignore: cast_nullable_to_non_nullable
|
: orderType // ignore: cast_nullable_to_non_nullable
|
||||||
as OrderType,
|
as OrderType,
|
||||||
table: freezed == table
|
tableNumber: null == tableNumber
|
||||||
? _value.table
|
? _value.tableNumber
|
||||||
: table // ignore: cast_nullable_to_non_nullable
|
: tableNumber // ignore: cast_nullable_to_non_nullable
|
||||||
as TableModel,
|
as String,
|
||||||
paymentMethod: null == paymentMethod
|
paymentMethod: null == paymentMethod
|
||||||
? _value.paymentMethod
|
? _value.paymentMethod
|
||||||
: paymentMethod // ignore: cast_nullable_to_non_nullable
|
: paymentMethod // ignore: cast_nullable_to_non_nullable
|
||||||
@ -585,7 +622,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
{required final List<ProductQuantity> items,
|
{required final List<ProductQuantity> items,
|
||||||
required this.customerName,
|
required this.customerName,
|
||||||
required this.orderType,
|
required this.orderType,
|
||||||
required this.table,
|
required this.tableNumber,
|
||||||
required this.paymentMethod})
|
required this.paymentMethod})
|
||||||
: _items = items;
|
: _items = items;
|
||||||
|
|
||||||
@ -602,13 +639,13 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
@override
|
@override
|
||||||
final OrderType orderType;
|
final OrderType orderType;
|
||||||
@override
|
@override
|
||||||
final TableModel table;
|
final String tableNumber;
|
||||||
@override
|
@override
|
||||||
final PaymentMethod paymentMethod;
|
final PaymentMethod paymentMethod;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'OrderFormEvent.createWithPayment(items: $items, customerName: $customerName, orderType: $orderType, table: $table, paymentMethod: $paymentMethod)';
|
return 'OrderFormEvent.createWithPayment(items: $items, customerName: $customerName, orderType: $orderType, tableNumber: $tableNumber, paymentMethod: $paymentMethod)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -621,7 +658,8 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
other.customerName == customerName) &&
|
other.customerName == customerName) &&
|
||||||
(identical(other.orderType, orderType) ||
|
(identical(other.orderType, orderType) ||
|
||||||
other.orderType == orderType) &&
|
other.orderType == orderType) &&
|
||||||
const DeepCollectionEquality().equals(other.table, table) &&
|
(identical(other.tableNumber, tableNumber) ||
|
||||||
|
other.tableNumber == tableNumber) &&
|
||||||
(identical(other.paymentMethod, paymentMethod) ||
|
(identical(other.paymentMethod, paymentMethod) ||
|
||||||
other.paymentMethod == paymentMethod));
|
other.paymentMethod == paymentMethod));
|
||||||
}
|
}
|
||||||
@ -632,7 +670,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
const DeepCollectionEquality().hash(_items),
|
const DeepCollectionEquality().hash(_items),
|
||||||
customerName,
|
customerName,
|
||||||
orderType,
|
orderType,
|
||||||
const DeepCollectionEquality().hash(table),
|
tableNumber,
|
||||||
paymentMethod);
|
paymentMethod);
|
||||||
|
|
||||||
/// Create a copy of OrderFormEvent
|
/// Create a copy of OrderFormEvent
|
||||||
@ -649,17 +687,21 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)
|
OrderType orderType, String tableNumber)
|
||||||
create,
|
create,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
required TResult Function() refund,
|
required TResult Function() refund,
|
||||||
}) {
|
}) {
|
||||||
return createWithPayment(
|
return createWithPayment(
|
||||||
items, customerName, orderType, table, paymentMethod);
|
items, customerName, orderType, tableNumber, paymentMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -667,17 +709,21 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
TResult? Function()? refund,
|
TResult? Function()? refund,
|
||||||
}) {
|
}) {
|
||||||
return createWithPayment?.call(
|
return createWithPayment?.call(
|
||||||
items, customerName, orderType, table, paymentMethod);
|
items, customerName, orderType, tableNumber, paymentMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -685,10 +731,14 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -697,7 +747,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
}) {
|
}) {
|
||||||
if (createWithPayment != null) {
|
if (createWithPayment != null) {
|
||||||
return createWithPayment(
|
return createWithPayment(
|
||||||
items, customerName, orderType, table, paymentMethod);
|
items, customerName, orderType, tableNumber, paymentMethod);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -751,14 +801,14 @@ abstract class _CreateWithPaymentMethod implements OrderFormEvent {
|
|||||||
{required final List<ProductQuantity> items,
|
{required final List<ProductQuantity> items,
|
||||||
required final String customerName,
|
required final String customerName,
|
||||||
required final OrderType orderType,
|
required final OrderType orderType,
|
||||||
required final TableModel table,
|
required final String tableNumber,
|
||||||
required final PaymentMethod paymentMethod}) =
|
required final PaymentMethod paymentMethod}) =
|
||||||
_$CreateWithPaymentMethodImpl;
|
_$CreateWithPaymentMethodImpl;
|
||||||
|
|
||||||
List<ProductQuantity> get items;
|
List<ProductQuantity> get items;
|
||||||
String get customerName;
|
String get customerName;
|
||||||
OrderType get orderType;
|
OrderType get orderType;
|
||||||
TableModel get table;
|
String get tableNumber;
|
||||||
PaymentMethod get paymentMethod;
|
PaymentMethod get paymentMethod;
|
||||||
|
|
||||||
/// Create a copy of OrderFormEvent
|
/// Create a copy of OrderFormEvent
|
||||||
@ -838,10 +888,14 @@ class _$ToggleItemImpl implements _ToggleItem {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)
|
OrderType orderType, String tableNumber)
|
||||||
create,
|
create,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -855,10 +909,14 @@ class _$ToggleItemImpl implements _ToggleItem {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -872,10 +930,14 @@ class _$ToggleItemImpl implements _ToggleItem {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -1016,10 +1078,14 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)
|
OrderType orderType, String tableNumber)
|
||||||
create,
|
create,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -1033,10 +1099,14 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -1050,10 +1120,14 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -1165,10 +1239,14 @@ class _$RefundImpl implements _Refund {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)
|
OrderType orderType, String tableNumber)
|
||||||
create,
|
create,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -1182,10 +1260,14 @@ class _$RefundImpl implements _Refund {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -1199,10 +1281,14 @@ class _$RefundImpl implements _Refund {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, TableModel table)?
|
OrderType orderType, String tableNumber)?
|
||||||
create,
|
create,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(
|
||||||
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
List<ProductQuantity> items,
|
||||||
|
String customerName,
|
||||||
|
OrderType orderType,
|
||||||
|
String tableNumber,
|
||||||
|
PaymentMethod paymentMethod)?
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
|
|||||||
@ -7,13 +7,13 @@ class OrderFormEvent with _$OrderFormEvent {
|
|||||||
required List<ProductQuantity> items,
|
required List<ProductQuantity> items,
|
||||||
required String customerName,
|
required String customerName,
|
||||||
required OrderType orderType,
|
required OrderType orderType,
|
||||||
required TableModel table,
|
required String tableNumber,
|
||||||
}) = _Create;
|
}) = _Create;
|
||||||
const factory OrderFormEvent.createWithPayment({
|
const factory OrderFormEvent.createWithPayment({
|
||||||
required List<ProductQuantity> items,
|
required List<ProductQuantity> items,
|
||||||
required String customerName,
|
required String customerName,
|
||||||
required OrderType orderType,
|
required OrderType orderType,
|
||||||
required TableModel table,
|
required String tableNumber,
|
||||||
required PaymentMethod paymentMethod,
|
required PaymentMethod paymentMethod,
|
||||||
}) = _CreateWithPaymentMethod;
|
}) = _CreateWithPaymentMethod;
|
||||||
const factory OrderFormEvent.toggleItem(OrderItem item) = _ToggleItem;
|
const factory OrderFormEvent.toggleItem(OrderItem item) = _ToggleItem;
|
||||||
|
|||||||
@ -35,9 +35,6 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
context
|
|
||||||
.read<GetTableStatusBloc>()
|
|
||||||
.add(GetTableStatusEvent.getTablesStatus('available'));
|
|
||||||
if (widget.selectedTable != null) {
|
if (widget.selectedTable != null) {
|
||||||
selectTable = widget.selectedTable;
|
selectTable = widget.selectedTable;
|
||||||
}
|
}
|
||||||
@ -70,10 +67,7 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
BlocBuilder<GetTableStatusBloc, GetTableStatusState>(
|
BlocBuilder<GetTableStatusBloc, GetTableStatusState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return state.maybeWhen(
|
return state.maybeWhen(
|
||||||
orElse: () =>
|
orElse: () => const CircularProgressIndicator(),
|
||||||
Center(child: const CircularProgressIndicator()),
|
|
||||||
loading: () =>
|
|
||||||
Center(child: const CircularProgressIndicator()),
|
|
||||||
success: (tables) {
|
success: (tables) {
|
||||||
final availableTables = tables;
|
final availableTables = tables;
|
||||||
|
|
||||||
@ -112,10 +106,7 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
child: DropdownButtonHideUnderline(
|
child: DropdownButtonHideUnderline(
|
||||||
child: DropdownButton<TableModel>(
|
child: DropdownButton<TableModel>(
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
value: availableTables.firstWhere(
|
value: selectTable,
|
||||||
(t) => t.id == selectTable?.id,
|
|
||||||
orElse: () => availableTables.first,
|
|
||||||
),
|
|
||||||
onChanged: (TableModel? newValue) {
|
onChanged: (TableModel? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectTable = newValue;
|
selectTable = newValue;
|
||||||
@ -126,7 +117,7 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
(TableModel value) =>
|
(TableModel value) =>
|
||||||
DropdownMenuItem<TableModel>(
|
DropdownMenuItem<TableModel>(
|
||||||
value: value,
|
value: value,
|
||||||
child: Text(value.tableName ?? ""),
|
child: Text(value.tableName),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
@ -161,7 +152,7 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
items: widget.items,
|
items: widget.items,
|
||||||
customerName: widget.customerName,
|
customerName: widget.customerName,
|
||||||
orderType: widget.orderType,
|
orderType: widget.orderType,
|
||||||
table: selectTable!,
|
tableNumber: selectTable!.tableName.toString(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -4,7 +4,6 @@ class OrderRequestModel {
|
|||||||
final String? outletId;
|
final String? outletId;
|
||||||
final String? userId;
|
final String? userId;
|
||||||
final String? tableNumber;
|
final String? tableNumber;
|
||||||
final String? tableId;
|
|
||||||
final String? orderType;
|
final String? orderType;
|
||||||
final String? notes;
|
final String? notes;
|
||||||
final List<OrderItemRequest>? orderItems;
|
final List<OrderItemRequest>? orderItems;
|
||||||
@ -14,7 +13,6 @@ class OrderRequestModel {
|
|||||||
this.outletId,
|
this.outletId,
|
||||||
this.userId,
|
this.userId,
|
||||||
this.tableNumber,
|
this.tableNumber,
|
||||||
this.tableId,
|
|
||||||
this.orderType,
|
this.orderType,
|
||||||
this.notes,
|
this.notes,
|
||||||
this.orderItems,
|
this.orderItems,
|
||||||
@ -31,7 +29,6 @@ class OrderRequestModel {
|
|||||||
outletId: json["outlet_id"],
|
outletId: json["outlet_id"],
|
||||||
userId: json["user_id"],
|
userId: json["user_id"],
|
||||||
tableNumber: json["table_number"],
|
tableNumber: json["table_number"],
|
||||||
tableId: json["table_id"],
|
|
||||||
orderType: json["order_type"],
|
orderType: json["order_type"],
|
||||||
notes: json["notes"],
|
notes: json["notes"],
|
||||||
orderItems: json["order_items"] == null
|
orderItems: json["order_items"] == null
|
||||||
@ -45,7 +42,6 @@ class OrderRequestModel {
|
|||||||
"outlet_id": outletId,
|
"outlet_id": outletId,
|
||||||
"user_id": userId,
|
"user_id": userId,
|
||||||
"table_number": tableNumber,
|
"table_number": tableNumber,
|
||||||
"table_id": tableId,
|
|
||||||
"order_type": orderType,
|
"order_type": orderType,
|
||||||
"notes": notes,
|
"notes": notes,
|
||||||
"order_items": orderItems == null
|
"order_items": orderItems == null
|
||||||
|
|||||||
@ -829,8 +829,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
DropdownMenuItem<
|
DropdownMenuItem<
|
||||||
TableModel>(
|
TableModel>(
|
||||||
value: value,
|
value: value,
|
||||||
child: Text(
|
child: Text(value.tableName),
|
||||||
value.tableName ?? ""),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
@ -1193,28 +1192,28 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
savedDraftOrder: (orderDraftId) {
|
savedDraftOrder: (orderDraftId) {
|
||||||
log("PRICEVALUE: ${priceValue}");
|
log("PRICEVALUE: ${priceValue}");
|
||||||
|
|
||||||
// final newTabel = TableModel(
|
final newTabel = TableModel(
|
||||||
// id: widget.isTable
|
id: widget.isTable
|
||||||
// ? widget.table!.id
|
? widget.table!.id
|
||||||
// : selectTable?.id,
|
: selectTable?.id,
|
||||||
// tableName: widget.isTable
|
tableName: widget.isTable
|
||||||
// ? widget.table!.tableName
|
? widget.table!.tableName
|
||||||
// : selectTable?.tableName ??
|
: selectTable?.tableName ??
|
||||||
// '0',
|
'0',
|
||||||
// status: 'occupied',
|
status: 'occupied',
|
||||||
// paymentAmount: priceValue,
|
paymentAmount: priceValue,
|
||||||
// orderId: orderDraftId,
|
orderId: orderDraftId,
|
||||||
// startTime: DateTime.now()
|
startTime: DateTime.now()
|
||||||
// .toIso8601String(),
|
.toIso8601String(),
|
||||||
// position: widget.isTable
|
position: widget.isTable
|
||||||
// ? widget.table!.position
|
? widget.table!.position
|
||||||
// : selectTable!.position);
|
: selectTable!.position);
|
||||||
// log('new tabel: ${newTabel.toMap()}');
|
log('new tabel: ${newTabel.toMap()}');
|
||||||
// context
|
context
|
||||||
// .read<StatusTableBloc>()
|
.read<StatusTableBloc>()
|
||||||
// .add(StatusTableEvent.statusTabel(
|
.add(StatusTableEvent.statusTabel(
|
||||||
// newTabel,
|
newTabel,
|
||||||
// ));
|
));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child:
|
child:
|
||||||
@ -1358,16 +1357,16 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
|
|
||||||
if (widget.isTable) {
|
if (widget.isTable) {
|
||||||
log("discountAmountValue: $totalDiscount");
|
log("discountAmountValue: $totalDiscount");
|
||||||
// context.read<CheckoutBloc>().add(
|
context.read<CheckoutBloc>().add(
|
||||||
// CheckoutEvent
|
CheckoutEvent
|
||||||
// .saveDraftOrder(
|
.saveDraftOrder(
|
||||||
// widget.isTable == true
|
widget.isTable == true
|
||||||
// ? widget.table!.id!
|
? widget.table!.id!
|
||||||
// : selectTable!.id!,
|
: selectTable!.id!,
|
||||||
// customerController.text,
|
customerController.text,
|
||||||
// totalDiscount.toInt(),
|
totalDiscount.toInt(),
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@ -1516,120 +1515,120 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
// Tambahkan ke pesanan meja yang sudah ada
|
// Tambahkan ke pesanan meja yang sudah ada
|
||||||
if (selectTable != null) {
|
if (selectTable != null) {
|
||||||
// Ambil draft order yang sudah ada
|
// Ambil draft order yang sudah ada
|
||||||
// final existingDraftOrder =
|
final existingDraftOrder =
|
||||||
// await ProductLocalDatasource
|
await ProductLocalDatasource
|
||||||
// .instance
|
.instance
|
||||||
// .getDraftOrderById(
|
.getDraftOrderById(
|
||||||
// selectTable
|
selectTable
|
||||||
// ?.orderId ??
|
?.orderId ??
|
||||||
// 0);
|
0);
|
||||||
|
|
||||||
// if (existingDraftOrder !=
|
if (existingDraftOrder !=
|
||||||
// null) {
|
null) {
|
||||||
// // Convert items ke DraftOrderItem
|
// Convert items ke DraftOrderItem
|
||||||
// final newDraftItems = items
|
final newDraftItems = items
|
||||||
// .map((item) =>
|
.map((item) =>
|
||||||
// DraftOrderItem(
|
DraftOrderItem(
|
||||||
// product:
|
product:
|
||||||
// item.product,
|
item.product,
|
||||||
// quantity:
|
quantity:
|
||||||
// item.quantity,
|
item.quantity,
|
||||||
// ))
|
))
|
||||||
// .toList();
|
.toList();
|
||||||
|
|
||||||
// // Gabungkan dengan pesanan yang sudah ada
|
// Gabungkan dengan pesanan yang sudah ada
|
||||||
// final updatedItems = [
|
final updatedItems = [
|
||||||
// ...existingDraftOrder
|
...existingDraftOrder
|
||||||
// .orders,
|
.orders,
|
||||||
// ...newDraftItems
|
...newDraftItems
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// final updatedDraftOrder =
|
final updatedDraftOrder =
|
||||||
// existingDraftOrder
|
existingDraftOrder
|
||||||
// .copyWith(
|
.copyWith(
|
||||||
// orders: updatedItems,
|
orders: updatedItems,
|
||||||
// totalQuantity:
|
totalQuantity:
|
||||||
// updatedItems.fold<int>(
|
updatedItems.fold<int>(
|
||||||
// 0,
|
0,
|
||||||
// (sum, item) =>
|
(sum, item) =>
|
||||||
// sum +
|
sum +
|
||||||
// item.quantity),
|
item.quantity),
|
||||||
// subTotal: updatedItems.fold<
|
subTotal: updatedItems.fold<
|
||||||
// int>(
|
int>(
|
||||||
// 0,
|
0,
|
||||||
// (sum, item) =>
|
(sum, item) =>
|
||||||
// sum +
|
sum +
|
||||||
// (item.product
|
(item.product
|
||||||
// .price ??
|
.price ??
|
||||||
// 0) *
|
0) *
|
||||||
// item.quantity),
|
item.quantity),
|
||||||
// );
|
);
|
||||||
|
|
||||||
// // Update draft order
|
// Update draft order
|
||||||
// await ProductLocalDatasource
|
await ProductLocalDatasource
|
||||||
// .instance
|
.instance
|
||||||
// .updateDraftOrder(
|
.updateDraftOrder(
|
||||||
// updatedDraftOrder);
|
updatedDraftOrder);
|
||||||
|
|
||||||
// // Tampilkan dialog sukses
|
// Tampilkan dialog sukses
|
||||||
// await showDialog(
|
await showDialog(
|
||||||
// context: context,
|
context: context,
|
||||||
// barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
// builder: (context) =>
|
builder: (context) =>
|
||||||
// SaveOrderDialog(
|
SaveOrderDialog(
|
||||||
// data: items,
|
data: items,
|
||||||
// totalQty: totalQty,
|
totalQty: totalQty,
|
||||||
// totalPrice:
|
totalPrice:
|
||||||
// totalPriceFinal,
|
totalPriceFinal,
|
||||||
// totalTax:
|
totalTax:
|
||||||
// finalTax.toInt(),
|
finalTax.toInt(),
|
||||||
// totalDiscount:
|
totalDiscount:
|
||||||
// totalDiscount.toInt(),
|
totalDiscount.toInt(),
|
||||||
// subTotal:
|
subTotal:
|
||||||
// subTotal.toInt(),
|
subTotal.toInt(),
|
||||||
// normalPrice: price,
|
normalPrice: price,
|
||||||
// table: selectTable!,
|
table: selectTable!,
|
||||||
// draftName:
|
draftName:
|
||||||
// customerController
|
customerController
|
||||||
// .text,
|
.text,
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
// } else {
|
} else {
|
||||||
// // Jika tidak ada draft order, buat baru
|
// Jika tidak ada draft order, buat baru
|
||||||
// context
|
context
|
||||||
// .read<CheckoutBloc>()
|
.read<CheckoutBloc>()
|
||||||
// .add(
|
.add(
|
||||||
// CheckoutEvent
|
CheckoutEvent
|
||||||
// .saveDraftOrder(
|
.saveDraftOrder(
|
||||||
// selectTable!.id!,
|
selectTable!.id!,
|
||||||
// customerController
|
customerController
|
||||||
// .text,
|
.text,
|
||||||
// totalDiscount.toInt(),
|
totalDiscount.toInt(),
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
// await showDialog(
|
await showDialog(
|
||||||
// context: context,
|
context: context,
|
||||||
// barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
// builder: (context) =>
|
builder: (context) =>
|
||||||
// SaveOrderDialog(
|
SaveOrderDialog(
|
||||||
// data: items,
|
data: items,
|
||||||
// totalQty: totalQty,
|
totalQty: totalQty,
|
||||||
// totalPrice:
|
totalPrice:
|
||||||
// totalPriceFinal,
|
totalPriceFinal,
|
||||||
// totalTax:
|
totalTax:
|
||||||
// finalTax.toInt(),
|
finalTax.toInt(),
|
||||||
// totalDiscount:
|
totalDiscount:
|
||||||
// totalDiscount.toInt(),
|
totalDiscount.toInt(),
|
||||||
// subTotal:
|
subTotal:
|
||||||
// subTotal.toInt(),
|
subTotal.toInt(),
|
||||||
// normalPrice: price,
|
normalPrice: price,
|
||||||
// table: selectTable!,
|
table: selectTable!,
|
||||||
// draftName:
|
draftName:
|
||||||
// customerController
|
customerController
|
||||||
// .text,
|
.text,
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context)
|
||||||
.showSnackBar(
|
.showSnackBar(
|
||||||
@ -1641,16 +1640,16 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// context.read<CheckoutBloc>().add(
|
context.read<CheckoutBloc>().add(
|
||||||
// CheckoutEvent
|
CheckoutEvent
|
||||||
// .saveDraftOrder(
|
.saveDraftOrder(
|
||||||
// widget.isTable == true
|
widget.isTable == true
|
||||||
// ? widget.table!.id!
|
? widget.table!.id!
|
||||||
// : selectTable!.id!,
|
: selectTable!.id!,
|
||||||
// customerController.text,
|
customerController.text,
|
||||||
// totalDiscount.toInt(),
|
totalDiscount.toInt(),
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
||||||
import 'package:enaklo_pos/core/extensions/string_ext.dart';
|
import 'package:enaklo_pos/core/extensions/string_ext.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||||
|
import 'package:enaklo_pos/presentation/home/bloc/get_table_status/get_table_status_bloc.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/bloc/payment_methods/payment_methods_bloc.dart';
|
import 'package:enaklo_pos/presentation/home/bloc/payment_methods/payment_methods_bloc.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
||||||
|
|
||||||
@ -61,7 +62,9 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// Fetch available tables by default
|
// Fetch available tables by default
|
||||||
|
context
|
||||||
|
.read<GetTableStatusBloc>()
|
||||||
|
.add(GetTableStatusEvent.getTablesStatus('available'));
|
||||||
context
|
context
|
||||||
.read<PaymentMethodsBloc>()
|
.read<PaymentMethodsBloc>()
|
||||||
.add(PaymentMethodsEvent.fetchPaymentMethods());
|
.add(PaymentMethodsEvent.fetchPaymentMethods());
|
||||||
@ -925,7 +928,9 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
customerController
|
customerController
|
||||||
.text,
|
.text,
|
||||||
orderType: orderType,
|
orderType: orderType,
|
||||||
table: widget.table!,
|
tableNumber: widget.table
|
||||||
|
?.tableName ??
|
||||||
|
'',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -134,7 +134,7 @@ class HomeRightTitle extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
label: table == null ? 'Pilih Meja' : '${table!.tableName}',
|
label: table == null ? 'Pilih Meja' : '${table!.id}',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -97,17 +97,7 @@ class _SaveOrderDialogState extends State<SaveOrderDialog> {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final orderType = state.maybeWhen(
|
final orderType = state.maybeWhen(
|
||||||
orElse: () => OrderType.dineIn,
|
orElse: () => OrderType.dineIn,
|
||||||
loaded: (items,
|
loaded: (items, discountModel, discount, discountAmount, tax, serviceCharge, totalQuantity, totalPrice, draftName, orderType) => orderType,
|
||||||
discountModel,
|
|
||||||
discount,
|
|
||||||
discountAmount,
|
|
||||||
tax,
|
|
||||||
serviceCharge,
|
|
||||||
totalQuantity,
|
|
||||||
totalPrice,
|
|
||||||
draftName,
|
|
||||||
orderType) =>
|
|
||||||
orderType,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return Button.filled(
|
return Button.filled(
|
||||||
@ -118,8 +108,7 @@ class _SaveOrderDialogState extends State<SaveOrderDialog> {
|
|||||||
final kitchenPrinter = await ProductLocalDatasource
|
final kitchenPrinter = await ProductLocalDatasource
|
||||||
.instance
|
.instance
|
||||||
.getPrinterByCode('kitchen');
|
.getPrinterByCode('kitchen');
|
||||||
final barPrinter = await ProductLocalDatasource
|
final barPrinter = await ProductLocalDatasource.instance
|
||||||
.instance
|
|
||||||
.getPrinterByCode('bar');
|
.getPrinterByCode('bar');
|
||||||
|
|
||||||
log("Checker printer: ${checkerPrinter?.toMap()}");
|
log("Checker printer: ${checkerPrinter?.toMap()}");
|
||||||
@ -132,20 +121,21 @@ class _SaveOrderDialogState extends State<SaveOrderDialog> {
|
|||||||
final printValue = await PrintDataoutputs.instance
|
final printValue = await PrintDataoutputs.instance
|
||||||
.printChecker(
|
.printChecker(
|
||||||
widget.data,
|
widget.data,
|
||||||
widget.table.tableName!,
|
widget.table.tableName,
|
||||||
widget.draftName,
|
widget.draftName,
|
||||||
'kasir',
|
'kasir',
|
||||||
checkerPrinter.paper.toIntegerFromText,
|
checkerPrinter.paper.toIntegerFromText,
|
||||||
orderType.value);
|
orderType.value);
|
||||||
|
|
||||||
await PrinterService().printWithPrinter(
|
await PrinterService().printWithPrinter(
|
||||||
checkerPrinter, printValue, context);
|
checkerPrinter,
|
||||||
|
printValue,
|
||||||
|
context
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log("Error printing checker: $e");
|
log("Error printing checker: $e");
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(content: Text('Error printing checker: $e')),
|
||||||
content:
|
|
||||||
Text('Error printing checker: $e')),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,10 +143,9 @@ class _SaveOrderDialogState extends State<SaveOrderDialog> {
|
|||||||
// Kitchen printer
|
// Kitchen printer
|
||||||
if (kitchenPrinter != null) {
|
if (kitchenPrinter != null) {
|
||||||
try {
|
try {
|
||||||
final printValue =
|
final printValue = await PrintDataoutputs.instance.printKitchen(
|
||||||
await PrintDataoutputs.instance.printKitchen(
|
|
||||||
widget.data,
|
widget.data,
|
||||||
widget.table.tableName!,
|
widget.table.tableName,
|
||||||
widget.draftName,
|
widget.draftName,
|
||||||
'kasir',
|
'kasir',
|
||||||
kitchenPrinter.paper.toIntegerFromText,
|
kitchenPrinter.paper.toIntegerFromText,
|
||||||
@ -164,13 +153,14 @@ class _SaveOrderDialogState extends State<SaveOrderDialog> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await PrinterService().printWithPrinter(
|
await PrinterService().printWithPrinter(
|
||||||
kitchenPrinter, printValue, context);
|
kitchenPrinter,
|
||||||
|
printValue,
|
||||||
|
context
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log("Error printing kitchen order: $e");
|
log("Error printing kitchen order: $e");
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(content: Text('Error printing kitchen order: $e')),
|
||||||
content: Text(
|
|
||||||
'Error printing kitchen order: $e')),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,10 +168,9 @@ class _SaveOrderDialogState extends State<SaveOrderDialog> {
|
|||||||
// Bar printer
|
// Bar printer
|
||||||
if (barPrinter != null) {
|
if (barPrinter != null) {
|
||||||
try {
|
try {
|
||||||
final printValue =
|
final printValue = await PrintDataoutputs.instance.printBar(
|
||||||
await PrintDataoutputs.instance.printBar(
|
|
||||||
widget.data,
|
widget.data,
|
||||||
widget.table.tableName!,
|
widget.table.tableName,
|
||||||
widget.draftName,
|
widget.draftName,
|
||||||
'kasir',
|
'kasir',
|
||||||
barPrinter.paper.toIntegerFromText,
|
barPrinter.paper.toIntegerFromText,
|
||||||
@ -189,13 +178,14 @@ class _SaveOrderDialogState extends State<SaveOrderDialog> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await PrinterService().printWithPrinter(
|
await PrinterService().printWithPrinter(
|
||||||
barPrinter, printValue, context);
|
barPrinter,
|
||||||
|
printValue,
|
||||||
|
context
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log("Error printing bar order: $e");
|
log("Error printing bar order: $e");
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(content: Text('Error printing bar order: $e')),
|
||||||
content:
|
|
||||||
Text('Error printing bar order: $e')),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,7 +152,8 @@ class SuccessSaveOrderPage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Button.outlined(
|
child: Button.outlined(
|
||||||
onPressed: () => context.push(DashboardPage()),
|
onPressed: () =>
|
||||||
|
context.pushReplacement(DashboardPage()),
|
||||||
label: 'Kembali',
|
label: 'Kembali',
|
||||||
height: 44,
|
height: 44,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/table_remote_datasource.dart';
|
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
part 'change_position_table_event.dart';
|
part 'change_position_table_event.dart';
|
||||||
@ -10,19 +10,11 @@ part 'change_position_table_bloc.freezed.dart';
|
|||||||
|
|
||||||
class ChangePositionTableBloc
|
class ChangePositionTableBloc
|
||||||
extends Bloc<ChangePositionTableEvent, ChangePositionTableState> {
|
extends Bloc<ChangePositionTableEvent, ChangePositionTableState> {
|
||||||
final TableRemoteDataSource _tableRemoteDataSource;
|
ChangePositionTableBloc() : super(_Initial()) {
|
||||||
ChangePositionTableBloc(this._tableRemoteDataSource)
|
|
||||||
: super(ChangePositionTableState.initial()) {
|
|
||||||
on<_ChangePositionTable>((event, emit) async {
|
on<_ChangePositionTable>((event, emit) async {
|
||||||
emit(_Loading());
|
emit(_Loading());
|
||||||
final result = await _tableRemoteDataSource.updatePosition(
|
await ProductLocalDatasource.instance
|
||||||
tableId: event.tableId,
|
.changePositionTable(event.tableId, event.position);
|
||||||
position: event.position,
|
|
||||||
);
|
|
||||||
result.fold(
|
|
||||||
(l) => emit(_Error(l)),
|
|
||||||
(r) => emit(_Success('Generate Success')),
|
|
||||||
);
|
|
||||||
emit(_Success('Generate Success'));
|
emit(_Success('Generate Success'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,20 +19,19 @@ mixin _$ChangePositionTableEvent {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() started,
|
required TResult Function() started,
|
||||||
required TResult Function(String tableId, Offset position)
|
required TResult Function(int tableId, Offset position) changePositionTable,
|
||||||
changePositionTable,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function()? started,
|
TResult? Function()? started,
|
||||||
TResult? Function(String tableId, Offset position)? changePositionTable,
|
TResult? Function(int tableId, Offset position)? changePositionTable,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? started,
|
TResult Function()? started,
|
||||||
TResult Function(String tableId, Offset position)? changePositionTable,
|
TResult Function(int tableId, Offset position)? changePositionTable,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -121,8 +120,7 @@ class _$StartedImpl implements _Started {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() started,
|
required TResult Function() started,
|
||||||
required TResult Function(String tableId, Offset position)
|
required TResult Function(int tableId, Offset position) changePositionTable,
|
||||||
changePositionTable,
|
|
||||||
}) {
|
}) {
|
||||||
return started();
|
return started();
|
||||||
}
|
}
|
||||||
@ -131,7 +129,7 @@ class _$StartedImpl implements _Started {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function()? started,
|
TResult? Function()? started,
|
||||||
TResult? Function(String tableId, Offset position)? changePositionTable,
|
TResult? Function(int tableId, Offset position)? changePositionTable,
|
||||||
}) {
|
}) {
|
||||||
return started?.call();
|
return started?.call();
|
||||||
}
|
}
|
||||||
@ -140,7 +138,7 @@ class _$StartedImpl implements _Started {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? started,
|
TResult Function()? started,
|
||||||
TResult Function(String tableId, Offset position)? changePositionTable,
|
TResult Function(int tableId, Offset position)? changePositionTable,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (started != null) {
|
if (started != null) {
|
||||||
@ -191,7 +189,7 @@ abstract class _$$ChangePositionTableImplCopyWith<$Res> {
|
|||||||
$Res Function(_$ChangePositionTableImpl) then) =
|
$Res Function(_$ChangePositionTableImpl) then) =
|
||||||
__$$ChangePositionTableImplCopyWithImpl<$Res>;
|
__$$ChangePositionTableImplCopyWithImpl<$Res>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String tableId, Offset position});
|
$Res call({int tableId, Offset position});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -215,7 +213,7 @@ class __$$ChangePositionTableImplCopyWithImpl<$Res>
|
|||||||
tableId: null == tableId
|
tableId: null == tableId
|
||||||
? _value.tableId
|
? _value.tableId
|
||||||
: tableId // ignore: cast_nullable_to_non_nullable
|
: tableId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as int,
|
||||||
position: null == position
|
position: null == position
|
||||||
? _value.position
|
? _value.position
|
||||||
: position // ignore: cast_nullable_to_non_nullable
|
: position // ignore: cast_nullable_to_non_nullable
|
||||||
@ -231,7 +229,7 @@ class _$ChangePositionTableImpl implements _ChangePositionTable {
|
|||||||
{required this.tableId, required this.position});
|
{required this.tableId, required this.position});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String tableId;
|
final int tableId;
|
||||||
@override
|
@override
|
||||||
final Offset position;
|
final Offset position;
|
||||||
|
|
||||||
@ -266,8 +264,7 @@ class _$ChangePositionTableImpl implements _ChangePositionTable {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() started,
|
required TResult Function() started,
|
||||||
required TResult Function(String tableId, Offset position)
|
required TResult Function(int tableId, Offset position) changePositionTable,
|
||||||
changePositionTable,
|
|
||||||
}) {
|
}) {
|
||||||
return changePositionTable(tableId, position);
|
return changePositionTable(tableId, position);
|
||||||
}
|
}
|
||||||
@ -276,7 +273,7 @@ class _$ChangePositionTableImpl implements _ChangePositionTable {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function()? started,
|
TResult? Function()? started,
|
||||||
TResult? Function(String tableId, Offset position)? changePositionTable,
|
TResult? Function(int tableId, Offset position)? changePositionTable,
|
||||||
}) {
|
}) {
|
||||||
return changePositionTable?.call(tableId, position);
|
return changePositionTable?.call(tableId, position);
|
||||||
}
|
}
|
||||||
@ -285,7 +282,7 @@ class _$ChangePositionTableImpl implements _ChangePositionTable {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? started,
|
TResult Function()? started,
|
||||||
TResult Function(String tableId, Offset position)? changePositionTable,
|
TResult Function(int tableId, Offset position)? changePositionTable,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (changePositionTable != null) {
|
if (changePositionTable != null) {
|
||||||
@ -328,10 +325,10 @@ class _$ChangePositionTableImpl implements _ChangePositionTable {
|
|||||||
|
|
||||||
abstract class _ChangePositionTable implements ChangePositionTableEvent {
|
abstract class _ChangePositionTable implements ChangePositionTableEvent {
|
||||||
const factory _ChangePositionTable(
|
const factory _ChangePositionTable(
|
||||||
{required final String tableId,
|
{required final int tableId,
|
||||||
required final Offset position}) = _$ChangePositionTableImpl;
|
required final Offset position}) = _$ChangePositionTableImpl;
|
||||||
|
|
||||||
String get tableId;
|
int get tableId;
|
||||||
Offset get position;
|
Offset get position;
|
||||||
|
|
||||||
/// Create a copy of ChangePositionTableEvent
|
/// Create a copy of ChangePositionTableEvent
|
||||||
@ -348,7 +345,6 @@ mixin _$ChangePositionTableState {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String message) success,
|
required TResult Function(String message) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -356,7 +352,6 @@ mixin _$ChangePositionTableState {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String message)? success,
|
TResult? Function(String message)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -364,7 +359,6 @@ mixin _$ChangePositionTableState {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String message)? success,
|
TResult Function(String message)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -373,7 +367,6 @@ mixin _$ChangePositionTableState {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -381,7 +374,6 @@ mixin _$ChangePositionTableState {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -389,7 +381,6 @@ mixin _$ChangePositionTableState {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -461,7 +452,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String message) success,
|
required TResult Function(String message) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial();
|
return initial();
|
||||||
}
|
}
|
||||||
@ -472,7 +462,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String message)? success,
|
TResult? Function(String message)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial?.call();
|
return initial?.call();
|
||||||
}
|
}
|
||||||
@ -483,7 +472,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String message)? success,
|
TResult Function(String message)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -498,7 +486,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial(this);
|
return initial(this);
|
||||||
}
|
}
|
||||||
@ -509,7 +496,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial?.call(this);
|
return initial?.call(this);
|
||||||
}
|
}
|
||||||
@ -520,7 +506,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -578,7 +563,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String message) success,
|
required TResult Function(String message) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading();
|
return loading();
|
||||||
}
|
}
|
||||||
@ -589,7 +573,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String message)? success,
|
TResult? Function(String message)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading?.call();
|
return loading?.call();
|
||||||
}
|
}
|
||||||
@ -600,7 +583,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String message)? success,
|
TResult Function(String message)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -615,7 +597,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading(this);
|
return loading(this);
|
||||||
}
|
}
|
||||||
@ -626,7 +607,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading?.call(this);
|
return loading?.call(this);
|
||||||
}
|
}
|
||||||
@ -637,7 +617,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -722,7 +701,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String message) success,
|
required TResult Function(String message) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return success(message);
|
return success(message);
|
||||||
}
|
}
|
||||||
@ -733,7 +711,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String message)? success,
|
TResult? Function(String message)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return success?.call(message);
|
return success?.call(message);
|
||||||
}
|
}
|
||||||
@ -744,7 +721,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String message)? success,
|
TResult Function(String message)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -759,7 +735,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return success(this);
|
return success(this);
|
||||||
}
|
}
|
||||||
@ -770,7 +745,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return success?.call(this);
|
return success?.call(this);
|
||||||
}
|
}
|
||||||
@ -781,7 +755,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -802,155 +775,3 @@ abstract class _Success implements ChangePositionTableState {
|
|||||||
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$ErrorImplCopyWith<$Res> {
|
|
||||||
factory _$$ErrorImplCopyWith(
|
|
||||||
_$ErrorImpl value, $Res Function(_$ErrorImpl) then) =
|
|
||||||
__$$ErrorImplCopyWithImpl<$Res>;
|
|
||||||
@useResult
|
|
||||||
$Res call({String message});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$ErrorImplCopyWithImpl<$Res>
|
|
||||||
extends _$ChangePositionTableStateCopyWithImpl<$Res, _$ErrorImpl>
|
|
||||||
implements _$$ErrorImplCopyWith<$Res> {
|
|
||||||
__$$ErrorImplCopyWithImpl(
|
|
||||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
|
||||||
: super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of ChangePositionTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? message = null,
|
|
||||||
}) {
|
|
||||||
return _then(_$ErrorImpl(
|
|
||||||
null == message
|
|
||||||
? _value.message
|
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$ErrorImpl implements _Error {
|
|
||||||
const _$ErrorImpl(this.message);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'ChangePositionTableState.error(message: $message)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$ErrorImpl &&
|
|
||||||
(identical(other.message, message) || other.message == message));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, message);
|
|
||||||
|
|
||||||
/// Create a copy of ChangePositionTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
__$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() initial,
|
|
||||||
required TResult Function() loading,
|
|
||||||
required TResult Function(String message) success,
|
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
|
||||||
return error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? initial,
|
|
||||||
TResult? Function()? loading,
|
|
||||||
TResult? Function(String message)? success,
|
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
|
||||||
return error?.call(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? initial,
|
|
||||||
TResult Function()? loading,
|
|
||||||
TResult Function(String message)? success,
|
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (error != null) {
|
|
||||||
return error(message);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Initial value) initial,
|
|
||||||
required TResult Function(_Loading value) loading,
|
|
||||||
required TResult Function(_Success value) success,
|
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
|
||||||
return error(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Initial value)? initial,
|
|
||||||
TResult? Function(_Loading value)? loading,
|
|
||||||
TResult? Function(_Success value)? success,
|
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
|
||||||
return error?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Initial value)? initial,
|
|
||||||
TResult Function(_Loading value)? loading,
|
|
||||||
TResult Function(_Success value)? success,
|
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (error != null) {
|
|
||||||
return error(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _Error implements ChangePositionTableState {
|
|
||||||
const factory _Error(final String message) = _$ErrorImpl;
|
|
||||||
|
|
||||||
String get message;
|
|
||||||
|
|
||||||
/// Create a copy of ChangePositionTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ part of 'change_position_table_bloc.dart';
|
|||||||
class ChangePositionTableEvent with _$ChangePositionTableEvent {
|
class ChangePositionTableEvent with _$ChangePositionTableEvent {
|
||||||
const factory ChangePositionTableEvent.started() = _Started;
|
const factory ChangePositionTableEvent.started() = _Started;
|
||||||
const factory ChangePositionTableEvent.changePositionTable({
|
const factory ChangePositionTableEvent.changePositionTable({
|
||||||
required String tableId,
|
required int tableId,
|
||||||
required Offset position,
|
required Offset position,
|
||||||
}) = _ChangePositionTable;
|
}) = _ChangePositionTable;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,5 +7,4 @@ class ChangePositionTableState with _$ChangePositionTableState {
|
|||||||
const factory ChangePositionTableState.loading() = _Loading;
|
const factory ChangePositionTableState.loading() = _Loading;
|
||||||
|
|
||||||
const factory ChangePositionTableState.success(String message) = _Success;
|
const factory ChangePositionTableState.success(String message) = _Success;
|
||||||
const factory ChangePositionTableState.error(String message) = _Error;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/table_remote_datasource.dart';
|
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
part 'create_table_event.dart';
|
part 'create_table_event.dart';
|
||||||
@ -7,19 +9,12 @@ part 'create_table_state.dart';
|
|||||||
part 'create_table_bloc.freezed.dart';
|
part 'create_table_bloc.freezed.dart';
|
||||||
|
|
||||||
class CreateTableBloc extends Bloc<CreateTableEvent, CreateTableState> {
|
class CreateTableBloc extends Bloc<CreateTableEvent, CreateTableState> {
|
||||||
final TableRemoteDataSource _tableRemoteDataSource;
|
CreateTableBloc() : super(_Initial()) {
|
||||||
CreateTableBloc(this._tableRemoteDataSource)
|
|
||||||
: super(CreateTableState.initial()) {
|
|
||||||
on<_CreateTable>((event, emit) async {
|
on<_CreateTable>((event, emit) async {
|
||||||
emit(_Loading());
|
emit(_Loading());
|
||||||
final result = await _tableRemoteDataSource.createTable(
|
await ProductLocalDatasource.instance
|
||||||
tableName: event.tableName,
|
.createTableManagement(event.tableName, event.position);
|
||||||
capacity: event.capacity,
|
emit(_Success('Create Table Success'));
|
||||||
location: event.location,
|
|
||||||
);
|
|
||||||
|
|
||||||
result.fold((l) => emit(_Error(l)),
|
|
||||||
(r) => emit(_Success('Meja berhasil dibuat')));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,22 +19,19 @@ mixin _$CreateTableEvent {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() started,
|
required TResult Function() started,
|
||||||
required TResult Function(String tableName, int capacity, String location)
|
required TResult Function(String tableName, Offset position) createTable,
|
||||||
createTable,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function()? started,
|
TResult? Function()? started,
|
||||||
TResult? Function(String tableName, int capacity, String location)?
|
TResult? Function(String tableName, Offset position)? createTable,
|
||||||
createTable,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? started,
|
TResult Function()? started,
|
||||||
TResult Function(String tableName, int capacity, String location)?
|
TResult Function(String tableName, Offset position)? createTable,
|
||||||
createTable,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -122,8 +119,7 @@ class _$StartedImpl implements _Started {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() started,
|
required TResult Function() started,
|
||||||
required TResult Function(String tableName, int capacity, String location)
|
required TResult Function(String tableName, Offset position) createTable,
|
||||||
createTable,
|
|
||||||
}) {
|
}) {
|
||||||
return started();
|
return started();
|
||||||
}
|
}
|
||||||
@ -132,8 +128,7 @@ class _$StartedImpl implements _Started {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function()? started,
|
TResult? Function()? started,
|
||||||
TResult? Function(String tableName, int capacity, String location)?
|
TResult? Function(String tableName, Offset position)? createTable,
|
||||||
createTable,
|
|
||||||
}) {
|
}) {
|
||||||
return started?.call();
|
return started?.call();
|
||||||
}
|
}
|
||||||
@ -142,8 +137,7 @@ class _$StartedImpl implements _Started {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? started,
|
TResult Function()? started,
|
||||||
TResult Function(String tableName, int capacity, String location)?
|
TResult Function(String tableName, Offset position)? createTable,
|
||||||
createTable,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (started != null) {
|
if (started != null) {
|
||||||
@ -194,7 +188,7 @@ abstract class _$$CreateTableImplCopyWith<$Res> {
|
|||||||
_$CreateTableImpl value, $Res Function(_$CreateTableImpl) then) =
|
_$CreateTableImpl value, $Res Function(_$CreateTableImpl) then) =
|
||||||
__$$CreateTableImplCopyWithImpl<$Res>;
|
__$$CreateTableImplCopyWithImpl<$Res>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String tableName, int capacity, String location});
|
$Res call({String tableName, Offset position});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -211,22 +205,17 @@ class __$$CreateTableImplCopyWithImpl<$Res>
|
|||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? tableName = null,
|
Object? tableName = null,
|
||||||
Object? capacity = null,
|
Object? position = null,
|
||||||
Object? location = null,
|
|
||||||
}) {
|
}) {
|
||||||
return _then(_$CreateTableImpl(
|
return _then(_$CreateTableImpl(
|
||||||
tableName: null == tableName
|
null == tableName
|
||||||
? _value.tableName
|
? _value.tableName
|
||||||
: tableName // ignore: cast_nullable_to_non_nullable
|
: tableName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
capacity: null == capacity
|
null == position
|
||||||
? _value.capacity
|
? _value.position
|
||||||
: capacity // ignore: cast_nullable_to_non_nullable
|
: position // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as Offset,
|
||||||
location: null == location
|
|
||||||
? _value.location
|
|
||||||
: location // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,21 +223,16 @@ class __$$CreateTableImplCopyWithImpl<$Res>
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
||||||
class _$CreateTableImpl implements _CreateTable {
|
class _$CreateTableImpl implements _CreateTable {
|
||||||
const _$CreateTableImpl(
|
const _$CreateTableImpl(this.tableName, this.position);
|
||||||
{required this.tableName,
|
|
||||||
required this.capacity,
|
|
||||||
required this.location});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String tableName;
|
final String tableName;
|
||||||
@override
|
@override
|
||||||
final int capacity;
|
final Offset position;
|
||||||
@override
|
|
||||||
final String location;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'CreateTableEvent.createTable(tableName: $tableName, capacity: $capacity, location: $location)';
|
return 'CreateTableEvent.createTable(tableName: $tableName, position: $position)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -258,14 +242,12 @@ class _$CreateTableImpl implements _CreateTable {
|
|||||||
other is _$CreateTableImpl &&
|
other is _$CreateTableImpl &&
|
||||||
(identical(other.tableName, tableName) ||
|
(identical(other.tableName, tableName) ||
|
||||||
other.tableName == tableName) &&
|
other.tableName == tableName) &&
|
||||||
(identical(other.capacity, capacity) ||
|
(identical(other.position, position) ||
|
||||||
other.capacity == capacity) &&
|
other.position == position));
|
||||||
(identical(other.location, location) ||
|
|
||||||
other.location == location));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, tableName, capacity, location);
|
int get hashCode => Object.hash(runtimeType, tableName, position);
|
||||||
|
|
||||||
/// Create a copy of CreateTableEvent
|
/// Create a copy of CreateTableEvent
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -279,32 +261,29 @@ class _$CreateTableImpl implements _CreateTable {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() started,
|
required TResult Function() started,
|
||||||
required TResult Function(String tableName, int capacity, String location)
|
required TResult Function(String tableName, Offset position) createTable,
|
||||||
createTable,
|
|
||||||
}) {
|
}) {
|
||||||
return createTable(tableName, capacity, location);
|
return createTable(tableName, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function()? started,
|
TResult? Function()? started,
|
||||||
TResult? Function(String tableName, int capacity, String location)?
|
TResult? Function(String tableName, Offset position)? createTable,
|
||||||
createTable,
|
|
||||||
}) {
|
}) {
|
||||||
return createTable?.call(tableName, capacity, location);
|
return createTable?.call(tableName, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? started,
|
TResult Function()? started,
|
||||||
TResult Function(String tableName, int capacity, String location)?
|
TResult Function(String tableName, Offset position)? createTable,
|
||||||
createTable,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (createTable != null) {
|
if (createTable != null) {
|
||||||
return createTable(tableName, capacity, location);
|
return createTable(tableName, position);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -342,14 +321,11 @@ class _$CreateTableImpl implements _CreateTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class _CreateTable implements CreateTableEvent {
|
abstract class _CreateTable implements CreateTableEvent {
|
||||||
const factory _CreateTable(
|
const factory _CreateTable(final String tableName, final Offset position) =
|
||||||
{required final String tableName,
|
_$CreateTableImpl;
|
||||||
required final int capacity,
|
|
||||||
required final String location}) = _$CreateTableImpl;
|
|
||||||
|
|
||||||
String get tableName;
|
String get tableName;
|
||||||
int get capacity;
|
Offset get position;
|
||||||
String get location;
|
|
||||||
|
|
||||||
/// Create a copy of CreateTableEvent
|
/// Create a copy of CreateTableEvent
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -365,7 +341,6 @@ mixin _$CreateTableState {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String message) success,
|
required TResult Function(String message) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -373,7 +348,6 @@ mixin _$CreateTableState {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String message)? success,
|
TResult? Function(String message)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -381,7 +355,6 @@ mixin _$CreateTableState {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String message)? success,
|
TResult Function(String message)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -390,7 +363,6 @@ mixin _$CreateTableState {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -398,7 +370,6 @@ mixin _$CreateTableState {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -406,7 +377,6 @@ mixin _$CreateTableState {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -477,7 +447,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String message) success,
|
required TResult Function(String message) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial();
|
return initial();
|
||||||
}
|
}
|
||||||
@ -488,7 +457,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String message)? success,
|
TResult? Function(String message)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial?.call();
|
return initial?.call();
|
||||||
}
|
}
|
||||||
@ -499,7 +467,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String message)? success,
|
TResult Function(String message)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -514,7 +481,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial(this);
|
return initial(this);
|
||||||
}
|
}
|
||||||
@ -525,7 +491,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial?.call(this);
|
return initial?.call(this);
|
||||||
}
|
}
|
||||||
@ -536,7 +501,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -594,7 +558,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String message) success,
|
required TResult Function(String message) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading();
|
return loading();
|
||||||
}
|
}
|
||||||
@ -605,7 +568,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String message)? success,
|
TResult? Function(String message)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading?.call();
|
return loading?.call();
|
||||||
}
|
}
|
||||||
@ -616,7 +578,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String message)? success,
|
TResult Function(String message)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -631,7 +592,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading(this);
|
return loading(this);
|
||||||
}
|
}
|
||||||
@ -642,7 +602,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading?.call(this);
|
return loading?.call(this);
|
||||||
}
|
}
|
||||||
@ -653,7 +612,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -738,7 +696,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(String message) success,
|
required TResult Function(String message) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return success(message);
|
return success(message);
|
||||||
}
|
}
|
||||||
@ -749,7 +706,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(String message)? success,
|
TResult? Function(String message)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return success?.call(message);
|
return success?.call(message);
|
||||||
}
|
}
|
||||||
@ -760,7 +716,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(String message)? success,
|
TResult Function(String message)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -775,7 +730,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return success(this);
|
return success(this);
|
||||||
}
|
}
|
||||||
@ -786,7 +740,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return success?.call(this);
|
return success?.call(this);
|
||||||
}
|
}
|
||||||
@ -797,7 +750,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -818,155 +770,3 @@ abstract class _Success implements CreateTableState {
|
|||||||
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$ErrorImplCopyWith<$Res> {
|
|
||||||
factory _$$ErrorImplCopyWith(
|
|
||||||
_$ErrorImpl value, $Res Function(_$ErrorImpl) then) =
|
|
||||||
__$$ErrorImplCopyWithImpl<$Res>;
|
|
||||||
@useResult
|
|
||||||
$Res call({String message});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$ErrorImplCopyWithImpl<$Res>
|
|
||||||
extends _$CreateTableStateCopyWithImpl<$Res, _$ErrorImpl>
|
|
||||||
implements _$$ErrorImplCopyWith<$Res> {
|
|
||||||
__$$ErrorImplCopyWithImpl(
|
|
||||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
|
||||||
: super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of CreateTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? message = null,
|
|
||||||
}) {
|
|
||||||
return _then(_$ErrorImpl(
|
|
||||||
null == message
|
|
||||||
? _value.message
|
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$ErrorImpl implements _Error {
|
|
||||||
const _$ErrorImpl(this.message);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CreateTableState.error(message: $message)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$ErrorImpl &&
|
|
||||||
(identical(other.message, message) || other.message == message));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, message);
|
|
||||||
|
|
||||||
/// Create a copy of CreateTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
__$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() initial,
|
|
||||||
required TResult Function() loading,
|
|
||||||
required TResult Function(String message) success,
|
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
|
||||||
return error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? initial,
|
|
||||||
TResult? Function()? loading,
|
|
||||||
TResult? Function(String message)? success,
|
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
|
||||||
return error?.call(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? initial,
|
|
||||||
TResult Function()? loading,
|
|
||||||
TResult Function(String message)? success,
|
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (error != null) {
|
|
||||||
return error(message);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Initial value) initial,
|
|
||||||
required TResult Function(_Loading value) loading,
|
|
||||||
required TResult Function(_Success value) success,
|
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
|
||||||
return error(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Initial value)? initial,
|
|
||||||
TResult? Function(_Loading value)? loading,
|
|
||||||
TResult? Function(_Success value)? success,
|
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
|
||||||
return error?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Initial value)? initial,
|
|
||||||
TResult Function(_Loading value)? loading,
|
|
||||||
TResult Function(_Success value)? success,
|
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (error != null) {
|
|
||||||
return error(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _Error implements CreateTableState {
|
|
||||||
const factory _Error(final String message) = _$ErrorImpl;
|
|
||||||
|
|
||||||
String get message;
|
|
||||||
|
|
||||||
/// Create a copy of CreateTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -3,9 +3,6 @@ part of 'create_table_bloc.dart';
|
|||||||
@freezed
|
@freezed
|
||||||
class CreateTableEvent with _$CreateTableEvent {
|
class CreateTableEvent with _$CreateTableEvent {
|
||||||
const factory CreateTableEvent.started() = _Started;
|
const factory CreateTableEvent.started() = _Started;
|
||||||
const factory CreateTableEvent.createTable({
|
const factory CreateTableEvent.createTable(
|
||||||
required String tableName,
|
String tableName, Offset position) = _CreateTable;
|
||||||
required int capacity,
|
|
||||||
required String location,
|
|
||||||
}) = _CreateTable;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,5 +7,4 @@ class CreateTableState with _$CreateTableState {
|
|||||||
const factory CreateTableState.loading() = _Loading;
|
const factory CreateTableState.loading() = _Loading;
|
||||||
// success
|
// success
|
||||||
const factory CreateTableState.success(String message) = _Success;
|
const factory CreateTableState.success(String message) = _Success;
|
||||||
const factory CreateTableState.error(String message) = _Error;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'package:enaklo_pos/data/datasources/table_remote_datasource.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||||
@ -9,17 +8,11 @@ part 'get_table_state.dart';
|
|||||||
part 'get_table_bloc.freezed.dart';
|
part 'get_table_bloc.freezed.dart';
|
||||||
|
|
||||||
class GetTableBloc extends Bloc<GetTableEvent, GetTableState> {
|
class GetTableBloc extends Bloc<GetTableEvent, GetTableState> {
|
||||||
final TableRemoteDataSource _tableRemoteDataSource;
|
GetTableBloc() : super(_Initial()) {
|
||||||
GetTableBloc(this._tableRemoteDataSource) : super(GetTableState.initial()) {
|
|
||||||
on<_GetTables>((event, emit) async {
|
on<_GetTables>((event, emit) async {
|
||||||
emit(_Loading());
|
emit(_Loading());
|
||||||
final tables = await _tableRemoteDataSource.getTable();
|
final tables = await ProductLocalDatasource.instance.getAllTable();
|
||||||
tables.fold(
|
emit(_Success(tables));
|
||||||
(l) => emit(_Error(l)),
|
|
||||||
(r) => emit(
|
|
||||||
_Success(r.data!.tables!),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -294,7 +294,6 @@ mixin _$GetTableState {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -302,7 +301,6 @@ mixin _$GetTableState {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -310,7 +308,6 @@ mixin _$GetTableState {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -319,7 +316,6 @@ mixin _$GetTableState {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -327,7 +323,6 @@ mixin _$GetTableState {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -335,7 +330,6 @@ mixin _$GetTableState {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -406,7 +400,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial();
|
return initial();
|
||||||
}
|
}
|
||||||
@ -417,7 +410,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial?.call();
|
return initial?.call();
|
||||||
}
|
}
|
||||||
@ -428,7 +420,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -443,7 +434,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial(this);
|
return initial(this);
|
||||||
}
|
}
|
||||||
@ -454,7 +444,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return initial?.call(this);
|
return initial?.call(this);
|
||||||
}
|
}
|
||||||
@ -465,7 +454,6 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -523,7 +511,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading();
|
return loading();
|
||||||
}
|
}
|
||||||
@ -534,7 +521,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading?.call();
|
return loading?.call();
|
||||||
}
|
}
|
||||||
@ -545,7 +531,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -560,7 +545,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading(this);
|
return loading(this);
|
||||||
}
|
}
|
||||||
@ -571,7 +555,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return loading?.call(this);
|
return loading?.call(this);
|
||||||
}
|
}
|
||||||
@ -582,7 +565,6 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -673,7 +655,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
}) {
|
||||||
return success(tables);
|
return success(tables);
|
||||||
}
|
}
|
||||||
@ -684,7 +665,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return success?.call(tables);
|
return success?.call(tables);
|
||||||
}
|
}
|
||||||
@ -695,7 +675,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -710,7 +689,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
}) {
|
||||||
return success(this);
|
return success(this);
|
||||||
}
|
}
|
||||||
@ -721,7 +699,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
}) {
|
||||||
return success?.call(this);
|
return success?.call(this);
|
||||||
}
|
}
|
||||||
@ -732,7 +709,6 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -753,155 +729,3 @@ abstract class _Success implements GetTableState {
|
|||||||
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$ErrorImplCopyWith<$Res> {
|
|
||||||
factory _$$ErrorImplCopyWith(
|
|
||||||
_$ErrorImpl value, $Res Function(_$ErrorImpl) then) =
|
|
||||||
__$$ErrorImplCopyWithImpl<$Res>;
|
|
||||||
@useResult
|
|
||||||
$Res call({String message});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$ErrorImplCopyWithImpl<$Res>
|
|
||||||
extends _$GetTableStateCopyWithImpl<$Res, _$ErrorImpl>
|
|
||||||
implements _$$ErrorImplCopyWith<$Res> {
|
|
||||||
__$$ErrorImplCopyWithImpl(
|
|
||||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
|
||||||
: super(_value, _then);
|
|
||||||
|
|
||||||
/// Create a copy of GetTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? message = null,
|
|
||||||
}) {
|
|
||||||
return _then(_$ErrorImpl(
|
|
||||||
null == message
|
|
||||||
? _value.message
|
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
|
|
||||||
class _$ErrorImpl implements _Error {
|
|
||||||
const _$ErrorImpl(this.message);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'GetTableState.error(message: $message)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$ErrorImpl &&
|
|
||||||
(identical(other.message, message) || other.message == message));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, message);
|
|
||||||
|
|
||||||
/// Create a copy of GetTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
__$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() initial,
|
|
||||||
required TResult Function() loading,
|
|
||||||
required TResult Function(List<TableModel> tables) success,
|
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
|
||||||
return error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? initial,
|
|
||||||
TResult? Function()? loading,
|
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
|
||||||
TResult? Function(String message)? error,
|
|
||||||
}) {
|
|
||||||
return error?.call(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? initial,
|
|
||||||
TResult Function()? loading,
|
|
||||||
TResult Function(List<TableModel> tables)? success,
|
|
||||||
TResult Function(String message)? error,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (error != null) {
|
|
||||||
return error(message);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult map<TResult extends Object?>({
|
|
||||||
required TResult Function(_Initial value) initial,
|
|
||||||
required TResult Function(_Loading value) loading,
|
|
||||||
required TResult Function(_Success value) success,
|
|
||||||
required TResult Function(_Error value) error,
|
|
||||||
}) {
|
|
||||||
return error(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function(_Initial value)? initial,
|
|
||||||
TResult? Function(_Loading value)? loading,
|
|
||||||
TResult? Function(_Success value)? success,
|
|
||||||
TResult? Function(_Error value)? error,
|
|
||||||
}) {
|
|
||||||
return error?.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@optionalTypeArgs
|
|
||||||
TResult maybeMap<TResult extends Object?>({
|
|
||||||
TResult Function(_Initial value)? initial,
|
|
||||||
TResult Function(_Loading value)? loading,
|
|
||||||
TResult Function(_Success value)? success,
|
|
||||||
TResult Function(_Error value)? error,
|
|
||||||
required TResult orElse(),
|
|
||||||
}) {
|
|
||||||
if (error != null) {
|
|
||||||
return error(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _Error implements GetTableState {
|
|
||||||
const factory _Error(final String message) = _$ErrorImpl;
|
|
||||||
|
|
||||||
String get message;
|
|
||||||
|
|
||||||
/// Create a copy of GetTableState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,5 +5,4 @@ class GetTableState with _$GetTableState {
|
|||||||
const factory GetTableState.initial() = _Initial;
|
const factory GetTableState.initial() = _Initial;
|
||||||
const factory GetTableState.loading() = _Loading;
|
const factory GetTableState.loading() = _Loading;
|
||||||
const factory GetTableState.success(List<TableModel> tables) = _Success;
|
const factory GetTableState.success(List<TableModel> tables) = _Success;
|
||||||
const factory GetTableState.error(String message) = _Error;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,86 +0,0 @@
|
|||||||
import 'package:enaklo_pos/core/components/buttons.dart';
|
|
||||||
import 'package:enaklo_pos/core/components/custom_modal_dialog.dart';
|
|
||||||
import 'package:enaklo_pos/core/components/custom_text_field.dart';
|
|
||||||
import 'package:enaklo_pos/core/components/flushbar.dart';
|
|
||||||
import 'package:enaklo_pos/core/components/spaces.dart';
|
|
||||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
|
||||||
import 'package:enaklo_pos/presentation/table/blocs/create_table/create_table_bloc.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
class FormTableNewDialog extends StatefulWidget {
|
|
||||||
const FormTableNewDialog({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<FormTableNewDialog> createState() => _FormTableNewDialogState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FormTableNewDialogState extends State<FormTableNewDialog> {
|
|
||||||
TextEditingController tableNameController = TextEditingController();
|
|
||||||
TextEditingController capacityController = TextEditingController();
|
|
||||||
TextEditingController locationController = TextEditingController();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return CustomModalDialog(
|
|
||||||
title: 'Tambah Meja',
|
|
||||||
subtitle: 'Silahkan isi data meja',
|
|
||||||
contentPadding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
CustomTextField(
|
|
||||||
controller: tableNameController,
|
|
||||||
label: 'Nama Meja',
|
|
||||||
),
|
|
||||||
SpaceHeight(16),
|
|
||||||
CustomTextField(
|
|
||||||
controller: capacityController,
|
|
||||||
label: 'Kapasitas',
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
),
|
|
||||||
SpaceHeight(16),
|
|
||||||
CustomTextField(
|
|
||||||
controller: locationController,
|
|
||||||
label: 'Lokasi',
|
|
||||||
),
|
|
||||||
SpaceHeight(24),
|
|
||||||
BlocListener<CreateTableBloc, CreateTableState>(
|
|
||||||
listener: (context, state) {
|
|
||||||
state.maybeWhen(
|
|
||||||
orElse: () {},
|
|
||||||
success: (message) {
|
|
||||||
context.pop();
|
|
||||||
AppFlushbar.showSuccess(context, message);
|
|
||||||
},
|
|
||||||
error: (message) {
|
|
||||||
AppFlushbar.showError(context, message);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: BlocBuilder<CreateTableBloc, CreateTableState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return state.maybeWhen(
|
|
||||||
orElse: () => Button.filled(
|
|
||||||
onPressed: () {
|
|
||||||
context.read<CreateTableBloc>().add(
|
|
||||||
CreateTableEvent.createTable(
|
|
||||||
capacity: int.parse(capacityController.text),
|
|
||||||
location: locationController.text,
|
|
||||||
tableName: tableNameController.text,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
label: 'Simpan',
|
|
||||||
),
|
|
||||||
loading: () =>
|
|
||||||
Center(child: const CircularProgressIndicator()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +1,18 @@
|
|||||||
import 'package:enaklo_pos/presentation/table/dialogs/form_table_new_dialog.dart';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:enaklo_pos/core/components/components.dart';
|
import 'package:enaklo_pos/core/components/components.dart';
|
||||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||||
|
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||||
|
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||||
import 'package:enaklo_pos/presentation/table/blocs/change_position_table/change_position_table_bloc.dart';
|
import 'package:enaklo_pos/presentation/table/blocs/change_position_table/change_position_table_bloc.dart';
|
||||||
import 'package:enaklo_pos/presentation/table/blocs/create_table/create_table_bloc.dart';
|
import 'package:enaklo_pos/presentation/table/blocs/create_table/create_table_bloc.dart';
|
||||||
import 'package:enaklo_pos/presentation/table/blocs/get_table/get_table_bloc.dart';
|
import 'package:enaklo_pos/presentation/table/blocs/get_table/get_table_bloc.dart';
|
||||||
import 'package:enaklo_pos/presentation/table/widgets/table_widget.dart';
|
import 'package:enaklo_pos/presentation/table/widgets/table_widget.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
class TableManagementScreen extends StatefulWidget {
|
class TableManagementScreen extends StatefulWidget {
|
||||||
const TableManagementScreen({super.key});
|
const TableManagementScreen({super.key});
|
||||||
@ -59,8 +65,54 @@ class _TableManagementScreenState extends State<TableManagementScreen> {
|
|||||||
// show dialaog adn input table name
|
// show dialaog adn input table name
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => FormTableNewDialog(),
|
builder: (context) {
|
||||||
);
|
return AlertDialog(
|
||||||
|
title: Text('Add Table'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 180,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
CustomTextField(
|
||||||
|
controller: tableNameController!,
|
||||||
|
label: 'Table Name',
|
||||||
|
),
|
||||||
|
SpaceHeight(16),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Button.outlined(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
label: 'close',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SpaceWidth(16),
|
||||||
|
Expanded(
|
||||||
|
child: Button.filled(
|
||||||
|
onPressed: () {
|
||||||
|
context.read<CreateTableBloc>().add(
|
||||||
|
CreateTableEvent.createTable(
|
||||||
|
tableNameController!.text,
|
||||||
|
Offset(200, 200)));
|
||||||
|
context
|
||||||
|
.pop(); // close dialog after adding
|
||||||
|
},
|
||||||
|
label: 'Add',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: []);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -93,8 +145,8 @@ class _TableManagementScreenState extends State<TableManagementScreen> {
|
|||||||
return Stack(
|
return Stack(
|
||||||
children: tables.map((table) {
|
children: tables.map((table) {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
left: (table.positionX ?? 0) - 116,
|
left: table.position.dx - 116,
|
||||||
top: (table.positionY ?? 0) - 80,
|
top: table.position.dy - 80,
|
||||||
child: BlocListener<ChangePositionTableBloc,
|
child: BlocListener<ChangePositionTableBloc,
|
||||||
ChangePositionTableState>(
|
ChangePositionTableState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
@ -113,7 +165,7 @@ class _TableManagementScreenState extends State<TableManagementScreen> {
|
|||||||
context
|
context
|
||||||
.read<ChangePositionTableBloc>()
|
.read<ChangePositionTableBloc>()
|
||||||
.add(ChangePositionTableEvent.changePositionTable(
|
.add(ChangePositionTableEvent.changePositionTable(
|
||||||
tableId: table.id ?? "",
|
tableId: table.id!,
|
||||||
position: details.offset,
|
position: details.offset,
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
|
|||||||
@ -51,18 +51,18 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
|
|||||||
Future<void> _handlePostPaymentCleanup() async {
|
Future<void> _handlePostPaymentCleanup() async {
|
||||||
if (widget.table != null && widget.draftOrder?.id != null) {
|
if (widget.table != null && widget.draftOrder?.id != null) {
|
||||||
// Update table status to available
|
// Update table status to available
|
||||||
// final newTable = TableModel(
|
final newTable = TableModel(
|
||||||
// id: widget.table!.id,
|
id: widget.table!.id,
|
||||||
// tableName: widget.table!.tableName,
|
tableName: widget.table!.tableName,
|
||||||
// status: 'available',
|
status: 'available',
|
||||||
// orderId: 0,
|
orderId: 0,
|
||||||
// paymentAmount: 0,
|
paymentAmount: 0,
|
||||||
// startTime: DateTime.now().toIso8601String(),
|
startTime: DateTime.now().toIso8601String(),
|
||||||
// position: widget.table!.position,
|
position: widget.table!.position,
|
||||||
// );
|
);
|
||||||
|
|
||||||
// Update table status
|
// Update table status
|
||||||
// await ProductLocalDatasource.instance.updateStatusTable(newTable);
|
await ProductLocalDatasource.instance.updateStatusTable(newTable);
|
||||||
|
|
||||||
// Remove draft order
|
// Remove draft order
|
||||||
await ProductLocalDatasource.instance
|
await ProductLocalDatasource.instance
|
||||||
@ -965,25 +965,25 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Void the order
|
// Void the order
|
||||||
if (widget.table != null) {
|
if (widget.table != null) {
|
||||||
// final newTable = TableModel(
|
final newTable = TableModel(
|
||||||
// id: widget.table!.id,
|
id: widget.table!.id,
|
||||||
// tableName: widget
|
tableName: widget
|
||||||
// .table!.tableName,
|
.table!.tableName,
|
||||||
// status: 'available',
|
status: 'available',
|
||||||
// orderId: 0,
|
orderId: 0,
|
||||||
// paymentAmount: 0,
|
paymentAmount: 0,
|
||||||
// startTime: DateTime.now()
|
startTime: DateTime.now()
|
||||||
// .toIso8601String(),
|
.toIso8601String(),
|
||||||
// position: widget
|
position: widget
|
||||||
// .table!.position,
|
.table!.position,
|
||||||
// );
|
);
|
||||||
// context
|
context
|
||||||
// .read<StatusTableBloc>()
|
.read<StatusTableBloc>()
|
||||||
// .add(
|
.add(
|
||||||
// StatusTableEvent
|
StatusTableEvent
|
||||||
// .statusTabel(
|
.statusTabel(
|
||||||
// newTable),
|
newTable),
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
// Remove draft order from local storage
|
// Remove draft order from local storage
|
||||||
if (widget.draftOrder?.id !=
|
if (widget.draftOrder?.id !=
|
||||||
@ -1013,21 +1013,21 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
|
|||||||
const SpaceWidth(8.0),
|
const SpaceWidth(8.0),
|
||||||
BlocListener<OrderBloc, OrderState>(
|
BlocListener<OrderBloc, OrderState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
// final newTable = TableModel(
|
final newTable = TableModel(
|
||||||
// id: widget.table!.id,
|
id: widget.table!.id,
|
||||||
// tableName: widget.table!.tableName,
|
tableName: widget.table!.tableName,
|
||||||
// status: 'available',
|
status: 'available',
|
||||||
// orderId: 0,
|
orderId: 0,
|
||||||
// paymentAmount: 0,
|
paymentAmount: 0,
|
||||||
// startTime:
|
startTime:
|
||||||
// DateTime.now().toIso8601String(),
|
DateTime.now().toIso8601String(),
|
||||||
// position: widget.table!.position,
|
position: widget.table!.position,
|
||||||
// );
|
);
|
||||||
// context.read<StatusTableBloc>().add(
|
context.read<StatusTableBloc>().add(
|
||||||
// StatusTableEvent.statusTabel(
|
StatusTableEvent.statusTabel(
|
||||||
// newTable,
|
newTable,
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
ProductLocalDatasource.instance
|
ProductLocalDatasource.instance
|
||||||
.removeDraftOrderById(
|
.removeDraftOrderById(
|
||||||
widget.draftOrder!.id!);
|
widget.draftOrder!.id!);
|
||||||
@ -1160,24 +1160,24 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
|
|||||||
'uang tunai' ||
|
'uang tunai' ||
|
||||||
paymentMethodName ==
|
paymentMethodName ==
|
||||||
'cash payment') {
|
'cash payment') {
|
||||||
// context.read<OrderBloc>().add(
|
context.read<OrderBloc>().add(
|
||||||
// OrderEvent.order(
|
OrderEvent.order(
|
||||||
// items,
|
items,
|
||||||
// discount,
|
discount,
|
||||||
// discountAmountFinal,
|
discountAmountFinal,
|
||||||
// finalTax.toInt(),
|
finalTax.toInt(),
|
||||||
// 0,
|
0,
|
||||||
// totalPriceController.text
|
totalPriceController.text
|
||||||
// .toIntegerFromText,
|
.toIntegerFromText,
|
||||||
// customerController.text,
|
customerController.text,
|
||||||
// widget.table?.id ?? 0,
|
widget.table?.id ?? 0,
|
||||||
// 'completed',
|
'completed',
|
||||||
// 'paid',
|
'paid',
|
||||||
// selectedPaymentMethod
|
selectedPaymentMethod
|
||||||
// ?.name ??
|
?.name ??
|
||||||
// 'Cash',
|
'Cash',
|
||||||
// totalPriceFinal,
|
totalPriceFinal,
|
||||||
// orderType));
|
orderType));
|
||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -1202,24 +1202,24 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
|
|||||||
await _handlePostPaymentCleanup();
|
await _handlePostPaymentCleanup();
|
||||||
} else {
|
} else {
|
||||||
log("Processing non-cash payment: ${selectedPaymentMethod?.name}");
|
log("Processing non-cash payment: ${selectedPaymentMethod?.name}");
|
||||||
// context.read<OrderBloc>().add(
|
context.read<OrderBloc>().add(
|
||||||
// OrderEvent.order(
|
OrderEvent.order(
|
||||||
// items,
|
items,
|
||||||
// discount,
|
discount,
|
||||||
// discountAmountFinal,
|
discountAmountFinal,
|
||||||
// finalTax.toInt(),
|
finalTax.toInt(),
|
||||||
// 0,
|
0,
|
||||||
// totalPriceController.text
|
totalPriceController.text
|
||||||
// .toIntegerFromText,
|
.toIntegerFromText,
|
||||||
// customerController.text,
|
customerController.text,
|
||||||
// widget.table?.id ?? 0,
|
widget.table?.id ?? 0,
|
||||||
// 'completed',
|
'completed',
|
||||||
// 'paid',
|
'paid',
|
||||||
// selectedPaymentMethod
|
selectedPaymentMethod
|
||||||
// ?.name ??
|
?.name ??
|
||||||
// 'Unknown Payment Method',
|
'Unknown Payment Method',
|
||||||
// totalPriceFinal,
|
totalPriceFinal,
|
||||||
// orderType));
|
orderType));
|
||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -39,8 +39,8 @@ class _CardTableWidgetState extends State<CardTableWidget> {
|
|||||||
|
|
||||||
loadData() async {
|
loadData() async {
|
||||||
if (widget.table.status != 'available') {
|
if (widget.table.status != 'available') {
|
||||||
// data = await ProductLocalDatasource.instance
|
data = await ProductLocalDatasource.instance
|
||||||
// .getDraftOrderById(widget.table.orderId);
|
.getDraftOrderById(widget.table.orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,10 +70,9 @@ class _CardTableWidgetState extends State<CardTableWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
// widget.table.status == 'available'
|
widget.table.status == 'available'
|
||||||
// ? widget.table.status
|
? widget.table.status
|
||||||
// : "${widget.table.status} - ${DateTime.parse(widget.table.startTime).toFormattedTime()}",
|
: "${widget.table.status} - ${DateTime.parse(widget.table.startTime).toFormattedTime()}",
|
||||||
"",
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.black,
|
color: AppColors.black,
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
|
|||||||
@ -51,8 +51,8 @@ class _TableWidgetState extends State<TableWidget> {
|
|||||||
|
|
||||||
loadData() async {
|
loadData() async {
|
||||||
if (widget.table.status != 'available') {
|
if (widget.table.status != 'available') {
|
||||||
// data = await ProductLocalDatasource.instance
|
data = await ProductLocalDatasource.instance
|
||||||
// .getDraftOrderById(widget.table.orderId);
|
.getDraftOrderById(widget.table.orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,33 +136,33 @@ class _TableWidgetState extends State<TableWidget> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Button.filled(
|
child: Button.filled(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// final newData =
|
final newData =
|
||||||
// TableModel(
|
TableModel(
|
||||||
// id: widget.table.id,
|
id: widget.table.id,
|
||||||
// tableName:
|
tableName:
|
||||||
// tableNameController!
|
tableNameController!
|
||||||
// .text,
|
.text,
|
||||||
// status:
|
status:
|
||||||
// widget.table.status,
|
widget.table.status,
|
||||||
// startTime: widget
|
startTime: widget
|
||||||
// .table.startTime,
|
.table.startTime,
|
||||||
// orderId: widget
|
orderId: widget
|
||||||
// .table.orderId,
|
.table.orderId,
|
||||||
// paymentAmount: widget
|
paymentAmount: widget
|
||||||
// .table
|
.table
|
||||||
// .paymentAmount,
|
.paymentAmount,
|
||||||
// position: widget
|
position: widget
|
||||||
// .table.position,
|
.table.position,
|
||||||
// );
|
);
|
||||||
// context
|
context
|
||||||
// .read<
|
.read<
|
||||||
// UpdateTableBloc>()
|
UpdateTableBloc>()
|
||||||
// .add(
|
.add(
|
||||||
// UpdateTableEvent
|
UpdateTableEvent
|
||||||
// .updateTable(
|
.updateTable(
|
||||||
// newData,
|
newData,
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
context
|
context
|
||||||
.pop(); // close dialog after adding
|
.pop(); // close dialog after adding
|
||||||
},
|
},
|
||||||
@ -194,16 +194,16 @@ class _TableWidgetState extends State<TableWidget> {
|
|||||||
color: widget.table.status == 'available'
|
color: widget.table.status == 'available'
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: Colors.red),
|
: Colors.red),
|
||||||
// widget.table.status == 'available'
|
widget.table.status == 'available'
|
||||||
// ? SizedBox.shrink()
|
? SizedBox.shrink()
|
||||||
// : _buildInfoRow(
|
: _buildInfoRow(
|
||||||
// 'Start Time:',
|
'Start Time:',
|
||||||
// DateFormatter.formatDateTime2(
|
DateFormatter.formatDateTime2(
|
||||||
// widget.table.startTime)),
|
widget.table.startTime)),
|
||||||
// widget.table.status == 'available'
|
widget.table.status == 'available'
|
||||||
// ? SizedBox.shrink()
|
? SizedBox.shrink()
|
||||||
// : _buildInfoRow(
|
: _buildInfoRow(
|
||||||
// 'Order ID:', widget.table.orderId.toString()),
|
'Order ID:', widget.table.orderId.toString()),
|
||||||
widget.table.status == 'available'
|
widget.table.status == 'available'
|
||||||
? SizedBox.shrink()
|
? SizedBox.shrink()
|
||||||
: SpaceHeight(16),
|
: SpaceHeight(16),
|
||||||
@ -267,29 +267,29 @@ class _TableWidgetState extends State<TableWidget> {
|
|||||||
backgroundColor: AppColors.red,
|
backgroundColor: AppColors.red,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// // Void the order
|
// Void the order
|
||||||
// final newTable = TableModel(
|
final newTable = TableModel(
|
||||||
// id: widget.table.id,
|
id: widget.table.id,
|
||||||
// tableName:
|
tableName:
|
||||||
// widget.table.tableName,
|
widget.table.tableName,
|
||||||
// status: 'available',
|
status: 'available',
|
||||||
// orderId: 0,
|
orderId: 0,
|
||||||
// paymentAmount: 0,
|
paymentAmount: 0,
|
||||||
// startTime: DateTime.now()
|
startTime: DateTime.now()
|
||||||
// .toIso8601String(),
|
.toIso8601String(),
|
||||||
// position: widget.table.position,
|
position: widget.table.position,
|
||||||
// );
|
);
|
||||||
// context
|
context
|
||||||
// .read<StatusTableBloc>()
|
.read<StatusTableBloc>()
|
||||||
// .add(
|
.add(
|
||||||
// StatusTableEvent
|
StatusTableEvent
|
||||||
// .statusTabel(newTable),
|
.statusTabel(newTable),
|
||||||
// );
|
);
|
||||||
// // Remove draft order from local storage
|
// Remove draft order from local storage
|
||||||
// ProductLocalDatasource.instance
|
ProductLocalDatasource.instance
|
||||||
// .removeDraftOrderById(
|
.removeDraftOrderById(
|
||||||
// widget.table.orderId);
|
widget.table.orderId);
|
||||||
// log("Voided order for table: ${widget.table.tableName}");
|
log("Voided order for table: ${widget.table.tableName}");
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
"Ya, Batalkan",
|
"Ya, Batalkan",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user