feat: delivery type

This commit is contained in:
efrilm 2025-08-06 18:47:20 +07:00
parent a46a2cfa7c
commit 6fdaac2c0f
22 changed files with 1560 additions and 679 deletions

BIN
assets/images/gojek.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
assets/images/grab.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

@ -186,6 +186,12 @@ class $AssetsImagesGen {
/// File path: assets/images/drink7.png
AssetGenImage get drink7 => const AssetGenImage('assets/images/drink7.png');
/// File path: assets/images/gojek.png
AssetGenImage get gojek => const AssetGenImage('assets/images/gojek.png');
/// File path: assets/images/grab.png
AssetGenImage get grab => const AssetGenImage('assets/images/grab.png');
/// File path: assets/images/logo.png
AssetGenImage get logo => const AssetGenImage('assets/images/logo.png');
@ -265,6 +271,8 @@ class $AssetsImagesGen {
drink5,
drink6,
drink7,
gojek,
grab,
logo,
managePrinter,
manageProduct,

View File

@ -0,0 +1,15 @@
import 'package:enaklo_pos/core/assets/assets.gen.dart';
import 'package:enaklo_pos/data/models/response/delivery_response_model.dart';
List<DeliveryModel> deliveries = [
DeliveryModel(
id: 'gojek',
name: 'Gojek',
imageUrl: Assets.images.gojek.path,
),
DeliveryModel(
id: 'grab',
name: 'Grab',
imageUrl: Assets.images.grab.path,
),
];

View File

@ -0,0 +1,11 @@
class DeliveryModel {
String id;
String name;
String imageUrl;
DeliveryModel({
required this.id,
required this.name,
required this.imageUrl,
});
}

View File

@ -2,6 +2,7 @@ import 'dart:developer';
import 'package:bloc/bloc.dart';
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
import 'package:enaklo_pos/data/models/response/delivery_response_model.dart';
import 'package:enaklo_pos/data/models/response/discount_response_model.dart';
import 'package:enaklo_pos/presentation/table/models/draft_order_item.dart';
import 'package:enaklo_pos/presentation/table/models/draft_order_model.dart';
@ -58,7 +59,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType));
currentState.orderType,
currentState.deliveryType));
});
on<_RemoveItem>((event, emit) {
@ -91,7 +93,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType));
currentState.orderType,
currentState.deliveryType));
});
on<_DeleteItem>((event, emit) {
@ -116,7 +119,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType));
currentState.orderType,
currentState.deliveryType));
});
on<_Started>((event, emit) async {
@ -126,29 +130,41 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
final tax = await settingsLocalDatasource.getTax();
final serviceCharge = await settingsLocalDatasource.getServiceCharge();
emit(_Loaded([], null, 0, 0, tax.value, serviceCharge, 0, 0, '',
OrderType.dineIn));
emit(_Loaded(
[],
null,
0,
0,
tax.value,
serviceCharge,
0,
0,
'',
OrderType.dineIn,
null,
));
} catch (e) {
// If loading fails, use default values
log('Failed to load settings: $e');
emit(const _Loaded([], null, 0, 0, 10, 5, 0, 0, '', OrderType.dineIn));
emit(const _Loaded(
[], null, 0, 0, 10, 5, 0, 0, '', OrderType.dineIn, null));
}
});
on<_AddDiscount>((event, emit) {
var currentState = state as _Loaded;
emit(_Loaded(
currentState.items,
event.discount,
currentState.discount,
currentState.discountAmount,
currentState.tax,
currentState.serviceCharge,
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType,
));
currentState.items,
event.discount,
currentState.discount,
currentState.discountAmount,
currentState.tax,
currentState.serviceCharge,
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType,
currentState.deliveryType));
});
on<_RemoveDiscount>((event, emit) {
@ -163,7 +179,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType));
currentState.orderType,
currentState.deliveryType));
});
on<_AddTax>((event, emit) {
@ -178,7 +195,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType));
currentState.orderType,
currentState.deliveryType));
});
on<_AddServiceCharge>((event, emit) {
@ -194,6 +212,7 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalPrice,
currentState.draftName,
currentState.orderType,
currentState.deliveryType,
));
});
@ -209,7 +228,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType));
currentState.orderType,
currentState.deliveryType));
});
on<_RemoveServiceCharge>((event, emit) {
@ -224,7 +244,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType));
currentState.orderType,
currentState.deliveryType));
});
on<_UpdateOrderType>((event, emit) {
@ -239,7 +260,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
event.orderType));
event.orderType,
currentState.deliveryType));
});
on<_UpdateItemNotes>((event, emit) {
@ -260,7 +282,8 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType));
currentState.orderType,
currentState.deliveryType));
});
on<_SaveDraftOrder>((event, emit) async {
@ -298,19 +321,38 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
final draftOrder = event.data;
log("draftOrder: ${draftOrder.toMap()}");
emit(_Loaded(
draftOrder.orders
.map((e) =>
ProductQuantity(product: e.product, quantity: e.quantity))
.toList(),
null,
draftOrder.discount,
draftOrder.discountAmount,
draftOrder.tax,
draftOrder.serviceCharge,
draftOrder.totalQuantity,
draftOrder.totalPrice,
draftOrder.draftName,
OrderType.dineIn));
draftOrder.orders
.map((e) =>
ProductQuantity(product: e.product, quantity: e.quantity))
.toList(),
null,
draftOrder.discount,
draftOrder.discountAmount,
draftOrder.tax,
draftOrder.serviceCharge,
draftOrder.totalQuantity,
draftOrder.totalPrice,
draftOrder.draftName,
OrderType.dineIn,
null,
));
});
on<_UpdateDeliveryType>((event, emit) {
var currentState = state as _Loaded;
emit(_Loaded(
currentState.items,
currentState.discountModel,
currentState.discount,
currentState.discountAmount,
currentState.tax,
currentState.serviceCharge,
currentState.totalQuantity,
currentState.totalPrice,
currentState.draftName,
currentState.orderType,
event.delivery,
));
});
}
}

View File

@ -42,4 +42,8 @@ class CheckoutEvent with _$CheckoutEvent {
//load draft order
const factory CheckoutEvent.loadDraftOrder(DraftOrderModel data) =
_LoadDraftOrder;
// Update delivery type
const factory CheckoutEvent.updateDeliveryType(DeliveryModel delivery) =
_UpdateDeliveryType;
}

View File

@ -5,16 +5,18 @@ class CheckoutState with _$CheckoutState {
const factory CheckoutState.initial() = _Initial;
const factory CheckoutState.loading() = _Loading;
const factory CheckoutState.loaded(
List<ProductQuantity> items,
Discount? discountModel,
int discount,
int discountAmount,
int tax,
int serviceCharge,
int totalQuantity,
int totalPrice,
String draftName,
OrderType orderType) = _Loaded;
List<ProductQuantity> items,
Discount? discountModel,
int discount,
int discountAmount,
int tax,
int serviceCharge,
int totalQuantity,
int totalPrice,
String draftName,
OrderType orderType,
DeliveryModel? deliveryType,
) = _Loaded;
const factory CheckoutState.error(String message) = _Error;
//save draft order

View File

@ -0,0 +1,114 @@
import 'package:enaklo_pos/core/components/custom_modal_dialog.dart';
import 'package:enaklo_pos/core/components/spaces.dart';
import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:enaklo_pos/data/datasources/delivery_local_datasource.dart';
import 'package:enaklo_pos/data/models/response/delivery_response_model.dart';
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class DeliveryDialog extends StatefulWidget {
const DeliveryDialog({super.key});
@override
State<DeliveryDialog> createState() => _DeliveryDialogState();
}
class _DeliveryDialogState extends State<DeliveryDialog> {
@override
Widget build(BuildContext context) {
return CustomModalDialog(
title: 'Pilih Pengiriman',
subtitle: 'Silahkan pilih pengiriman yang sesuai',
contentPadding:
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0),
child: BlocBuilder<CheckoutBloc, CheckoutState>(
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
loaded: (items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType) {
return Column(
children: List.generate(deliveries.length, (index) {
return _buildItem(
context,
deliveries[index],
selectedType: deliveryType,
);
}),
);
});
},
),
);
}
Widget _buildItem(BuildContext context, DeliveryModel delivery,
{DeliveryModel? selectedType}) {
return GestureDetector(
onTap: () {
context.read<CheckoutBloc>().add(
CheckoutEvent.updateDeliveryType(delivery),
);
Navigator.pop(context);
},
child: Container(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0),
margin: const EdgeInsets.only(bottom: 8.0),
decoration: BoxDecoration(
color: selectedType?.id == delivery.id
? AppColors.primary
: AppColors.white,
borderRadius: BorderRadius.circular(8.0),
border: Border.all(
color: selectedType?.id == delivery.id
? AppColors.primary
: AppColors.grey,
width: 1.0,
),
),
child: Row(
children: [
Image.asset(
delivery.imageUrl,
width: 40.0,
height: 40.0,
fit: BoxFit.contain,
),
SpaceWidth(12.0),
Expanded(
child: Text(
delivery.name,
style: TextStyle(
fontSize: 16,
color: selectedType?.id == delivery.id
? AppColors.white
: AppColors.black,
fontWeight: FontWeight.bold,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
SpaceWidth(12.0),
Icon(
Icons.check_circle,
color: selectedType?.id == delivery.id
? AppColors.green
: Colors.transparent,
),
],
),
),
);
}
}

View File

@ -56,7 +56,19 @@ class ServiceDialog extends StatelessWidget {
return state.maybeWhen(
initial: () => const SizedBox(),
loading: () => const Center(child: CircularProgressIndicator()),
loaded: (data, a, b, c, d, service, e, f, g, orderType) =>
loaded: (
data,
a,
b,
c,
d,
service,
e,
f,
g,
orderType,
deliveryType,
) =>
_buildServiceItem(context, service),
orElse: () => const SizedBox(),
);

View File

@ -44,7 +44,20 @@ class TaxDialog extends StatelessWidget {
return state.maybeWhen(
initial: () => const SizedBox(),
loading: () => const Center(child: CircularProgressIndicator()),
loaded: (data, a, b, c, tax, d, e, f, g, orderType) => ListTile(
loaded: (
data,
a,
b,
c,
tax,
d,
e,
f,
g,
orderType,
deliveryType,
) =>
ListTile(
title: const Text('PB1'),
subtitle: Text('tarif pajak ($tax%)'),
contentPadding: EdgeInsets.zero,

View File

@ -52,16 +52,19 @@ class _TypeDialogState extends State<TypeDialog> {
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
loaded: (items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
return Column(
children: List.generate(types.length, (index) {
return _buildItem(

View File

@ -198,16 +198,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
orElse: () => const Center(
child: Text('No Items'),
),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (products.isEmpty) {
return const Center(
child: Text('No Items'),
@ -240,16 +243,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -280,16 +286,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (discountModel == null) {
return 0;
}
@ -300,16 +309,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final subTotal = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -343,30 +355,36 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -378,16 +396,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (discountModel == null) {
return 0;
}
@ -425,31 +446,37 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final serviceCharge = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
serviceCharge,
);
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -491,16 +518,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -512,16 +542,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (discountModel == null) {
return 0;
}
@ -532,31 +565,37 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
final serviceCharge = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
serviceCharge,
);
@ -1220,16 +1259,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (discountModel == null) {
return 0;
}
@ -1240,16 +1282,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -1261,46 +1306,55 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final serviceCharge = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderTyp,
deliveryType,
) =>
serviceCharge,
);
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
final orderType = state.maybeWhen(
orElse: () => OrderType.dineIn,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
orderType,
);
@ -1315,16 +1369,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
List<ProductQuantity> items =
state.maybeWhen(
orElse: () => [],
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products,
);
final totalQty = items.fold(

View File

@ -132,16 +132,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox(),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
@ -221,16 +224,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
orElse: () => const Center(
child: Text('No Items'),
),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (products.isEmpty) {
return const Center(
child: Text('No Items'),
@ -263,6 +269,59 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
),
child: Column(
children: [
BlocBuilder<CheckoutBloc, CheckoutState>(
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (deliveryType == null) {
return const SizedBox.shrink();
}
return Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'Pengiriman',
style: TextStyle(
color: AppColors.black,
fontWeight: FontWeight.w600,
),
),
Text(
deliveryType.name,
style: TextStyle(
color: AppColors.black,
fontWeight: FontWeight.w600,
),
),
],
),
const SpaceHeight(8.0),
DashedDivider(
color: AppColors.grey,
),
const SpaceHeight(8.0),
],
);
});
},
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -277,16 +336,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -320,30 +382,36 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -355,16 +423,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (discountModel == null) {
return 0;
}
@ -410,16 +481,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -431,16 +505,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (discountModel == null) {
return 0;
}
@ -451,31 +528,37 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
final serviceCharge = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
serviceCharge,
);
@ -826,31 +909,37 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
builder: (context, state) {
final orderType = state.maybeWhen(
orElse: () => OrderType.dineIn,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
orderType,
);
List<ProductQuantity> items = state.maybeWhen(
orElse: () => [],
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products,
);

View File

@ -307,16 +307,19 @@ class _HomePageState extends State<HomePage> {
orElse: () => const Center(
child: Text('No Items'),
),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (products.isEmpty) {
return const Center(
child: Text('No Items'),
@ -358,16 +361,19 @@ class _HomePageState extends State<HomePage> {
builder: (context, state) {
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (products.isEmpty) {
return 0;
}
@ -409,7 +415,8 @@ class _HomePageState extends State<HomePage> {
totalQuantity,
totalPrice,
draftName,
orderType) {
orderType,
deliveryType) {
if (products.isEmpty) {
return 0;
}
@ -462,7 +469,8 @@ class _HomePageState extends State<HomePage> {
totalQuantity,
totalPrice,
draftName,
orderType) =>
orderType,
deliveryType) =>
Align(
alignment: Alignment.bottomCenter,
child: Button.filled(
@ -476,6 +484,14 @@ class _HomePageState extends State<HomePage> {
'Mohon pilih meja terlebih dahulu');
return;
}
if (orderType.name == 'delivery' &&
deliveryType == null) {
AppFlushbar.showError(context,
'Mohon pilih pengiriman terlebih dahulu');
return;
}
context.push(ConfirmPaymentPage(
isTable: widget.table == null
? false

View File

@ -5,6 +5,7 @@ import 'package:enaklo_pos/core/extensions/string_ext.dart';
import 'package:enaklo_pos/data/models/response/table_model.dart';
import 'package:enaklo_pos/presentation/customer/pages/customer_page.dart';
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart';
import 'package:enaklo_pos/presentation/home/dialog/delivery_dialog.dart';
import 'package:enaklo_pos/presentation/home/dialog/type_dialog.dart';
import 'package:enaklo_pos/presentation/home/models/order_type.dart';
import 'package:enaklo_pos/presentation/home/pages/dashboard_page.dart';
@ -81,16 +82,19 @@ class HomeRightTitle extends StatelessWidget {
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
loaded: (items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
return Button.filled(
width: 180.0,
height: 40,
@ -120,16 +124,19 @@ class HomeRightTitle extends StatelessWidget {
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
loaded: (items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
switch (orderType) {
case OrderType.dineIn:
return Expanded(
@ -159,7 +166,30 @@ class HomeRightTitle extends StatelessWidget {
case OrderType.takeAway:
return const SizedBox.shrink();
case OrderType.delivery:
return const SizedBox.shrink();
return Expanded(
child: Button.filled(
width: 180.0,
height: 40,
elevation: 0,
icon: Icon(
Icons.motorcycle_outlined,
color: Colors.white,
size: 24,
),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return DeliveryDialog();
});
},
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
label: deliveryType == null
? 'Pilih Pengiriman'
: deliveryType.name,
),
);
default:
return const SizedBox.shrink();
}

View File

@ -15,7 +15,19 @@ class OrderTypeSelector extends StatelessWidget {
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
loaded: (items, discountModel, discount, discountAmount, tax, serviceCharge, totalQuantity, totalPrice, draftName, orderType) {
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -36,8 +48,8 @@ class OrderTypeSelector extends StatelessWidget {
return GestureDetector(
onTap: () {
context.read<CheckoutBloc>().add(
CheckoutEvent.updateOrderType(type),
);
CheckoutEvent.updateOrderType(type),
);
},
child: Container(
padding: const EdgeInsets.symmetric(
@ -45,9 +57,11 @@ class OrderTypeSelector extends StatelessWidget {
vertical: 8.0,
),
decoration: BoxDecoration(
color: isSelected ? AppColors.primary : AppColors.white,
color:
isSelected ? AppColors.primary : AppColors.white,
border: Border.all(
color: isSelected ? AppColors.primary : AppColors.grey,
color:
isSelected ? AppColors.primary : AppColors.grey,
width: 1.0,
),
borderRadius: BorderRadius.circular(8.0),
@ -55,9 +69,12 @@ class OrderTypeSelector extends StatelessWidget {
child: Text(
type.value,
style: TextStyle(
color: isSelected ? AppColors.white : AppColors.black,
color:
isSelected ? AppColors.white : AppColors.black,
fontSize: 14,
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
fontWeight: isSelected
? FontWeight.w600
: FontWeight.normal,
),
),
),
@ -71,4 +88,4 @@ class OrderTypeSelector extends StatelessWidget {
},
);
}
}
}

View File

@ -114,16 +114,19 @@ class ProductCard extends StatelessWidget {
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox(),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
final totalQuantity = products
.where((item) => item.product.id == data.id)
.map((item) => item.quantity)

View File

@ -90,16 +90,19 @@ class _SaveOrderDialogState extends State<SaveOrderDialog> {
builder: (context, state) {
final orderType = state.maybeWhen(
orElse: () => OrderType.dineIn,
loaded: (items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
orderType,
);

View File

@ -201,16 +201,19 @@ class _SuccessPaymentDialogState extends State<SuccessPaymentDialog> {
builder: (context, checkoutState) {
final orderType = checkoutState.maybeWhen(
orElse: () => OrderType.dineIn,
loaded: (items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
orderType,
);

View File

@ -250,16 +250,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
orElse: () => const Center(
child: Text('No Items'),
),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (products.isEmpty) {
return const Center(
child: Text('No Items'),
@ -294,16 +297,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
builder: (context, state) {
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -335,16 +341,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
builder: (context, state) {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
log("discountAmount: $discountAmount");
return discountAmount;
});
@ -374,30 +383,36 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
builder: (context, state) {
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -409,16 +424,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
return discountAmount;
});
@ -448,30 +466,36 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
builder: (context, state) {
state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -483,31 +507,37 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
return discountAmount;
});
final serviceCharge = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
serviceCharge,
);
@ -541,16 +571,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
builder: (context, state) {
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -562,46 +595,55 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
return discountAmount;
});
final serviceCharge = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
serviceCharge,
);
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
@ -674,16 +716,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
orElse: () {
return SizedBox.shrink();
},
loaded: (items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
customerController.text = draftName;
return TextFormField(
readOnly: true,
@ -1037,16 +1082,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
builder: (context, state) {
final discount = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (discountModel == null) {
return 0;
}
@ -1057,16 +1105,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
final price = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products.fold(
0,
(previousValue, element) =>
@ -1078,16 +1129,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
tax,
);
@ -1100,16 +1154,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
List<ProductQuantity> items =
state.maybeWhen(
orElse: () => [],
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
products,
);
final totalQty = items.fold(
@ -1120,16 +1177,19 @@ class _PaymentTablePageState extends State<PaymentTablePage> {
final orderType = state.maybeWhen(
orElse: () => OrderType.dineIn,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) =>
orderType,
);