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); ...@@ -248,6 +248,7 @@ const Color backgroundColor = Color(0xffF4F4F4);
const Color backgroundColorViewBill = Color(0xffE5E5E5); const Color backgroundColorViewBill = Color(0xffE5E5E5);
const Color backgroundWhite = Color(0xffFFFFFF); const Color backgroundWhite = Color(0xffFFFFFF);
const Color dividerGrey = Color(0xff898A8D); const Color dividerGrey = Color(0xff898A8D);
const Color greyColor = Color(0xffD9D9D9);
const textColorTabel = Color(0xff333333); const textColorTabel = Color(0xff333333);
const textColorBlack = Color(0xff000000); const textColorBlack = Color(0xff000000);
const textColorRed = Color(0xffE73636); const textColorRed = Color(0xffE73636);
......
// ignore_for_file: must_be_immutable
import 'package:byod/helper/widget/style.dart'; import 'package:byod/helper/widget/style.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../api/api.dart'; import '../../api/api.dart';
import '../../bloc/order_bloc.dart'; import '../../bloc/order_bloc.dart';
......
...@@ -33,6 +33,19 @@ TextStyle appBarNameVariant({font = 17, Color color = textColorBlack}) { ...@@ -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}) { TextStyle appBarNameViewBill({font = 17, Color color = textColorBlack}) {
return TextStyle( return TextStyle(
fontFamily: 'Mulish', fontFamily: 'Mulish',
...@@ -261,9 +274,24 @@ TextStyle addButton({ ...@@ -261,9 +274,24 @@ TextStyle addButton({
); );
} }
TextStyle rincianPembayaran( TextStyle rincianPembayaran({
{font = 12, font = 12,
Color color = textColorBlack, 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}) { FontWeight fontWeight = FontWeight.w400}) {
return TextStyle( return TextStyle(
fontFamily: 'OpenSans', fontFamily: 'OpenSans',
...@@ -664,12 +692,27 @@ TextStyle textStyleTambahPesanan(context) { ...@@ -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( return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily, fontFamily: 'OpenSans',
fontSize: MediaQuery.of(context).size.height * versionFont, fontSize: font,
color: Colors.black54, fontWeight: fontWeight,
fontStyle: FontStyle.italic, color: color,
fontStyle: fontStyle,
); );
} }
......
...@@ -14,7 +14,9 @@ class BuildVersion extends StatelessWidget { ...@@ -14,7 +14,9 @@ class BuildVersion extends StatelessWidget {
child: defaultText( child: defaultText(
context, context,
'Ravintola BYOD v$majorVersion.$minorVersion', 'Ravintola BYOD v$majorVersion.$minorVersion',
style: textStyleVersionNumber(context), style: textStyleVersionNumber(
fontStyle: FontStyle.italic,
),
), ),
); );
} }
......
...@@ -74,7 +74,7 @@ class FinishOrder extends StatelessWidget { ...@@ -74,7 +74,7 @@ class FinishOrder extends StatelessWidget {
), ),
SizedBox(height: MediaQuery.of(context).size.height * 0.015), SizedBox(height: MediaQuery.of(context).size.height * 0.015),
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom(primary: buttonColor), style: ElevatedButton.styleFrom(backgroundColor: buttonColor),
onPressed: () { onPressed: () {
// list[index].note = noteController.text; // list[index].note = noteController.text;
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
......
...@@ -4,9 +4,9 @@ import 'dart:convert'; ...@@ -4,9 +4,9 @@ import 'dart:convert';
import 'package:byod/helper/helper.dart'; import 'package:byod/helper/helper.dart';
import 'package:byod/ui/screen_responsive.dart'; import 'package:byod/ui/screen_responsive.dart';
import 'package:byod/ui/viewbill/view_bill_new.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../helper/widget/style.dart'; import '../../helper/widget/style.dart';
import '../viewbill/view_bill.dart';
class HistoryOrder extends StatelessWidget { class HistoryOrder extends StatelessWidget {
final List<String> historyOrder; final List<String> historyOrder;
...@@ -68,8 +68,10 @@ class HistoryOrder extends StatelessWidget { ...@@ -68,8 +68,10 @@ class HistoryOrder extends StatelessWidget {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.pushReplacement(context, Navigator.pushReplacement(
MaterialPageRoute(builder: (_) => ViewBill())); context,
MaterialPageRoute(
builder: (_) => const ViewBillNew()));
}, },
child: buttonBottom( child: buttonBottom(
context, context,
...@@ -102,16 +104,18 @@ class HistoryOrder extends StatelessWidget { ...@@ -102,16 +104,18 @@ class HistoryOrder extends StatelessWidget {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => ViewBill( builder: (_) => ViewBillNew(
isHistory: true, isHistory: true,
sessionId: jsonDecodeHistory['session'], sessionId: jsonDecodeHistory['session'],
branchCode: jsonDecodeHistory['branch_code'], branchCodeH: jsonDecodeHistory['branch_code'],
brandCode: jsonDecodeHistory['brand'], brandCodeH: jsonDecodeHistory['brand'],
token: jsonDecodeHistory['token'], token: jsonDecodeHistory['token'],
userName: jsonDecodeHistory['user_name'], userName: jsonDecodeHistory['user_name'],
))); ),
),
);
}, },
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
...@@ -222,7 +226,7 @@ class HistoryOrder extends StatelessWidget { ...@@ -222,7 +226,7 @@ class HistoryOrder extends StatelessWidget {
Navigator.pushReplacement( Navigator.pushReplacement(
context, context,
MaterialPageRoute( 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( ...@@ -104,8 +104,8 @@ GestureDetector noteMenu(
child: Align( child: Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: ElevatedButton( child: ElevatedButton(
style: style: ElevatedButton.styleFrom(
ElevatedButton.styleFrom(primary: buttonColor), backgroundColor: buttonColor),
onPressed: () async { onPressed: () async {
// list[index].note = noteController.text; // list[index].note = noteController.text;
if (callFrom == fromMenu) { if (callFrom == fromMenu) {
......
...@@ -66,29 +66,50 @@ class _CategoryListHomeState extends State<CategoryListHome> { ...@@ -66,29 +66,50 @@ class _CategoryListHomeState extends State<CategoryListHome> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
defaultText(
context,
widget.categoryList[i].name,
style: catNameStyle(),
),
AnimatedSwitcher( AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime), duration: Duration(milliseconds: animatedTime),
transitionBuilder: transitionBuilder:
(Widget child, Animation<double> animation) { (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child); return ScaleTransition(scale: animation, child: child);
}, },
child: (selectedIndex == i) child: Container(
? Container( key: const Key('underline'),
key: const Key('underline'), padding: const EdgeInsets.only(bottom: 27),
margin: const EdgeInsets.only(top: 27), decoration: BoxDecoration(
width: 30, border: Border(
height: 1, bottom: BorderSide(
color: buttonColor, color: (selectedIndex == i)
) ? buttonColor
: const SizedBox( : Colors.transparent,
key: Key('underline'), 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'; ...@@ -12,7 +12,8 @@ import '../../helper/widget/style.dart';
import '../../models/filter_menu.dart'; import '../../models/filter_menu.dart';
import '../../models/order_details.dart'; import '../../models/order_details.dart';
import '../../models/order_variants.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 'bottom_sheet_variant.dart';
import 'variant_cat.dart'; import 'variant_cat.dart';
...@@ -32,6 +33,7 @@ class FavGridMenu extends StatelessWidget { ...@@ -32,6 +33,7 @@ class FavGridMenu extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double widthScreen = responsiveWidthScreen(context);
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: (i == 0) ? 0 : 8, // paling awal gausah dikasih margin left: (i == 0) ? 0 : 8, // paling awal gausah dikasih margin
...@@ -74,19 +76,30 @@ class FavGridMenu extends StatelessWidget { ...@@ -74,19 +76,30 @@ class FavGridMenu extends StatelessWidget {
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: (context) { builder: (context) {
return ShowMenuModal( // return ShowMenuModal(
imageUrl: categoryFavAfterSelect[i].imageUrlMedium, // imageUrl: categoryFavAfterSelect[i].imageUrlMedium,
namaMenu: categoryFavAfterSelect[i].name, // namaMenu: categoryFavAfterSelect[i].name,
hargaMenu: // hargaMenu:
amountParseToInt(categoryFavAfterSelect[i].price), // amountParseToInt(categoryFavAfterSelect[i].price),
isHavevariant: // isHavevariant:
categoryFavAfterSelect[i].variantCat.isNotEmpty // categoryFavAfterSelect[i].variantCat.isNotEmpty
? true // ? true
: false, // : false,
description: categoryFavAfterSelect[i].description, // description: categoryFavAfterSelect[i].description,
id: categoryFavAfterSelect[i].id, // id: categoryFavAfterSelect[i].id,
variantCat: categoryFavAfterSelect[i].variantCat, // variantCat: categoryFavAfterSelect[i].variantCat,
isSell: categoryFavAfterSelect[i].isSell, // 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> { ...@@ -46,28 +46,41 @@ class _FavoriteListState extends State<FavoriteList> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
defaultText( Container(
context, padding: const EdgeInsets.only(bottom: 3),
widget.favoriteList[i].name, decoration: BoxDecoration(
style: favNameStyle(), border: Border(
bottom: BorderSide(
width: 1,
color: (selectedIndex == i)
? buttonColor
: Colors.transparent,
),
),
),
child: defaultText(
context,
widget.favoriteList[i].name,
style: favNameStyle(),
),
), ),
AnimatedSwitcher( // AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime), // duration: Duration(milliseconds: animatedTime),
transitionBuilder: // transitionBuilder:
(Widget child, Animation<double> animation) { // (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child); // return ScaleTransition(scale: animation, child: child);
}, // },
child: (selectedIndex == i) // child: (selectedIndex == i)
? Container( // ? Container(
key: const Key('underline'), // key: const Key('underline'),
margin: const EdgeInsets.only(top: 2), // margin: const EdgeInsets.only(top: 2),
width: 30, // width: 30,
height: 1, // height: 1,
color: buttonColor) // color: buttonColor)
: const SizedBox( // : const SizedBox(
key: Key('underline'), // key: Key('underline'),
), // ),
) // )
], ],
), ),
), ),
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import 'package:byod/bloc/order_bloc.dart'; import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/models/orders.dart'; import 'package:byod/models/orders.dart';
import 'package:byod/ui/home/variant_cat.dart'; import 'package:byod/ui/home/variant_cat.dart';
import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
...@@ -13,9 +14,8 @@ import '../../helper/widget/style.dart'; ...@@ -13,9 +14,8 @@ import '../../helper/widget/style.dart';
import '../../models/filter_menu.dart'; import '../../models/filter_menu.dart';
import '../../models/order_details.dart'; import '../../models/order_details.dart';
import '../../models/order_variants.dart'; import '../../models/order_variants.dart';
import 'bottom_sheet_menu.dart'; import 'bottom_sheet_menu_new.dart';
import 'bottom_sheet_variant.dart'; import 'bottom_sheet_variant.dart';
import 'variant_cat_new.dart';
class MenuListUtama extends StatelessWidget { class MenuListUtama extends StatelessWidget {
const MenuListUtama({ const MenuListUtama({
...@@ -115,19 +115,32 @@ class MenuListUtama extends StatelessWidget { ...@@ -115,19 +115,32 @@ class MenuListUtama extends StatelessWidget {
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: (context) { builder: (context) {
return ShowMenuModal( // return ShowMenuModal(
imageUrl: categoryNonFav[i].imageUrlMedium, // imageUrl: categoryNonFav[i].imageUrlMedium,
namaMenu: categoryNonFav[i].name, // namaMenu: categoryNonFav[i].name,
hargaMenu: amountParseToInt( // hargaMenu: amountParseToInt(
categoryNonFav[i].price), // categoryNonFav[i].price),
isHavevariant: // isHavevariant:
categoryNonFav[i].variantCat.isNotEmpty // categoryNonFav[i].variantCat.isNotEmpty
? true // ? true
: false, // : false,
description: categoryNonFav[i].description, // description: categoryNonFav[i].description,
id: categoryNonFav[i].id, // id: categoryNonFav[i].id,
variantCat: categoryNonFav[i].variantCat, // variantCat: categoryNonFav[i].variantCat,
isSell: categoryNonFav[i].isSell, // 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'; ...@@ -11,7 +11,6 @@ import 'package:byod/helper/widget/style.dart';
import 'package:byod/models/filter_menu.dart'; import 'package:byod/models/filter_menu.dart';
import 'package:byod/models/orders.dart'; import 'package:byod/models/orders.dart';
import 'package:byod/ui/home/menu_list_utama.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/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
...@@ -19,19 +18,13 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; ...@@ -19,19 +18,13 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:sliver_tools/sliver_tools.dart'; import 'package:sliver_tools/sliver_tools.dart';
import '../../bloc/filter_menu.dart'; import '../../bloc/filter_menu.dart';
import '../../bloc/order_variant_temporary.dart';
import '../../helper/widget/button_dialog.dart'; import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/note_modal_bottom_sheet.dart';
import '../../main.dart'; import '../../main.dart';
import '../../models/fav_group.dart'; import '../../models/fav_group.dart';
import '../../models/order_variants.dart';
import '../checkout/checkout.dart'; import '../checkout/checkout.dart';
import '../checkout/fuction.dart'; import '../checkout/fuction.dart';
import '../screen_responsive.dart'; import '../screen_responsive.dart';
import '../viewbill/view_bill.dart';
import '../viewbill/view_bill_new.dart'; import '../viewbill/view_bill_new.dart';
import 'bottom_sheet_menu.dart';
import 'bottom_sheet_variant.dart';
import 'cat_list.dart'; import 'cat_list.dart';
import 'fav_grid_menu.dart'; import 'fav_grid_menu.dart';
import 'fav_list.dart'; import 'fav_list.dart';
...@@ -183,14 +176,14 @@ class _NewHome2State extends State<NewHome2> { ...@@ -183,14 +176,14 @@ class _NewHome2State extends State<NewHome2> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double heightTotal = MediaQuery.of(context).size.height; // double heightTotal = MediaQuery.of(context).size.height;
double appBarHeight = 40; double appBarHeight = 40;
double searchFieldHeight = 36; double searchFieldHeight = 36;
double spacerHeight = 20; double spacerHeight = 20;
double favListHeight = 35; double favListHeight = 35;
double favItemHeight = 227; double favItemHeight = 227;
double spacerAboveCat = 16; double spacerAboveCat = 16;
double categoryFont = 14; // double categoryFont = 14;
double spacerAboveCatList = 42; double spacerAboveCatList = 42;
double catListHeight = 51; double catListHeight = 51;
double spacerAboveMenuItem = 25; double spacerAboveMenuItem = 25;
......
...@@ -48,7 +48,7 @@ class _VariantCatNewState extends State<VariantCatNew> { ...@@ -48,7 +48,7 @@ class _VariantCatNewState extends State<VariantCatNew> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
FocusScopeNode currentFocus = FocusScope.of(context); FocusScopeNode currentFocus = FocusScope.of(context);
double widthScreen = responsiveWidthScreen(context); // double widthScreen = responsiveWidthScreen(context);
return SafeArea( return SafeArea(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
......
...@@ -40,7 +40,7 @@ class _VariantNewState extends State<VariantNew> { ...@@ -40,7 +40,7 @@ class _VariantNewState extends State<VariantNew> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double widthScreen = responsiveWidthScreen(context); double widthScreen = responsiveWidthScreen(context);
double currentScreen = MediaQuery.of(context).size.width; // double currentScreen = MediaQuery.of(context).size.width;
double maxWidthScreen = getMaxWidthScreen(context, useResponsive); double maxWidthScreen = getMaxWidthScreen(context, useResponsive);
// if (variantRadio.isNotEmpty) { // if (variantRadio.isNotEmpty) {
......
...@@ -5,9 +5,8 @@ import 'dart:convert'; ...@@ -5,9 +5,8 @@ import 'dart:convert';
import 'package:byod/bloc/filter_menu.dart'; import 'package:byod/bloc/filter_menu.dart';
import 'package:byod/bloc/member_info.dart'; import 'package:byod/bloc/member_info.dart';
import 'package:byod/helper/helper.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/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/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
...@@ -84,11 +83,12 @@ class _SplashState extends State<Splash> { ...@@ -84,11 +83,12 @@ class _SplashState extends State<Splash> {
if (widget.toBill == 'go') { if (widget.toBill == 'go') {
// ignore: use_build_context_synchronously // ignore: use_build_context_synchronously
Navigator.pushReplacement( Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => ViewBill())); context, MaterialPageRoute(builder: (_) => const ViewBillNew()));
} else { } else {
// ignore: use_build_context_synchronously // ignore: use_build_context_synchronously
// Navigator.pushReplacement( // Navigator.pushReplacement(
// context, MaterialPageRoute(builder: (_) => const Home())); // context, MaterialPageRoute(builder: (_) => const Home()));
// ignore: use_build_context_synchronously
Navigator.pushReplacement( Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => const NewHome2())); context, MaterialPageRoute(builder: (_) => const NewHome2()));
} }
......
...@@ -61,7 +61,7 @@ class CustomAppBar extends StatelessWidget { ...@@ -61,7 +61,7 @@ class CustomAppBar extends StatelessWidget {
Center( Center(
child: defaultText( child: defaultText(
context, context,
'Check-Out', (!isHistory) ? 'Check-Out' : 'Riwayat Pesanan',
maxLines: 1, maxLines: 1,
overFlow: TextOverflow.ellipsis, overFlow: TextOverflow.ellipsis,
style: appBarNameViewBill(), style: appBarNameViewBill(),
......
...@@ -8,9 +8,13 @@ class ListOrder extends StatelessWidget { ...@@ -8,9 +8,13 @@ class ListOrder extends StatelessWidget {
const ListOrder({ const ListOrder({
Key? key, Key? key,
required this.billDetail, required this.billDetail,
required this.isHistory,
required this.tableStatus,
}) : super(key: key); }) : super(key: key);
final List<BillDetail> billDetail; final List<BillDetail> billDetail;
final bool isHistory;
final int tableStatus;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -23,6 +27,8 @@ class ListOrder extends StatelessWidget { ...@@ -23,6 +27,8 @@ class ListOrder extends StatelessWidget {
return OrderViewBillNew( return OrderViewBillNew(
billDetail: billDetail[i], billDetail: billDetail[i],
lastItem: (i + 1 == itemCounts) ? true : false, lastItem: (i + 1 == itemCounts) ? true : false,
isHistory: isHistory,
tableStatus: tableStatus,
); );
}, },
); );
......
...@@ -14,10 +14,14 @@ import 'view_bill_new.dart'; ...@@ -14,10 +14,14 @@ import 'view_bill_new.dart';
class OrderViewBillNew extends StatefulWidget { class OrderViewBillNew extends StatefulWidget {
final BillDetail billDetail; final BillDetail billDetail;
final bool lastItem; final bool lastItem;
final bool isHistory;
final int tableStatus;
const OrderViewBillNew({ const OrderViewBillNew({
Key? key, Key? key,
required this.billDetail, required this.billDetail,
required this.isHistory,
this.lastItem = false, this.lastItem = false,
required this.tableStatus,
}) : super(key: key); }) : super(key: key);
@override @override
...@@ -172,166 +176,179 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -172,166 +176,179 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
const SizedBox( const SizedBox(
height: 11, height: 11,
), ),
Container( (!widget.isHistory && widget.tableStatus == tableStatusOpen)
padding: EdgeInsets.only( ? Container(
left: paddingLeftRightBill, right: paddingLeftRightBill), padding: EdgeInsets.only(
child: Row( left: paddingLeftRightBill,
children: [ right: paddingLeftRightBill),
GestureDetector( child: Row(
onTap: () { children: [
FocusScopeNode currentFocus = FocusScope.of(context); GestureDetector(
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(
onTap: () { onTap: () {
if (initialValue > 1) { FocusScopeNode currentFocus =
setState(() { FocusScope.of(context);
initialValue -= 1;
amount = initialValue * amountPeritem; if (!currentFocus.hasPrimaryFocus) {
}); currentFocus.unfocus();
changeOrderDetail(context, widget.billDetail.id,
initialValue, widget.billDetail.notes);
} else {
deleteOrder(context, widget.billDetail.menuName,
ontapOkDelete, ontapCancelDelete);
} }
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( child: Container(
width: 22, height: 30,
height: 22, width: 98,
child: Image( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21),
color: buttonColor, 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,
),
),
),
)
],
), ),
), ),
), ),
), const Spacer(),
Positioned( Stack(
right: 0, children: [
child: GestureDetector( Container(
onTap: () { width: 94,
setState(() { height: 22,
initialValue += 1; decoration: BoxDecoration(
amount = initialValue * amountPeritem; borderRadius: BorderRadius.circular(30),
}); color: backgroundColor,
// await Api.changeOrderDetail( ),
// context, child: Center(
// widget.billDetail.id, child: defaultText(
// initialValue, context,
// widget.billDetail.notes, widget.billDetail.quantity.toString(),
// ); style: amountViewBillButton(),
changeOrderDetail(context, widget.billDetail.id, ),
initialValue, widget.billDetail.notes); ),
},
child: Container(
width: 22,
height: 22,
child: const Image(
image: AssetImage('assets/icons/plus.png'),
), ),
), 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) (widget.lastItem)
? const SizedBox( ? const SizedBox(
height: 11, height: 11,
......
// ignore_for_file: sized_box_for_whitespace // 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/helper.dart';
import 'package:byod/helper/widget/style.dart'; import 'package:byod/helper/widget/style.dart';
import 'package:byod/ui/screen_responsive.dart'; import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import '../../api/api.dart'; import '../../api/api.dart';
import '../../bloc/branch_exist.dart';
import '../../bloc/feedback_option.dart'; import '../../bloc/feedback_option.dart';
import '../../bloc/view_bill.dart'; import '../../bloc/view_bill.dart';
import '../../bloc/voucher_list.dart';
import '../../helper/widget/button_dialog.dart'; import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/emoticon_rate.dart'; import '../../helper/widget/emoticon_rate.dart';
import '../../helper/widget/thousand_formatter.dart';
import '../../main.dart'; import '../../main.dart';
import '../../models/bill.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 '../build_version.dart';
import '../history_order/history.dart';
import '../home/new_home2.dart'; import '../home/new_home2.dart';
import '../payment/function.dart';
import '../payment/payment.dart';
import 'app_bar.dart'; import 'app_bar.dart';
import 'list_order.dart'; import 'list_order.dart';
import 'rincian_pembayaran.dart'; import 'rincian_pembayaran.dart';
...@@ -29,7 +39,7 @@ class ViewBillNew extends StatelessWidget { ...@@ -29,7 +39,7 @@ class ViewBillNew extends StatelessWidget {
final bool isHistory; final bool isHistory;
final String sessionId; final String sessionId;
final String branchCode; final String branchCodeH;
final String brandCodeH; final String brandCodeH;
final String tableNumberH; final String tableNumberH;
final String token; final String token;
...@@ -38,7 +48,7 @@ class ViewBillNew extends StatelessWidget { ...@@ -38,7 +48,7 @@ class ViewBillNew extends StatelessWidget {
Key? key, Key? key,
this.isHistory = false, this.isHistory = false,
this.sessionId = '', this.sessionId = '',
this.branchCode = '', this.branchCodeH = '',
this.brandCodeH = '', this.brandCodeH = '',
this.tableNumberH = '', this.tableNumberH = '',
this.token = '', this.token = '',
...@@ -62,7 +72,7 @@ class ViewBillNew extends StatelessWidget { ...@@ -62,7 +72,7 @@ class ViewBillNew extends StatelessWidget {
} else { } else {
context.read<ViewBillBloc>().getBill( context.read<ViewBillBloc>().getBill(
sessionIdH: sessionId, sessionIdH: sessionId,
branchCodeH: brandCodeH, branchCodeH: branchCodeH,
brandCodeH: brandCodeH, brandCodeH: brandCodeH,
tableNumberH: tableNumberH, tableNumberH: tableNumberH,
tokenH: token, tokenH: token,
...@@ -129,7 +139,7 @@ class ViewBillNew extends StatelessWidget { ...@@ -129,7 +139,7 @@ class ViewBillNew extends StatelessWidget {
// int individuTotalPayment = 0; // int individuTotalPayment = 0;
// int individuPaymentPaid = 0; // int individuPaymentPaid = 0;
// int outStandingIndividu = 0; int outStandingIndividu = 0;
// int allPaymentPaid = 0; // int allPaymentPaid = 0;
int outStandingAll = 0; int outStandingAll = 0;
...@@ -187,8 +197,8 @@ class ViewBillNew extends StatelessWidget { ...@@ -187,8 +197,8 @@ class ViewBillNew extends StatelessWidget {
outStandingAll = outStandingAll =
amountParseToInt(dataBill[0].outStandingPay); amountParseToInt(dataBill[0].outStandingPay);
totalDiscount = amountParseToInt(dataBill[0].discountTotal); totalDiscount = amountParseToInt(dataBill[0].discountTotal);
// outStandingIndividu = outStandingIndividu =
// amountParseToInt(dataBill[0].outStandingIndividu); amountParseToInt(dataBill[0].outStandingIndividu);
} }
void ontapOkAfterCashier() async { void ontapOkAfterCashier() async {
...@@ -261,6 +271,13 @@ class ViewBillNew extends StatelessWidget { ...@@ -261,6 +271,13 @@ class ViewBillNew extends StatelessWidget {
outStandingAll: outStandingAll, outStandingAll: outStandingAll,
totalDiscount: totalDiscount, totalDiscount: totalDiscount,
isHistory: isHistory, isHistory: isHistory,
customerName: customerName,
outStandingIndividu: outStandingIndividu,
tableMode: tableMode,
onTapCashier: onTapCashier,
branchCode: branchCode,
brandCode: brandCode,
sessionId: sessionId,
), ),
widthScreen: MediaQuery.of(context).size.width, widthScreen: MediaQuery.of(context).size.width,
isCoreLayout: true, isCoreLayout: true,
...@@ -268,11 +285,13 @@ class ViewBillNew extends StatelessWidget { ...@@ -268,11 +285,13 @@ class ViewBillNew extends StatelessWidget {
} }
} else { } else {
return ScreenResponsive( return ScreenResponsive(
widget: emptyBill( widget: EmptyBill(
widthScreen, widthScreen: widthScreen,
maxWidthScreen, branchCode: branchCode,
historyOrder, brandCode: brandCode,
context, customerName: customerName,
isHistory: isHistory,
sessionId: sessionID,
), ),
widthScreen: currentScreen, widthScreen: currentScreen,
isCoreLayout: true, isCoreLayout: true,
...@@ -285,276 +304,1173 @@ class ViewBillNew extends StatelessWidget { ...@@ -285,276 +304,1173 @@ class ViewBillNew extends StatelessWidget {
); );
} }
Future<dynamic> ratingModal( // Future<dynamic> ratingModal(
BuildContext context, List<Bill> dataBill, bool isHistory, // BuildContext context, List<Bill> dataBill, bool isHistory,
{String sessionID = ''}) { // {String sessionID = ''}) {
return showDialog( // return showDialog(
context: context, // context: context,
builder: (BuildContext context) => AlertDialog( // builder: (BuildContext context) => AlertDialog(
title: defaultText( // title: defaultText(
context, // context,
'Bagaimana pengalaman anda bertransaksi di excelso ?', // 'Bagaimana pengalaman anda bertransaksi di excelso ?',
style: textStyleNormalFont(context), // style: textStyleNormalFont(context),
), // ),
content: EmoticonRate( // content: EmoticonRate(
bill: dataBill[0], // bill: dataBill[0],
isHistory: isHistory, // isHistory: isHistory,
sessionId: sessionID, // sessionId: sessionID,
), // ),
), // ),
); // );
} // }
}
Container emptyBill(double widthScreen, double maxWidthScreen, class CoreBill extends StatelessWidget {
List<String> historyOrder, BuildContext context) { const CoreBill({
String branchCode = prefs.getString('outlet') ?? ''; Key? key,
String tableNumber = prefs.getString('table_number') ?? ''; required this.widthScreen,
String brandCode = prefs.getString('brand') ?? ''; required this.dataBill,
String role = prefs.getString('role') ?? ''; required this.outStandingAll,
String cashierName = prefs.getString('cashier_name') ?? ''; required this.totalDiscount,
String sessionID = prefs.getString('sessionId') ?? ''; required this.isHistory,
return Container( required this.customerName,
padding: required this.outStandingIndividu,
EdgeInsets.only(left: widthScreen * 0.01, right: widthScreen * 0.01), required this.tableMode,
width: (widthScreen > maxWidthScreen) ? maxWidthScreen : widthScreen, required this.onTapCashier,
// color: Colors.red, required this.branchCode,
child: SingleChildScrollView( required this.brandCode,
child: Stack( required this.sessionId,
children: [ }) : super(key: key);
Column(
children: [ final double widthScreen;
CustomAppBar( final List<Bill> dataBill;
isHistory: isHistory, final int outStandingAll;
), final int totalDiscount;
SizedBox( final bool isHistory;
height: MediaQuery.of(context).size.height * 0.92, 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( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
// Icon( GestureDetector(
// Icons.assignment, onTap: () {
// size: 80, if (dataBill[0].tableStatus == tableStatusOpen) {
// color: buttonColor, if (tableMode == singleTable &&
// ), memberinfo.id == '') {
fontAwesome( addPayment(
context, context,
listPesanan, dataBill[0].id,
listPesananSizeViewBill, branchCode,
color: buttonColor, brandCode,
), customerName,
defaultText( payCard,
context, fullPayment,
"Belum Ada Orderan", '',
textAlign: TextAlign.center, outStandingAll,
style: textStyleMenuList(context), );
} 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) (dataBill[0].isFeedBack == false)
? Column( ? GestureDetector(
mainAxisAlignment: MainAxisAlignment.center, onTap: () {
children: [ if (dataBill[0].tableStatus ==
GestureDetector( tableStatusOpen) {
onTap: () { onTapCashier();
context.read<BranchExist>().branchExist( } else {
branchCode, if (dataBill[0].isFeedBack == false) {
brandCode, ratingModal(
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(
context, context,
'Buat Pesanan Baru', dataBill,
textAlign: TextAlign.center, isHistory,
maxLines: 2, sessionID: sessionId,
style: textStyleTambahPesanan(context), );
), }
}
},
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 { class EmptyBill extends StatelessWidget {
const CoreBill({ EmptyBill({
Key? key, Key? key,
required this.widthScreen, required this.widthScreen,
required this.dataBill,
required this.outStandingAll,
required this.totalDiscount,
required this.isHistory, required this.isHistory,
required this.customerName,
required this.branchCode,
required this.brandCode,
required this.sessionId,
}) : super(key: key); }) : super(key: key);
final double widthScreen; final double widthScreen;
final List<Bill> dataBill;
final int outStandingAll;
final int totalDiscount;
final bool isHistory; final bool isHistory;
final String customerName;
final String branchCode;
final String brandCode;
final String sessionId;
final String tableNumber = prefs.getString("table_number") ?? '';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return BlocBuilder<MemberInfoBloc, MemberInfo>(
width: widthScreen, builder: (contextMember, memberinfo) {
// padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight), return Container(
child: Column( width: widthScreen,
crossAxisAlignment: CrossAxisAlignment.start, // padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
children: [ child: Stack(
CustomAppBar( children: [
isHistory: isHistory, Column(
), crossAxisAlignment: CrossAxisAlignment.start,
Expanded( children: [
child: SingleChildScrollView( CustomAppBar(
child: Column( isHistory: isHistory,
crossAxisAlignment: CrossAxisAlignment.start, ),
children: [ Expanded(
Container( child: Column(
padding: const EdgeInsets.symmetric( crossAxisAlignment: CrossAxisAlignment.start,
horizontal: paddingLeftRight), children: [
child: defaultText(context, 'Meja ${dataBill[0].tableName}', Container(
style: viewbillStyle())), padding: const EdgeInsets.symmetric(
Container( horizontal: paddingLeftRight),
padding: child: defaultText(context, 'Meja $tableNumber',
const EdgeInsets.symmetric(horizontal: paddingLeftRight), style: viewbillStyle())),
child: defaultText(context, dataBill[0].customerName, Container(
style: customerNameViewbill()), padding: const EdgeInsets.symmetric(
), horizontal: paddingLeftRight),
const SizedBox( child: defaultText(context, customerName,
height: 18, style: customerNameViewbill()),
), ),
const Divider( const SizedBox(
color: backgroundColorViewBill, height: 18,
thickness: 24, ),
), const Divider(
const SizedBox( color: backgroundColorViewBill,
height: 16, thickness: 24,
), ),
Container( const Spacer(),
padding: Container(
const EdgeInsets.symmetric(horizontal: paddingLeftRight), padding: const EdgeInsets.symmetric(
child: defaultText( horizontal: paddingLeftRight),
context, child: Center(
'Daftar Order', child: Column(
style: viewbillStyle( mainAxisAlignment: MainAxisAlignment.center,
font: 14, children: [
fontWeight: FontWeight.w600, 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,
), Future<dynamic> ratingModal(
const AddMoreOrder(), BuildContext context, List<Bill> dataBill, bool isHistory,
const Divider( {String sessionID = ''}) {
color: backgroundColorViewBill, double sizeImage = 76;
thickness: 24, final rateNote = TextEditingController();
), return showDialog(
RincianPembayaran( context: context,
dataBill: dataBill, builder: (BuildContext context) => AlertDialog(
totalDiscount: totalDiscount, // title: defaultText(
outStandingAll: outStandingAll, // context,
), // 'Bagaimana pengalaman anda bertransaksi di excelso ?',
const Divider( // style: textStyleNormalFont(context),
color: backgroundColorViewBill, // ),
thickness: 24, // 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 { 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