Commit f95c5dae authored by Dio Maulana's avatar Dio Maulana

outlet gmaps on

parent c7a0b437
{
"base_url": "https://6b3f-125-165-111-49.ap.ngrok.io/",
"base_url": "https://cc79-125-165-111-49.ap.ngrok.io/",
"title": "Ravintola Dev BYOD",
"isResponsive": true,
"debug": true
......
......@@ -154,6 +154,10 @@ class Api {
setBranch(jsonObject['data']['code']);
setBrand(jsonObject['data']['brand_code']);
setBranchName(jsonObject['data']['name']);
setLatOutlet(jsonObject['data']['lat']);
setLongOutlet(jsonObject['data']['long']);
setIsDelivery(jsonObject['data']['is_delivery']);
setIsPickup(jsonObject['data']['is_pickup']);
if (jsonObject['data']['payment_mode'] != null) {
setPaymentMode(jsonObject['data']['payment_mode']);
}
......@@ -1997,6 +2001,8 @@ class Api {
if (jsonObject['status'].toString().toLowerCase() == 'ok') {
setBranch(newBranch);
setBranchName(jsonObject['data']['branch_name']);
setLatOutlet(jsonObject['data']['lat']);
setLongOutlet(jsonObject['data']['long']);
return true;
}
return false;
......
......@@ -296,7 +296,7 @@ bool isCanTapAddMoreButton(int orderState) {
bool isVisibleAddMoreButton(int tableStatus, int orderState) {
int paymentMethod = getPaymentMode();
if (tableStatus == tableStatusOpen) {
if (tableStatus == tableStatusOpen && getTableMode() == tableIndividu) {
if (paymentMethod == closebill) {
if (orderState == orderStatePending ||
orderState == orderStateCreated ||
......
......@@ -34,6 +34,8 @@ const String _mqMessage = 'mqmsg';
const String _tableMode = 'tbm';
const String _branchName = 'bN';
const String _orderCreated = 'oC';
const String _latOutlet = 'latO';
const String _longOutlet = 'longO';
String getBaseUrl() {
return prefs.getString(_baseUrl) ?? '';
......@@ -287,7 +289,6 @@ Future<void> setBranchName(String value) async {
prefs.setString(_branchName, value);
}
bool getStatusOrderCreated() {
return prefs.getBool(_orderCreated) ?? false;
}
......@@ -295,3 +296,19 @@ bool getStatusOrderCreated() {
Future<void> setStatusOrderCreated(bool value) async {
prefs.setBool(_orderCreated, value);
}
String getLatOutlet() {
return prefs.getString(_latOutlet) ?? '';
}
Future<void> setLatOutlet(String value) async {
prefs.setString(_latOutlet, value);
}
String getLongOutlet() {
return prefs.getString(_longOutlet) ?? '';
}
Future<void> setLongOutlet(String value) async {
prefs.setString(_longOutlet, value);
}
......@@ -90,28 +90,28 @@ class _SplashState extends State<Splash> {
getBrancList: true,
);
Future.delayed(const Duration(milliseconds: 2000), () async {
if (getStatusOrderCreated()) {
context.read<FilterMenuBloc>().catAndMenu(
getBranchPref(),
getBrand(),
getRole(),
getCashierName(),
getOrderId(),
);
Navigator.pushReplacement(
widget.context,
MaterialPageRoute(
builder: (_) => const NewHome2(),
),
);
} else {
Navigator.pushReplacement(
widget.context,
MaterialPageRoute(
builder: (_) => const SelectBranch(),
),
);
}
// if (getStatusOrderCreated()) {
context.read<FilterMenuBloc>().catAndMenu(
getBranchPref(),
getBrand(),
getRole(),
getCashierName(),
getOrderId(),
);
Navigator.pushReplacement(
widget.context,
MaterialPageRoute(
builder: (_) => const NewHome2(),
),
);
// } else {
// Navigator.pushReplacement(
// widget.context,
// MaterialPageRoute(
// builder: (_) => const SelectBranch(),
// ),
// );
// }
});
});
} else {
......
......@@ -1451,11 +1451,56 @@ class DeliveryPickupDetail extends StatelessWidget {
const SizedBox(
width: 12,
),
defaultText(
context,
getBranchName(),
maxLines: 2,
overFlow: TextOverflow.ellipsis,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
defaultText(
context,
getBranchName(),
maxLines: 2,
overFlow: TextOverflow.ellipsis,
),
const SizedBox(
height: 5,
),
GestureDetector(
onTap: () {
htmlOpenLink(
'https://maps.google.com/?q=${getLatOutlet()},${getLongOutlet()}',
self: false,
);
},
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,
'Alamat Outlet',
style: addButton(
font: 8,
),
)
],
),
),
),
)
],
),
const SizedBox(
width: 12,
......@@ -1855,10 +1900,8 @@ class EmptyBill extends StatelessWidget {
child: defaultText(
context,
(getIsDeliveryPickup())
? (getIsCustomerDelivery())
? 'Delivery'
: 'Pickup'
: 'Meja ${tableNumber}',
? 'Delivery / Pickup'
: 'Meja $tableNumber',
style: viewbillStyle()),
),
Container(
......@@ -1872,44 +1915,45 @@ class EmptyBill extends StatelessWidget {
),
],
),
(getIsDeliveryPickup())
? GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) =>
const SelectBranch(),
),
);
},
child: Container(
height: 30,
width: 80,
margin: const EdgeInsets.only(
right: 20,
),
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: textColorBlack,
),
),
),
),
)
: const SizedBox()
// (getIsDeliveryPickup())
// ? GestureDetector(
// onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => const SelectBranch(
// isFormBill: true,
// ),
// ),
// );
// },
// child: Container(
// height: 30,
// width: 80,
// margin: const EdgeInsets.only(
// right: 20,
// ),
// 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: textColorBlack,
// ),
// ),
// ),
// ),
// )
// : const SizedBox()
],
),
),
......
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