feat: void order

This commit is contained in:
efrilm
2025-08-04 11:39:47 +07:00
parent cbfa1689ba
commit ee38b6218f
9 changed files with 824 additions and 114 deletions
@@ -5,6 +5,7 @@ import 'package:enaklo_pos/core/components/flushbar.dart';
import 'package:enaklo_pos/core/components/spaces.dart';
import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
import 'package:enaklo_pos/core/extensions/date_time_ext.dart';
import 'package:enaklo_pos/core/extensions/string_ext.dart';
import 'package:enaklo_pos/data/models/response/order_response_model.dart';
import 'package:enaklo_pos/presentation/home/bloc/order_form/order_form_bloc.dart';
@@ -30,29 +31,87 @@ class _RefundDialogState extends State<RefundDialog> {
return CustomModalDialog(
title: 'Refund',
subtitle: 'Pengembalian dana',
minWidth: context.deviceWidth * 0.5,
contentPadding:
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0),
child: Column(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('No. Pesanan'),
Text(
'Pesanan yang akan di refund',
style: const TextStyle(
widget.order.orderNumber ?? '',
style: TextStyle(
color: AppColors.black,
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppColors.black,
),
),
SpaceHeight(12),
Column(
children: widget.selectedItems
.map((item) => _item(context, item))
.toList(),
],
),
SpaceHeight(8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Tanggal'),
Text(
(widget.order.createdAt ?? DateTime.now()).toFormattedDate2(),
style: TextStyle(
color: AppColors.black,
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
],
),
SpaceHeight(8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Tagihan'),
Text(
widget.selectedItems.isEmpty
? widget.order.totalAmount.toString().currencyFormatRpV2
: widget.selectedItems
.fold(
0,
(sum, item) =>
sum +
((item.unitPrice ?? 0) * (item.quantity ?? 0)),
)
.toString()
.currencyFormatRpV2,
style: TextStyle(
color: AppColors.black,
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
],
),
Padding(
padding: const EdgeInsets.only(top: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Pesanan yang akan di refund',
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppColors.black,
),
),
SpaceHeight(12),
Column(
children: widget.selectedItems
.map((item) => _item(context, item))
.toList(),
),
],
),
),
SpaceHeight(16),
CustomTextField(
controller: _reasonController,