Commit b1e9ed76 authored by Dio Maulana's avatar Dio Maulana

view bill dan feedback

parent a238dc4b
......@@ -248,6 +248,7 @@ const Color backgroundColor = Color(0xffF4F4F4);
const Color backgroundColorViewBill = Color(0xffE5E5E5);
const Color backgroundWhite = Color(0xffFFFFFF);
const Color dividerGrey = Color(0xff898A8D);
const Color greyColor = Color(0xffD9D9D9);
const textColorTabel = Color(0xff333333);
const textColorBlack = Color(0xff000000);
const textColorRed = Color(0xffE73636);
......
// ignore_for_file: must_be_immutable
import 'package:byod/helper/widget/style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../api/api.dart';
import '../../bloc/order_bloc.dart';
......
......@@ -33,6 +33,19 @@ TextStyle appBarNameVariant({font = 17, Color color = textColorBlack}) {
);
}
TextStyle emojiStyle({
font = 14,
Color color = textColorBlack,
FontWeight fontWeight = FontWeight.w600,
}) {
return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily,
fontSize: font,
fontWeight: fontWeight,
color: color,
);
}
TextStyle appBarNameViewBill({font = 17, Color color = textColorBlack}) {
return TextStyle(
fontFamily: 'Mulish',
......@@ -261,9 +274,24 @@ TextStyle addButton({
);
}
TextStyle rincianPembayaran(
{font = 12,
Color color = textColorBlack,
TextStyle rincianPembayaran({
font = 12,
Color color = textColorBlack,
FontWeight fontWeight = FontWeight.w400,
FontStyle? fontStyle,
}) {
return TextStyle(
fontFamily: 'OpenSans',
fontSize: font,
fontWeight: fontWeight,
color: color,
fontStyle: fontStyle,
);
}
TextStyle buttonBottomBill(
{font = 14,
Color color = textInButton,
FontWeight fontWeight = FontWeight.w400}) {
return TextStyle(
fontFamily: 'OpenSans',
......@@ -664,12 +692,27 @@ TextStyle textStyleTambahPesanan(context) {
);
}
TextStyle textStyleVersionNumber(context) {
// TextStyle textStyleVersionNumber(context) {
// return TextStyle(
// fontFamily: (fontFamily == '') ? null : fontFamily,
// fontSize: MediaQuery.of(context).size.height * versionFont,
// color: Colors.black54,
// fontStyle: FontStyle.italic,
// );
// }
TextStyle textStyleVersionNumber({
font = 10,
Color color = Colors.black54,
FontWeight fontWeight = FontWeight.w400,
FontStyle? fontStyle,
}) {
return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily,
fontSize: MediaQuery.of(context).size.height * versionFont,
color: Colors.black54,
fontStyle: FontStyle.italic,
fontFamily: 'OpenSans',
fontSize: font,
fontWeight: fontWeight,
color: color,
fontStyle: fontStyle,
);
}
......
......@@ -14,7 +14,9 @@ class BuildVersion extends StatelessWidget {
child: defaultText(
context,
'Ravintola BYOD v$majorVersion.$minorVersion',
style: textStyleVersionNumber(context),
style: textStyleVersionNumber(
fontStyle: FontStyle.italic,
),
),
);
}
......
......@@ -74,7 +74,7 @@ class FinishOrder extends StatelessWidget {
),
SizedBox(height: MediaQuery.of(context).size.height * 0.015),
ElevatedButton(
style: ElevatedButton.styleFrom(primary: buttonColor),
style: ElevatedButton.styleFrom(backgroundColor: buttonColor),
onPressed: () {
// list[index].note = noteController.text;
Navigator.pushAndRemoveUntil(
......
......@@ -4,9 +4,9 @@ import 'dart:convert';
import 'package:byod/helper/helper.dart';
import 'package:byod/ui/screen_responsive.dart';
import 'package:byod/ui/viewbill/view_bill_new.dart';
import 'package:flutter/material.dart';
import '../../helper/widget/style.dart';
import '../viewbill/view_bill.dart';
class HistoryOrder extends StatelessWidget {
final List<String> historyOrder;
......@@ -68,8 +68,10 @@ class HistoryOrder extends StatelessWidget {
children: [
GestureDetector(
onTap: () {
Navigator.pushReplacement(context,
MaterialPageRoute(builder: (_) => ViewBill()));
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const ViewBillNew()));
},
child: buttonBottom(
context,
......@@ -102,16 +104,18 @@ class HistoryOrder extends StatelessWidget {
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ViewBill(
isHistory: true,
sessionId: jsonDecodeHistory['session'],
branchCode: jsonDecodeHistory['branch_code'],
brandCode: jsonDecodeHistory['brand'],
token: jsonDecodeHistory['token'],
userName: jsonDecodeHistory['user_name'],
)));
context,
MaterialPageRoute(
builder: (_) => ViewBillNew(
isHistory: true,
sessionId: jsonDecodeHistory['session'],
branchCodeH: jsonDecodeHistory['branch_code'],
brandCodeH: jsonDecodeHistory['brand'],
token: jsonDecodeHistory['token'],
userName: jsonDecodeHistory['user_name'],
),
),
);
},
child: Container(
margin: EdgeInsets.only(
......@@ -222,7 +226,7 @@ class HistoryOrder extends StatelessWidget {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => ViewBill(),
builder: (_) => const ViewBillNew(),
),
);
},
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/order_bloc.dart';
import '../../bloc/order_variant_temporary.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../../models/filter_menu.dart';
import '../../models/order_details.dart';
import '../../models/orders.dart';
import 'bottom_sheet_variant.dart';
import 'variant_cat.dart';
class ShowMenuBottomSheet extends StatelessWidget {
const ShowMenuBottomSheet({
Key? key,
required this.menuDetail,
required this.i,
required this.widthScreen,
required this.widthImage,
}) : super(key: key);
final List<FilterMenu> menuDetail;
final int i;
final double widthScreen;
final double widthImage;
@override
Widget build(BuildContext context) {
return BlocBuilder<OrdersBloc, List<Orders>>(
builder: (context, list) {
int indexListOrderan = list
.indexWhere((listOrderan) => listOrderan.id == menuDetail[i].id);
int initialValue;
if (indexListOrderan != -1) {
initialValue = list[indexListOrderan].totalItem;
} else {
initialValue = 0;
}
return Container(
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
width: widthScreen,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
margin: const EdgeInsets.only(top: 8, bottom: 32),
width: 50,
height: 3,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7),
color: greyColor,
),
),
Align(
alignment: Alignment.centerLeft,
child: textMenuNameBottomShetModalMenu(
context, menuDetail[i].name),
),
const SizedBox(
height: 30,
),
ClipRRect(
borderRadius: BorderRadius.circular(21),
child: Image(
width: widthImage,
height: widthImage,
image: NetworkImage(
menuDetail[i].imageUrlMedium,
),
),
),
const SizedBox(
height: 20,
),
(menuDetail[i].description != '')
? Align(
alignment: Alignment.centerLeft,
child: defaultText(
context,
'Deskripsi',
style: textDeskripsiHeader(),
),
)
: const SizedBox(),
const SizedBox(
height: 12,
),
Align(
alignment: Alignment.centerLeft,
child: defaultText(
context,
menuDetail[i].description,
maxLines: 5,
overFlow: TextOverflow.ellipsis,
style: textDeskripsi(),
),
),
const SizedBox(
height: 12,
),
Container(
padding: const EdgeInsets.only(bottom: 18),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
defaultText(
context,
'Rp ${formatNumber().format(amountParseToInt(menuDetail[i].price))}',
style: amountMenuStyle(
font: 20, fontWeight: FontWeight.w500),
),
GestureDetector(
onTap: () {
if (menuDetail[i].isSell) {
if (menuDetail[i].variantCat.isNotEmpty) {
if (indexListOrderan == -1) {
Navigator.pop(context);
context
.read<OrderVariantTemporaryBloc>()
.insertDataVariant(
menuDetail[i].id,
amountParseToInt(menuDetail[i].price),
1,
[]); // check pada bloc untuk mengethui list arraynya
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => VariantCat(
namaMenu: menuDetail[i].name,
variantCategories:
menuDetail[i].variantCat,
initPrice: amountParseToInt(
menuDetail[i].price),
idItem: menuDetail[i].id,
imageUrl:
menuDetail[i].imageUrlMedium,
listCurrentOrder: list,
orderDetail: OrderDetail(
allIdVariant: '',
totalItem: 0,
totalHarga: 0,
note: '',
orderVariant: []),
)));
} else {
Navigator.pop(context);
showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0),
isScrollControlled: true,
context: context,
builder: (context) {
return CustomizeVariant(
orders: list[indexListOrderan],
variantCat: menuDetail[i].variantCat);
},
);
}
} else {
initialValue += 1;
context.read<OrdersBloc>().insertData([
[
menuDetail[i].id,
menuDetail[i].name,
initialValue,
amountParseToInt(menuDetail[i].price),
list,
menuDetail[i].imageUrlMedium,
[],
amountParseToInt(menuDetail[i].price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: '',
]
], context);
Navigator.pop(context);
}
}
},
child: Container(
height: 38,
width: 119,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: buttonColor,
),
child: Center(
child: defaultText(
context,
'Tambah',
style: addButton(),
),
),
),
)
],
),
),
],
),
);
},
);
}
}
......@@ -104,8 +104,8 @@ GestureDetector noteMenu(
child: Align(
alignment: Alignment.centerRight,
child: ElevatedButton(
style:
ElevatedButton.styleFrom(primary: buttonColor),
style: ElevatedButton.styleFrom(
backgroundColor: buttonColor),
onPressed: () async {
// list[index].note = noteController.text;
if (callFrom == fromMenu) {
......
......@@ -66,29 +66,50 @@ class _CategoryListHomeState extends State<CategoryListHome> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
defaultText(
context,
widget.categoryList[i].name,
style: catNameStyle(),
),
AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime),
transitionBuilder:
(Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
child: (selectedIndex == i)
? Container(
key: const Key('underline'),
margin: const EdgeInsets.only(top: 27),
width: 30,
height: 1,
color: buttonColor,
)
: const SizedBox(
key: Key('underline'),
child: Container(
key: const Key('underline'),
padding: const EdgeInsets.only(bottom: 27),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: (selectedIndex == i)
? buttonColor
: Colors.transparent,
width: 1,
),
)
),
),
child: defaultText(
context,
widget.categoryList[i].name,
style: catNameStyle(),
),
),
),
// AnimatedSwitcher(
// duration: Duration(milliseconds: animatedTime),
// transitionBuilder:
// (Widget child, Animation<double> animation) {
// return ScaleTransition(scale: animation, child: child);
// },
// child: (selectedIndex == i)
// ? Container(
// key: const Key('underline'),
// margin: const EdgeInsets.only(top: 27),
// width: 30,
// height: 1,
// color: buttonColor,
// )
// : const SizedBox(
// key: Key('underline'),
// ),
// )
],
),
),
......
......@@ -12,7 +12,8 @@ import '../../helper/widget/style.dart';
import '../../models/filter_menu.dart';
import '../../models/order_details.dart';
import '../../models/order_variants.dart';
import 'bottom_sheet_menu.dart';
import '../screen_responsive.dart';
import 'bottom_sheet_menu_new.dart';
import 'bottom_sheet_variant.dart';
import 'variant_cat.dart';
......@@ -32,6 +33,7 @@ class FavGridMenu extends StatelessWidget {
@override
Widget build(BuildContext context) {
double widthScreen = responsiveWidthScreen(context);
return Container(
margin: EdgeInsets.only(
left: (i == 0) ? 0 : 8, // paling awal gausah dikasih margin
......@@ -74,19 +76,30 @@ class FavGridMenu extends StatelessWidget {
isScrollControlled: true,
context: context,
builder: (context) {
return ShowMenuModal(
imageUrl: categoryFavAfterSelect[i].imageUrlMedium,
namaMenu: categoryFavAfterSelect[i].name,
hargaMenu:
amountParseToInt(categoryFavAfterSelect[i].price),
isHavevariant:
categoryFavAfterSelect[i].variantCat.isNotEmpty
? true
: false,
description: categoryFavAfterSelect[i].description,
id: categoryFavAfterSelect[i].id,
variantCat: categoryFavAfterSelect[i].variantCat,
isSell: categoryFavAfterSelect[i].isSell,
// return ShowMenuModal(
// imageUrl: categoryFavAfterSelect[i].imageUrlMedium,
// namaMenu: categoryFavAfterSelect[i].name,
// hargaMenu:
// amountParseToInt(categoryFavAfterSelect[i].price),
// isHavevariant:
// categoryFavAfterSelect[i].variantCat.isNotEmpty
// ? true
// : false,
// description: categoryFavAfterSelect[i].description,
// id: categoryFavAfterSelect[i].id,
// variantCat: categoryFavAfterSelect[i].variantCat,
// isSell: categoryFavAfterSelect[i].isSell,
// );
double widthImage = widthScreen - 2 * paddingLeftRight;
return ScreenResponsive(
widget: ShowMenuBottomSheet(
menuDetail: categoryFavAfterSelect,
i: i,
widthScreen: widthScreen,
widthImage: widthImage,
),
isCoreLayout: true,
widthScreen: MediaQuery.of(context).size.width,
);
},
);
......
......@@ -46,28 +46,41 @@ class _FavoriteListState extends State<FavoriteList> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
defaultText(
context,
widget.favoriteList[i].name,
style: favNameStyle(),
Container(
padding: const EdgeInsets.only(bottom: 3),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1,
color: (selectedIndex == i)
? buttonColor
: Colors.transparent,
),
),
),
child: defaultText(
context,
widget.favoriteList[i].name,
style: favNameStyle(),
),
),
AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime),
transitionBuilder:
(Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
child: (selectedIndex == i)
? Container(
key: const Key('underline'),
margin: const EdgeInsets.only(top: 2),
width: 30,
height: 1,
color: buttonColor)
: const SizedBox(
key: Key('underline'),
),
)
// AnimatedSwitcher(
// duration: Duration(milliseconds: animatedTime),
// transitionBuilder:
// (Widget child, Animation<double> animation) {
// return ScaleTransition(scale: animation, child: child);
// },
// child: (selectedIndex == i)
// ? Container(
// key: const Key('underline'),
// margin: const EdgeInsets.only(top: 2),
// width: 30,
// height: 1,
// color: buttonColor)
// : const SizedBox(
// key: Key('underline'),
// ),
// )
],
),
),
......
......@@ -3,6 +3,7 @@
import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/models/orders.dart';
import 'package:byod/ui/home/variant_cat.dart';
import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -13,9 +14,8 @@ import '../../helper/widget/style.dart';
import '../../models/filter_menu.dart';
import '../../models/order_details.dart';
import '../../models/order_variants.dart';
import 'bottom_sheet_menu.dart';
import 'bottom_sheet_menu_new.dart';
import 'bottom_sheet_variant.dart';
import 'variant_cat_new.dart';
class MenuListUtama extends StatelessWidget {
const MenuListUtama({
......@@ -115,19 +115,32 @@ class MenuListUtama extends StatelessWidget {
isScrollControlled: true,
context: context,
builder: (context) {
return ShowMenuModal(
imageUrl: categoryNonFav[i].imageUrlMedium,
namaMenu: categoryNonFav[i].name,
hargaMenu: amountParseToInt(
categoryNonFav[i].price),
isHavevariant:
categoryNonFav[i].variantCat.isNotEmpty
? true
: false,
description: categoryNonFav[i].description,
id: categoryNonFav[i].id,
variantCat: categoryNonFav[i].variantCat,
isSell: categoryNonFav[i].isSell,
// return ShowMenuModal(
// imageUrl: categoryNonFav[i].imageUrlMedium,
// namaMenu: categoryNonFav[i].name,
// hargaMenu: amountParseToInt(
// categoryNonFav[i].price),
// isHavevariant:
// categoryNonFav[i].variantCat.isNotEmpty
// ? true
// : false,
// description: categoryNonFav[i].description,
// id: categoryNonFav[i].id,
// variantCat: categoryNonFav[i].variantCat,
// isSell: categoryNonFav[i].isSell,
// );
double widthImage =
widthScreen - 2 * paddingLeftRight;
return ScreenResponsive(
widget: ShowMenuBottomSheet(
menuDetail: categoryNonFav,
i: i,
widthScreen: widthScreen,
widthImage: widthImage,
),
isCoreLayout: true,
widthScreen:
MediaQuery.of(context).size.width,
);
},
);
......
......@@ -11,7 +11,6 @@ import 'package:byod/helper/widget/style.dart';
import 'package:byod/models/filter_menu.dart';
import 'package:byod/models/orders.dart';
import 'package:byod/ui/home/menu_list_utama.dart';
import 'package:byod/ui/home/variant_cat_new.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
......@@ -19,19 +18,13 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:sliver_tools/sliver_tools.dart';
import '../../bloc/filter_menu.dart';
import '../../bloc/order_variant_temporary.dart';
import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/note_modal_bottom_sheet.dart';
import '../../main.dart';
import '../../models/fav_group.dart';
import '../../models/order_variants.dart';
import '../checkout/checkout.dart';
import '../checkout/fuction.dart';
import '../screen_responsive.dart';
import '../viewbill/view_bill.dart';
import '../viewbill/view_bill_new.dart';
import 'bottom_sheet_menu.dart';
import 'bottom_sheet_variant.dart';
import 'cat_list.dart';
import 'fav_grid_menu.dart';
import 'fav_list.dart';
......@@ -183,14 +176,14 @@ class _NewHome2State extends State<NewHome2> {
@override
Widget build(BuildContext context) {
double heightTotal = MediaQuery.of(context).size.height;
// double heightTotal = MediaQuery.of(context).size.height;
double appBarHeight = 40;
double searchFieldHeight = 36;
double spacerHeight = 20;
double favListHeight = 35;
double favItemHeight = 227;
double spacerAboveCat = 16;
double categoryFont = 14;
// double categoryFont = 14;
double spacerAboveCatList = 42;
double catListHeight = 51;
double spacerAboveMenuItem = 25;
......
......@@ -48,7 +48,7 @@ class _VariantCatNewState extends State<VariantCatNew> {
@override
Widget build(BuildContext context) {
FocusScopeNode currentFocus = FocusScope.of(context);
double widthScreen = responsiveWidthScreen(context);
// double widthScreen = responsiveWidthScreen(context);
return SafeArea(
child: GestureDetector(
onTap: () {
......
......@@ -40,7 +40,7 @@ class _VariantNewState extends State<VariantNew> {
@override
Widget build(BuildContext context) {
double widthScreen = responsiveWidthScreen(context);
double currentScreen = MediaQuery.of(context).size.width;
// double currentScreen = MediaQuery.of(context).size.width;
double maxWidthScreen = getMaxWidthScreen(context, useResponsive);
// if (variantRadio.isNotEmpty) {
......
......@@ -5,9 +5,8 @@ import 'dart:convert';
import 'package:byod/bloc/filter_menu.dart';
import 'package:byod/bloc/member_info.dart';
import 'package:byod/helper/helper.dart';
import 'package:byod/ui/home/home.dart';
import 'package:byod/ui/no_route.dart';
import 'package:byod/ui/viewbill/view_bill.dart';
import 'package:byod/ui/viewbill/view_bill_new.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -84,11 +83,12 @@ class _SplashState extends State<Splash> {
if (widget.toBill == 'go') {
// ignore: use_build_context_synchronously
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => ViewBill()));
context, MaterialPageRoute(builder: (_) => const ViewBillNew()));
} else {
// ignore: use_build_context_synchronously
// Navigator.pushReplacement(
// context, MaterialPageRoute(builder: (_) => const Home()));
// ignore: use_build_context_synchronously
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => const NewHome2()));
}
......
......@@ -61,7 +61,7 @@ class CustomAppBar extends StatelessWidget {
Center(
child: defaultText(
context,
'Check-Out',
(!isHistory) ? 'Check-Out' : 'Riwayat Pesanan',
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: appBarNameViewBill(),
......
......@@ -8,9 +8,13 @@ class ListOrder extends StatelessWidget {
const ListOrder({
Key? key,
required this.billDetail,
required this.isHistory,
required this.tableStatus,
}) : super(key: key);
final List<BillDetail> billDetail;
final bool isHistory;
final int tableStatus;
@override
Widget build(BuildContext context) {
......@@ -23,6 +27,8 @@ class ListOrder extends StatelessWidget {
return OrderViewBillNew(
billDetail: billDetail[i],
lastItem: (i + 1 == itemCounts) ? true : false,
isHistory: isHistory,
tableStatus: tableStatus,
);
},
);
......
......@@ -14,10 +14,14 @@ import 'view_bill_new.dart';
class OrderViewBillNew extends StatefulWidget {
final BillDetail billDetail;
final bool lastItem;
final bool isHistory;
final int tableStatus;
const OrderViewBillNew({
Key? key,
required this.billDetail,
required this.isHistory,
this.lastItem = false,
required this.tableStatus,
}) : super(key: key);
@override
......@@ -172,166 +176,179 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
const SizedBox(
height: 11,
),
Container(
padding: EdgeInsets.only(
left: paddingLeftRightBill, right: paddingLeftRightBill),
child: Row(
children: [
GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
showModalBottomSheet(
backgroundColor: backgroundColor,
isScrollControlled: true,
context: context,
builder: (context) {
return NoteModalBottomSheet(
noteController: noteController,
initialValue: initialValue,
orderVariants: const [],
menuItem: FilterMenu(
id: '',
name: '',
price: '',
originalPrice: '',
imageUrlMedium: '',
imageUrlThumbnail: '',
isSell: false,
type: typeMenu,
categoryName: '',
categoryId: '',
description: '',
groupName: '',
groupId: ''),
lisrOrders: const [],
from: fromBill,
idOrderan: widget.billDetail.id,
noteInit: widget.billDetail.notes,
contextFrom: context,
);
},
);
},
child: Container(
height: 30,
width: 98,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21),
color: buttonColor,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Image(
height: 16,
width: 16,
image: AssetImage('assets/icons/note.png'),
),
const SizedBox(
width: 10,
),
Container(
height: 16,
child: Center(
child: defaultText(
context,
(widget.billDetail.notes != '')
? 'Ubah'
: 'Catatan',
style: noteViewBill(
color: textInButton,
),
),
),
)
],
),
),
),
const Spacer(),
Stack(
children: [
Container(
width: 94,
height: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: backgroundColor,
),
child: Center(
child: defaultText(
context,
widget.billDetail.quantity.toString(),
style: amountViewBillButton(),
),
),
),
Positioned(
left: 0,
child: GestureDetector(
(!widget.isHistory && widget.tableStatus == tableStatusOpen)
? Container(
padding: EdgeInsets.only(
left: paddingLeftRightBill,
right: paddingLeftRightBill),
child: Row(
children: [
GestureDetector(
onTap: () {
if (initialValue > 1) {
setState(() {
initialValue -= 1;
amount = initialValue * amountPeritem;
});
changeOrderDetail(context, widget.billDetail.id,
initialValue, widget.billDetail.notes);
} else {
deleteOrder(context, widget.billDetail.menuName,
ontapOkDelete, ontapCancelDelete);
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
showModalBottomSheet(
backgroundColor: backgroundColor,
isScrollControlled: true,
context: context,
builder: (context) {
return NoteModalBottomSheet(
noteController: noteController,
initialValue: initialValue,
orderVariants: const [],
menuItem: FilterMenu(
id: '',
name: '',
price: '',
originalPrice: '',
imageUrlMedium: '',
imageUrlThumbnail: '',
isSell: false,
type: typeMenu,
categoryName: '',
categoryId: '',
description: '',
groupName: '',
groupId: ''),
lisrOrders: const [],
from: fromBill,
idOrderan: widget.billDetail.id,
noteInit: widget.billDetail.notes,
contextFrom: context,
);
},
);
},
child: Container(
width: 22,
height: 22,
child: Image(
height: 30,
width: 98,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21),
color: buttonColor,
image: const AssetImage(
'assets/icons/minus-blue.png'),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Image(
height: 16,
width: 16,
image: AssetImage('assets/icons/note.png'),
),
const SizedBox(
width: 10,
),
Container(
height: 16,
child: Center(
child: defaultText(
context,
(widget.billDetail.notes != '')
? 'Ubah'
: 'Catatan',
style: noteViewBill(
color: textInButton,
),
),
),
)
],
),
),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () {
setState(() {
initialValue += 1;
amount = initialValue * amountPeritem;
});
// await Api.changeOrderDetail(
// context,
// widget.billDetail.id,
// initialValue,
// widget.billDetail.notes,
// );
changeOrderDetail(context, widget.billDetail.id,
initialValue, widget.billDetail.notes);
},
child: Container(
width: 22,
height: 22,
child: const Image(
image: AssetImage('assets/icons/plus.png'),
const Spacer(),
Stack(
children: [
Container(
width: 94,
height: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: backgroundColor,
),
child: Center(
child: defaultText(
context,
widget.billDetail.quantity.toString(),
style: amountViewBillButton(),
),
),
),
),
Positioned(
left: 0,
child: GestureDetector(
onTap: () {
if (initialValue > 1) {
setState(() {
initialValue -= 1;
amount = initialValue * amountPeritem;
});
changeOrderDetail(
context,
widget.billDetail.id,
initialValue,
widget.billDetail.notes);
} else {
deleteOrder(
context,
widget.billDetail.menuName,
ontapOkDelete,
ontapCancelDelete);
}
},
child: Container(
width: 22,
height: 22,
child: Image(
color: buttonColor,
image: const AssetImage(
'assets/icons/minus-blue.png'),
),
),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () {
setState(() {
initialValue += 1;
amount = initialValue * amountPeritem;
});
// await Api.changeOrderDetail(
// context,
// widget.billDetail.id,
// initialValue,
// widget.billDetail.notes,
// );
changeOrderDetail(
context,
widget.billDetail.id,
initialValue,
widget.billDetail.notes);
},
child: Container(
width: 22,
height: 22,
child: const Image(
image: AssetImage('assets/icons/plus.png'),
),
),
),
)
],
),
)
],
),
const SizedBox(
width: 12,
const SizedBox(
width: 12,
)
],
),
)
],
),
),
: const SizedBox(),
(widget.lastItem)
? const SizedBox(
height: 11,
......
// ignore_for_file: sized_box_for_whitespace
import 'dart:convert';
import 'dart:math';
import 'package:byod/bloc/feedback_select.dart';
import 'package:byod/bloc/member_info.dart';
import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/style.dart';
import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:uuid/uuid.dart';
import '../../api/api.dart';
import '../../bloc/branch_exist.dart';
import '../../bloc/feedback_option.dart';
import '../../bloc/view_bill.dart';
import '../../bloc/voucher_list.dart';
import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/emoticon_rate.dart';
import '../../helper/widget/thousand_formatter.dart';
import '../../main.dart';
import '../../models/bill.dart';
import '../../models/bill_detail.dart';
import '../../models/feedback_option.dart';
import '../../models/member_info.dart';
import '../../models/rate_value_selected.dart';
import '../build_version.dart';
import '../history_order/history.dart';
import '../home/new_home2.dart';
import '../payment/function.dart';
import '../payment/payment.dart';
import 'app_bar.dart';
import 'list_order.dart';
import 'rincian_pembayaran.dart';
......@@ -29,7 +39,7 @@ class ViewBillNew extends StatelessWidget {
final bool isHistory;
final String sessionId;
final String branchCode;
final String branchCodeH;
final String brandCodeH;
final String tableNumberH;
final String token;
......@@ -38,7 +48,7 @@ class ViewBillNew extends StatelessWidget {
Key? key,
this.isHistory = false,
this.sessionId = '',
this.branchCode = '',
this.branchCodeH = '',
this.brandCodeH = '',
this.tableNumberH = '',
this.token = '',
......@@ -62,7 +72,7 @@ class ViewBillNew extends StatelessWidget {
} else {
context.read<ViewBillBloc>().getBill(
sessionIdH: sessionId,
branchCodeH: brandCodeH,
branchCodeH: branchCodeH,
brandCodeH: brandCodeH,
tableNumberH: tableNumberH,
tokenH: token,
......@@ -129,7 +139,7 @@ class ViewBillNew extends StatelessWidget {
// int individuTotalPayment = 0;
// int individuPaymentPaid = 0;
// int outStandingIndividu = 0;
int outStandingIndividu = 0;
// int allPaymentPaid = 0;
int outStandingAll = 0;
......@@ -187,8 +197,8 @@ class ViewBillNew extends StatelessWidget {
outStandingAll =
amountParseToInt(dataBill[0].outStandingPay);
totalDiscount = amountParseToInt(dataBill[0].discountTotal);
// outStandingIndividu =
// amountParseToInt(dataBill[0].outStandingIndividu);
outStandingIndividu =
amountParseToInt(dataBill[0].outStandingIndividu);
}
void ontapOkAfterCashier() async {
......@@ -261,6 +271,13 @@ class ViewBillNew extends StatelessWidget {
outStandingAll: outStandingAll,
totalDiscount: totalDiscount,
isHistory: isHistory,
customerName: customerName,
outStandingIndividu: outStandingIndividu,
tableMode: tableMode,
onTapCashier: onTapCashier,
branchCode: branchCode,
brandCode: brandCode,
sessionId: sessionId,
),
widthScreen: MediaQuery.of(context).size.width,
isCoreLayout: true,
......@@ -268,11 +285,13 @@ class ViewBillNew extends StatelessWidget {
}
} else {
return ScreenResponsive(
widget: emptyBill(
widthScreen,
maxWidthScreen,
historyOrder,
context,
widget: EmptyBill(
widthScreen: widthScreen,
branchCode: branchCode,
brandCode: brandCode,
customerName: customerName,
isHistory: isHistory,
sessionId: sessionID,
),
widthScreen: currentScreen,
isCoreLayout: true,
......@@ -285,276 +304,1173 @@ class ViewBillNew extends StatelessWidget {
);
}
Future<dynamic> ratingModal(
BuildContext context, List<Bill> dataBill, bool isHistory,
{String sessionID = ''}) {
return showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: defaultText(
context,
'Bagaimana pengalaman anda bertransaksi di excelso ?',
style: textStyleNormalFont(context),
),
content: EmoticonRate(
bill: dataBill[0],
isHistory: isHistory,
sessionId: sessionID,
),
),
);
}
// Future<dynamic> ratingModal(
// BuildContext context, List<Bill> dataBill, bool isHistory,
// {String sessionID = ''}) {
// return showDialog(
// context: context,
// builder: (BuildContext context) => AlertDialog(
// title: defaultText(
// context,
// 'Bagaimana pengalaman anda bertransaksi di excelso ?',
// style: textStyleNormalFont(context),
// ),
// content: EmoticonRate(
// bill: dataBill[0],
// isHistory: isHistory,
// sessionId: sessionID,
// ),
// ),
// );
// }
}
Container emptyBill(double widthScreen, double maxWidthScreen,
List<String> historyOrder, BuildContext context) {
String branchCode = prefs.getString('outlet') ?? '';
String tableNumber = prefs.getString('table_number') ?? '';
String brandCode = prefs.getString('brand') ?? '';
String role = prefs.getString('role') ?? '';
String cashierName = prefs.getString('cashier_name') ?? '';
String sessionID = prefs.getString('sessionId') ?? '';
return Container(
padding:
EdgeInsets.only(left: widthScreen * 0.01, right: widthScreen * 0.01),
width: (widthScreen > maxWidthScreen) ? maxWidthScreen : widthScreen,
// color: Colors.red,
child: SingleChildScrollView(
child: Stack(
children: [
Column(
children: [
CustomAppBar(
isHistory: isHistory,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.92,
class CoreBill extends StatelessWidget {
const CoreBill({
Key? key,
required this.widthScreen,
required this.dataBill,
required this.outStandingAll,
required this.totalDiscount,
required this.isHistory,
required this.customerName,
required this.outStandingIndividu,
required this.tableMode,
required this.onTapCashier,
required this.branchCode,
required this.brandCode,
required this.sessionId,
}) : super(key: key);
final double widthScreen;
final List<Bill> dataBill;
final int outStandingAll;
final int totalDiscount;
final bool isHistory;
final String customerName;
final int outStandingIndividu;
final int tableMode;
final void Function() onTapCashier;
final String branchCode;
final String brandCode;
final String sessionId;
@override
Widget build(BuildContext context) {
return BlocBuilder<MemberInfoBloc, MemberInfo>(
builder: (contextMember, memberinfo) {
return Container(
width: widthScreen,
// padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomAppBar(
isHistory: isHistory,
),
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(
context, 'Meja ${dataBill[0].tableName}',
style: viewbillStyle())),
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(
context, dataBill[0].customerName,
style: customerNameViewbill()),
),
const SizedBox(
height: 18,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
const SizedBox(
height: 16,
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(
context,
'Daftar Order',
style: viewbillStyle(
font: 14,
fontWeight: FontWeight.w600,
),
),
),
ListOrder(
billDetail: dataBill[0].billDetail,
isHistory: isHistory,
tableStatus: dataBill[0].tableStatus,
),
const SizedBox(
height: 11,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
const AddMoreOrder(),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
RincianPembayaran(
dataBill: dataBill,
totalDiscount: totalDiscount,
outStandingAll: outStandingAll,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
// (dataBill[0].paymentList.isNotEmpty)
// ? Container(
// padding: ,
// )
// : const SizedBox(),
const SizedBox(
height: 5,
),
Align(
alignment: Alignment.center,
child: defaultText(
context,
"Harga sudah termasuk pajak",
style: rincianPembayaran(
fontStyle: FontStyle.italic,
),
),
),
const SizedBox(
height: 180,
)
],
),
),
)
],
),
Positioned(
bottom: 0,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight, vertical: paddingLeftRight),
width: widthScreen,
color: backgroundWhite,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Icon(
// Icons.assignment,
// size: 80,
// color: buttonColor,
// ),
fontAwesome(
context,
listPesanan,
listPesananSizeViewBill,
color: buttonColor,
),
defaultText(
context,
"Belum Ada Orderan",
textAlign: TextAlign.center,
style: textStyleMenuList(context),
GestureDetector(
onTap: () {
if (dataBill[0].tableStatus == tableStatusOpen) {
if (tableMode == singleTable &&
memberinfo.id == '') {
addPayment(
context,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else {
buttonDialogAllPayment(
context,
dataBill,
customerName,
outStandingIndividu,
outStandingAll,
tableMode,
onTapCashier,
widthScreen,
memberinfo,
branchCode,
brandCode,
);
}
}
},
child: Container(
margin: const EdgeInsets.only(top: 12),
height: 43,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: (dataBill[0].tableStatus == tableStatusOpen)
? buttonColor
: disabledColor,
),
child: Center(
child: defaultText(
context,
(dataBill[0].tableStatus == tableStatusOpen)
? 'Pembayaran Online'
: 'Transaksi Selesai',
style: buttonBottomBill(),
),
),
),
),
(historyOrder.isNotEmpty)
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
context.read<BranchExist>().branchExist(
branchCode,
brandCode,
role,
cashierName,
sessionID,
);
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const NewHome2()));
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: widthScreen * 0.02,
vertical:
MediaQuery.of(context).size.height *
0.01,
),
margin: EdgeInsets.symmetric(
vertical:
MediaQuery.of(context).size.height *
0.01),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
roundedSmallButton),
color: buttonColor,
),
child: defaultText(
(dataBill[0].isFeedBack == false)
? GestureDetector(
onTap: () {
if (dataBill[0].tableStatus ==
tableStatusOpen) {
onTapCashier();
} else {
if (dataBill[0].isFeedBack == false) {
ratingModal(
context,
'Buat Pesanan Baru',
textAlign: TextAlign.center,
maxLines: 2,
style: textStyleTambahPesanan(context),
),
dataBill,
isHistory,
sessionID: sessionId,
);
}
}
},
child: Container(
margin: const EdgeInsets.only(top: 12),
height: 43,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: successColor,
),
child: Center(
child: defaultText(
context,
(dataBill[0].tableStatus == tableStatusOpen)
? 'Tutup Pesanan & Minta Bill'
: 'Beri Penilaian',
style: buttonBottomBill(),
),
),
(historyOrder.isNotEmpty)
? SizedBox(
width: widthScreen * 0.01,
)
: const SizedBox(),
(historyOrder.isNotEmpty)
? GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => HistoryOrder(
historyOrder: historyOrder,
),
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: widthScreen * 0.02,
vertical: MediaQuery.of(context)
.size
.height *
0.01,
),
margin: EdgeInsets.symmetric(
vertical: MediaQuery.of(context)
.size
.height *
0.01),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
roundedSmallButton),
color: buttonColor,
),
child: defaultText(
context,
'Lihat Transaksi Terakhir',
textAlign: TextAlign.center,
maxLines: 2,
style:
textStyleTambahPesanan(context),
),
),
)
: const SizedBox()
],
),
)
: const SizedBox()
: const SizedBox(),
const SizedBox(
height: 5,
),
const BuildVersion()
],
),
)
],
),
Positioned(
bottom: 10,
child: Container(
width: widthScreen,
child: const BuildVersion(),
),
)
],
),
),
),
)
],
),
);
},
);
}
}
class CoreBill extends StatelessWidget {
const CoreBill({
class EmptyBill extends StatelessWidget {
EmptyBill({
Key? key,
required this.widthScreen,
required this.dataBill,
required this.outStandingAll,
required this.totalDiscount,
required this.isHistory,
required this.customerName,
required this.branchCode,
required this.brandCode,
required this.sessionId,
}) : super(key: key);
final double widthScreen;
final List<Bill> dataBill;
final int outStandingAll;
final int totalDiscount;
final bool isHistory;
final String customerName;
final String branchCode;
final String brandCode;
final String sessionId;
final String tableNumber = prefs.getString("table_number") ?? '';
@override
Widget build(BuildContext context) {
return Container(
width: widthScreen,
// padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomAppBar(
isHistory: isHistory,
),
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(context, 'Meja ${dataBill[0].tableName}',
style: viewbillStyle())),
Container(
padding:
const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: defaultText(context, dataBill[0].customerName,
style: customerNameViewbill()),
),
const SizedBox(
height: 18,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
const SizedBox(
height: 16,
),
Container(
padding:
const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: defaultText(
context,
'Daftar Order',
style: viewbillStyle(
font: 14,
fontWeight: FontWeight.w600,
return BlocBuilder<MemberInfoBloc, MemberInfo>(
builder: (contextMember, memberinfo) {
return Container(
width: widthScreen,
// padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomAppBar(
isHistory: isHistory,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(context, 'Meja $tableNumber',
style: viewbillStyle())),
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(context, customerName,
style: customerNameViewbill()),
),
const SizedBox(
height: 18,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
const Spacer(),
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Image(
width: 187,
height: 173,
image:
AssetImage('assets/icons/big-cart.png'),
),
const SizedBox(
height: 24,
),
defaultText(
context,
'Belum Ada Orderan',
style: rincianPembayaran(
font: 16,
fontWeight: FontWeight.w700,
color: backgroundColorViewBill,
),
)
],
),
),
),
const Spacer(),
],
),
)
],
),
Positioned(
bottom: 0,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight, vertical: paddingLeftRight),
width: widthScreen,
color: backgroundWhite,
child: Column(
children: const [
SizedBox(
height: 5,
),
BuildVersion()
],
),
),
ListOrder(
billDetail: dataBill[0].billDetail,
),
const SizedBox(
height: 11,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
const AddMoreOrder(),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
RincianPembayaran(
dataBill: dataBill,
totalDiscount: totalDiscount,
outStandingAll: outStandingAll,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
)
],
),
);
},
);
}
}
Future<dynamic> ratingModal(
BuildContext context, List<Bill> dataBill, bool isHistory,
{String sessionID = ''}) {
double sizeImage = 76;
final rateNote = TextEditingController();
return showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
// title: defaultText(
// context,
// 'Bagaimana pengalaman anda bertransaksi di excelso ?',
// style: textStyleNormalFont(context),
// ),
// content: EmoticonRate(
// bill: dataBill[0],
// isHistory: isHistory,
// sessionId: sessionID,
// ),
content: BlocBuilder<FeedbackSelect, RateValueSelected>(
builder: (contextSelectedFB, valueSelected) {
return BlocBuilder<FeedBackOptionBloc, List<FeedBackOption>>(
builder: (contextFeedback, listOption) {
List<String> feedBakcAnswer = [];
String header = '';
// List<String> feedBakcAnswerSelected = [];
if (valueSelected.ratingFeedback != noRate) {
int indexOption = listOption.indexWhere((option) =>
option.feedBackOptionValue == valueSelected.ratingFeedback);
if (indexOption != -1) {
feedBakcAnswer = listOption[indexOption].feedBackAnswer;
header = listOption[indexOption].header;
}
}
return GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.only(top: 8),
height: 3,
width: 50,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7),
color: greyColor,
),
),
const SizedBox(
height: 40,
),
defaultText(
context,
'Bagaimana pengalaman anda bertransaksi di excelso ?',
style: emojiStyle(),
),
const SizedBox(
height: 19,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
// setState(() {
// rateValue = badRate;
// });
context
.read<FeedbackSelect>()
.select(valueSelected, badRate, '', '');
},
child: Image(
width: sizeImage,
height: sizeImage,
image: AssetImage(
(valueSelected.ratingFeedback == badRate)
? 'assets/emoji/bad.png'
: 'assets/emoji/bad_grey.png'),
),
),
const SizedBox(
width: 28,
),
GestureDetector(
onTap: () {
// setState(() {
// rateValue = badRate;
// });
context
.read<FeedbackSelect>()
.select(valueSelected, neutralRate, '', '');
},
child: Image(
width: sizeImage,
height: sizeImage,
image: AssetImage(
(valueSelected.ratingFeedback == neutralRate)
? 'assets/emoji/neutral.png'
: 'assets/emoji/neutral_grey.png'),
),
),
const SizedBox(
width: 28,
),
GestureDetector(
onTap: () {
// setState(() {
// rateValue = badRate;
// });
context
.read<FeedbackSelect>()
.select(valueSelected, goodRate, '', '');
},
child: Image(
width: sizeImage,
height: sizeImage,
image: AssetImage(
(valueSelected.ratingFeedback == goodRate)
? 'assets/emoji/good.png'
: 'assets/emoji/good_grey.png'),
),
),
],
),
const SizedBox(
height: 33,
),
defaultText(
context,
header,
style: emojiStyle(
font: 14,
),
),
const SizedBox(
height: 10,
),
Wrap(
crossAxisAlignment: WrapCrossAlignment.start,
alignment: WrapAlignment.start,
spacing: 14,
runSpacing: 14,
children: [
for (var feedback in feedBakcAnswer)
GestureDetector(
onTap: () {
context.read<FeedbackSelect>().select(
valueSelected,
valueSelected.ratingFeedback,
feedback,
'');
},
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 4,
horizontal: 11,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
border: Border.all(
color: const Color(0xffB0BEC5),
),
color: (valueSelected.answerOption
.contains(feedback))
? selectedColor
: null,
),
child: defaultText(
context,
feedback,
style: emojiStyle(
font: 12,
fontWeight: FontWeight.w400,
color: const Color(0xff212121)),
),
),
),
],
),
const SizedBox(
height: 20,
),
TextField(
maxLines: 4,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.done,
controller: rateNote,
maxLength: maxLengthTextField,
decoration: const InputDecoration(
labelText: 'Beri Masukan',
labelStyle: TextStyle(
fontFamily: 'OpenSans',
fontSize: 12,
fontWeight: FontWeight.w600,
color: textColorBlack,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: greyColor),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: greyColor),
)),
style: textStyleNormalFont(context),
// decoration: const InputDecoration(
// labelText: 'Beri Masukkan',
// labelStyle: TextStyle(
// fontFamily: 'OpenSans',
// fontSize: 14,
// color: textColorModalHeaderNama,
// ),
// ),
),
const SizedBox(
height: 20,
),
GestureDetector(
onTap: () async {
if (valueSelected.ratingFeedback == noRate) {
EasyLoading.showToast('Anda belum memilih rating');
} else {
Api.sendFeedBack(
valueSelected.ratingFeedback,
rateNote.text,
dataBill[0].id,
valueSelected.answerOption,
).then((value) {
Navigator.pop(context);
if (!isHistory) {
context.read<ViewBillBloc>().getBill();
} else {
List<String> listHistory =
prefs.getStringList('list_history') ?? [];
if (listHistory.isNotEmpty) {
int indexHistory = listHistory.indexWhere(
(listHistory) =>
jsonDecode(listHistory)['session'] ==
sessionID,
);
if (indexHistory != -1) {
dynamic jsonDecodeHistory =
jsonDecode(listHistory[indexHistory]);
context.read<ViewBillBloc>().getBill(
sessionIdH:
jsonDecodeHistory['session'],
branchCodeH:
jsonDecodeHistory['branch_code'],
brandCodeH: jsonDecodeHistory['brand'],
tableNumberH:
jsonDecodeHistory['table'],
tokenH: jsonDecodeHistory['token'],
userNameH:
jsonDecodeHistory['user_name'],
);
} else {
context.read<ViewBillBloc>().getBill();
}
} else {
context.read<ViewBillBloc>().getBill();
}
}
});
}
},
child: Container(
height: 43,
decoration: BoxDecoration(
color: buttonColor,
borderRadius: BorderRadius.circular(8),
),
child: Center(
child: defaultText(
context,
'Kirim Masukan',
style: rincianPembayaran(
color: textInButton,
fontWeight: FontWeight.w400,
font: 14,
),
),
),
),
),
const SizedBox(
height: 5,
),
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: 43,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
),
child: Center(
child: defaultText(
context,
'Lewati',
style: rincianPembayaran(
color: textColorBlack,
fontWeight: FontWeight.w400,
font: 14,
),
),
),
),
),
],
),
],
),
))
],
);
},
);
},
),
);
),
);
}
Future<dynamic> buttonDialog(BuildContext context, List<Bill> dataBill,
int outStandingAll, double widthScreen) {
final nominalController = TextEditingController();
return showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: defaultText(context, "Nominal Bayar"),
content: SizedBox(
height: MediaQuery.of(context).size.height * 0.3,
width: widthScreen * widhtDialog,
child: Column(
children: [
Container(
height: MediaQuery.of(context).size.height * 0.12,
child: Column(
children: [
TextField(
// autofocus: true,
keyboardType: TextInputType.number,
controller: nominalController,
inputFormatters: [ThousandsSeparatorInputFormatter()],
onChanged: (inputValue) {
var replaceComma =
inputValue.replaceAll(separatorThousand, '');
var inputAmount = int.tryParse(replaceComma);
if (inputAmount == null) {
EasyLoading.showToast(
'Nominal hanya diisi dengan angka');
}
},
style: textStyleNormalFont(context),
),
Align(
alignment: Alignment.topLeft,
child: defaultText(
context,
"Min ${formatNumber().format(amountParseToInt(dataBill[0].dokuMinPay))} - Max ${formatNumber().format(outStandingAll)}",
),
)
],
),
),
SizedBox(height: MediaQuery.of(context).size.height * 0.01),
GestureDetector(
onTap: () {
if (nominalController.text != '') {
var replaceComma = nominalController.text
.replaceAll(separatorThousand, '');
var inputAmount = int.tryParse(replaceComma);
if (nominalController.text == '') {
EasyLoading.showToast('Nominal wajib diisi');
} else if (inputAmount == null) {
EasyLoading.showToast(
'Nominal hanya diisi dengan angka');
} else if (inputAmount <
amountParseToInt(dataBill[0].dokuMinPay)) {
EasyLoading.showToast(
'Minimal bayar ${formatNumber().format(amountParseToInt(dataBill[0].dokuMinPay))}');
} else if (inputAmount > outStandingAll) {
EasyLoading.showToast(
'Maksimal bayar ${formatNumber().format(outStandingAll)}');
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => Payment(
dataBill: dataBill,
isIndividu: true,
outstandingIndividu: inputAmount,
outstandingAll: outStandingAll,
title: ''),
),
);
}
}
},
child: Container(
height: MediaQuery.of(context).size.height * heightTombol,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButton),
color: buttonColor),
child: Align(
child: defaultText(
context,
"OK",
style:
textStyleNormalFont(context, color: textInButton),
),
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: MediaQuery.of(context).size.height * heightTombol,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButton),
color: cancelColorButton,
),
child: Align(
child: Text(
"Batal",
style: textStyleNormalFont(
context,
color: textCancelColor,
),
),
),
),
)
],
),
),
));
}
Future<dynamic> buttonDialogAllPayment(
BuildContext context,
List<Bill> dataBill,
String customerName,
int outStandingIndividu,
int outStandingAll,
int tableMode,
void Function() ontapCashier,
double widthScreen,
MemberInfo memberinfo,
String branchCode,
String brandCode,
) async {
int indexDataIndividu =
dataBill.indexWhere((data) => data.customerName == customerName);
double heighContainer;
if (tableMode == singleTable && memberinfo.id != '') {
heighContainer = MediaQuery.of(context).size.height * 0.45;
} else if ((tableMode == multiTable && memberinfo.id == '') ||
tableMode == singleTable && memberinfo.id != '') {
heighContainer = MediaQuery.of(context).size.height * 0.3;
} else {
heighContainer = MediaQuery.of(context).size.height * 0.25;
}
int outStandingTopayMember = 0;
if (memberinfo.id != '') {
outStandingTopayMember =
min(outStandingAll, amountParseToIntCrm(memberinfo.balance));
}
return showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: defaultText(context, "Pilih cara pembayaran"),
content: SizedBox(
height: heighContainer,
width: widthScreen * widhtDialog,
child: Column(
children: [
Container(
// height: MediaQuery.of(context).size.height * 0.05,
child: Align(
alignment: Alignment.topLeft,
child: defaultText(
context,
"Pembayaran online menggunakan saldo eWallet atau Virtual Account",
style: textStyleNormalFont(context),
),
),
),
SizedBox(height: MediaQuery.of(context).size.height * 0.012),
GestureDetector(
onTap: () {
String titlePayment;
String customerName = prefs.getString('userName') ?? '';
bool isIndividu;
if (tableMode == multiTable) {
isIndividu = true;
titlePayment = 'Semua Bill';
} else {
isIndividu = false;
titlePayment = customerName;
}
if (outStandingAll > 0) {
if (tableMode == singleTable) {
addPayment(
context,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else {
Navigator.pop(context);
buttonDialog(
context, dataBill, outStandingAll, widthScreen);
}
} else {
EasyLoading.showToast('Semua Tagihan Sudah Dibayar');
}
},
child: Container(
// height: MediaQuery.of(context).size.height * 0.04,
height: MediaQuery.of(context).size.height * heightTombol,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButton),
color: buttonColor),
child: Align(
child: defaultText(
context,
(tableMode == multiTable)
? "Bayar Sebagian"
: "Online - Rp ${formatNumber().format(outStandingAll)}",
style: textStyleNormalFont(
context,
color: textInButton,
),
),
),
),
),
(tableMode == multiTable)
? SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
)
: const SizedBox(),
(tableMode == multiTable)
? GestureDetector(
onTap: () {
if (outStandingAll > 0) {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => Payment(
dataBill: dataBill,
isIndividu: false,
outstandingIndividu:
outStandingIndividu,
outstandingAll: outStandingAll,
title: '')));
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: Container(
// height: MediaQuery.of(context).size.height * 0.04,
height: MediaQuery.of(context).size.height *
heightTombol,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(roundedButton),
color: buttonColor),
child: Align(
child: defaultText(
context,
"Bayar Seluruhnya - Rp ${formatNumber().format(outStandingAll)}",
style: textStyleNormalFont(
context,
color: textInButton,
),
),
),
),
)
: const SizedBox(),
(memberinfo.id != '')
? SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
)
: const SizedBox(),
(memberinfo.id != '')
? Container(
// height: MediaQuery.of(context).size.height * 0.05,
child: Align(
alignment: Alignment.topLeft,
child: defaultText(
context,
"Pembayaran dengan saldo member excelso CRM",
style: textStyleNormalFont(context),
),
),
)
: const SizedBox(),
(memberinfo.id != '')
? SizedBox(
height: MediaQuery.of(context).size.height * 0.01,
)
: const SizedBox(),
(memberinfo.id != '')
? GestureDetector(
onTap: () {
if (outStandingAll > 0) {
if (outStandingTopayMember <= 0) {
EasyLoading.showToast(
'Tidak ada tagihan / Tidak ada balance');
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => Payment(
dataBill: dataBill,
isIndividu: true,
outstandingIndividu:
outStandingTopayMember, // karena hanya excelso untuk saat ini jadi overide outstandingindividu dulu
outstandingAll: outStandingAll,
title: 'Dengan Balance',
isUsingBalance: true)));
}
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: Container(
// height:
// MediaQuery.of(context).size.height * 0.04,
height: MediaQuery.of(context).size.height *
heightTombol,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(roundedButton),
color: buttonColor),
child: Align(
child: defaultText(
context,
"Excelco CRM Balance - Rp ${formatNumber().format(outStandingTopayMember)} ",
style: textStyleNormalFont(
context,
color: textInButton,
),
),
),
),
)
: const SizedBox(),
(memberinfo.id != '')
? SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
)
: const SizedBox(),
(memberinfo.id != '')
? Container(
// height: MediaQuery.of(context).size.height * 0.05,
child: Align(
alignment: Alignment.topLeft,
child: defaultText(
context,
"Pembayaran dengan e-Voucher CRM",
style: textStyleNormalFont(context),
),
),
)
: const SizedBox(),
(memberinfo.id != '')
? SizedBox(
height: MediaQuery.of(context).size.height * 0.01,
)
: const SizedBox(),
(memberinfo.id != '')
? GestureDetector(
onTap: () {
int indexVoucher = dataBill[0]
.paymentList
.indexWhere(
(element) => element.method == payVoucher);
if (indexVoucher != -1) {
// check apakah sudah pernah melakukan pembayran voucher
EasyLoading.showToast(
'Voucher telah digunakan pada orderan ini');
} else if (outStandingAll > 0) {
if (indexDataIndividu == -1) {
EasyLoading.showToast(
'Kamu Belum Memiliki Orderan');
} else {
context
.read<VoucherListBloc>()
.getVoucherList();
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => Payment(
dataBill: dataBill,
isIndividu: false,
indexIndividu: indexDataIndividu,
isVoucher: true,
outstandingIndividu:
outStandingIndividu,
outstandingAll: outStandingAll,
title: 'Voucher',
)));
}
} else {
EasyLoading.showToast('Tidak ada tagihan');
}
},
child: Container(
height: MediaQuery.of(context).size.height *
heightTombol,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(roundedButton),
color: buttonColor),
child: Align(
child: defaultText(
context,
"Excelco CRM Voucher",
style: textStyleNormalFont(
context,
color: textInButton,
),
),
),
),
)
: const SizedBox(),
Divider(
thickness: MediaQuery.of(context).size.height * 0.001,
color: Colors.grey,
),
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: MediaQuery.of(context).size.height * heightTombol,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButton),
color: cancelColorButton,
),
child: Align(
child: defaultText(
context,
"Batal",
style: textStyleNormalFont(
context,
color: textCancelColor,
),
),
),
),
),
],
),
),
));
}
class AddMoreOrder extends StatelessWidget {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment