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