Commit 300ca720 authored by Jasa Digital's avatar Jasa Digital

19/10/22

parent bdbf0d11
......@@ -26,6 +26,7 @@ import '../helper/widget/open_url.dart';
import '../main.dart';
import '../models/branchs.dart';
import '../models/variant_categories.dart';
import '../models/variant_detail_bill.dart';
import '../models/variants.dart';
// ignore: avoid_web_libraries_in_flutter
......@@ -867,9 +868,24 @@ class Api {
bill.customerName == orderDetail[d]['customer_name']);
if (index != -1) {
// ketemu nama yang sama
List<String> variants = [];
List<VariantDetailBill> variants = [];
for (int z = 0; z < orderDetail[d]['variant'].length; z++) {
variants.add(orderDetail[d]['variant'][z]);
int indexVariantBill = variants.indexWhere((element) =>
(element.caption ==
orderDetail[d]['variant'][z]['caption']));
if (indexVariantBill == -1) {
Map<String, dynamic> variantBill = {
"caption": orderDetail[d]['variant'][z]['caption'],
"variant_name": [
orderDetail[d]['variant'][z]['variant_name'].toString()
]
};
variants.add(VariantDetailBill.json(variantBill));
} else {
variants[indexVariantBill]
.variantName
.add(orderDetail[d]['variant'][z]['variant_name']);
}
}
int totalPerCustomer =
......@@ -895,9 +911,24 @@ class Api {
} else {
// beda orang
List<BillDetail> billDetail = [];
List<String> variants = [];
List<VariantDetailBill> variants = [];
for (int z = 0; z < orderDetail[d]['variant'].length; z++) {
variants.add(orderDetail[d]['variant'][z]);
int indexVariantBill = variants.indexWhere((element) =>
(element.caption ==
orderDetail[d]['variant'][z]['caption']));
if (indexVariantBill == -1) {
Map<String, dynamic> variantBill = {
"caption": orderDetail[d]['variant'][z]['caption'],
"variant_name": [
orderDetail[d]['variant'][z]['variant_name'].toString()
]
};
variants.add(VariantDetailBill.json(variantBill));
} else {
variants[indexVariantBill]
.variantName
.add(orderDetail[d]['variant'][z]['variant_name']);
}
}
var z = {
"id": orderDetail[d]['id'],
......@@ -946,7 +977,14 @@ class Api {
"delivery_fee": jsonObject['data']['delivery_fee'] ?? "0.00",
"delivery_state":
jsonObject['data']['order_delivery_state'] ?? 0,
"rdm_staff_courier_name":
jsonObject['data']['rdm_staff_courier_name'] ?? "",
"rdm_staff_courier_mobile":
jsonObject['data']['rdm_staff_courier_mobile'] ?? "",
};
if (jsonObject['data']['delivery_fee'] != "") {
setIsCustomerDelivery(true);
}
bill.add(Bill.createBill(i));
// billDetail.add(BillDetail.createBillDetail(orderDetail[d]));
}
......@@ -2261,7 +2299,7 @@ class Api {
if (jsonObject['status'].toString().toLowerCase() == 'ok') {
return true;
} else {
EasyLoading.showToast(jsonObject['msg']);
// EasyLoading.showToast(jsonObject['msg']);
return false;
}
} else {
......
import 'package:flutter_bloc/flutter_bloc.dart';
class ChangeDeliveryPickupBloc extends Cubit<bool> {
ChangeDeliveryPickupBloc() : super(false);
void toDelivery(bool status) {
emit(status);
}
}
......@@ -7,6 +7,7 @@ import 'package:crypto/crypto.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:http/http.dart' as http;
import 'package:uuid/uuid.dart';
import '../api/api.dart';
import '../main.dart';
import 'logger.dart';
......@@ -418,7 +419,16 @@ String logoUrl = prefs.getString("logoUrl") ?? "";
double imageHeight = (logoUrl != '') ? 96 : 0;
double heighScrollWithImage = 371 + imageHeight;
double heighDeliveryPickupDetail = 187;
double heighScrollWithOutImage = 371;
double animateToWhenCategoryClick() {
if (getIsDeliveryPickup()) {
return heighScrollWithImage + heighDeliveryPickupDetail;
} else {
return heighScrollWithImage;
}
}
//** */
//** core warna */
......@@ -719,6 +729,9 @@ const double phoneIconSize = 16;
const String trahsIcon = '\uf2ed';
const double trahsIconSize = 16;
const String angelDown = '\uf107';
const double angelDownSize = 12;
//** fontawesome unicode */
//** max item menu */
......@@ -766,4 +779,8 @@ const int orderDeliveryStateInDelivery = 1;
const int orderDeliveryStateDelivered = 99;
// devliery state
// init uuid
const uuidInit = Uuid();
//
//** END CONSTANT */
......@@ -21,7 +21,7 @@ const String queueTopic = 'romi/byod/payment';
// String queueMessage = getMqMessage();
const String usernameMq = 'jasadigital';
const String passwordMq = 'jasadigital';
const uuidInit = Uuid();
var uuid = uuidInit.v4();
Future<int> runMqTT(BuildContext context) async {
......
......@@ -20,6 +20,7 @@ import 'package:web_browser_detect/web_browser_detect.dart';
import 'bloc/branch_exist.dart';
import 'bloc/branch_list.dart';
import 'bloc/change_delivery_pickup.dart';
import 'bloc/fav_selected_bar.dart';
import 'bloc/feedback_option.dart';
import 'bloc/feedback_select.dart';
......@@ -195,6 +196,7 @@ class _MyAppState extends State<MyApp> {
BlocProvider(create: (_) => SearchBranch()),
BlocProvider(create: (_) => AddressUser()),
BlocProvider(create: (_) => ExpandDetailOutlet()),
BlocProvider(create: (_) => ChangeDeliveryPickupBloc()),
],
child: MaterialApp(
title: (widget.title == null) ? defaultTitle : widget.title,
......
......@@ -27,6 +27,8 @@ class Bill {
String platformFee;
String deliveryFee;
int deliveryState;
String courierName;
String courierPhone;
// List<MemberInfo> memberInfo;
Bill({
......@@ -54,36 +56,40 @@ class Bill {
this.platformFee = "0.00",
this.deliveryFee = "0.00",
this.deliveryState = 0,
this.courierName = '',
this.courierPhone = '',
// this.memberInfo = const []
});
factory Bill.createBill(Map<String, dynamic> json) {
return Bill(
id: json['id'],
totalSeluruhOrderan: json['total'],
subTotalSeluruhOrderan: json['subtotal'],
totalPerCustomer: json['total_per_customer'],
customerName: json['customer_name'],
tableStatus: json['table_status'],
orderStatus: json['order_status'],
state: json['order_state'],
billDetail: json['order_detail'],
paymentList: json['payment_list'],
outStandingPay: json['outstanding'],
invoice: json['invoice'],
totalService: json['total_service'],
totalServiceTax: json['total_service_tax'],
outStandingIndividu: json['my_self_outstanding'],
discountTotal: json['discount_total'],
tableName: json['table_number'],
isFeedBack: json['is_feedback'],
dokuMinPay: json['doku_minimum_payment'],
dateOrder: json['order_date'],
packagingFee: json['packaging_fee'],
platformFee: json['platform_fee'],
deliveryFee: json['delivery_fee'],
deliveryState: json['delivery_state'] ?? 0
// memberInfo: json['member_info']
);
id: json['id'],
totalSeluruhOrderan: json['total'],
subTotalSeluruhOrderan: json['subtotal'],
totalPerCustomer: json['total_per_customer'],
customerName: json['customer_name'],
tableStatus: json['table_status'],
orderStatus: json['order_status'],
state: json['order_state'],
billDetail: json['order_detail'],
paymentList: json['payment_list'],
outStandingPay: json['outstanding'],
invoice: json['invoice'],
totalService: json['total_service'],
totalServiceTax: json['total_service_tax'],
outStandingIndividu: json['my_self_outstanding'],
discountTotal: json['discount_total'],
tableName: json['table_number'],
isFeedBack: json['is_feedback'],
dokuMinPay: json['doku_minimum_payment'],
dateOrder: json['order_date'],
packagingFee: json['packaging_fee'],
platformFee: json['platform_fee'],
deliveryFee: json['delivery_fee'],
deliveryState: json['delivery_state'] ?? 0,
courierName: json['rdm_staff_courier_name'] ?? '',
courierPhone: json['rdm_staff_courier_mobile'] ?? '',
// memberInfo: json['member_info']
);
}
}
import 'package:byod/models/variant_detail_bill.dart';
class BillDetail {
String id;
String customerName;
......@@ -12,7 +14,7 @@ class BillDetail {
String notes;
String imageUrl;
// int paidStatus;
List<String> variant;
List<VariantDetailBill> variant;
BillDetail(
{required this.id,
......
class VariantDetailBill {
String caption;
List<String> variantName;
VariantDetailBill({required this.caption, this.variantName = const []});
factory VariantDetailBill.json(Map<String, dynamic> json) {
return VariantDetailBill(
caption: json['caption'],
variantName: json['variant_name'],
);
}
}
// ignore_for_file: must_be_immutable
import 'package:byod/bloc/menu_selected_bar.dart';
import 'package:byod/helper/prefs.dart';
import 'package:byod/models/fav_group.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -52,8 +53,10 @@ class _CategoryListHomeState extends State<CategoryListHome> {
.selectedBarMenu(i, widget.categoryList[i].id);
widget.scrollController.animateTo(
(widget.favList.isNotEmpty)
? heighScrollWithImage
: imageHeight, // 371 sudah dihituing pixelnya untuk awal banget dari menu item
? animateToWhenCategoryClick()
: (getIsDeliveryPickup())
? imageHeight + heighDeliveryPickupDetail
: imageHeight, // 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration: const Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn,
);
......
......@@ -12,12 +12,15 @@ 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:dotted_line/dotted_line.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:sliver_tools/sliver_tools.dart';
import '../../bloc/address_user_bloc.dart';
import '../../bloc/filter_menu.dart';
import '../../bloc/outlet_detail.dart';
import '../../helper/mq.dart';
import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/modal_input_name.dart';
......@@ -26,7 +29,7 @@ import '../../models/fav_group.dart';
import '../checkout/fuction.dart';
import '../confirm_order/confirm_order.dart';
import '../screen_responsive.dart';
import '../select_branch.dart';
import '../viewbill/component_name_user.dart';
import '../viewbill/view_bill_new.dart';
import 'cat_list.dart';
import 'fav_grid_menu.dart';
......@@ -77,7 +80,6 @@ class _NewHome2State extends State<NewHome2> {
isFirstLoad = false;
});
}
// double positionCustomScrollView = _scrollController.position.pixels;
// print(positionCustomScrollView);
// if (_scrollController.position.pixels >=
......@@ -181,6 +183,13 @@ class _NewHome2State extends State<NewHome2> {
@override
Widget build(BuildContext context) {
if (getIsDeliveryPickup()) {
context.read<AddressUser>().getAddressUser(
context,
isCallDeliveryCharge: false,
isGetBranchList: true,
);
}
// double heightTotal = MediaQuery.of(context).size.height;
double appBarHeight = 50;
double searchFieldHeight = 50;
......@@ -668,118 +677,188 @@ class _NewHome2State extends State<NewHome2> {
),
),
),
SliverToBoxAdapter(
child: Column(
children: [
(getIsDeliveryPickup())
? const SizedBox(
height: 5,
)
: const SizedBox(),
(getIsDeliveryPickup())
? Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
(getIsDeliveryPickup())
? const SliverToBoxAdapter(
child: ComponentNameUser(
isDeliveryPickuup: true,
backgroundColorComponent: backgroundColor,
isFromMenu: true,
),
)
: const SliverToBoxAdapter(
child: SizedBox(),
),
(getIsDeliveryPickup())
? SliverToBoxAdapter(
child: BlocBuilder<ExpandDetailOutlet, bool>(
builder: (ctx, isShowOutletDetail) {
return Column(
children: [
Expanded(
child: defaultText(
context,
"Open Hour: ${timeHm(getOpenTime())} - ${timeHm(getCloseTime())}",
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(),
Container(
color: backgroundColor,
child: const DottedLine(
dashColor: dashGrey,
dashLength: 12,
),
),
// const Spacer(),
GestureDetector(
onTap: () {
void ontapOkeChange() {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) =>
const SelectBranch(
isFormBill: true,
),
),
);
}
void onTapCancelChange() {
Navigator.pop(context);
}
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Ganti Outlet';
String description = '''
Ganti outlet akan menyebabkan orderan anda saat ini hilang.
Apakah ingin melanjutkan ?''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChange,
onTapCancelChange,
okButtonColor: buttonColor,
);
},
child: Container(
width: 64,
height: 20,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(40),
color: backgroundColor,
border: Border.all(
color: textColorBlack,
Container(
padding: (!isShowOutletDetail)
? const EdgeInsets.only(bottom: 15)
: null,
child: Column(
children: [
DeliveryPickupDetail(
isShowOutletDetail:
isShowOutletDetail,
isFromMenu: true,
),
),
child: Center(
child: defaultText(
context,
'Ganti Outlet',
style: addButton(
font: 8,
color: textColorBlack,
),
),
),
(!isShowOutletDetail)
? Container(
color: backgroundColor,
child: const DottedLine(
dashColor: dashGrey,
dashLength: 12,
),
)
: const SizedBox(),
],
),
),
(isShowOutletDetail)
? Container(
color: backgroundColor,
child: const DottedLine(
dashColor: dashGrey,
dashLength: 12,
),
)
: const SizedBox(),
(isShowOutletDetail)
? const OutletDetail(
isFromMenu: true,
)
: const SizedBox(),
],
)
: const SizedBox(),
(getIsDeliveryPickup())
? (getDistance() > getServiceRadius().toDouble())
? Container(
padding: const EdgeInsets.symmetric(
vertical: 5,
),
child: Align(
alignment: Alignment.centerLeft,
child: defaultText(
context,
'Jarak anda dan outlet terlalu jauh, silahkan ganti outlet',
style: viewbillStyle(
font: 12,
color: dangerColor,
),
),
),
)
: const SizedBox()
: const SizedBox(),
(getIsDeliveryPickup())
? const SizedBox(
height: 10,
)
: const SizedBox(),
],
),
),
);
},
),
)
: const SliverToBoxAdapter(
child: SizedBox(),
),
// SliverToBoxAdapter(
// child: Column(
// children: [
// (getIsDeliveryPickup())
// ? const SizedBox(
// height: 5,
// )
// : const SizedBox(),
// (getIsDeliveryPickup())
// ? Row(
// // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Expanded(
// child: defaultText(
// context,
// "Open Hour: ${timeHm(getOpenTime())} - ${timeHm(getCloseTime())}",
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
// style: viewbillStyle(),
// ),
// ),
// // const Spacer(),
// GestureDetector(
// onTap: () {
// void ontapOkeChange() {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) =>
// const SelectBranch(
// isFormBill: true,
// ),
// ),
// );
// }
// void onTapCancelChange() {
// Navigator.pop(context);
// }
// String textOnOk = 'OK';
// String textOnCancel = 'Batal';
// String title = 'Ganti Outlet';
// String description = '''
// Ganti outlet akan menyebabkan orderan anda saat ini hilang.
// Apakah ingin melanjutkan ?''';
// buttonDialogGlobal(
// context,
// title,
// description,
// textOnOk,
// textOnCancel,
// ontapOkeChange,
// onTapCancelChange,
// okButtonColor: buttonColor,
// );
// },
// child: Container(
// width: 64,
// height: 20,
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(40),
// color: backgroundColor,
// border: Border.all(
// color: textColorBlack,
// ),
// ),
// child: Center(
// child: defaultText(
// context,
// 'Ganti Outlet',
// style: addButton(
// font: 8,
// color: textColorBlack,
// ),
// ),
// ),
// ),
// ),
// ],
// )
// : const SizedBox(),
// (getIsDeliveryPickup())
// ? (getDistance() > getServiceRadius().toDouble())
// ? Container(
// padding: const EdgeInsets.symmetric(
// vertical: 5,
// ),
// child: Align(
// alignment: Alignment.centerLeft,
// child: defaultText(
// context,
// 'Jarak anda dan outlet terlalu jauh, silahkan ganti outlet',
// style: viewbillStyle(
// font: 12,
// color: dangerColor,
// ),
// ),
// ),
// )
// : const SizedBox()
// : const SizedBox(),
// (getIsDeliveryPickup())
// ? const SizedBox(
// height: 10,
// )
// : const SizedBox(),
// ],
// ),
// ),
SliverPersistentHeader(
pinned: true,
delegate: DelegateSearchField(
......@@ -1172,9 +1251,9 @@ Apakah ingin melanjutkan ?''';
String barName;
if (getIsDeliveryPickup()) {
if (getIsCustomerDelivery()) {
barName = "${getBranchName()} - Delivery";
barName = getBranchName();
} else {
barName = "${getBranchName()} - Pickup";
barName = getBranchName();
}
} else {
if (userName != '') {
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../api/api.dart';
import '../../bloc/change_delivery_pickup.dart';
import '../../bloc/outlet_detail.dart';
import '../../bloc/view_bill.dart';
import '../../helper/helper.dart';
import '../../helper/prefs.dart';
import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/style.dart';
import '../select_branch.dart';
Future<dynamic> modalBottomSelectOption(BuildContext context) {
void ontapOkeChangeOutlet() {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const SelectBranch(
isFormBill: true,
),
),
);
}
void onTapCancelChange() {
Navigator.pop(context);
}
return showModalBottomSheet(
backgroundColor: backgroundWhite,
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(19),
topRight: Radius.circular(19),
),
),
barrierColor: Colors.grey.withOpacity(0.9),
builder: (contextModal) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Container(
margin: const EdgeInsets.only(
top: 8,
bottom: 28,
),
width: 50,
height: 3,
color: disabledColor,
),
),
defaultText(
context,
'Pilih Tipe Order',
style: pickUpdeliveryStyleFont(),
),
GestureDetector(
onTap: () {
if (getIsPickup()) {
Api.changeTypeOrder(typeOrderPickup).then((value) {
if (value) {
context
.read<ChangeDeliveryPickupBloc>()
.toDelivery(false);
setIsCustomerDelivery(false);
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderPickup);
}
});
context.read<ExpandDetailOutlet>().show(false);
Navigator.pop(context);
} else {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat menerima pickup order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
);
}
},
child: Container(
padding: const EdgeInsets.only(top: 19, bottom: 25, left: 10),
color: backgroundWhite,
child: Row(
children: [
const Image(
image: AssetImage('assets/icons/pickup-icon.png'),
),
const SizedBox(
width: 12,
),
defaultText(
context,
'Pick Up',
style: pickUpdeliveryStyleFont(),
)
],
),
),
),
GestureDetector(
onTap: () {
if (!getIsDelivery()) {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat delivery order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
);
} else {
Api.changeTypeOrder(typeOrderDelivery).then((value) {
if (value) {
setIsCustomerDelivery(true);
context
.read<ChangeDeliveryPickupBloc>()
.toDelivery(true);
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderDelivery);
}
});
context.read<ExpandDetailOutlet>().show(false);
Navigator.pop(context);
}
},
child: Container(
padding: const EdgeInsets.only(left: 10, bottom: 24),
color: backgroundWhite,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Image(
image: AssetImage('assets/icons/delivery-icon.png'),
),
const SizedBox(
width: 12,
),
defaultText(
context,
'Delivery',
style: pickUpdeliveryStyleFont(),
)
],
),
// defaultText(
// context,
// '23 Menit',
// style: pickUpdeliveryStyleFont(),
// )
],
),
),
)
],
),
);
},
);
}
import 'package:flutter/material.dart';
import '../../helper/helper.dart';
import '../../helper/prefs.dart';
import '../../helper/widget/style.dart';
import '../../models/bill.dart';
import 'bottom_sheet_pickup_delivery.dart';
class ComponentNameUser extends StatelessWidget {
const ComponentNameUser({
Key? key,
required this.isDeliveryPickuup,
this.dataBill = const [],
required this.backgroundColorComponent,
this.isFromMenu = false,
}) : super(key: key);
final bool isDeliveryPickuup;
final List<Bill> dataBill;
final Color backgroundColorComponent;
final bool isFromMenu;
@override
Widget build(BuildContext context) {
String customerName;
if (dataBill.isEmpty) {
customerName = getCustomerName();
} else {
customerName = dataBill[0].customerName;
}
return Container(
width: double.infinity,
color: backgroundColorComponent.withOpacity(0.9),
padding: const EdgeInsets.symmetric(vertical: 10),
// height: 40,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: (isFromMenu)
? null
: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: defaultText(
context,
(isDeliveryPickuup)
? (getIsCustomerDelivery())
? 'Delivery'
: 'Pickup'
: 'Meja ${dataBill[0].tableName}',
style: viewbillStyle()),
),
Container(
padding: (isFromMenu)
? null
: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
// bottom: 18,
),
child: defaultText(context, customerName,
style: customerNameViewbill()),
),
],
),
(isDeliveryPickuup)
? GestureDetector(
onTap: () {
modalBottomSelectOption(context);
},
child: Container(
height: 30,
width: 69,
margin: (isFromMenu)
? null
: const EdgeInsets.only(
right: 20,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: buttonColor,
),
child: Center(
child: defaultText(
context,
'Ganti',
style: addButton(
font: 8,
),
),
),
),
)
: const SizedBox()
],
),
);
}
}
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/helper/prefs.dart';
import 'package:flutter/material.dart';
import 'package:timeline_tile/timeline_tile.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../../models/bill.dart';
class DeliveryPickupStatus extends StatelessWidget {
const DeliveryPickupStatus({
Key? key,
required this.dataBill,
}) : super(key: key);
final List<Bill> dataBill;
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
color: backgroundWhite.withOpacity(0.9),
padding: const EdgeInsets.only(
bottom: 10,
),
// height: 134,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
(getIsCustomerDelivery())
? (dataBill[0].state == orderStateDone)
? Container(
padding: const EdgeInsets.only(
top: 20,
bottom: 20,
),
child: defaultText(
context,
'Delivery Status',
style: viewbillStyle(),
),
)
: const SizedBox()
: Container(
padding: const EdgeInsets.only(
top: 20,
bottom: 20,
),
child: defaultText(
context,
'Pickup Status',
style: viewbillStyle(),
),
),
(getIsCustomerDelivery())
? (dataBill[0].state == orderStateDone)
? DeliveryState(dataBill: dataBill)
: const SizedBox()
: PickUpState(dataBill: dataBill)
],
),
);
}
}
class DeliveryState extends StatelessWidget {
const DeliveryState({
Key? key,
required this.dataBill,
}) : super(key: key);
final List<Bill> dataBill;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
isFirst: true,
endChild: defaultText(
context,
'Order Processing',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: const BoxDecoration(
color: successColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage('assets/icons/processing_order.png'),
),
),
// child: ,
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
'Looking for Driver',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: (dataBill[0].state == orderStateDone)
? successColor
: disabledColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage('assets/icons/looking_driver.png'),
),
),
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
'Order on the way',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: (dataBill[0].state == orderStateDone &&
(dataBill[0].deliveryState ==
orderDeliveryStateInDelivery ||
dataBill[0].deliveryState ==
orderDeliveryStateDelivered))
? successColor
: disabledColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage('assets/icons/otw_pickup.png'),
),
),
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
isLast: true,
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
'Order delivered',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: (dataBill[0].state == orderStateDone &&
dataBill[0].deliveryState ==
orderDeliveryStateDelivered)
? successColor
: disabledColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage('assets/icons/order_delivered.png'),
),
),
),
),
),
),
],
);
}
}
class PickUpState extends StatelessWidget {
const PickUpState({
Key? key,
required this.dataBill,
}) : super(key: key);
final List<Bill> dataBill;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
isFirst: true,
endChild: defaultText(
context,
'Order Processing',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: const BoxDecoration(
color: successColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage('assets/icons/processing_order.png'),
),
),
// child: ,
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
'Ready For Pickup',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: getColorStatusPickUp(dataBill[0].state),
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage('assets/icons/otw_pickup.png'),
),
),
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
isLast: true,
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
'Ready For Pickup',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: getColorStatusPickUp(dataBill[0].state),
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage('assets/icons/order_delivered.png'),
),
),
),
),
),
),
],
);
}
}
Color getColorStatusPickUp(int orderState) {
if (orderState != orderStateReady && orderState != orderStateDone) {
return disabledColor;
} else if (orderState == orderStateReady && orderState != orderStateDone) {
return disabledColor;
}
return successColor;
}
......@@ -214,6 +214,40 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
fontWeight: FontWeight.w300,
),
),
(widget.billDetail.variant.isNotEmpty)
? Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
for (int k = 0;
k < widget.billDetail.variant.length;
k++)
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
defaultText(
context,
"${widget.billDetail.variant[k].caption} : ",
style: viewbillStyle(
font: 12,
fontWeight: FontWeight.w300,
),
),
defaultText(
context,
widget.billDetail.variant[k].variantName.join(', '),
style: viewbillStyle(
font: 12,
fontWeight: FontWeight.w300,
),
)
],
)
],
)
: const SizedBox(),
const SizedBox(
height: 6,
),
......@@ -392,9 +426,19 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
)
: const SizedBox(),
(!widget.lastItem)
? const Divider(
thickness: 2,
color: backgroundColorViewBill,
? Container(
padding: (isVisibleAddRemoveQuantityButtonCheckout(
widget.isHistory,
widget.billDetail.orderStatus,
widget.bill.state))
? null
: const EdgeInsets.only(
top: 15,
),
child: const Divider(
thickness: 2,
color: backgroundColorViewBill,
),
)
: const SizedBox()
],
......
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/helper/prefs.dart';
import 'package:flutter/material.dart';
import 'package:timeline_tile/timeline_tile.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../../models/bill.dart';
class DeliveryPickupStatus extends StatelessWidget {
const DeliveryPickupStatus({
Key? key,
required this.dataBill,
}) : super(key: key);
final List<Bill> dataBill;
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
color: backgroundWhite.withOpacity(0.9),
padding: const EdgeInsets.only(
bottom: 10,
),
// height: 134,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.only(
top: 20,
bottom: 20,
),
child: defaultText(
context,
(getIsCustomerDelivery()) ? 'Delivery Status' : 'Pickup Status',
style: viewbillStyle(),
),
),
(getIsCustomerDelivery())
? Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
isFirst: true,
endChild: defaultText(
context,
'Order Processing',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: const BoxDecoration(
color: successColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage(
'assets/icons/processing_order.png'),
),
),
// child: ,
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
'Looking for Driver',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: (dataBill[0].state == orderStateDone &&
dataBill[0].deliveryState ==
orderDeliveryStateOtwPickup)
? successColor
: disabledColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage(
'assets/icons/looking_driver.png'),
),
),
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
'Order on the way',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: (dataBill[0].state == orderStateDone &&
dataBill[0].deliveryState ==
orderDeliveryStateInDelivery)
? successColor
: disabledColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image:
AssetImage('assets/icons/otw_pickup.png'),
),
),
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
isLast: true,
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
'Order delivered',
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: (dataBill[0].state == orderStateDone &&
dataBill[0].deliveryState ==
orderDeliveryStateDelivered)
? successColor
: disabledColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage(
'assets/icons/order_delivered.png'),
),
),
),
),
),
),
],
)
: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
isFirst: true,
endChild: defaultText(
context,
getStateusPickup(
dataBill[0].state,
),
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: const BoxDecoration(
color: successColor,
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage(
'assets/icons/processing_order.png'),
),
),
// child: ,
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
getStateusPickup(
dataBill[0].state,
),
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: getColorStatusPickUp(dataBill[0].state),
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image:
AssetImage('assets/icons/otw_pickup.png'),
),
),
),
),
),
),
Container(
width: 80,
height: 80,
child: TimelineTile(
isLast: true,
axis: TimelineAxis.horizontal,
endChild: defaultText(
context,
getStateusPickup(
dataBill[0].state,
),
maxLines: 2,
textAlign: TextAlign.center,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(font: 14),
),
beforeLineStyle: const LineStyle(color: successColor),
afterLineStyle: const LineStyle(color: successColor),
indicatorStyle: IndicatorStyle(
width: 42,
height: 42,
// height: 42,
indicator: Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: getColorStatusPickUp(dataBill[0].state),
shape: BoxShape.circle,
),
child: const Center(
child: Image(
width: 23,
image: AssetImage(
'assets/icons/order_delivered.png'),
),
),
),
),
),
),
],
)
],
),
);
}
}
String getStateusPickup(int orderState) {
if (orderState == orderStateReady) {
return 'Ready For Pickup';
} else if (orderState == orderStateDone) {
return 'Order Picked Up';
}
return 'Order Processing';
}
Color getColorStatusPickUp(int orderState) {
if (orderState != orderStateReady && orderState != orderStateDone) {
return disabledColor;
} else if (orderState == orderStateReady && orderState != orderStateDone) {
return disabledColor;
}
return successColor;
}
......@@ -24,6 +24,7 @@ import 'package:uuid/uuid.dart';
import '../../api/api.dart';
import '../../bloc/address_user_bloc.dart';
import '../../bloc/branch_exist.dart';
import '../../bloc/change_delivery_pickup.dart';
import '../../bloc/feedback_option.dart';
import '../../bloc/outlet_detail.dart';
import '../../bloc/view_bill.dart';
......@@ -44,10 +45,12 @@ import '../payment/payment.dart';
import '../payment/payment_voucher.dart';
import '../webview/webview.dart';
import 'app_bar.dart';
import 'bottom_sheet_pickup_delivery.dart';
import 'component_name_user.dart';
import 'list_order.dart';
import 'rincian_pembayaran.dart';
import 'shimmer_bill.dart';
import 'timeline.dart';
import 'delivery_pickup_state.dart';
class ViewBillNew extends StatefulWidget {
// const ViewBillNew({Key? key}) : super(key: key);
......@@ -149,7 +152,6 @@ class _ViewBillNewState extends State<ViewBillNew> {
double currentScreen = MediaQuery.of(context).size.width;
//**UUID */
const uuidInit = Uuid();
var uuid = uuidInit.v4();
//** UUID */
String branchCode = getBranchPref();
......@@ -482,80 +484,19 @@ class CoreBill extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(getIsDeliveryPickup())
? const SizedBox(
height: 24,
)
? (dataBill[0].state == orderStateDone)
? const SizedBox(
height: 24,
)
: const SizedBox()
: const SizedBox(),
(getIsDeliveryPickup())
? DeliveryPickupStatus(dataBill: dataBill)
: const SizedBox(),
Container(
width: double.infinity,
color: backgroundWhite.withOpacity(0.9),
padding: const EdgeInsets.symmetric(vertical: 10),
// height: 40,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(
context,
(isDeliveryPickuup)
? (getIsCustomerDelivery())
? 'Delivery'
: 'Pickup'
: 'Meja ${dataBill[0].tableName}',
style: viewbillStyle()),
),
Container(
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
// bottom: 18,
),
child: defaultText(
context, dataBill[0].customerName,
style: customerNameViewbill()),
),
],
),
(isDeliveryPickuup)
? GestureDetector(
onTap: () {
modalBottomSelectOption(context);
},
child: Container(
height: 30,
width: 69,
margin: const EdgeInsets.only(
right: 20,
),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(40),
color: buttonColor,
),
child: Center(
child: defaultText(
context,
'Ganti',
style: addButton(
font: 8,
),
),
),
),
)
: const SizedBox()
],
),
ComponentNameUser(
isDeliveryPickuup: isDeliveryPickuup,
dataBill: dataBill,
backgroundColorComponent: backgroundWhite,
),
(isDeliveryPickuup)
? Container(
......@@ -569,6 +510,7 @@ class CoreBill extends StatelessWidget {
(isDeliveryPickuup)
? DeliveryPickupDetail(
isShowOutletDetail: isShowOutletDetail,
databill: dataBill,
)
: const SizedBox(),
(isDeliveryPickuup)
......@@ -617,10 +559,17 @@ class CoreBill extends StatelessWidget {
const SizedBox(
height: 15,
),
defaultText(
context,
'Bagaimana pengalaman anda bertransaksi di ${getBranchName()}',
style: emojiStyle(),
Container(
padding:
const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
),
child: defaultText(
context,
'Bagaimana pengalaman anda bertransaksi di ${getBranchName()}',
textAlign: TextAlign.center,
style: emojiStyle(),
),
),
const SizedBox(
height: 19,
......@@ -1065,7 +1014,6 @@ class CoreBill extends StatelessWidget {
if (dataBill[0].state ==
orderStateDone) {
//**UUID */
const uuidInit = Uuid();
var newOrderId = uuidInit.v4();
//** UUID */
setOrderId(newOrderId);
......@@ -1135,182 +1083,6 @@ class CoreBill extends StatelessWidget {
},
);
}
Future<dynamic> modalBottomSelectOption(BuildContext context) {
void ontapOkeChangeOutlet() {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const SelectBranch(
isFormBill: true,
),
),
);
}
void onTapCancelChange() {
Navigator.pop(context);
}
return showModalBottomSheet(
backgroundColor: backgroundWhite,
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(19),
topRight: Radius.circular(19),
),
),
barrierColor: Colors.grey.withOpacity(0.9),
builder: (contextModal) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Container(
margin: const EdgeInsets.only(
top: 8,
bottom: 28,
),
width: 50,
height: 3,
color: disabledColor,
),
),
defaultText(
context,
'Pilih Tipe Order',
style: pickUpdeliveryStyleFont(),
),
GestureDetector(
onTap: () {
if (getIsPickup()) {
setIsCustomerDelivery(false);
Api.changeTypeOrder(typeOrderPickup).then((value) {
if (value) {
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderPickup);
}
});
context.read<ExpandDetailOutlet>().show(false);
Navigator.pop(context);
} else {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat menerima pickup order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
);
}
},
child: Container(
padding: const EdgeInsets.only(top: 19, bottom: 25, left: 10),
color: backgroundWhite,
child: Row(
children: [
const Image(
image: AssetImage('assets/icons/pickup-icon.png'),
),
const SizedBox(
width: 12,
),
defaultText(
context,
'Pick Up',
style: pickUpdeliveryStyleFont(),
)
],
),
),
),
GestureDetector(
onTap: () {
if (!getIsDelivery()) {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat delivery order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
);
} else {
setIsCustomerDelivery(true);
Api.changeTypeOrder(typeOrderDelivery).then((value) {
if (value) {
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderDelivery);
}
});
context.read<ExpandDetailOutlet>().show(false);
Navigator.pop(context);
}
},
child: Container(
padding: const EdgeInsets.only(left: 10, bottom: 24),
color: backgroundWhite,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Image(
image: AssetImage('assets/icons/delivery-icon.png'),
),
const SizedBox(
width: 12,
),
defaultText(
context,
'Delivery',
style: pickUpdeliveryStyleFont(),
)
],
),
// defaultText(
// context,
// '23 Menit',
// style: pickUpdeliveryStyleFont(),
// )
],
),
),
)
],
),
);
},
);
}
}
class ButtonPayment extends StatelessWidget {
......@@ -1357,6 +1129,7 @@ class ButtonPayment extends StatelessWidget {
Api.setToPendingOrder();
context.read<ViewBillBloc>().getBill();
}
} else {
if (getPickupTime() == '') {
EasyLoading.showToast('Silakan pilih jam pickup');
} else {
......@@ -1364,11 +1137,34 @@ class ButtonPayment extends StatelessWidget {
context.read<ViewBillBloc>().getBill();
}
}
} else {
Api.setToPendingOrder();
context.read<ViewBillBloc>().getBill();
}
} else if (dataBill[0].state == orderStatePending &&
getTableMode() == tableIndividu) {
EasyLoading.showToast(
'Status orderan anda menunggu untuk disetujui');
} else if (dataBill[0].state == orderStateDone) {
//**UUID */
var newOrderId = uuidInit.v4();
//** UUID */
setOrderId(newOrderId);
context.read<BranchExist>().branchExist(
getBranchPref(),
getBrand(),
getRole(),
getCashierName(),
getOrderId(),
context,
);
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const NewHome2(),
),
);
} else {
if (paymentMode == closebill && memberinfo.id == '') {
addPayment(
......@@ -1724,7 +1520,11 @@ class ButtonPayment extends StatelessWidget {
}
class OutletDetail extends StatelessWidget {
const OutletDetail({super.key});
const OutletDetail({
super.key,
this.isFromMenu = false,
});
final bool isFromMenu;
@override
Widget build(BuildContext context) {
......@@ -1734,7 +1534,7 @@ class OutletDetail extends StatelessWidget {
vertical: 12,
),
width: double.infinity,
color: backgroundWhite.withOpacity(0.9),
color: (isFromMenu) ? backgroundColor : backgroundWhite.withOpacity(0.9),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
......@@ -1850,23 +1650,34 @@ class OutletDetail extends StatelessWidget {
}
class DeliveryPickupDetail extends StatelessWidget {
DeliveryPickupDetail({
const DeliveryPickupDetail({
Key? key,
required this.isShowOutletDetail,
this.isFromMenu = false,
this.databill = const [],
}) : super(key: key);
final bool isDelivery = getIsCustomerDelivery();
// final bool isDelivery = getIsCustomerDelivery();
final bool isShowOutletDetail;
final bool isFromMenu;
final List<Bill> databill;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
vertical: 12,
),
color: backgroundWhite.withOpacity(0.9),
child: (isDelivery) ? deliveryOption(context) : pickupOption(context),
return BlocBuilder<ChangeDeliveryPickupBloc, bool>(
builder: (ctx, isDelivery) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
vertical: 12,
),
color:
(isFromMenu) ? backgroundColor : backgroundWhite.withOpacity(0.9),
child: (isDelivery)
? deliveryOption(context, isFromMenu, databill)
: pickupOption(context),
);
},
);
}
......@@ -1934,67 +1745,6 @@ class DeliveryPickupDetail extends StatelessWidget {
const SizedBox(
height: 5,
),
// GestureDetector(
// onTap: () {
// context.read<ExpandDetailOutlet>().show(!isShowOutletDetail);
// // Geolocator.getCurrentPosition().then((position) {
// // htmlOpenLink(
// // 'https://www.google.com/maps/dir/${position.latitude},${position.longitude}/${getLatOutlet()},${getLongOutlet()}',
// // self: false,
// // );
// // });
// },
// child: Container(
// width: 98,
// height: 30,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// color: backgroundWhite,
// border: Border.all(
// color: buttonColor,
// ),
// ),
// child: Center(
// child: defaultText(
// context,
// 'Detail Outlet',
// style: addButton(
// font: 8,
// color: buttonColor,
// ),
// ),
// ),
// )
// // child: Container(
// // width: 100,
// // height: 23,
// // decoration: BoxDecoration(
// // borderRadius: BorderRadius.circular(40),
// // color: buttonColor,
// // ),
// // child: Center(
// // child: Row(
// // crossAxisAlignment: CrossAxisAlignment.center,
// // mainAxisAlignment: MainAxisAlignment.center,
// // children: [
// // const Image(
// // image: AssetImage('assets/icons/pin-address.png'),
// // ),
// // const SizedBox(
// // width: 12.6,
// // ),
// // defaultText(
// // context,
// // 'Detail Outlet',
// // style: addButton(
// // font: 8,
// // ),
// // )
// // ],
// // ),
// // ),
// // ),
// )
],
),
const SizedBox(
......@@ -2106,7 +1856,7 @@ class DeliveryPickupDetail extends StatelessWidget {
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
color: (isFromMenu) ? backgroundColor : backgroundWhite,
border: Border.all(
color: buttonColor,
),
......@@ -2139,24 +1889,42 @@ class DeliveryPickupDetail extends StatelessWidget {
context.read<ExpandDetailOutlet>().show(!isShowOutletDetail);
},
child: Container(
width: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
border: Border.all(
color: buttonColor,
),
),
child: Center(
child: defaultText(
context,
'Detail Outlet',
style: addButton(
font: 8,
color: buttonColor,
padding: const EdgeInsets.only(top: 10),
color: (isFromMenu) ? backgroundColor : backgroundWhite,
// width: 98,
// height: 30,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// color: backgroundWhite,
// border: Border.all(
// color: buttonColor,
// ),
// ),
// child: Center(
// child: defaultText(
// context,
// 'Detail Outlet',
// style: addButton(
// font: 8,
// color: buttonColor,
// ),
// ),
// ),
child: Row(
children: [
fontAwesomeNew(angelDown, angelDownSize),
const SizedBox(
width: 5,
),
),
defaultText(
context,
'Detail Outlet',
style: addButton(
font: 12,
color: textColorBlack,
),
)
],
),
),
);
......@@ -2222,7 +1990,8 @@ Apakah ingin melanjutkan ?''';
);
}
BlocBuilder deliveryOption(BuildContext context) {
BlocBuilder deliveryOption(
BuildContext context, bool isFromMenu, List<Bill> databill) {
void ontapAddressDetail() {
Navigator.pop(context);
}
......@@ -2293,6 +2062,43 @@ Apakah ingin melanjutkan ?''';
font: 10,
),
),
(databill.isNotEmpty && databill[0].courierName != '')
? defaultText(
context,
"Kurir : ${databill[0].courierName}",
style: addressStyle(
font: 10,
),
)
: const SizedBox(),
(databill.isNotEmpty && databill[0].courierPhone != '')
? GestureDetector(
onTap: () {
htmlOpenLink(
'https://wa.me/${databill[0].courierPhone}',
self: false,
);
},
child: Row(
children: [
fontAwesomeNew(
phoneIcon,
phoneIconSize,
),
const SizedBox(
width: 10,
),
defaultText(
context,
"Kurir Mobile : ${databill[0].courierPhone}",
style: addressStyle(
font: 10,
),
)
],
),
)
: const SizedBox(),
// (address.locationDetail != '')
// ? Container(
// padding: const EdgeInsets.only(top: 6),
......@@ -2334,6 +2140,7 @@ Apakah ingin melanjutkan ?''';
titleAppBar: 'Ganti Alamat',
url:
'${getBaseUrl()}rdm/address/add/?session_id=${getSessionId()}',
isFromMenu: isFromMenu,
),
),
);
......@@ -2403,7 +2210,9 @@ Apakah ingin melanjutkan ?''';
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
color: (isFromMenu)
? backgroundColor
: backgroundWhite,
border: Border.all(
color: buttonColor,
),
......@@ -2536,47 +2345,6 @@ Apakah ingin melanjutkan ?''';
return Row(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Container(
// width: maxWidthScreens,
// color: backgroundWhite,
// child: Align(
// alignment: Alignment.centerLeft,
// child: GestureDetector(
// onTap: () {
// Navigator.pushReplacement(
// context,
// MaterialPageRoute(
// builder: (_) => WebViewMap(
// titleAppBar: 'Pilih Alamat',
// url:
// '${getBaseUrl()}rdm/address/add/?session_id=${getSessionId()}'),
// ),
// );
// },
// child: Container(
// width: 98,
// height: 30,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// color: backgroundWhite,
// border: Border.all(
// color: buttonColor,
// ),
// ),
// child: Center(
// child: defaultText(
// context,
// 'Pilih Alamat',
// style: addButton(
// font: 8,
// color: buttonColor,
// ),
// ),
// ),
// ),
// ),
// ),
// ),
GestureDetector(
onTap: () {
Navigator.pushReplacement(
......@@ -2594,7 +2362,7 @@ Apakah ingin melanjutkan ?''';
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
color: (isFromMenu) ? backgroundColor : backgroundWhite,
border: Border.all(
color: buttonColor,
),
......@@ -2615,9 +2383,7 @@ Apakah ingin melanjutkan ?''';
width: 5,
),
changeOutlet(context),
const SizedBox(
width: 5,
),
const Spacer(),
GestureDetector(
onTap: () {
context.read<ExpandDetailOutlet>().show(!isShowOutletDetail);
......@@ -2628,56 +2394,66 @@ Apakah ingin melanjutkan ?''';
// );
// });
},
child: Container(
width: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
border: Border.all(
color: buttonColor,
),
),
child: Center(
child: defaultText(
context,
'Detail Outlet',
style: addButton(
font: 8,
color: buttonColor,
),
),
),
),
// child: Container(
// width: 100,
// height: 23,
// width: 98,
// height: 30,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// color: buttonColor,
// color: (isFromMenu) ? backgroundColor : backgroundWhite,
// border: Border.all(
// color: buttonColor,
// ),
// ),
// child: Center(
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// const Image(
// image: AssetImage('assets/icons/pin-address.png'),
// ),
// const SizedBox(
// width: 12.6,
// ),
// defaultText(
// context,
// 'Detail Outlet',
// style: addButton(
// font: 8,
// ),
// )
// ],
// child: defaultText(
// context,
// 'Detail Outlet',
// style: addButton(
// font: 8,
// color: buttonColor,
// ),
// ),
// ),
// ),
child: Container(
padding: const EdgeInsets.only(top: 10),
color: (isFromMenu) ? backgroundColor : backgroundWhite,
// width: 98,
// height: 30,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// color: backgroundWhite,
// border: Border.all(
// color: buttonColor,
// ),
// ),
// child: Center(
// child: defaultText(
// context,
// 'Detail Outlet',
// style: addButton(
// font: 8,
// color: buttonColor,
// ),
// ),
// ),
child: Row(
children: [
fontAwesomeNew(angelDown, angelDownSize),
const SizedBox(
width: 5,
),
defaultText(
context,
'Detail Outlet',
style: addButton(
font: 12,
color: textColorBlack,
),
)
],
),
),
)
],
);
......
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/ui/home/new_home2.dart';
import 'package:byod/ui/viewbill/view_bill_new.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -10,12 +11,16 @@ import '../../helper/widget/style.dart';
import '../select_branch.dart';
class CustomAppBar extends StatelessWidget {
const CustomAppBar(
{Key? key, required this.titleAppBar, required this.isFromSelectBranch})
: super(key: key);
const CustomAppBar({
Key? key,
required this.titleAppBar,
required this.isFromSelectBranch,
required this.isFromMenu,
}) : super(key: key);
final String titleAppBar;
final bool isFromSelectBranch;
final bool isFromMenu;
@override
Widget build(BuildContext context) {
......@@ -49,6 +54,18 @@ class CustomAppBar extends StatelessWidget {
),
),
);
} else if (isFromMenu) {
context.read<AddressUser>().getAddressUser(
context,
isGetBranchList: true,
isCallDeliveryCharge: false,
);
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const NewHome2(),
),
);
} else {
Navigator.pushReplacement(
context,
......
......@@ -133,6 +133,7 @@
// }
import 'package:byod/bloc/address_user_bloc.dart';
import 'package:byod/ui/home/new_home2.dart';
import 'package:byod/ui/select_branch.dart';
import 'package:byod/ui/viewbill/view_bill_new.dart';
import 'package:byod/ui/webview/app_bar_webview.dart';
......@@ -150,10 +151,12 @@ class WebViewMap extends StatefulWidget {
required this.titleAppBar,
required this.url,
this.isFromSelectBranch = false,
this.isFromMenu = false,
});
final String titleAppBar;
final String url;
final bool isFromSelectBranch;
final bool isFromMenu;
@override
State<WebViewMap> createState() => _WebViewMapState();
......@@ -171,6 +174,15 @@ class _WebViewMapState extends State<WebViewMap> {
builder: (_) => const SelectBranch(),
),
);
} else if (widget.isFromMenu == true) {
context.read<AddressUser>().getAddressUser(context,
isGetBranchList: false, isCallDeliveryCharge: false);
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const NewHome2(),
),
);
} else {
context
.read<AddressUser>()
......@@ -207,8 +219,10 @@ class _WebViewMapState extends State<WebViewMap> {
child: Column(
children: [
CustomAppBar(
titleAppBar: widget.titleAppBar,
isFromSelectBranch: widget.isFromSelectBranch),
titleAppBar: widget.titleAppBar,
isFromSelectBranch: widget.isFromSelectBranch,
isFromMenu: widget.isFromMenu,
),
Expanded(
child: WebViewX(
width: MediaQuery.of(context).size.width,
......
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