Commit 94c58a71 authored by Dio Maulana's avatar Dio Maulana

17/10/22

parent 7a75e7bb
...@@ -75,7 +75,7 @@ class Api { ...@@ -75,7 +75,7 @@ class Api {
if (indexTypeUrl != -1) { if (indexTypeUrl != -1) {
currentOrderId = jsonDecode(listTypeUrl[indexTypeUrl])['order_id']; currentOrderId = jsonDecode(listTypeUrl[indexTypeUrl])['order_id'];
} else { } else {
currentOrderId = getOrderId(); currentOrderId = getOrderId();
} }
var uuidOrderId = uuidInit.v4(); var uuidOrderId = uuidInit.v4();
String orderID; String orderID;
...@@ -100,6 +100,7 @@ class Api { ...@@ -100,6 +100,7 @@ class Api {
: '', : '',
"customer_lat": latitude, "customer_lat": latitude,
"customer_long": longitude, "customer_long": longitude,
"table_number": (getUrlType() == typeUrlDua) ? getTabelNumber() : '',
"type_url": urlType, "type_url": urlType,
}; };
var bodies = json.encode(data); var bodies = json.encode(data);
...@@ -110,32 +111,32 @@ class Api { ...@@ -110,32 +111,32 @@ class Api {
if (jsonObject != false) { if (jsonObject != false) {
if (jsonObject['status'].toString().toLowerCase() == 'ok') { if (jsonObject['status'].toString().toLowerCase() == 'ok') {
//** save sessionID and Table Mode*/ //** save sessionID and Table Mode*/
List<String> listHistory = getListHistory(); // List<String> listHistory = getListHistory();
String tableNumber = getTabelNumber(); // String tableNumber = getTabelNumber();
String userName = getCustomerName(); // String userName = getCustomerName();
String totalOrder = getTotalOrder(); // String totalOrder = getTotalOrder();
String dateOrder = getOrderDate(); // String dateOrder = getOrderDate();
String branchCode = getBranchPref(); // String branchCode = getBranchPref();
String brandCode = getBrand(); // String brandCode = getBrand();
String token = getToken(); // String token = getToken();
if (orderID != jsonObject['data']['order_id']) { // if (orderID != jsonObject['data']['order_id']) {
Map historyOrder = { // Map historyOrder = {
"order_id": orderId, // "order_id": orderId,
"table": tableNumber, // "table": tableNumber,
"user_name": userName, // "user_name": userName,
"total_order": totalOrder, // "total_order": totalOrder,
"date_order": localDate( // "date_order": localDate(
dateOrder, // dateOrder,
isHistory: true, // isHistory: true,
), // ),
"branch_code": branchCode, // "branch_code": branchCode,
"brand": brandCode, // "brand": brandCode,
"token": token, // "token": token,
}; // };
String historySave = jsonEncode(historyOrder); // String historySave = jsonEncode(historyOrder);
listHistory.add(historySave); // listHistory.add(historySave);
setListHistory(listHistory); // setListHistory(listHistory);
} // }
if (indexTypeUrl != -1) { if (indexTypeUrl != -1) {
listTypeUrl.removeWhere( listTypeUrl.removeWhere(
...@@ -150,7 +151,7 @@ class Api { ...@@ -150,7 +151,7 @@ class Api {
); );
setListTypeUrl(listTypeUrl); setListTypeUrl(listTypeUrl);
setMqMessage('update-${jsonObject['data']['order_id']}'); setMqMessage('ORDER-ID-${jsonObject['data']['order_id']}');
setOrderId(jsonObject['data']['order_id']); setOrderId(jsonObject['data']['order_id']);
setTypeOrder(jsonObject['data']['type_order']); setTypeOrder(jsonObject['data']['type_order']);
setLogoUrl(jsonObject['data']['logo']); setLogoUrl(jsonObject['data']['logo']);
...@@ -166,6 +167,8 @@ class Api { ...@@ -166,6 +167,8 @@ class Api {
setIsPickup(jsonObject['data']['is_pickup']); setIsPickup(jsonObject['data']['is_pickup']);
setOpenTime(jsonObject['data']['open_time']); setOpenTime(jsonObject['data']['open_time']);
setCloseTime(jsonObject['data']['close_time']); setCloseTime(jsonObject['data']['close_time']);
setAddressOutlet(jsonObject['data']['address']);
setPhoneOutlet(jsonObject['data']['mobile']);
setTableNumber(jsonObject['data']['table_number'] ?? ''); setTableNumber(jsonObject['data']['table_number'] ?? '');
if (jsonObject['data']['payment_mode'] != null) { if (jsonObject['data']['payment_mode'] != null) {
setPaymentMode(jsonObject['data']['payment_mode']); setPaymentMode(jsonObject['data']['payment_mode']);
...@@ -1335,7 +1338,8 @@ class Api { ...@@ -1335,7 +1338,8 @@ class Api {
"menu": variantData, "menu": variantData,
'secure_token': secureToken, 'secure_token': secureToken,
"from": fromByod, "from": fromByod,
"type_order": typeOrder "type_order": typeOrder,
"type_url": getUrlType(),
}; };
var bodies = jsonEncode(data); var bodies = jsonEncode(data);
// var apiResult = await http.post(Uri.parse(urlCheckout), body: bodies); // var apiResult = await http.post(Uri.parse(urlCheckout), body: bodies);
...@@ -1358,7 +1362,7 @@ class Api { ...@@ -1358,7 +1362,7 @@ class Api {
timeOfDayPickup.minute.toString().padLeft(2, '0'); timeOfDayPickup.minute.toString().padLeft(2, '0');
// String amPM = timeToset.split(' ')[1]; // String amPM = timeToset.split(' ')[1];
String setPickup = "$hourString:$minuteString"; String setPickup = "$hourString:$minuteString";
setPickupTime(setPickup); // setPickupTime(setPickup);
} }
setStatusOrderCreated(true); setStatusOrderCreated(true);
......
import 'package:flutter_bloc/flutter_bloc.dart';
class ExpandDetailOutlet extends Cubit<bool> {
ExpandDetailOutlet() : super(false);
void show(bool status) {
emit(status);
}
}
...@@ -298,6 +298,22 @@ bool isCanTapAddMoreButton(int orderState) { ...@@ -298,6 +298,22 @@ bool isCanTapAddMoreButton(int orderState) {
return true; return true;
} }
bool isRemoveButtonBillShow(int orderState, int orderDetailState) {
int paymentMethod = getPaymentMode();
if (orderState == orderStateApproved &&
orderDetailState == approvedOrder &&
paymentMethod == closebill) {
return true;
} else {
return false;
}
}
String timeHm(String timeComplete) {
timeComplete.split(':');
return "${timeComplete.split(':')[0]}:${timeComplete.split(':')[1]}";
}
bool isVisibleAddMoreButton(int tableStatus, int orderState) { bool isVisibleAddMoreButton(int tableStatus, int orderState) {
int paymentMethod = getPaymentMode(); int paymentMethod = getPaymentMode();
if (tableStatus == tableStatusOpen && getTableMode() == tableIndividu) { if (tableStatus == tableStatusOpen && getTableMode() == tableIndividu) {
...@@ -319,11 +335,12 @@ bool isVisibleAddMoreButton(int tableStatus, int orderState) { ...@@ -319,11 +335,12 @@ bool isVisibleAddMoreButton(int tableStatus, int orderState) {
} }
bool isVisibleAddRemoveQuantityButtonCheckout( bool isVisibleAddRemoveQuantityButtonCheckout(
bool isHistory, int orderStatusBillDetail) { bool isHistory, int orderStatusBillDetail, int orderState) {
int paymentMethod = getPaymentMode(); int paymentMethod = getPaymentMode();
if (!isHistory && if (!isHistory &&
paymentMethod == closebill && paymentMethod == closebill &&
orderStatusBillDetail == pendingOrder) { orderStatusBillDetail == pendingOrder &&
orderState == orderStateCreated) {
return true; return true;
} }
return false; return false;
...@@ -339,7 +356,7 @@ iscanTapAddRemoveQtyViewBill(int orderState) { ...@@ -339,7 +356,7 @@ iscanTapAddRemoveQtyViewBill(int orderState) {
String textButtonCheckout(int orderState) { String textButtonCheckout(int orderState) {
int paymentMethod = getPaymentMode(); int paymentMethod = getPaymentMode();
if (paymentMethod == closebill && orderState == orderStateCreated) { if (paymentMethod == closebill && orderState == orderStateCreated) {
return 'Kirim Pesanan'; return 'Pesan';
} else if (paymentMethod == closebill && } else if (paymentMethod == closebill &&
(orderState == orderStatePending || (orderState == orderStatePending ||
orderState == orderStateApproved) || orderState == orderStateApproved) ||
...@@ -592,6 +609,7 @@ String defaultViewBill = 'default'; ...@@ -592,6 +609,7 @@ String defaultViewBill = 'default';
//** call from untuk notemenu */ //** call from untuk notemenu */
String fromMenu = 'menu'; String fromMenu = 'menu';
String fromBill = 'bill'; String fromBill = 'bill';
String fromConfirmationPage = 'confirmationPage';
//** call from untuk notemenu */ //** call from untuk notemenu */
//**Rating Value */ //**Rating Value */
...@@ -690,6 +708,15 @@ const double shopingBagSize = 0.03; ...@@ -690,6 +708,15 @@ const double shopingBagSize = 0.03;
const String refreshIcon = '\uf2f9'; const String refreshIcon = '\uf2f9';
const double refreshIconSize = 0.02; const double refreshIconSize = 0.02;
const String openLink = '\uf35d';
const double openLinkSize = 14;
const String phoneIcon = '\uf098';
const double phoneIconSize = 16;
const String trahsIcon = '\uf2ed';
const double trahsIconSize = 16;
//** fontawesome unicode */ //** fontawesome unicode */
//** max item menu */ //** max item menu */
...@@ -727,4 +754,10 @@ const int typeOrderDineIn = 1; ...@@ -727,4 +754,10 @@ const int typeOrderDineIn = 1;
const int typeOrderPickup = 2; const int typeOrderPickup = 2;
//** Type ORder */ //** Type ORder */
// String MQmessage
String mqMessage = getMqMessage();
// String MQmessage
//** END CONSTANT */ //** END CONSTANT */
// ignore_for_file: unused_catch_clause // ignore_for_file: unused_catch_clause
import 'dart:io'; import 'dart:io';
import 'dart:js';
import 'package:byod/bloc/view_bill.dart';
import 'package:byod/helper/logger.dart'; import 'package:byod/helper/logger.dart';
import 'package:byod/helper/prefs.dart';
import 'package:byod/main.dart'; import 'package:byod/main.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
...@@ -13,12 +10,15 @@ import 'package:mqtt_client/mqtt_browser_client.dart'; ...@@ -13,12 +10,15 @@ import 'package:mqtt_client/mqtt_browser_client.dart';
import 'package:mqtt_client/mqtt_client.dart'; import 'package:mqtt_client/mqtt_client.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import '../bloc/view_bill.dart';
import 'helper.dart';
String mqttUrl = 'wss://mq.jasadigital.co.id'; String mqttUrl = 'wss://mq.jasadigital.co.id';
final mqClient = MqttBrowserClient(mqttUrl, ''); final mqClient = MqttBrowserClient(mqttUrl, '');
const int mqttPort = 8083; const int mqttPort = 8083;
const String queueTopic = 'byod/bill/update'; const String queueTopic = 'romi/byod/payment';
String queueMessage = getMqMessage(); // String queueMessage = getMqMessage();
const String usernameMq = 'jasadigital'; const String usernameMq = 'jasadigital';
const String passwordMq = 'jasadigital'; const String passwordMq = 'jasadigital';
const uuidInit = Uuid(); const uuidInit = Uuid();
...@@ -81,11 +81,11 @@ Future<int> runMqTT(BuildContext context) async { ...@@ -81,11 +81,11 @@ Future<int> runMqTT(BuildContext context) async {
MqttPublishPayload.bytesToStringAsString(recMess.payload.message); MqttPublishPayload.bytesToStringAsString(recMess.payload.message);
// print('Notifikasi masuk dari topic <${c[0].topic}>, isinya adalah: $pt '); // print('Notifikasi masuk dari topic <${c[0].topic}>, isinya adalah: $pt ');
// print(''); // print('');
if (c[0].topic == topic && pt == queueMessage) { if (c[0].topic == topic && pt == mqMessage) {
// update bill disini // update bill disini
context.read<ViewBillBloc>().getBill(); context.read<ViewBillBloc>().getBill();
if (debug) { if (debug) {
logd('CHECK TOPIC', 'TOPIC MASUK::$topic , MESSAGE::$queueMessage'); logd('CHECK TOPIC', 'TOPIC MASUK::$topic , MESSAGE::$mqMessage');
} }
} else { } else {
if (debug) { if (debug) {
......
...@@ -39,6 +39,8 @@ const String _longOutlet = 'longO'; ...@@ -39,6 +39,8 @@ const String _longOutlet = 'longO';
const String _openTime = 'oT'; const String _openTime = 'oT';
const String _closeTime = 'cT'; const String _closeTime = 'cT';
const String _pickupTime = 'puT'; const String _pickupTime = 'puT';
const String _addressOutlet = 'addressOutlet';
const String _phoneOutlet = 'phoneOutlet';
String getBaseUrl() { String getBaseUrl() {
return prefs.getString(_baseUrl) ?? ''; return prefs.getString(_baseUrl) ?? '';
...@@ -339,3 +341,19 @@ String getPickupTime() { ...@@ -339,3 +341,19 @@ String getPickupTime() {
Future<void> setPickupTime(String value) async { Future<void> setPickupTime(String value) async {
prefs.setString(_pickupTime, value); prefs.setString(_pickupTime, value);
} }
String getAddressOutlet() {
return prefs.getString(_addressOutlet) ?? '';
}
Future<void> setAddressOutlet(String value) async {
prefs.setString(_addressOutlet, value);
}
String getPhoneOutlet() {
return prefs.getString(_phoneOutlet) ?? '';
}
Future<void> setPhoneOutlet(String value) async {
prefs.setString(_phoneOutlet, value);
}
...@@ -73,7 +73,7 @@ class EmoticonRateNew extends StatelessWidget { ...@@ -73,7 +73,7 @@ class EmoticonRateNew extends StatelessWidget {
), ),
defaultText( defaultText(
context, context,
'Bagaimana pengalaman anda bertransaksi di excelso ?', 'Bagaimana pengalaman anda bertransaksi di ${getBranchName()} ?',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: emojiStyle(), style: emojiStyle(),
), ),
...@@ -240,9 +240,7 @@ class EmoticonRateNew extends StatelessWidget { ...@@ -240,9 +240,7 @@ class EmoticonRateNew extends StatelessWidget {
).then((value) { ).then((value) {
Navigator.pop(context); Navigator.pop(context);
if (!isHistory) { if (!isHistory) {
context context.read<ViewBillBloc>().getBill();
.read<ViewBillBloc>()
.getBill();
} else { } else {
List<String> listHistory = getListHistory(); List<String> listHistory = getListHistory();
if (listHistory.isNotEmpty) { if (listHistory.isNotEmpty) {
......
...@@ -23,6 +23,10 @@ class NoteModalBottomSheet extends StatelessWidget { ...@@ -23,6 +23,10 @@ class NoteModalBottomSheet extends StatelessWidget {
required this.from, required this.from,
this.idOrderan = '', this.idOrderan = '',
this.noteInit = '', this.noteInit = '',
this.idMenu = '',
this.menuName = '',
this.imageUrl = '',
this.priceMemu = 0,
required this.contextFrom, required this.contextFrom,
}) : super(key: key); }) : super(key: key);
...@@ -35,6 +39,10 @@ class NoteModalBottomSheet extends StatelessWidget { ...@@ -35,6 +39,10 @@ class NoteModalBottomSheet extends StatelessWidget {
final String idOrderan; final String idOrderan;
final String noteInit; final String noteInit;
final BuildContext contextFrom; final BuildContext contextFrom;
final String idMenu;
final String menuName;
final String imageUrl;
final int priceMemu;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -109,6 +117,19 @@ class NoteModalBottomSheet extends StatelessWidget { ...@@ -109,6 +117,19 @@ class NoteModalBottomSheet extends StatelessWidget {
context.read<ViewBillBloc>().getBill(); context.read<ViewBillBloc>().getBill();
}); });
} }
} else if (from == fromConfirmationPage) {
Map<String, dynamic> insertData = {
'menu_id': idMenu,
'menu_name': menuName,
'initvalue': initialValue,
'menu_price': priceMemu,
'old_order': lisrOrders,
'image_url': menuItem.imageUrlMedium,
'total_price': priceMemu,
'order_variant': orderVariants,
'note': noteController.text,
};
context.read<OrdersBloc>().insertData(insertData);
} }
Navigator.pop(context); Navigator.pop(context);
}, },
......
...@@ -29,6 +29,7 @@ import 'bloc/menu_selected_bar.dart'; ...@@ -29,6 +29,7 @@ import 'bloc/menu_selected_bar.dart';
import 'bloc/order_detail_variant.dart'; import 'bloc/order_detail_variant.dart';
import 'bloc/order_variant_temporary.dart'; import 'bloc/order_variant_temporary.dart';
import 'bloc/order_variant_value.dart'; import 'bloc/order_variant_value.dart';
import 'bloc/outlet_detail.dart';
import 'bloc/search_active.dart'; import 'bloc/search_active.dart';
import 'bloc/search_branch.dart'; import 'bloc/search_branch.dart';
import 'bloc/search_history.dart'; import 'bloc/search_history.dart';
...@@ -195,6 +196,7 @@ class _MyAppState extends State<MyApp> { ...@@ -195,6 +196,7 @@ class _MyAppState extends State<MyApp> {
BlocProvider(create: (_) => BranchList()), BlocProvider(create: (_) => BranchList()),
BlocProvider(create: (_) => SearchBranch()), BlocProvider(create: (_) => SearchBranch()),
BlocProvider(create: (_) => AddressUser()), BlocProvider(create: (_) => AddressUser()),
BlocProvider(create: (_) => ExpandDetailOutlet()),
], ],
child: MaterialApp( child: MaterialApp(
title: (widget.title == null) ? defaultTitle : widget.title, title: (widget.title == null) ? defaultTitle : widget.title,
......
// ignore_for_file: sized_box_for_whitespace // ignore_for_file: sized_box_for_whitespace
import 'package:byod/helper/helper.dart'; import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/plus_minus_button.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';
...@@ -10,6 +11,9 @@ import '../../bloc/order_bloc.dart'; ...@@ -10,6 +11,9 @@ import '../../bloc/order_bloc.dart';
import '../../helper/prefs.dart'; import '../../helper/prefs.dart';
import '../../helper/widget/button_modal.dart'; import '../../helper/widget/button_modal.dart';
import '../../helper/widget/modal_input_name.dart'; import '../../helper/widget/modal_input_name.dart';
import '../../helper/widget/note_modal_bottom_sheet.dart';
import '../../main.dart';
import '../../models/filter_menu.dart';
import '../../models/orders.dart'; import '../../models/orders.dart';
import '../checkout/fuction.dart'; import '../checkout/fuction.dart';
import 'app_bar_confirm.dart'; import 'app_bar_confirm.dart';
...@@ -100,6 +104,10 @@ class CoreConfirm extends StatelessWidget { ...@@ -100,6 +104,10 @@ class CoreConfirm extends StatelessWidget {
// totalItem = fixTotalItem + totalItemBukanOrderDetail; // totalItem = fixTotalItem + totalItemBukanOrderDetail;
} }
void plus() {}
void minus() {}
return Container( return Container(
width: widthScreen, width: widthScreen,
child: Stack( child: Stack(
...@@ -269,6 +277,223 @@ class CoreConfirm extends StatelessWidget { ...@@ -269,6 +277,223 @@ class CoreConfirm extends StatelessWidget {
], ],
), ),
), ),
Container(
width: double.infinity,
color: backgroundWhite,
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
bottom: 10,
),
child: Row(
children: [
GestureDetector(
onTap: () {
final noteController =
TextEditingController(
text: listOrders[j].note);
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
showModalBottomSheet(
backgroundColor: backgroundColor,
isScrollControlled: true,
context: context,
builder: (context) {
return NoteModalBottomSheet(
noteController: noteController,
initialValue:
listOrders[j].totalItem,
orderVariants: [],
menuItem: FilterMenu(
id: '',
name: '',
price: '',
originalPrice: '',
imageUrlMedium: '',
imageUrlThumbnail: '',
isSell: false,
type: 1,
categoryName: '',
categoryId: '',
description: '',
groupName: '',
groupId: '',
),
lisrOrders: listOrders,
from: fromConfirmationPage,
contextFrom: context,
idMenu: listOrders[j].id,
menuName:
listOrders[j].namaMenu,
priceMemu:
listOrders[j].satuanHarga,
imageUrl:
listOrders[j].imageUrl,
);
},
);
},
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,
(listOrders[j].note != '')
? '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,
listOrders[j]
.totalItem
.toString(),
style: amountViewBillButton(),
),
),
),
Positioned(
left: 0,
child: GestureDetector(
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus
.hasPrimaryFocus) {
currentFocus.unfocus();
}
Map<String, dynamic>
insertData = {
'menu_id': listOrders[j].id,
'menu_name':
listOrders[j].namaMenu,
'initvalue':
listOrders[j].totalItem -
1,
'menu_price':
listOrders[j].satuanHarga,
'total_price':
listOrders[j].satuanHarga,
'old_order': listOrders,
'image_url':
listOrders[j].imageUrl,
'order_variant': [],
'note': listOrders[j].note,
};
context
.read<OrdersBloc>()
.insertData(insertData);
},
child: Container(
width: 22,
height: 22,
child: Image(
image: AssetImage((isExcelso)
? 'assets/icons/minus-gold.png'
: 'assets/icons/minus-blue.png'),
),
),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus
.hasPrimaryFocus) {
currentFocus.unfocus();
}
Map<String, dynamic>
insertData = {
'menu_id': listOrders[j].id,
'menu_name':
listOrders[j].namaMenu,
'initvalue':
listOrders[j].totalItem +
1,
'menu_price':
listOrders[j].satuanHarga,
'total_price':
listOrders[j].satuanHarga,
'old_order': listOrders,
'image_url':
listOrders[j].imageUrl,
'order_variant': [],
'note': listOrders[j].note,
};
context
.read<OrdersBloc>()
.insertData(insertData);
},
child: Container(
width: 22,
height: 22,
child: Image(
image: AssetImage((isExcelso)
? 'assets/icons/plus-gold.png'
: 'assets/icons/plus.png'),
),
),
),
)
],
),
const SizedBox(
width: 12,
)
],
),
),
const SizedBox( const SizedBox(
height: 24, height: 24,
) )
......
...@@ -1057,62 +1057,86 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1057,62 +1057,86 @@ class _NewHome2State extends State<NewHome2> {
String userName, String userName,
bool isSearchActive) { bool isSearchActive) {
String barName; String barName;
if (userName != '') { if (getIsDeliveryPickup()) {
barName = 'Meja $tableNumber - $userName'; if (getIsCustomerDelivery()) {
barName = "${getBranchName()} - Delivery";
} else {
barName = "${getBranchName()} - Pickup";
}
} else { } else {
barName = "Meja $tableNumber"; if (userName != '') {
barName = 'Meja $tableNumber - $userName';
} else {
barName = "Meja $tableNumber";
}
} }
return Container( return Container(
padding: const EdgeInsets.only(top: 10), padding: const EdgeInsets.only(top: 10),
height: appBarHeight, height: appBarHeight,
color: backgroundColor, color: backgroundColor,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
defaultText( Expanded(
context, child: defaultText(
barName, context,
style: tableNameStyle(), barName,
), maxLines: 2,
const Spacer(), overFlow: TextOverflow.ellipsis,
GestureDetector( style: tableNameStyle(),
onTap: () {
context.read<SearchActive>().searchClick(isSearchActive);
context.read<MenuSelectedBar>().selectedBarMenu(0, '');
context.read<SearchMenu>().searchMenu(
categoryNonFav,
keyword: '',
isSearch: true,
);
_scrollController.animateTo(
(favList.isNotEmpty)
? heighScrollWithImage
: imageHeight, // 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration: const Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn,
);
},
child: const Image(
image: AssetImage('assets/icons/search.png'),
height: 24,
width: 24,
), ),
), ),
const SizedBox( // const Spacer(),
width: 16, Container(
), width: 64,
GestureDetector( child: Row(
onTap: () { mainAxisAlignment: MainAxisAlignment.end,
// Navigator.push( children: [
// context, MaterialPageRoute(builder: (_) => ViewBill())); GestureDetector(
Navigator.push(context, onTap: () {
MaterialPageRoute(builder: (_) => const ViewBillNew())); context.read<SearchActive>().searchClick(isSearchActive);
}, context.read<MenuSelectedBar>().selectedBarMenu(0, '');
child: const Image( context.read<SearchMenu>().searchMenu(
image: AssetImage('assets/icons/book.png'), categoryNonFav,
height: 24, keyword: '',
width: 24, isSearch: true,
);
_scrollController.animateTo(
(favList.isNotEmpty)
? heighScrollWithImage
: imageHeight, // 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration: const Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn,
);
},
child: const Image(
image: AssetImage('assets/icons/search.png'),
height: 24,
width: 24,
),
),
const SizedBox(
width: 16,
),
GestureDetector(
onTap: () {
// Navigator.push(
// context, MaterialPageRoute(builder: (_) => ViewBill()));
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const ViewBillNew()));
},
child: const Image(
image: AssetImage('assets/icons/book.png'),
height: 24,
width: 24,
),
),
],
), ),
), )
], ],
)); ));
} }
......
// ignore_for_file: sized_box_for_whitespace // ignore_for_file: sized_box_for_whitespace
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../../models/bill.dart'; import '../../models/bill.dart';
import '../../models/bill_detail.dart';
import 'order_view_bill_new.dart'; import 'order_view_bill_new.dart';
class ListOrder extends StatelessWidget { class ListOrder extends StatelessWidget {
...@@ -24,23 +25,44 @@ class ListOrder extends StatelessWidget { ...@@ -24,23 +25,44 @@ class ListOrder extends StatelessWidget {
shrinkWrap: true, shrinkWrap: true,
itemCount: bill.length, itemCount: bill.length,
itemBuilder: (context, i) { itemBuilder: (context, i) {
return ListView.builder( return Column(
physics: children: [
const NeverScrollableScrollPhysics(), // to disable scrolling Container(
shrinkWrap: true, width: double.infinity,
itemCount: bill[i].billDetail.length, color: backgroundWhite,
itemBuilder: (ctx, d) { padding: const EdgeInsets.only(
return OrderViewBillNew( left: paddingLeftRight,
billDetail: bill[i].billDetail[d], right: paddingLeftRight,
bill: bill[0], top: 16,
lastItem: ),
(i + 1 == bill.length && d + 1 == bill[i].billDetail.length) child: defaultText(
context,
bill[i].customerName,
style: viewbillStyle(
font: 14,
fontWeight: FontWeight.w600,
),
),
),
ListView.builder(
physics:
const NeverScrollableScrollPhysics(), // to disable scrolling
shrinkWrap: true,
itemCount: bill[i].billDetail.length,
itemBuilder: (ctx, d) {
return OrderViewBillNew(
billDetail: bill[i].billDetail[d],
bill: bill[0],
lastItem: (i + 1 == bill.length &&
d + 1 == bill[i].billDetail.length)
? true ? true
: false, : false,
isHistory: isHistory, isHistory: isHistory,
tableStatus: tableStatus, tableStatus: tableStatus,
); );
}, },
),
],
); );
}); });
} }
......
...@@ -155,7 +155,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -155,7 +155,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
left: paddingLeftRightBill, right: paddingLeftRightBill), left: paddingLeftRightBill, right: paddingLeftRightBill),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
...@@ -181,64 +181,88 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -181,64 +181,88 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
width: 8, width: 8,
), ),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
defaultText( defaultText(
context, context,
widget.billDetail.menuName, widget.billDetail.menuName,
maxLines: 2, maxLines: 2,
overFlow: TextOverflow.ellipsis, overFlow: TextOverflow.ellipsis,
style: menuNameListViewBill(), style: menuNameListViewBill(),
),
defaultText(
context,
getOrderStatus(widget.billDetail.orderStatus),
style: viewbillStyle(
font: 12,
fontWeight: FontWeight.w300,
color: getOrderStatusColor(
widget.billDetail.orderStatus),
), ),
), defaultText(
const SizedBox( context,
height: 6, getOrderStatus(widget.billDetail.orderStatus),
), style: viewbillStyle(
defaultText( font: 12,
context, fontWeight: FontWeight.w300,
(paymentMode == openBill) color: getOrderStatusColor(
? 'Rp ${formatNumber().format(amountParseToInt(widget.billDetail.total))} | $itemQuantityString ' widget.billDetail.orderStatus),
: 'Rp ${formatNumber().format(amountParseToInt(widget.billDetail.total))}', ),
style: viewbillStyle(
font: 12,
fontWeight: FontWeight.w300,
), ),
), const SizedBox(
const SizedBox( height: 6,
height: 6, ),
), defaultText(
(widget.billDetail.notes != '') context,
? defaultText( (paymentMode == openBill)
context, ? 'Rp ${formatNumber().format(amountParseToInt(widget.billDetail.total))} | $itemQuantityString '
'Catatan: ${widget.billDetail.notes}', : 'Rp ${formatNumber().format(amountParseToInt(widget.billDetail.total))}',
maxLines: 2, style: viewbillStyle(
overFlow: TextOverflow.ellipsis, font: 12,
style: viewbillStyle( fontWeight: FontWeight.w300,
font: 12, ),
fontWeight: FontWeight.w300, ),
), const SizedBox(
) height: 6,
: const SizedBox(), ),
], (widget.billDetail.notes != '')
)) ? defaultText(
context,
'Catatan: ${widget.billDetail.notes}',
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(
font: 12,
fontWeight: FontWeight.w300,
),
)
: const SizedBox(),
],
),
),
(isRemoveButtonBillShow(
widget.bill.state, widget.billDetail.orderStatus))
? const SizedBox(
width: 5,
)
: const SizedBox(),
(isRemoveButtonBillShow(
widget.bill.state, widget.billDetail.orderStatus))
? GestureDetector(
onTap: () {
deleteOrder(context, widget.billDetail.menuName,
ontapOkDelete, ontapCancelDelete);
},
child: Container(
color: backgroundWhite,
child: fontAwesomeNew(
trahsIcon,
trahsIconSize,
color: dangerColor,
),
),
)
: const SizedBox()
], ],
), ),
), ),
], ],
), ),
), ),
isVisibleAddRemoveQuantityButtonCheckout( isVisibleAddRemoveQuantityButtonCheckout(widget.isHistory,
widget.isHistory, widget.billDetail.orderStatus) widget.billDetail.orderStatus, widget.bill.state)
? Container( ? Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: paddingLeftRightBill, right: paddingLeftRightBill), left: paddingLeftRightBill, right: paddingLeftRightBill),
...@@ -248,17 +272,19 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -248,17 +272,19 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
), ),
) )
: const SizedBox(), : const SizedBox(),
isVisibleAddRemoveQuantityButtonCheckout( isVisibleAddRemoveQuantityButtonCheckout(widget.isHistory,
widget.isHistory, widget.billDetail.orderStatus) widget.billDetail.orderStatus, widget.bill.state)
? const SizedBox( ? const SizedBox(
height: 11, height: 11,
) )
: const SizedBox(), : const SizedBox(),
isVisibleAddRemoveQuantityButtonCheckout( isVisibleAddRemoveQuantityButtonCheckout(widget.isHistory,
widget.isHistory, widget.billDetail.orderStatus) widget.billDetail.orderStatus, widget.bill.state)
? Container( ? Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: paddingLeftRightBill, right: paddingLeftRightBill), left: paddingLeftRightBill,
right: paddingLeftRightBill,
),
child: Row( child: Row(
children: [ children: [
GestureDetector( GestureDetector(
......
...@@ -23,6 +23,7 @@ import 'package:uuid/uuid.dart'; ...@@ -23,6 +23,7 @@ import 'package:uuid/uuid.dart';
import '../../api/api.dart'; import '../../api/api.dart';
import '../../bloc/branch_exist.dart'; import '../../bloc/branch_exist.dart';
import '../../bloc/feedback_option.dart'; import '../../bloc/feedback_option.dart';
import '../../helper/prefs.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/open_url.dart'; import '../../helper/widget/open_url.dart';
...@@ -323,7 +324,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -323,7 +324,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
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 ${getBranchName()} ?',
style: textStyleNormalFont(context), style: textStyleNormalFont(context),
), ),
content: EmoticonRate( content: EmoticonRate(
......
// ignore_for_file: sized_box_for_whitespace // ignore_for_file: sized_box_for_whitespace
import 'dart:convert';
import 'dart:math'; import 'dart:math';
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';
...@@ -15,6 +16,7 @@ import 'package:dotted_line/dotted_line.dart'; ...@@ -15,6 +16,7 @@ import 'package:dotted_line/dotted_line.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';
import 'package:geolocator/geolocator.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
...@@ -22,6 +24,7 @@ import '../../api/api.dart'; ...@@ -22,6 +24,7 @@ import '../../api/api.dart';
import '../../bloc/address_user_bloc.dart'; import '../../bloc/address_user_bloc.dart';
import '../../bloc/branch_exist.dart'; import '../../bloc/branch_exist.dart';
import '../../bloc/feedback_option.dart'; import '../../bloc/feedback_option.dart';
import '../../bloc/outlet_detail.dart';
import '../../bloc/view_bill.dart'; import '../../bloc/view_bill.dart';
import '../../bloc/voucher_list.dart'; import '../../bloc/voucher_list.dart';
import '../../helper/widget/button_dialog.dart'; import '../../helper/widget/button_dialog.dart';
...@@ -161,6 +164,48 @@ class ViewBillNew extends StatelessWidget { ...@@ -161,6 +164,48 @@ class ViewBillNew extends StatelessWidget {
isCoreLayout: true, isCoreLayout: true,
); );
} else { } else {
List<String> listHistoryOrder = getListHistory();
int indexListhIstory = listHistoryOrder.indexWhere(
(listHistoryOrders) =>
jsonDecode(listHistoryOrders)['order_id'] ==
dataBill[0].id);
if (indexListhIstory == -1) {
Map historyOrder = {
"order_id": dataBill[0].id,
"table": dataBill[0].tableName,
"user_name": dataBill[0].customerName,
"total_order": dataBill[0].totalSeluruhOrderan,
"date_order": localDate(
dataBill[0].dateOrder,
isHistory: true,
),
"branch_code": branchCode,
"brand": brandCode,
"token": token,
};
String historySave = jsonEncode(historyOrder);
listHistoryOrder.add(historySave);
setListHistory(listHistoryOrder);
} else {
listHistoryOrder.removeAt(indexListhIstory);
Map historyOrder = {
"order_id": dataBill[0].id,
"table": dataBill[0].tableName,
"user_name": dataBill[0].customerName,
"total_order": dataBill[0].totalSeluruhOrderan,
"date_order": localDate(
dataBill[0].dateOrder,
isHistory: true,
),
"branch_code": branchCode,
"brand": brandCode,
"token": token,
};
String historySave = jsonEncode(historyOrder);
listHistoryOrder.add(historySave);
setListHistory(listHistoryOrder);
}
saveBillDetail(dataBill); saveBillDetail(dataBill);
// int totalService = 0; // int totalService = 0;
...@@ -293,23 +338,28 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -293,23 +338,28 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
); );
} }
return ScreenResponsive( return BlocBuilder<ExpandDetailOutlet, bool>(
widget: CoreBill( builder: (context, isShowOutletDetail) {
widthScreen: widthScreen, return ScreenResponsive(
dataBill: dataBill, widget: CoreBill(
outStandingAll: outStandingAll, widthScreen: widthScreen,
totalDiscount: totalDiscount, dataBill: dataBill,
isHistory: isHistory, outStandingAll: outStandingAll,
customerName: customerName, totalDiscount: totalDiscount,
outStandingIndividu: outStandingIndividu, isHistory: isHistory,
paymentMode: paymentMode, customerName: customerName,
onTapCashier: onTapCashier, outStandingIndividu: outStandingIndividu,
branchCode: branchCode, paymentMode: paymentMode,
brandCode: brandCode, onTapCashier: onTapCashier,
orderId: orderId, branchCode: branchCode,
), brandCode: brandCode,
widthScreen: MediaQuery.of(context).size.width, orderId: orderId,
isCoreLayout: true, isShowOutletDetail: isShowOutletDetail,
),
widthScreen: MediaQuery.of(context).size.width,
isCoreLayout: true,
);
},
); );
} }
} else { } else {
...@@ -369,6 +419,7 @@ class CoreBill extends StatelessWidget { ...@@ -369,6 +419,7 @@ class CoreBill extends StatelessWidget {
required this.branchCode, required this.branchCode,
required this.brandCode, required this.brandCode,
required this.orderId, required this.orderId,
required this.isShowOutletDetail,
}) : super(key: key); }) : super(key: key);
final double widthScreen; final double widthScreen;
...@@ -383,6 +434,7 @@ class CoreBill extends StatelessWidget { ...@@ -383,6 +434,7 @@ class CoreBill extends StatelessWidget {
final String branchCode; final String branchCode;
final String brandCode; final String brandCode;
final String orderId; final String orderId;
final bool isShowOutletDetail;
void getBillFunction(BuildContext context) { void getBillFunction(BuildContext context) {
context.read<ViewBillBloc>().getBill(); context.read<ViewBillBloc>().getBill();
...@@ -494,7 +546,25 @@ class CoreBill extends StatelessWidget { ...@@ -494,7 +546,25 @@ class CoreBill extends StatelessWidget {
) )
: const SizedBox(), : const SizedBox(),
(isDeliveryPickuup) (isDeliveryPickuup)
? DeliveryPickupDetail() ? DeliveryPickupDetail(
isShowOutletDetail: isShowOutletDetail,
)
: const SizedBox(),
(isDeliveryPickuup)
? (isShowOutletDetail)
? Container(
color: backgroundWhite,
child: const DottedLine(
dashColor: dashGrey,
dashLength: 12,
),
)
: const SizedBox()
: const SizedBox(),
(isDeliveryPickuup)
? (isShowOutletDetail)
? const OutletDetail()
: const SizedBox()
: const SizedBox(), : const SizedBox(),
const SizedBox( const SizedBox(
height: 24, height: 24,
...@@ -528,7 +598,7 @@ class CoreBill extends StatelessWidget { ...@@ -528,7 +598,7 @@ class CoreBill extends StatelessWidget {
), ),
defaultText( defaultText(
context, context,
'Bagaimana pengalaman anda bertransaksi di excelso', 'Bagaimana pengalaman anda bertransaksi di ${getBranchName()}',
style: emojiStyle(), style: emojiStyle(),
), ),
const SizedBox( const SizedBox(
...@@ -574,23 +644,23 @@ class CoreBill extends StatelessWidget { ...@@ -574,23 +644,23 @@ class CoreBill extends StatelessWidget {
], ],
) )
: const SizedBox(), : const SizedBox(),
Container( // Container(
width: double.infinity, // width: double.infinity,
color: backgroundWhite, // color: backgroundWhite,
padding: const EdgeInsets.only( // padding: const EdgeInsets.only(
left: paddingLeftRight, // left: paddingLeftRight,
right: paddingLeftRight, // right: paddingLeftRight,
top: 16, // top: 16,
), // ),
child: defaultText( // child: defaultText(
context, // context,
'Daftar Order', // 'Daftar Order',
style: viewbillStyle( // style: viewbillStyle(
font: 14, // font: 14,
fontWeight: FontWeight.w600, // fontWeight: FontWeight.w600,
), // ),
), // ),
), // ),
ListOrder( ListOrder(
bill: dataBill, bill: dataBill,
isHistory: isHistory, isHistory: isHistory,
...@@ -1083,6 +1153,7 @@ class CoreBill extends StatelessWidget { ...@@ -1083,6 +1153,7 @@ class CoreBill extends StatelessWidget {
setTypeOrder(typeOrderPickup); setTypeOrder(typeOrderPickup);
} }
}); });
context.read<ExpandDetailOutlet>().show(false);
Navigator.pop(context); Navigator.pop(context);
} else { } else {
String textOnOk = 'OK'; String textOnOk = 'OK';
...@@ -1156,7 +1227,7 @@ Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang ...@@ -1156,7 +1227,7 @@ Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
setTypeOrder(typeOrderDelivery); setTypeOrder(typeOrderDelivery);
} }
}); });
context.read<ExpandDetailOutlet>().show(false);
Navigator.pop(context); Navigator.pop(context);
} }
}, },
...@@ -1181,11 +1252,11 @@ Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang ...@@ -1181,11 +1252,11 @@ Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
) )
], ],
), ),
defaultText( // defaultText(
context, // context,
'23 Menit', // '23 Menit',
style: pickUpdeliveryStyleFont(), // style: pickUpdeliveryStyleFont(),
) // )
], ],
), ),
), ),
...@@ -1226,364 +1297,511 @@ class ButtonPayment extends StatelessWidget { ...@@ -1226,364 +1297,511 @@ class ButtonPayment extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return BlocBuilder<AddressUser, Address>(
onTap: () { builder: (context, addressUser) {
if (dataBill[0].tableStatus == tableStatusOpen) { return GestureDetector(
if (isCanButtonCheckoutToTap(dataBill[0].state)) { onTap: () {
if (dataBill[0].state == orderStateCreated) { if (dataBill[0].tableStatus == tableStatusOpen) {
Api.setToPendingOrder(); if (isCanButtonCheckoutToTap(dataBill[0].state)) {
context.read<ViewBillBloc>().getBill(); if (getIsDeliveryPickup()) {
} else if (dataBill[0].state == orderStatePending && if (getIsCustomerDelivery()) {
getTableMode() == tableIndividu) { if (addressUser.id == '') {
EasyLoading.showToast( EasyLoading.showToast(
'Status orderan anda menunggu untuk disetujui'); 'Alamat harus dipilih terlebih dahulu');
} else { } else {
if (paymentMode == closebill && memberinfo.id == '') { Api.setToPendingOrder();
addPayment( context.read<ViewBillBloc>().getBill();
context, }
dataBill[0].id, } else {
branchCode, if (getPickupTime() == '') {
brandCode, EasyLoading.showToast('Silahkan pilih jam pickup');
customerName, } else {
payCard, Api.setToPendingOrder();
fullPayment, context.read<ViewBillBloc>().getBill();
'', }
outStandingAll, }
); } else if (dataBill[0].state == orderStateCreated) {
} else if (paymentMode == closebill && memberinfo.id != '') { Api.setToPendingOrder();
showDialog( context.read<ViewBillBloc>().getBill();
context: context, } else if (dataBill[0].state == orderStatePending &&
builder: (BuildContext context) { getTableMode() == tableIndividu) {
return AlertDialog( EasyLoading.showToast(
title: defaultText( 'Status orderan anda menunggu untuk disetujui');
context, } else {
"Pilih cara pembayaran", if (paymentMode == closebill && memberinfo.id == '') {
style: modalPaymentStyle(), addPayment(
), context,
content: Column( dataBill[0].id,
mainAxisSize: MainAxisSize.min, branchCode,
crossAxisAlignment: CrossAxisAlignment.start, brandCode,
children: [ customerName,
defaultText( payCard,
fullPayment,
'',
outStandingAll,
);
} else if (paymentMode == closebill && memberinfo.id != '') {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: defaultText(
context, context,
'Pembayaran online menggunakan saldo eWallet atau Virtual Account', "Pilih cara pembayaran",
textAlign: TextAlign.left, style: modalPaymentStyle(),
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
), ),
GestureDetector( content: Column(
onTap: () { mainAxisSize: MainAxisSize.min,
String titlePayment; crossAxisAlignment: CrossAxisAlignment.start,
String customerName = getCustomerName(); children: [
bool isIndividu; defaultText(
if (paymentMode == openBill) { context,
isIndividu = true; 'Pembayaran online menggunakan saldo eWallet atau Virtual Account',
titlePayment = 'Semua Bill'; textAlign: TextAlign.left,
} else { style: modalPaymentStyle(
isIndividu = false; font: 12,
titlePayment = customerName; fontWeight: FontWeight.w400,
} ),
if (outStandingAll > 0) { ),
if (paymentMode == closebill) { const SizedBox(
addPayment( height: 8,
context, ),
dataBill[0].id, GestureDetector(
branchCode, onTap: () {
brandCode, String titlePayment;
customerName, String customerName = getCustomerName();
payCard, bool isIndividu;
fullPayment, if (paymentMode == openBill) {
'', isIndividu = true;
outStandingAll, titlePayment = 'Semua Bill';
); } else {
} else { isIndividu = false;
titlePayment = customerName;
}
if (outStandingAll > 0) {
if (paymentMode == closebill) {
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: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Online - Rp ${formatNumber().format(outStandingAll)}'),
),
const SizedBox(
height: 16,
),
defaultText(
context,
'Pembayaran dengan saldo member excelso CRM',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
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)));
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => PaymentBalance(
outStanding: outStandingAll,
balanceMember: amountParseToIntCrm(
memberinfo.balance),
orderId: dataBill[0].id,
),
),
);
}
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Excelso CRM Balance - Rp ${formatNumber().format(outStandingTopayMember)}'),
),
const SizedBox(
height: 16,
),
defaultText(
context,
'Pembayaran dengan e-Voucher excelso CRM',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
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',
// ),
// ),
// );
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => PaymentVoucher(
outstandingAll: outStandingAll,
dataBill: dataBill,
),
),
);
}
} else {
EasyLoading.showToast('Tidak ada tagihan');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: 'Excelso CRM Voucher',
),
),
const SizedBox(
height: 16,
),
GestureDetector(
onTap: () {
Navigator.pop(context); Navigator.pop(context);
buttonDialog(context, dataBill, },
outStandingAll, widthScreen); child: const ButtonComponent(
} buttonColor: Colors.transparent,
} else { teksButton: 'Batal',
EasyLoading.showToast( teksButtonColor: textColorBlack,
'Semua Tagihan Sudah Dibayar'); ),
} )
}, ],
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Online - Rp ${formatNumber().format(outStandingAll)}'),
),
const SizedBox(
height: 16,
),
defaultText(
context,
'Pembayaran dengan saldo member excelso CRM',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
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)));
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => PaymentBalance(
outStanding: outStandingAll,
balanceMember: amountParseToIntCrm(
memberinfo.balance),
orderId: dataBill[0].id,
),
),
);
}
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Excelso CRM Balance - Rp ${formatNumber().format(outStandingTopayMember)}'),
),
const SizedBox(
height: 16,
), ),
defaultText( );
},
);
} else {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: defaultText(
context, context,
'Pembayaran dengan e-Voucher excelso CRM', "Pilih cara pembayaran",
textAlign: TextAlign.left, style: modalPaymentStyle(),
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
), ),
GestureDetector( content: Column(
onTap: () { mainAxisSize: MainAxisSize.min,
int indexVoucher = dataBill[0] crossAxisAlignment: CrossAxisAlignment.start,
.paymentList children: [
.indexWhere((element) => GestureDetector(
element.method == payVoucher); onTap: () {
if (indexVoucher != -1) { if (outStandingAll > 0) {
// check apakah sudah pernah melakukan pembayran voucher if (paymentMode == closebill) {
EasyLoading.showToast( addPayment(
'Voucher telah digunakan pada orderan ini'); context,
} else if (outStandingAll > 0) { dataBill[0].id,
if (indexDataIndividu == -1) { branchCode,
EasyLoading.showToast( brandCode,
'Kamu Belum Memiliki Orderan'); customerName,
} else { payCard,
context fullPayment,
.read<VoucherListBloc>() '',
.getVoucherList(); outStandingAll,
// Navigator.push( );
// context, } else {
// MaterialPageRoute( Navigator.pop(context);
// builder: (_) => Payment( buttonDialog(context, dataBill,
// dataBill: dataBill, outStandingAll, widthScreen);
// isIndividu: false, }
// indexIndividu: } else {
// indexDataIndividu, EasyLoading.showToast(
// isVoucher: true, 'Semua Tagihan Sudah Dibayar');
// outstandingIndividu: }
// outStandingIndividu, },
// outstandingAll: child: ButtonComponent(
// outStandingAll, buttonColor: buttonColor,
// title: 'Voucher', teksButton: 'Bayar Sebagian'),
// ), ),
// ), const SizedBox(
// ); height: 16,
Navigator.push( ),
context, GestureDetector(
MaterialPageRoute( onTap: () {
builder: (_) => PaymentVoucher( if (outStandingAll > 0) {
outstandingAll: outStandingAll, addPayment(
dataBill: dataBill, context,
), dataBill[0].id,
), branchCode,
); brandCode,
} customerName,
} else { payCard,
EasyLoading.showToast('Tidak ada tagihan'); fullPayment,
} '',
}, outStandingAll,
child: ButtonComponent( );
buttonColor: buttonColor, } else {
teksButton: 'Excelso CRM Voucher', EasyLoading.showToast(
), 'Semua Tagihan Sudah Dibayar');
), }
const SizedBox( },
height: 16, child: ButtonComponent(
), buttonColor: buttonColor,
GestureDetector( teksButton:
onTap: () { 'Bayar Seluruhnya - Rp ${formatNumber().format(outStandingAll)}'),
Navigator.pop(context); ),
}, const SizedBox(
child: const ButtonComponent( height: 16,
buttonColor: Colors.transparent, ),
teksButton: 'Batal', GestureDetector(
teksButtonColor: textColorBlack, onTap: () {
),
)
],
),
);
},
);
} else {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: defaultText(
context,
"Pilih cara pembayaran",
style: modalPaymentStyle(),
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
if (outStandingAll > 0) {
if (paymentMode == closebill) {
addPayment(
context,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else {
Navigator.pop(context); Navigator.pop(context);
buttonDialog(context, dataBill, },
outStandingAll, widthScreen); child: const ButtonComponent(
} buttonColor: Colors.transparent,
} else { teksButton: 'Batal',
EasyLoading.showToast( teksButtonColor: textColorBlack,
'Semua Tagihan Sudah Dibayar'); ),
} ),
}, ],
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: 'Bayar Sebagian'),
),
const SizedBox(
height: 16,
),
GestureDetector(
onTap: () {
if (outStandingAll > 0) {
addPayment(
context,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Bayar Seluruhnya - Rp ${formatNumber().format(outStandingAll)}'),
),
const SizedBox(
height: 16,
),
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const ButtonComponent(
buttonColor: Colors.transparent,
teksButton: 'Batal',
teksButtonColor: textColorBlack,
),
), ),
], );
), },
); );
}, // buttonDialogAllPayment(
); // context,
// buttonDialogAllPayment( // dataBill,
// context, // customerName,
// dataBill, // outStandingIndividu,
// customerName, // outStandingAll,
// outStandingIndividu, // paymentMode,
// outStandingAll, // onTapCashier,
// paymentMode, // widthScreen,
// onTapCashier, // memberinfo,
// widthScreen, // branchCode,
// memberinfo, // brandCode,
// branchCode, // );
// brandCode, }
// ); }
} }
} }
} },
} child: Container(
margin: const EdgeInsets.only(top: 12),
height: 43,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButtonComponent),
color: (isCanButtonCheckoutToTap(dataBill[0].state))
? buttonColor
: disabledColor,
),
child: Center(
child: defaultText(
context,
textButtonCheckout(dataBill[0].state),
style: buttonBottomBill(),
),
),
),
);
}, },
child: Container( );
margin: const EdgeInsets.only(top: 12), }
height: 43, }
width: double.infinity,
decoration: BoxDecoration( class OutletDetail extends StatelessWidget {
borderRadius: BorderRadius.circular(roundedButtonComponent), const OutletDetail({super.key});
color: (isCanButtonCheckoutToTap(dataBill[0].state))
? buttonColor @override
: disabledColor, Widget build(BuildContext context) {
), return Container(
child: Center( padding: const EdgeInsets.symmetric(
child: defaultText( horizontal: paddingLeftRight,
vertical: 12,
),
width: double.infinity,
color: backgroundWhite.withOpacity(0.9),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(getIsCustomerDelivery())
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
defaultText(
context,
getBranchName(),
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(),
),
const SizedBox(
height: 5,
),
Row(
children: [
defaultText(
context,
"Open Hour: ${timeHm(getOpenTime())} - ${timeHm(getCloseTime())}",
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(),
),
],
),
const SizedBox(
height: 5,
),
],
)
: const SizedBox(),
defaultText(
context, context,
textButtonCheckout(dataBill[0].state), getAddressOutlet(),
style: buttonBottomBill(), style: viewbillStyle(),
), ),
), const SizedBox(
height: 10,
),
GestureDetector(
onTap: () {
htmlOpenLink(
'https://wa.me/${getPhoneOutlet()}',
self: false,
);
},
child: Row(
children: [
fontAwesomeNew(
phoneIcon,
phoneIconSize,
),
const SizedBox(
width: 10,
),
defaultText(
context,
getPhoneOutlet(),
style: viewbillStyle(),
),
],
),
),
const SizedBox(
height: 10,
),
GestureDetector(
onTap: () {
Geolocator.getCurrentPosition().then((position) {
htmlOpenLink(
'https://www.google.com/maps/dir/${position.latitude},${position.longitude}/${getLatOutlet()},${getLongOutlet()}',
self: false,
);
});
},
child: Container(
width: 150,
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,
'Open Google Maps',
style: addButton(
font: 8,
),
)
],
),
),
),
),
],
), ),
); );
} }
...@@ -1592,9 +1810,11 @@ class ButtonPayment extends StatelessWidget { ...@@ -1592,9 +1810,11 @@ class ButtonPayment extends StatelessWidget {
class DeliveryPickupDetail extends StatelessWidget { class DeliveryPickupDetail extends StatelessWidget {
DeliveryPickupDetail({ DeliveryPickupDetail({
Key? key, Key? key,
required this.isShowOutletDetail,
}) : super(key: key); }) : super(key: key);
final bool isDelivery = getIsCustomerDelivery(); final bool isDelivery = getIsCustomerDelivery();
final bool isShowOutletDetail;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -1644,7 +1864,7 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -1644,7 +1864,7 @@ class DeliveryPickupDetail extends StatelessWidget {
children: [ children: [
defaultText( defaultText(
context, context,
"Open Hour: ${getOpenTime()} - ${getCloseTime()}", "Open Hour: ${timeHm(getOpenTime())} - ${timeHm(getCloseTime())}",
maxLines: 2, maxLines: 2,
overFlow: TextOverflow.ellipsis, overFlow: TextOverflow.ellipsis,
), ),
...@@ -1663,7 +1883,7 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -1663,7 +1883,7 @@ class DeliveryPickupDetail extends StatelessWidget {
), ),
defaultText( defaultText(
context, context,
"${getPickupTime()}:00", getPickupTime(),
maxLines: 1, maxLines: 1,
overFlow: TextOverflow.ellipsis, overFlow: TextOverflow.ellipsis,
), ),
...@@ -1672,43 +1892,67 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -1672,43 +1892,67 @@ class DeliveryPickupDetail extends StatelessWidget {
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),
GestureDetector( // GestureDetector(
onTap: () { // onTap: () {
htmlOpenLink( // context.read<ExpandDetailOutlet>().show(!isShowOutletDetail);
'https://maps.google.com/?q=${getLatOutlet()},${getLongOutlet()}', // // Geolocator.getCurrentPosition().then((position) {
self: false, // // htmlOpenLink(
); // // 'https://www.google.com/maps/dir/${position.latitude},${position.longitude}/${getLatOutlet()},${getLongOutlet()}',
}, // // self: false,
child: Container( // // );
width: 100, // // });
height: 23, // },
decoration: BoxDecoration( // child: Container(
borderRadius: BorderRadius.circular(40), // width: 98,
color: buttonColor, // height: 30,
), // decoration: BoxDecoration(
child: Center( // borderRadius: BorderRadius.circular(40),
child: Row( // color: backgroundWhite,
crossAxisAlignment: CrossAxisAlignment.center, // border: Border.all(
mainAxisAlignment: MainAxisAlignment.center, // color: buttonColor,
children: [ // ),
const Image( // ),
image: AssetImage('assets/icons/pin-address.png'), // child: Center(
), // child: defaultText(
const SizedBox( // context,
width: 12.6, // 'Detail Outlet',
), // style: addButton(
defaultText( // font: 8,
context, // color: buttonColor,
'Alamat Outlet', // ),
style: addButton( // ),
font: 8, // ),
), // )
) // // 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( const SizedBox(
...@@ -1717,63 +1961,7 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -1717,63 +1961,7 @@ class DeliveryPickupDetail extends StatelessWidget {
const Spacer(), const Spacer(),
Column( Column(
children: [ children: [
GestureDetector( changeOutlet(context),
onTap: () {
void ontapOkeChange() {
Navigator.pushReplacement(
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: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
border: Border.all(
color: buttonColor,
),
),
child: Center(
child: defaultText(
context,
'Ganti Outlet',
style: addButton(
font: 8,
color: buttonColor,
),
),
),
),
),
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),
...@@ -1816,8 +2004,7 @@ Apakah ingin melanjutkan ?'''; ...@@ -1816,8 +2004,7 @@ Apakah ingin melanjutkan ?''';
dateTimeCloseOutlet.difference(dateSelectedPickupTime); dateTimeCloseOutlet.difference(dateSelectedPickupTime);
final differenceOpen = final differenceOpen =
dateTimeOpenOutlet.difference(dateSelectedPickupTime); dateSelectedPickupTime.difference(dateTimeOpenOutlet);
final differenceFromNow = final differenceFromNow =
dateSelectedPickupTime.difference(now); dateSelectedPickupTime.difference(now);
if (differenceFromNow.inMinutes < 0) { if (differenceFromNow.inMinutes < 0) {
...@@ -1893,13 +2080,106 @@ Apakah ingin melanjutkan ?'''; ...@@ -1893,13 +2080,106 @@ Apakah ingin melanjutkan ?''';
), ),
), ),
), ),
) ),
const SizedBox(
height: 5,
),
detailOutlet(context),
], ],
) )
], ],
); );
} }
GestureDetector detailOutlet(BuildContext context) {
return GestureDetector(
onTap: () {
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,
),
),
),
),
);
}
GestureDetector changeOutlet(BuildContext context) {
return GestureDetector(
onTap: () {
void ontapOkeChange() {
Navigator.pushReplacement(
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: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
border: Border.all(
color: buttonColor,
),
),
child: Center(
child: defaultText(
context,
'Ganti Outlet',
style: addButton(
font: 8,
color: buttonColor,
),
),
),
),
);
}
BlocBuilder deliveryOption(BuildContext context) { BlocBuilder deliveryOption(BuildContext context) {
void ontapAddressDetail() { void ontapAddressDetail() {
Navigator.pop(context); Navigator.pop(context);
...@@ -1908,6 +2188,8 @@ Apakah ingin melanjutkan ?'''; ...@@ -1908,6 +2188,8 @@ Apakah ingin melanjutkan ?''';
return BlocBuilder<AddressUser, Address>( return BlocBuilder<AddressUser, Address>(
builder: (context, address) { builder: (context, address) {
if (address.id != '') { if (address.id != '') {
setLatitude(address.lat);
setLongitude(address.long);
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
...@@ -1955,6 +2237,20 @@ Apakah ingin melanjutkan ?'''; ...@@ -1955,6 +2237,20 @@ Apakah ingin melanjutkan ?''';
font: 10, font: 10,
), ),
), ),
defaultText(
context,
"Detail Lokasi: ${address.locationDetail}",
style: addressStyle(
font: 10,
),
),
defaultText(
context,
"Catatan : ${address.notes}",
style: addressStyle(
font: 10,
),
),
// (address.locationDetail != '') // (address.locationDetail != '')
// ? Container( // ? Container(
// padding: const EdgeInsets.only(top: 6), // padding: const EdgeInsets.only(top: 6),
...@@ -2023,7 +2319,7 @@ Apakah ingin melanjutkan ?'''; ...@@ -2023,7 +2319,7 @@ Apakah ingin melanjutkan ?''';
), ),
), ),
const SizedBox( const SizedBox(
height: 10, height: 5,
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
...@@ -2082,121 +2378,164 @@ Apakah ingin melanjutkan ?'''; ...@@ -2082,121 +2378,164 @@ Apakah ingin melanjutkan ?''';
), ),
), ),
), ),
const SizedBox(
height: 5,
),
detailOutlet(context),
], ],
), ),
], ],
), ),
const SizedBox( // const SizedBox(
height: 21, // height: 21,
), // ),
Row( // Row(
mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
children: [ // children: [
(address.locationDetail != '') // (address.locationDetail != '')
? GestureDetector( // ? GestureDetector(
onTap: () { // onTap: () {
buttonDialogGlobal( // buttonDialogGlobal(
context, // context,
'Detail Lokasi', // 'Detail Lokasi',
address.locationDetail, // address.locationDetail,
'OK', // 'OK',
'Close', // 'Close',
ontapAddressDetail, // ontapAddressDetail,
ontapAddressDetail, // ontapAddressDetail,
isOkeButtonShow: false, // isOkeButtonShow: false,
); // );
}, // },
child: Container( // child: Container(
width: 100, // width: 100,
height: 23, // height: 23,
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), // borderRadius: BorderRadius.circular(40),
color: buttonColor, // color: buttonColor,
), // ),
child: Center( // child: Center(
child: Row( // child: Row(
crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
children: [ // children: [
const Image( // const Image(
image: AssetImage( // image: AssetImage(
'assets/icons/pin-address.png'), // 'assets/icons/pin-address.png'),
), // ),
const SizedBox( // const SizedBox(
width: 12.6, // width: 12.6,
), // ),
defaultText( // defaultText(
context, // context,
'Detail Alamat', // 'Detail Alamat',
style: addButton( // style: addButton(
font: 8, // font: 8,
), // ),
) // )
], // ],
), // ),
), // ),
), // ),
) // )
: const SizedBox(), // : const SizedBox(),
(address.locationDetail != '') // (address.locationDetail != '')
? const SizedBox( // ? const SizedBox(
width: 16, // width: 16,
) // )
: const SizedBox(), // : const SizedBox(),
(address.notes != '') // (address.notes != '')
? GestureDetector( // ? GestureDetector(
onTap: () { // onTap: () {
buttonDialogGlobal( // buttonDialogGlobal(
context, // context,
'Catatan', // 'Catatan',
address.notes, // address.notes,
'OK', // 'OK',
'Close', // 'Close',
ontapAddressDetail, // ontapAddressDetail,
ontapAddressDetail, // ontapAddressDetail,
isOkeButtonShow: false, // isOkeButtonShow: false,
); // );
}, // },
child: Container( // child: Container(
width: 84, // width: 84,
height: 23, // height: 23,
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), // borderRadius: BorderRadius.circular(40),
color: buttonColor, // color: buttonColor,
), // ),
child: Center( // child: Center(
child: Row( // child: Row(
crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
children: [ // children: [
const Image( // const Image(
image: AssetImage('assets/icons/note.png'), // image: AssetImage('assets/icons/note.png'),
), // ),
const SizedBox( // const SizedBox(
width: 10, // width: 10,
), // ),
defaultText( // defaultText(
context, // context,
'Catatan', // 'Catatan',
style: addButton(font: 8), // style: addButton(font: 8),
) // )
], // ],
), // ),
), // ),
), // ),
) // )
: const SizedBox(), // : const SizedBox(),
], // ],
), // ),
], ],
); );
} else { } else {
return Container( return Row(
width: maxWidthScreens, // crossAxisAlignment: CrossAxisAlignment.start,
color: backgroundWhite, children: [
child: Align( // Container(
alignment: Alignment.centerRight, // width: maxWidthScreens,
child: GestureDetector( // 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: () { onTap: () {
Navigator.pushReplacement( Navigator.pushReplacement(
context, context,
...@@ -2230,7 +2569,75 @@ Apakah ingin melanjutkan ?'''; ...@@ -2230,7 +2569,75 @@ Apakah ingin melanjutkan ?''';
), ),
), ),
), ),
), const SizedBox(
width: 5,
),
changeOutlet(context),
const SizedBox(
width: 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,
// ),
// )
// ],
// ),
// ),
// ),
)
],
); );
} }
}, },
......
...@@ -62,34 +62,34 @@ class CustomAppBar extends StatelessWidget { ...@@ -62,34 +62,34 @@ class CustomAppBar extends StatelessWidget {
), ),
], ],
), ),
GestureDetector( // GestureDetector(
onTap: () { // onTap: () {
Navigator.pushReplacement( // Navigator.pushReplacement(
context, // context,
MaterialPageRoute( // MaterialPageRoute(
builder: (_) => const ViewBillNew( // builder: (_) => const ViewBillNew(
isRepeatViewBill: true, // isRepeatViewBill: true,
), // ),
), // ),
); // );
}, // },
child: Row( // child: Row(
children: [ // children: [
defaultText( // defaultText(
context, // context,
'Simpan', // 'Simpan',
style: appBarNameViewBill(), // style: appBarNameViewBill(),
), // ),
const SizedBox( // const SizedBox(
width: 5, // width: 5,
), // ),
fontAwesomeNew( // fontAwesomeNew(
saveIcon, // saveIcon,
saveIconSize, // saveIconSize,
), // ),
], // ],
), // ),
), // ),
], ],
), ),
); );
......
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