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,
);
......
This diff is collapsed.
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()
],
),
);
}
}
This diff is collapsed.
......@@ -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()
],
......
This diff is collapsed.
This diff is collapsed.
// 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