Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
B
Byodv2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
Byodv2
Commits
208bf8af
Commit
208bf8af
authored
Oct 06, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
06/10
parent
bfc893f0
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1290 additions
and
404 deletions
+1290
-404
config.json
assets/config.json
+1
-1
outlet.png
assets/icons/outlet.png
+0
-0
api.dart
lib/api/api.dart
+57
-3
helper.dart
lib/helper/helper.dart
+14
-3
mq.dart
lib/helper/mq.dart
+93
-0
prefs.dart
lib/helper/prefs.dart
+49
-3
button_dialog.dart
lib/helper/widget/button_dialog.dart
+11
-9
modal_input_name.dart
lib/helper/widget/modal_input_name.dart
+102
-0
main.dart
lib/main.dart
+20
-18
bill.dart
lib/models/bill.dart
+29
-23
app_bar_confirm.dart
lib/ui/confirm_order/app_bar_confirm.dart
+57
-0
confirm_order.dart
lib/ui/confirm_order/confirm_order.dart
+334
-0
new_home2.dart
lib/ui/home/new_home2.dart
+14
-95
select_branch.dart
lib/ui/select_branch.dart
+71
-17
splash.dart
lib/ui/splash.dart
+25
-6
list_order.dart
lib/ui/viewbill/list_order.dart
+22
-15
order_view_bill_new.dart
lib/ui/viewbill/order_view_bill_new.dart
+16
-7
rincian_pembayaran.dart
lib/ui/viewbill/rincian_pembayaran.dart
+63
-1
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+297
-203
pubspec.lock
pubspec.lock
+14
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
assets/config.json
View file @
208bf8af
{
"base_url"
:
"https://
58a4-125-165-98-228
.ap.ngrok.io/"
,
"base_url"
:
"https://
7f25-125-165-111-49
.ap.ngrok.io/"
,
"title"
:
"Ravintola Dev BYOD"
,
"isResponsive"
:
true
,
"debug"
:
true
...
...
assets/icons/outlet.png
0 → 100644
View file @
208bf8af
1.24 KB
lib/api/api.dart
View file @
208bf8af
...
...
@@ -142,6 +142,7 @@ class Api {
);
setListTypeUrl
(
listTypeUrl
);
setMqMessage
(
'update-
${jsonObject['data']['order_id']}
'
);
setOrderId
(
jsonObject
[
'data'
][
'order_id'
]);
setTypeOrder
(
jsonObject
[
'data'
][
'type_order'
]);
setLogoUrl
(
jsonObject
[
'data'
][
'logo'
]);
...
...
@@ -150,6 +151,13 @@ class Api {
setSessionCounter
(
jsonObject
[
'data'
][
'session_counter'
]);
setBranch
(
jsonObject
[
'data'
][
'code'
]);
setBrand
(
jsonObject
[
'data'
][
'brand_code'
]);
setBranchName
(
jsonObject
[
'data'
][
'name'
]);
if
(
jsonObject
[
'data'
][
'payment_mode'
]
!=
null
)
{
setPaymentMode
(
jsonObject
[
'data'
][
'payment_mode'
]);
}
if
(
jsonObject
[
'data'
][
'table_mode'
]
!=
null
)
{
setTableMode
(
jsonObject
[
'data'
][
'table_mode'
]);
}
return
responseByodBranchExist
;
}
else
if
(
jsonObject
[
'status'
]
==
'error'
&&
(
jsonObject
[
'code'
]
==
'BYOD_ALWAYS_OFF'
||
...
...
@@ -817,7 +825,6 @@ class Api {
// memberInfo.add(MemberInfo.getInfo(
// (jsonObject as Map<dynamic, dynamic>)['data']['member_info']));
// }
for
(
int
d
=
0
;
d
<
orderDetail
.
length
;
d
++)
{
if
(
orderDetail
[
d
][
'parent_id'
]
==
''
)
{
// yang variant gak dimasukin dulu
...
...
@@ -890,14 +897,17 @@ class Api {
"invoice"
:
jsonObject
[
'data'
][
'code'
],
"total_service"
:
jsonObject
[
'data'
][
'service'
],
"total_service_tax"
:
jsonObject
[
'data'
][
'service_tax'
],
"my_self_outstanding"
:
jsonObject
[
'data'
]
[
'my_self_outstanding'
]
,
"my_self_outstanding"
:
jsonObject
[
'data'
][
'my_self_outstanding'
]
??
"0.00"
,
"discount_total"
:
jsonObject
[
'data'
][
'discount'
],
"table_number"
:
jsonObject
[
'data'
][
'table_number'
]
??
''
,
"is_feedback"
:
jsonObject
[
'data'
][
'is_feedback'
],
"doku_minimum_payment"
:
jsonObject
[
'data'
]
[
'doku_minimum_payment'
],
"order_date"
:
jsonObject
[
'data'
][
'order_date'
],
"packaging_fee"
:
jsonObject
[
'data'
][
'packaging_fee'
]
??
"0.00"
,
"platform_fee"
:
jsonObject
[
'data'
][
'platform_fee'
]
??
"0.00"
,
};
bill
.
add
(
Bill
.
createBill
(
i
));
// billDetail.add(BillDetail.createBillDetail(orderDetail[d]));
...
...
@@ -1311,6 +1321,7 @@ class Api {
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'checkOut'
);
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
setStatusOrderCreated
(
true
);
await
EasyLoading
.
dismiss
();
// Navigator.pushAndRemoveUntil(
// context,
...
...
@@ -1955,4 +1966,47 @@ class Api {
return
branchList
;
}
}
static
Future
<
bool
>
changeBranch
(
String
newBranch
)
async
{
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
"
$baseUrl${endPoint}
change_branch"
;
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"brand_code"
:
getBrand
(),
"order_id"
:
getOrderId
(),
"role"
:
getRole
(),
"old_branch_code"
:
getBranchPref
(),
"new_branch_code"
:
newBranch
,
"type_order"
:
getTypeOrder
(),
"cashier_name"
:
getCashierName
(),
"from"
:
fromByod
,
};
var
bodies
=
jsonEncode
(
data
);
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'changeBranch'
);
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
setBranch
(
newBranch
);
setBranchName
(
jsonObject
[
'data'
][
'branch_name'
]);
return
true
;
}
return
false
;
}
else
{
return
false
;
}
}
catch
(
e
)
{
if
(
debug
)
{
logd
(
'API CLASS ON API.DART, FUNGSI: changeBranch, URL :
$apiUrl
'
,
'ERROR CONNECT TO SERVER, ERROR CATCH :
$e
'
);
}
return
false
;
}
}
}
lib/helper/helper.dart
View file @
208bf8af
...
...
@@ -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
'../api/api.dart'
;
import
'../main.dart'
;
import
'logger.dart'
;
...
...
@@ -366,6 +367,11 @@ bool isCanButtonCheckoutToTap(int orderState) {
}
}
Future
<
bool
>
changeBranch
(
String
newBranch
)
async
{
bool
result
=
await
Api
.
changeBranch
(
newBranch
);
return
result
;
}
//** END FUNCTION */
//** START CONSTANT */
...
...
@@ -507,11 +513,16 @@ const String responseByodBranchExist = 'branchExist';
//** untuk response API getbranch */
//** TABLE BILL MODE */
const
int
closebill
=
1
;
const
int
openBill
=
2
;
const
int
defaultBillTable
=
2
;
// default table di open aja
const
int
closebill
=
0
;
const
int
openBill
=
1
;
const
int
defaultBillTable
=
1
;
// default table di open aja
//** TABLE BILL MODE */
//** TABLE TABLE MODE */
const
int
tableIndividu
=
1
;
const
int
tableGroup
=
2
;
//** TABLE TABLE MODE */
//** DURATION ANIMATED SWITECHER in ms */
int
animatedTime
=
200
;
//** DURATION ANIMATED SWITECHER */
...
...
lib/helper/mq.dart
0 → 100644
View file @
208bf8af
// ignore_for_file: unused_catch_clause
import
'dart:io'
;
import
'package:byod/helper/logger.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/main.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:mqtt_client/mqtt_browser_client.dart'
;
import
'package:mqtt_client/mqtt_client.dart'
;
import
'package:uuid/uuid.dart'
;
String
mqttUrl
=
'wss://mq.jasadigital.co.id'
;
final
mqClient
=
MqttBrowserClient
(
mqttUrl
,
''
);
const
int
mqttPort
=
8083
;
const
String
queueTopic
=
'byod/bill/update'
;
String
queueMessage
=
getMqMessage
();
const
String
usernameMq
=
'jasadigital'
;
const
String
passwordMq
=
'jasadigital'
;
const
uuidInit
=
Uuid
();
var
uuid
=
uuidInit
.
v4
();
Future
<
int
>
runMqTT
(
BuildContext
context
)
async
{
mqClient
.
logging
(
on:
false
);
mqClient
.
setProtocolV311
();
mqClient
.
keepAlivePeriod
=
86400
;
mqClient
.
port
=
mqttPort
;
mqClient
.
onDisconnected
;
mqClient
.
onConnected
;
mqClient
.
onSubscribed
;
// mqClient.pongCallback = pong;
final
connMess
=
MqttConnectMessage
()
.
withClientIdentifier
(
uuid
)
.
withWillTopic
(
'willtopic'
)
// If you set this you must set a will message
.
withWillMessage
(
'My Will message'
)
.
startClean
()
// Non persistent session for testing
.
withWillQos
(
MqttQos
.
atLeastOnce
);
// print('EXAMPLE::Mosquitto client connecting....');
mqClient
.
connectionMessage
=
connMess
;
try
{
await
mqClient
.
connect
(
usernameMq
,
passwordMq
);
}
on
NoConnectionException
catch
(
e
)
{
if
(
debug
)
{
logd
(
'MQ CONFIG::client exception'
,
'
$e
'
);
}
mqClient
.
disconnect
();
}
on
SocketException
catch
(
e
)
{
if
(
debug
)
{
logd
(
'MQ CONFIG::socket exception'
,
'
$e
'
);
}
mqClient
.
disconnect
();
}
if
(
mqClient
.
connectionStatus
!.
state
==
MqttConnectionState
.
connected
)
{
if
(
debug
)
{
logd
(
'CHECK CONNECTION'
,
'CONNECTED'
);
}
}
else
{
/// Use status here rather than state if you also want the broker return code.
// print(
// 'EXAMPLE::ERROR Mosquitto client connection failed - disconnecting, status is ${mqClient.connectionStatus}');
mqClient
.
disconnect
();
exit
(-
1
);
}
/// Ok, lets try a subscription
// print('EXAMPLE::Subscribing to the queuetest/1 topic');
var
topic
=
queueTopic
;
// Not a wildcard topic
mqClient
.
subscribe
(
topic
,
MqttQos
.
atMostOnce
);
/// The client has a change notifier object(see the Observable class) which we then listen to to get
/// notifications of published updates to each subscribed topic.
mqClient
.
updates
!.
listen
((
List
<
MqttReceivedMessage
<
MqttMessage
?>>?
c
)
{
final
recMess
=
c
![
0
].
payload
as
MqttPublishMessage
;
final
pt
=
MqttPublishPayload
.
bytesToStringAsString
(
recMess
.
payload
.
message
);
// print('Notifikasi masuk dari topic <${c[0].topic}>, isinya adalah: $pt ');
// print('');
if
(
c
[
0
].
topic
==
topic
&&
pt
==
queueMessage
)
{
// update bill disini
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC MASUK::
$topic
, MESSAGE::
$queueMessage
'
);
}
}
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC TIDAK SAMA YANG -> MASUK::
$topic
, MESSAGE::
$pt
'
);
}
});
return
0
;
}
lib/helper/prefs.dart
View file @
208bf8af
...
...
@@ -8,7 +8,7 @@ const String _sessionCounter = 'session_counter';
const
String
_sessionId
=
'session_id'
;
const
String
_baseUrl
=
'baseUrl'
;
const
String
_tableNumber
=
'table_number'
;
const
String
_
tableMode
=
'table_mode
'
;
const
String
_
paymentMethod
=
'pM
'
;
const
String
_customerName
=
'userName'
;
const
String
_totalOrder
=
'total_order'
;
const
String
_dateOrder
=
'date_order'
;
...
...
@@ -29,6 +29,11 @@ const String _listTypeUrl = 'urlTypeList';
const
String
_orderType
=
'orderType'
;
const
String
_isDelivery
=
'isDelivery'
;
const
String
_isPickup
=
'isPickup'
;
const
String
_isCustomerDelivery
=
'isCustomerDelivery'
;
const
String
_mqMessage
=
'mqmsg'
;
const
String
_tableMode
=
'tbm'
;
const
String
_branchName
=
'bN'
;
const
String
_orderCreated
=
'oC'
;
String
getBaseUrl
(
)
{
return
prefs
.
getString
(
_baseUrl
)
??
''
;
...
...
@@ -139,11 +144,11 @@ Future<void> setListHistory(List<String> value) async {
}
int
getPaymentMode
(
)
{
return
prefs
.
getInt
(
_
tableMode
)
??
defaultBillTable
;
return
prefs
.
getInt
(
_
paymentMethod
)
??
defaultBillTable
;
}
Future
<
void
>
setPaymentMode
(
int
value
)
async
{
prefs
.
setInt
(
_
tableMode
,
value
);
prefs
.
setInt
(
_
paymentMethod
,
value
);
}
String
getLogoUrl
(
)
{
...
...
@@ -249,3 +254,44 @@ bool getIsDelivery() {
Future
<
void
>
setIsDelivery
(
bool
value
)
async
{
prefs
.
setBool
(
_isDelivery
,
value
);
}
bool
getIsCustomerDelivery
(
)
{
return
prefs
.
getBool
(
_isCustomerDelivery
)
??
false
;
}
Future
<
void
>
setIsCustomerDelivery
(
bool
value
)
async
{
prefs
.
setBool
(
_isCustomerDelivery
,
value
);
}
String
getMqMessage
(
)
{
return
prefs
.
getString
(
_mqMessage
)
??
'default'
;
}
Future
<
void
>
setMqMessage
(
String
value
)
async
{
prefs
.
setString
(
_mqMessage
,
value
);
}
int
getTableMode
(
)
{
return
prefs
.
getInt
(
_tableMode
)
??
0
;
}
Future
<
void
>
setTableMode
(
int
value
)
async
{
prefs
.
setInt
(
_tableMode
,
value
);
}
String
getBranchName
(
)
{
return
prefs
.
getString
(
_branchName
)
??
''
;
}
Future
<
void
>
setBranchName
(
String
value
)
async
{
prefs
.
setString
(
_branchName
,
value
);
}
bool
getStatusOrderCreated
(
)
{
return
prefs
.
getBool
(
_orderCreated
)
??
false
;
}
Future
<
void
>
setStatusOrderCreated
(
bool
value
)
async
{
prefs
.
setBool
(
_orderCreated
,
value
);
}
lib/helper/widget/button_dialog.dart
View file @
208bf8af
...
...
@@ -13,9 +13,11 @@ Future<dynamic> buttonDialogGlobal(
String
textOnOk
,
String
textOnCancel
,
void
Function
()
ontapOk
,
void
Function
()
ontapCancel
,
{
Color
okButtonColor
=
Colors
.
indigo
,
Color
cancelButtonColor
=
Colors
.
red
})
{
void
Function
()
ontapCancel
,
{
Color
okButtonColor
=
Colors
.
indigo
,
Color
cancelButtonColor
=
Colors
.
transparent
,
Color
textCancelColor
=
textColorBlack
,
})
{
return
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
=>
AlertDialog
(
...
...
lib/helper/widget/modal_input_name.dart
0 → 100644
View file @
208bf8af
import
'package:flutter/material.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'../../models/orders.dart'
;
import
'../../ui/checkout/fuction.dart'
;
import
'../helper.dart'
;
import
'style.dart'
;
// ignore: non_constant_identifier_names
AnimatedContainer
CoreModalInputName
(
BuildContext
context
,
TextEditingController
nameController
,
List
<
Orders
>
listOrders
)
{
return
AnimatedContainer
(
duration:
const
Duration
(
milliseconds:
300
),
child:
AlertDialog
(
scrollable:
true
,
title:
defaultText
(
context
,
"Masukkan Nama"
,
style:
modalNamaHeader
(),
),
content:
SizedBox
(
height:
216
,
width:
303
,
child:
Column
(
children:
[
TextField
(
keyboardType:
TextInputType
.
text
,
controller:
nameController
,
style:
const
TextStyle
(
fontFamily:
'OpenSans'
,
fontSize:
14
,
color:
textColorModalHeaderNama
,
),
decoration:
const
InputDecoration
(
labelText:
'Nama panggilan'
,
labelStyle:
TextStyle
(
fontFamily:
'OpenSans'
,
fontSize:
14
,
color:
textColorModalHeaderNama
,
),
),
),
const
SizedBox
(
height:
47
,
),
GestureDetector
(
onTap:
()
{
if
(
nameController
.
text
!=
''
)
{
checkOut
(
context
,
listOrders
,
nameController
.
text
);
}
else
{
EasyLoading
.
showToast
(
"Nama wajib diisi"
);
}
},
child:
Container
(
height:
43
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
31
),
color:
buttonColor
),
child:
Center
(
child:
defaultText
(
context
,
"Simpan"
,
style:
simpanButtonNote
(
font:
14
,
fontWeight:
FontWeight
.
w600
,
),
),
),
),
),
const
SizedBox
(
height:
20
,
),
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
},
child:
Container
(
height:
43
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
31
),
color:
Colors
.
transparent
,
),
child:
Center
(
child:
defaultText
(
context
,
"Batal"
,
style:
simpanButtonNote
(
font:
14
,
fontWeight:
FontWeight
.
w600
,
color:
textColorRed
,
),
),
),
),
),
],
),
),
),
);
}
lib/main.dart
View file @
208bf8af
...
...
@@ -34,7 +34,7 @@ import 'bloc/view_bill.dart';
import
'package:flutter/services.dart'
as
bundle_root
;
import
'bloc/voucher_list.dart'
;
import
'ui/
select_branch
.dart'
;
import
'ui/
confirm_order/confirm_order
.dart'
;
late
SharedPreferences
prefs
;
bool
isExcelso
=
false
;
...
...
@@ -61,7 +61,8 @@ void main() async {
[
DeviceOrientation
.
portraitUp
,
DeviceOrientation
.
portraitDown
]);
setPathUrlStrategy
();
WidgetsFlutterBinding
.
ensureInitialized
();
prefs
=
await
SharedPreferences
.
getInstance
();
SharedPreferences
.
getInstance
().
then
((
value
)
{
prefs
=
value
;
configLoading
();
for
(
int
d
=
0
;
d
<
Uri
.
base
.
pathSegments
.
length
;
d
++)
{
stringPath
.
add
(
Uri
.
base
.
pathSegments
[
d
]);
...
...
@@ -79,6 +80,7 @@ void main() async {
),
);
});
});
}
//easy loading
...
...
@@ -206,7 +208,7 @@ class _MyAppState extends State<MyApp> {
// initialRoute: '/',
// routes: {
// '/': (context) => const
SelectBranch
(),
// '/': (context) => const
ConfirmOrder
(),
// },
// onGenerateRoute: (routes) {
// return MaterialPageRoute(
...
...
lib/models/bill.dart
View file @
208bf8af
...
...
@@ -23,10 +23,12 @@ class Bill {
String
tableName
;
bool
isFeedBack
;
String
dokuMinPay
;
String
packagingFee
;
String
platformFee
;
// List<MemberInfo> memberInfo;
Bill
(
{
required
this
.
id
,
Bill
(
{
required
this
.
id
,
required
this
.
totalSeluruhOrderan
,
required
this
.
subTotalSeluruhOrderan
,
required
this
.
totalPerCustomer
,
...
...
@@ -45,7 +47,9 @@ class Bill {
required
this
.
discountTotal
,
required
this
.
tableName
,
required
this
.
isFeedBack
,
required
this
.
dokuMinPay
required
this
.
dokuMinPay
,
this
.
packagingFee
=
"0.00"
,
this
.
platformFee
=
"0.00"
,
// this.memberInfo = const []
});
...
...
@@ -71,6 +75,8 @@ class Bill {
isFeedBack:
json
[
'is_feedback'
],
dokuMinPay:
json
[
'doku_minimum_payment'
],
dateOrder:
json
[
'order_date'
],
packagingFee:
json
[
'packaging_fee'
],
platformFee:
json
[
'platform_fee'
],
// memberInfo: json['member_info']
);
}
...
...
lib/ui/confirm_order/app_bar_confirm.dart
0 → 100644
View file @
208bf8af
// ignore_for_file: sized_box_for_whitespace
import
'package:flutter/material.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/style.dart'
;
class
CustomAppBarConfirm
extends
StatelessWidget
{
const
CustomAppBarConfirm
({
Key
?
key
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
padding:
const
EdgeInsets
.
only
(
top:
15
,
bottom:
19
,
left:
paddingLeftRight
,
right:
paddingLeftRight
,
),
// padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
color:
backgroundWhite
,
child:
Row
(
// mainAxisAlignment: MainAxisAlignment.start,
children:
[
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
},
child:
Container
(
width:
24
,
height:
24
,
child:
Center
(
child:
fontAwesomeNew
(
arrowBack
,
arrowBackSize
,
),
),
),
),
const
SizedBox
(
width:
16
,
),
Center
(
child:
defaultText
(
context
,
'Konfirmasi Orderan'
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
style:
appBarNameViewBill
(),
),
),
],
),
);
}
}
lib/ui/confirm_order/confirm_order.dart
0 → 100644
View file @
208bf8af
// ignore_for_file: sized_box_for_whitespace
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../bloc/order_bloc.dart'
;
import
'../../helper/prefs.dart'
;
import
'../../helper/widget/button_modal.dart'
;
import
'../../helper/widget/modal_input_name.dart'
;
import
'../../models/orders.dart'
;
import
'../checkout/fuction.dart'
;
import
'app_bar_confirm.dart'
;
class
ConfirmOrder
extends
StatelessWidget
{
const
ConfirmOrder
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
SafeArea
(
child:
Scaffold
(
backgroundColor:
backgroundColor
,
body:
ScreenResponsive
(
widget:
CoreConfirm
(),
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
isCoreLayout:
true
,
),
));
}
}
class
CoreConfirm
extends
StatelessWidget
{
CoreConfirm
({
super
.
key
});
final
nameController
=
TextEditingController
();
@override
Widget
build
(
BuildContext
context
)
{
double
widthScreen
=
responsiveWidthScreen
(
context
);
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
context
,
listOrders
)
{
int
totalHarga
=
0
;
// List indexTidakAdaVariant = [];
// List<String> indexAdaVariant = [];
if
(
listOrders
.
isNotEmpty
)
{
int
fixTotalHarga
=
0
;
int
totalHargaOrderDetail
=
0
;
int
totalHargaBukanOrderDetail
=
0
;
for
(
var
i
=
0
;
i
<
listOrders
.
length
;
i
++)
{
if
(
listOrders
[
i
].
orderDetail
.
isEmpty
)
{
// indexTidakAdaVariant.add(i);
totalHargaBukanOrderDetail
+=
(
listOrders
[
i
].
totalItem
*
listOrders
[
i
].
totalHarga
);
}
else
{
// for (int kk = 0; kk < listOrders[i].orderDetail.length; kk++) {
// String indexWithVariant = '$i|$kk';
// indexAdaVariant.add(indexWithVariant);
// totalHargaOrderDetail +=
// listOrders[i].orderDetail[kk].totalHarga;
// }
fixTotalHarga
=
totalHargaOrderDetail
;
}
}
totalHarga
=
fixTotalHarga
+
totalHargaBukanOrderDetail
;
}
return
Container
(
width:
widthScreen
,
child:
Stack
(
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
const
CustomAppBarConfirm
(),
Expanded
(
child:
SingleChildScrollView
(
physics:
const
AlwaysScrollableScrollPhysics
(),
child:
Column
(
children:
[
const
SizedBox
(
height:
24
,
),
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
// to disable scrolling
shrinkWrap:
true
,
itemCount:
listOrders
.
length
,
itemBuilder:
(
context
,
i
)
{
return
Column
(
children:
[
Container
(
width:
double
.
infinity
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
,
vertical:
16
,
),
color:
backgroundWhite
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
(
listOrders
[
i
].
imageUrl
!=
''
)
?
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
listOrders
[
i
].
imageUrl
),
)
:
const
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
),
),
const
SizedBox
(
width:
12
,
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
defaultText
(
context
,
listOrders
[
i
].
namaMenu
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
menuNameListViewBill
(),
),
const
SizedBox
(
height:
6
,
),
defaultText
(
context
,
'
${listOrders[i].totalItem}
X Rp
${formatNumber().format(listOrders[i].satuanHarga)}
'
,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
const
SizedBox
(
height:
6
,
),
(
listOrders
[
i
].
note
!=
''
)
?
defaultText
(
context
,
"Catatan:
${listOrders[i].note}
"
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
)
:
const
SizedBox
(),
(
listOrders
[
i
]
.
orderDetail
.
isNotEmpty
)
?
defaultText
(
context
,
'Variant : '
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
)
:
const
SizedBox
(),
if
(
listOrders
[
i
]
.
orderDetail
.
isNotEmpty
)
for
(
int
a
=
0
;
a
<
listOrders
[
i
]
.
orderDetail
[
0
]
.
orderVariant
.
length
;
a
++)
defaultText
(
context
,
listOrders
[
i
]
.
orderDetail
[
0
]
.
orderVariant
[
a
]
.
name
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
),
],
)
],
),
),
const
SizedBox
(
height:
24
,
)
],
);
},
),
const
AddMoreOrder
()
],
),
),
)
],
),
Positioned
(
bottom:
0
,
child:
Container
(
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
16
),
topRight:
Radius
.
circular
(
16
),
),
color:
backgroundWhite
,
boxShadow:
[
BoxShadow
(
color:
Colors
.
grey
,
blurRadius:
10.0
,
)
],
),
padding:
const
EdgeInsets
.
all
(
paddingLeftRight
),
width:
widthScreen
,
child:
GestureDetector
(
onTap:
()
{
String
username
=
getCustomerName
();
if
(
username
!=
''
)
{
checkOut
(
context
,
listOrders
,
username
);
}
else
{
modalInputName
(
context
,
nameController
,
listOrders
);
}
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'Pesan - Rp
${formatNumber().format(totalHarga)}
'
),
),
),
)
],
),
);
},
);
}
}
Future
<
dynamic
>
modalInputName
(
BuildContext
context
,
TextEditingController
nameController
,
List
<
Orders
>
listOrders
)
{
return
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
{
return
CoreModalInputName
(
context
,
nameController
,
listOrders
);
},
);
}
class
AddMoreOrder
extends
StatelessWidget
{
const
AddMoreOrder
({
Key
?
key
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
height:
80
,
width:
double
.
infinity
,
color:
backgroundWhite
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
),
// color: Colors.red,
child:
Row
(
children:
[
Expanded
(
child:
Container
(
child:
defaultText
(
context
,
'Tambahkan menu lainnya?'
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
16
,
fontWeight:
FontWeight
.
w400
,
),
),
),
),
const
SizedBox
(
width:
19
,
),
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
},
child:
Container
(
width:
98
,
height:
30
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
21
),
color:
buttonColor
,
),
child:
Center
(
child:
defaultText
(
context
,
'Tambah'
,
style:
addButton
(
font:
8
,
),
),
),
),
)
],
),
);
}
}
lib/ui/home/new_home2.dart
View file @
208bf8af
...
...
@@ -14,16 +14,16 @@ import 'package:byod/models/orders.dart';
import
'package:byod/ui/home/menu_list_utama.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:scrollable_positioned_list/scrollable_positioned_list.dart'
;
import
'package:sliver_tools/sliver_tools.dart'
;
import
'../../bloc/filter_menu.dart'
;
import
'../../helper/widget/button_dialog.dart'
;
import
'../../helper/widget/modal_input_name.dart'
;
import
'../../main.dart'
;
import
'../../models/fav_group.dart'
;
import
'../checkout/checkout.dart'
;
import
'../checkout/fuction.dart'
;
import
'../confirm_order/confirm_order.dart'
;
import
'../screen_responsive.dart'
;
import
'../viewbill/view_bill_new.dart'
;
import
'cat_list.dart'
;
...
...
@@ -924,102 +924,11 @@ class _NewHome2State extends State<NewHome2> {
if
(
namaPelanggan
!=
''
)
{
checkOut
(
context
,
listOrders
,
namaPelanggan
);
}
else
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
{
return
AnimatedContainer
(
duration:
const
Duration
(
milliseconds:
300
),
child:
AlertDialog
(
scrollable:
true
,
title:
defaultText
(
context
,
"Masukkan Nama"
,
style:
modalNamaHeader
(),
),
content:
SizedBox
(
height:
216
,
width:
303
,
child:
Column
(
children:
[
TextField
(
keyboardType:
TextInputType
.
text
,
controller:
nameController
,
style:
textStyleNormalFont
(
context
),
decoration:
const
InputDecoration
(
labelText:
'Nama panggilan'
,
labelStyle:
TextStyle
(
fontFamily:
'OpenSans'
,
fontSize:
14
,
color:
textColorModalHeaderNama
,
),
),
),
const
SizedBox
(
height:
47
,
),
GestureDetector
(
onTap:
()
{
if
(
nameController
.
text
!=
''
||
namaPelanggan
!=
''
)
{
checkOut
(
context
,
listOrders
,
nameController
.
text
);
}
else
{
EasyLoading
.
showToast
(
"Nama wajib diisi"
);
}
},
child:
Container
(
height:
43
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
31
),
color:
buttonColor
),
child:
Center
(
child:
defaultText
(
context
,
"Simpan"
,
style:
simpanButtonNote
(
font:
14
,
fontWeight:
FontWeight
.
w600
,
),
),
),
),
),
const
SizedBox
(
height:
20
,
),
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
},
child:
Container
(
height:
43
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
31
),
color:
Colors
.
transparent
,
),
child:
Center
(
child:
defaultText
(
context
,
"Batal"
,
style:
simpanButtonNote
(
font:
14
,
fontWeight:
FontWeight
.
w600
,
color:
textColorRed
,
),
),
),
),
),
],
),
),
),
);
});
modalInputName
(
context
,
nameController
,
listOrders
);
}
}
else
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
const
C
heckOut
()));
MaterialPageRoute
(
builder:
(
context
)
=>
const
C
onfirmOrder
()));
}
},
child:
Stack
(
...
...
@@ -1127,6 +1036,16 @@ class _NewHome2State extends State<NewHome2> {
);
}
Future
<
dynamic
>
modalInputName
(
BuildContext
context
,
TextEditingController
nameController
,
List
<
Orders
>
listOrders
)
{
return
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
{
return
CoreModalInputName
(
context
,
nameController
,
listOrders
);
},
);
}
Container
customAppBar
(
BuildContext
context
,
double
paddingLeftRight
,
...
...
lib/ui/select_branch.dart
View file @
208bf8af
...
...
@@ -9,21 +9,28 @@ import 'package:byod/ui/home/new_home2.dart';
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'../bloc/search_branch.dart'
;
import
'../helper/widget/style.dart'
;
import
'app_bar_select_branch.dart'
;
class
SelectBranch
extends
StatelessWidget
{
const
SelectBranch
({
super
.
key
});
const
SelectBranch
({
super
.
key
,
this
.
isFormBill
=
false
,
});
final
bool
isFormBill
;
@override
Widget
build
(
BuildContext
context
)
{
return
SafeArea
(
child:
Scaffold
(
backgroundColor:
backgroundColor
,
body:
ScreenResponsive
(
widget:
const
CoreBranch
(),
widget:
CoreBranch
(
isFormBill:
isFormBill
,
),
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
isCoreLayout:
true
,
),
...
...
@@ -33,8 +40,12 @@ class SelectBranch extends StatelessWidget {
}
class
CoreBranch
extends
StatelessWidget
{
const
CoreBranch
({
super
.
key
});
const
CoreBranch
({
super
.
key
,
required
this
.
isFormBill
,
});
final
bool
isFormBill
;
@override
Widget
build
(
BuildContext
context
)
{
double
widthScreen
=
responsiveWidthScreen
(
context
);
...
...
@@ -69,6 +80,15 @@ class CoreBranch extends StatelessWidget {
itemBuilder:
(
context
,
i
)
{
return
GestureDetector
(
onTap:
()
{
if
(
listBranch
[
i
].
isDelivery
==
false
&&
listBranch
[
i
].
isPickup
==
false
)
{
EasyLoading
.
showToast
(
'Outlet tidak menerima delivery dan pickup'
);
}
else
{
if
(
isFormBill
)
{
changeBranch
(
listBranch
[
i
].
branchCode
)
.
then
((
value
)
{
if
(
value
)
{
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
listBranch
[
i
].
branchCode
,
getBrand
(),
...
...
@@ -79,11 +99,45 @@ class CoreBranch extends StatelessWidget {
setIsDelivery
(
listBranch
[
i
].
isDelivery
);
setIsPickup
(
listBranch
[
i
].
isPickup
);
setBranch
(
listBranch
[
i
].
branchCode
);
if
(
listBranch
[
i
].
isDelivery
)
{
setIsCustomerDelivery
(
true
);
}
else
{
setIsCustomerDelivery
(
false
);
}
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()),
);
}
else
{
EasyLoading
.
showToast
(
'Outlet tidak dapat dipilih'
);
}
});
}
else
{
setIsDelivery
(
listBranch
[
i
].
isDelivery
);
setIsPickup
(
listBranch
[
i
].
isPickup
);
setBranch
(
listBranch
[
i
].
branchCode
);
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
listBranch
[
i
].
branchCode
,
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
);
if
(
listBranch
[
i
].
isDelivery
)
{
setIsCustomerDelivery
(
true
);
}
else
{
setIsCustomerDelivery
(
false
);
}
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()),
);
}
}
},
child:
Container
(
margin:
const
EdgeInsets
.
only
(
...
...
lib/ui/splash.dart
View file @
208bf8af
...
...
@@ -12,6 +12,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'package:geolocator/geolocator.dart'
;
import
'../bloc/branch_exist.dart'
;
import
'../bloc/filter_menu.dart'
;
import
'../helper/mq.dart'
;
import
'../main.dart'
;
import
'package:flutter/services.dart'
as
bundle_root
;
import
'home/new_home2.dart'
;
...
...
@@ -50,6 +52,7 @@ class _SplashState extends State<Splash> {
@override
void
initState
()
{
loadBaseUrl
().
then
((
baseUrl
)
{
runMqTT
(
context
);
setBaseUrl
(
baseUrl
);
if
(
widget
.
pathSegmentString
.
isEmpty
)
{
Geolocator
.
requestPermission
().
then
((
permission
)
{
...
...
@@ -87,12 +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
(),
),
);
}
});
});
}
else
{
...
...
lib/ui/viewbill/list_order.dart
View file @
208bf8af
// ignore_for_file: sized_box_for_whitespace
import
'package:flutter/material.dart'
;
import
'../../models/bill.dart'
;
import
'../../models/bill_detail.dart'
;
import
'order_view_bill_new.dart'
;
class
ListOrder
extends
StatelessWidget
{
const
ListOrder
({
Key
?
key
,
required
this
.
bill
Detail
,
required
this
.
bill
,
required
this
.
isHistory
,
required
this
.
tableStatus
,
})
:
super
(
key:
key
);
final
List
<
Bill
Detail
>
billDetai
l
;
final
List
<
Bill
>
bil
l
;
final
bool
isHistory
;
final
int
tableStatus
;
@override
Widget
build
(
BuildContext
context
)
{
int
itemCounts
=
billDetail
.
length
;
return
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
// to disable scrolling
shrinkWrap:
true
,
itemCount:
itemCounts
,
itemBuilder:
(
ctx
,
i
)
{
itemCount:
bill
.
length
,
itemBuilder:
(
context
,
i
)
{
return
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
// to disable scrolling
shrinkWrap:
true
,
itemCount:
bill
[
i
].
billDetail
.
length
,
itemBuilder:
(
ctx
,
d
)
{
return
OrderViewBillNew
(
billDetail:
billDetail
[
i
],
lastItem:
(
i
+
1
==
itemCounts
)
?
true
:
false
,
billDetail:
bill
[
i
].
billDetail
[
d
],
lastItem:
(
i
+
1
==
bill
[
i
].
billDetail
.
length
)
?
true
:
false
,
isHistory:
isHistory
,
tableStatus:
tableStatus
,
);
},
);
});
}
}
lib/ui/viewbill/order_view_bill_new.dart
View file @
208bf8af
...
...
@@ -125,6 +125,13 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
@override
Widget
build
(
BuildContext
contextOrderViewBill
)
{
double
paddingLeftRightBill
=
32
;
int
paymentMode
=
getPaymentMode
();
String
itemQuantityString
;
if
(
widget
.
billDetail
.
quantity
>
1
)
{
itemQuantityString
=
'
${widget.billDetail.quantity}
items'
;
}
else
{
itemQuantityString
=
'
${widget.billDetail.quantity}
item'
;
}
return
Container
(
// padding: const EdgeInsets.symmetric(horizontal: 32),
padding:
EdgeInsets
.
only
(
...
...
@@ -197,7 +204,9 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
),
defaultText
(
context
,
'Rp
${formatNumber().format(amountParseToInt(widget.billDetail.total))}
'
,
(
paymentMode
==
openBill
)
?
'Rp
${formatNumber().format(amountParseToInt(widget.billDetail.total))}
|
$itemQuantityString
'
:
'Rp
${formatNumber().format(amountParseToInt(widget.billDetail.total))}
'
,
style:
viewbillStyle
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
...
...
@@ -226,8 +235,8 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
],
),
),
isVisibleAddRemoveQuantityButtonCheckout
(
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
isVisibleAddRemoveQuantityButtonCheckout
(
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
?
Container
(
padding:
EdgeInsets
.
only
(
left:
paddingLeftRightBill
,
...
...
@@ -238,14 +247,14 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
),
)
:
const
SizedBox
(),
isVisibleAddRemoveQuantityButtonCheckout
(
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
isVisibleAddRemoveQuantityButtonCheckout
(
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
?
const
SizedBox
(
height:
11
,
)
:
const
SizedBox
(),
isVisibleAddRemoveQuantityButtonCheckout
(
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
isVisibleAddRemoveQuantityButtonCheckout
(
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
?
Container
(
padding:
EdgeInsets
.
only
(
left:
paddingLeftRightBill
,
...
...
lib/ui/viewbill/rincian_pembayaran.dart
View file @
208bf8af
import
'package:byod/helper/prefs.dart'
;
import
'package:flutter/material.dart'
;
import
'../../helper/helper.dart'
;
...
...
@@ -23,10 +24,11 @@ class RincianPembayaran extends StatelessWidget {
horizontal:
paddingLeftRight
,
vertical:
16
,
),
height:
209
,
//
height: 209,
color:
backgroundWhite
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
defaultText
(
context
,
...
...
@@ -87,6 +89,66 @@ class RincianPembayaran extends StatelessWidget {
),
],
),
(
getIsDeliveryPickup
())
?
const
SizedBox
(
height:
8
,
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
())
?
Row
(
children:
[
defaultText
(
context
,
'Packaging Fee'
,
style:
rincianPembayaran
(
font:
12
,
color:
textGreyBill
,
),
),
const
Spacer
(),
defaultText
(
context
,
(
amountParseToInt
(
dataBill
[
0
].
packagingFee
)
==
0
)
?
'-'
:
'Rp
${formatNumber().format(amountParseToInt(dataBill[0].packagingFee))}
'
,
style:
rincianPembayaran
(
font:
12
,
color:
textGreyBill
,
),
),
],
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
())
?
const
SizedBox
(
height:
8
,
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
())
?
Row
(
children:
[
defaultText
(
context
,
'Platform Fee'
,
style:
rincianPembayaran
(
font:
12
,
color:
textGreyBill
,
),
),
const
Spacer
(),
defaultText
(
context
,
(
amountParseToInt
(
dataBill
[
0
].
platformFee
)
==
0
)
?
'-'
:
'Rp
${formatNumber().format(amountParseToInt(dataBill[0].platformFee))}
'
,
style:
rincianPembayaran
(
font:
12
,
color:
textGreyBill
,
),
),
],
)
:
const
SizedBox
(),
const
SizedBox
(
height:
8
,
),
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
208bf8af
...
...
@@ -9,6 +9,7 @@ import 'package:byod/helper/widget/style.dart';
import
'package:byod/ui/history_order/history_new.dart'
;
import
'package:byod/ui/payment/payment_balance.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:byod/ui/select_branch.dart'
;
import
'package:dotted_line/dotted_line.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
...
...
@@ -411,7 +412,9 @@ class CoreBill extends StatelessWidget {
child:
defaultText
(
context
,
(
isDeliveryPickuup
)
?
(
getIsCustomerDelivery
())
?
'Delivery'
:
'Pickup'
:
'Meja
${dataBill[0].tableName}
'
,
style:
viewbillStyle
()),
),
...
...
@@ -430,112 +433,7 @@ class CoreBill extends StatelessWidget {
(
isDeliveryPickuup
)
?
GestureDetector
(
onTap:
()
{
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
(),
),
Container
(
padding:
const
EdgeInsets
.
only
(
top:
19
,
bottom:
25
,
left:
10
),
child:
Row
(
children:
[
const
Image
(
image:
AssetImage
(
'assets/icons/pickup-icon.png'
),
),
const
SizedBox
(
width:
12
,
),
defaultText
(
context
,
'Pick Up'
,
style:
pickUpdeliveryStyleFont
(),
)
],
),
),
Container
(
padding:
const
EdgeInsets
.
only
(
left:
10
,
bottom:
24
),
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
(),
)
],
),
)
],
),
);
},
);
modalBottomSelectOption
(
context
);
},
child:
Container
(
height:
30
,
...
...
@@ -573,7 +471,7 @@ class CoreBill extends StatelessWidget {
)
:
const
SizedBox
(),
(
isDeliveryPickuup
)
?
const
DeliveryPickupDetail
()
?
DeliveryPickupDetail
()
:
const
SizedBox
(),
const
SizedBox
(
height:
24
,
...
...
@@ -671,7 +569,7 @@ class CoreBill extends StatelessWidget {
),
),
ListOrder
(
bill
Detail:
dataBill
[
0
].
billDetai
l
,
bill
:
dataBil
l
,
isHistory:
isHistory
,
tableStatus:
dataBill
[
0
].
tableStatus
,
),
...
...
@@ -1350,13 +1248,120 @@ class CoreBill extends StatelessWidget {
},
);
}
Future
<
dynamic
>
modalBottomSelectOption
(
BuildContext
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:
()
{
setIsCustomerDelivery
(
false
);
getBillFunc
(
context
);
Navigator
.
pop
(
context
);
},
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:
()
{
setIsCustomerDelivery
(
true
);
getBillFunc
(
context
);
Navigator
.
pop
(
context
);
},
child:
Container
(
padding:
const
EdgeInsets
.
only
(
left:
10
,
bottom:
24
),
color:
backgroundWhite
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Row
(
children:
[
const
Image
(
image:
AssetImage
(
'assets/icons/delivery-icon.png'
),
),
const
SizedBox
(
width:
12
,
),
defaultText
(
context
,
'Delivery'
,
style:
pickUpdeliveryStyleFont
(),
)
],
),
defaultText
(
context
,
'23 Menit'
,
style:
pickUpdeliveryStyleFont
(),
)
],
),
),
)
],
),
);
},
);
}
}
class
DeliveryPickupDetail
extends
StatelessWidget
{
const
DeliveryPickupDetail
({
DeliveryPickupDetail
({
Key
?
key
,
})
:
super
(
key:
key
);
final
bool
isDelivery
=
getIsCustomerDelivery
();
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
...
...
@@ -1365,7 +1370,97 @@ class DeliveryPickupDetail extends StatelessWidget {
vertical:
12
,
),
color:
backgroundWhite
.
withOpacity
(
0.9
),
child:
Column
(
child:
(
isDelivery
)
?
deliveryOption
(
context
)
:
pickupOption
(
context
),
);
}
Row
pickupOption
(
BuildContext
context
)
{
return
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
const
Image
(
fit:
BoxFit
.
fill
,
width:
40
,
height:
40
,
image:
AssetImage
(
'assets/icons/outlet.png'
),
),
const
SizedBox
(
width:
12
,
),
defaultText
(
context
,
getBranchName
(),
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
),
const
SizedBox
(
width:
12
,
),
const
Spacer
(),
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
,
),
),
),
),
)
],
);
}
Column
deliveryOption
(
BuildContext
context
)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Row
(
...
...
@@ -1476,7 +1571,6 @@ class DeliveryPickupDetail extends StatelessWidget {
],
),
],
),
);
}
}
...
...
pubspec.lock
View file @
208bf8af
...
...
@@ -71,6 +71,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
event_bus:
dependency: transitive
description:
name: event_bus
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
fake_async:
dependency: transitive
description:
...
...
@@ -268,6 +275,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
mqtt_client:
dependency: "direct main"
description:
name: mqtt_client
url: "https://pub.dartlang.org"
source: hosted
version: "9.7.2"
nested:
dependency: transitive
description:
...
...
pubspec.yaml
View file @
208bf8af
...
...
@@ -39,6 +39,7 @@ dependencies:
http
:
^0.13.4
intl
:
^0.17.0
loading_animations
:
^2.2.0
mqtt_client
:
^9.7.2
scrollable_positioned_list
:
^0.3.4
shared_preferences
:
^2.0.15
shimmer
:
^2.0.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment