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
Expand all
Hide 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
...
...
@@ -7,15 +7,17 @@ import '../helper.dart';
import
'button_modal.dart'
;
Future
<
dynamic
>
buttonDialogGlobal
(
BuildContext
context
,
String
title
,
String
description
,
String
textOnOk
,
String
textOnCancel
,
void
Function
()
ontapOk
,
void
Function
()
ontapCancel
,
{
Color
okButtonColor
=
Colors
.
indigo
,
Color
cancelButtonColor
=
Colors
.
red
})
{
BuildContext
context
,
String
title
,
String
description
,
String
textOnOk
,
String
textOnCancel
,
void
Function
()
ontapOk
,
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,23 +61,25 @@ void main() async {
[
DeviceOrientation
.
portraitUp
,
DeviceOrientation
.
portraitDown
]);
setPathUrlStrategy
();
WidgetsFlutterBinding
.
ensureInitialized
();
prefs
=
await
SharedPreferences
.
getInstance
();
configLoading
();
for
(
int
d
=
0
;
d
<
Uri
.
base
.
pathSegments
.
length
;
d
++)
{
stringPath
.
add
(
Uri
.
base
.
pathSegments
[
d
]);
if
(
d
==
Uri
.
base
.
pathSegments
.
length
-
1
)
{
routesToAccess
+=
Uri
.
base
.
pathSegments
[
d
];
}
else
{
routesToAccess
+=
'
${Uri.base.pathSegments[d]}
/'
;
SharedPreferences
.
getInstance
().
then
((
value
)
{
prefs
=
value
;
configLoading
();
for
(
int
d
=
0
;
d
<
Uri
.
base
.
pathSegments
.
length
;
d
++)
{
stringPath
.
add
(
Uri
.
base
.
pathSegments
[
d
]);
if
(
d
==
Uri
.
base
.
pathSegments
.
length
-
1
)
{
routesToAccess
+=
Uri
.
base
.
pathSegments
[
d
];
}
else
{
routesToAccess
+=
'
${Uri.base.pathSegments[d]}
/'
;
}
}
}
loadAssetConfig
().
then
((
title
)
{
setTitleWeb
(
title
);
run
App
(
MyApp
(
title:
title
,
)
,
);
loadAssetConfig
().
then
((
title
)
{
setTitleWeb
(
title
);
runApp
(
My
App
(
title:
title
,
)
,
)
;
}
);
});
}
...
...
@@ -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,31 +23,35 @@ class Bill {
String
tableName
;
bool
isFeedBack
;
String
dokuMinPay
;
String
packagingFee
;
String
platformFee
;
// List<MemberInfo> memberInfo;
Bill
(
{
required
this
.
id
,
required
this
.
totalSeluruhOrderan
,
required
this
.
subTotalSeluruhOrderan
,
required
this
.
totalPerCustomer
,
required
this
.
customerName
,
required
this
.
tableStatus
,
required
this
.
orderStatus
,
required
this
.
state
,
required
this
.
outStandingPay
,
required
this
.
outStandingIndividu
,
required
this
.
dateOrder
,
this
.
billDetail
=
const
[],
this
.
paymentList
=
const
[],
required
this
.
invoice
,
required
this
.
totalService
,
required
this
.
totalServiceTax
,
required
this
.
discountTotal
,
required
this
.
tableName
,
required
this
.
isFeedBack
,
required
this
.
dokuMinPay
// this.memberInfo = const []
});
Bill
({
required
this
.
id
,
required
this
.
totalSeluruhOrderan
,
required
this
.
subTotalSeluruhOrderan
,
required
this
.
totalPerCustomer
,
required
this
.
customerName
,
required
this
.
tableStatus
,
required
this
.
orderStatus
,
required
this
.
state
,
required
this
.
outStandingPay
,
required
this
.
outStandingIndividu
,
required
this
.
dateOrder
,
this
.
billDetail
=
const
[],
this
.
paymentList
=
const
[],
required
this
.
invoice
,
required
this
.
totalService
,
required
this
.
totalServiceTax
,
required
this
.
discountTotal
,
required
this
.
tableName
,
required
this
.
isFeedBack
,
required
this
.
dokuMinPay
,
this
.
packagingFee
=
"0.00"
,
this
.
platformFee
=
"0.00"
,
// this.memberInfo = const []
});
factory
Bill
.
createBill
(
Map
<
String
,
dynamic
>
json
)
{
return
Bill
(
...
...
@@ -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
This diff is collapsed.
Click to expand it.
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,21 +80,64 @@ class CoreBranch extends StatelessWidget {
itemBuilder:
(
context
,
i
)
{
return
GestureDetector
(
onTap:
()
{
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
listBranch
[
i
].
branchCode
,
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
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
(),
getRole
(),
getCashierName
(),
getOrderId
(),
);
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
()),
);
setIsDelivery
(
listBranch
[
i
].
isDelivery
);
setIsPickup
(
listBranch
[
i
].
isPickup
);
setBranch
(
listBranch
[
i
].
branchCode
);
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
{
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
{
...
...
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
)
{
return
OrderViewBillNew
(
billDetail:
billDetail
[
i
],
lastItem:
(
i
+
1
==
itemCounts
)
?
true
:
false
,
isHistory:
isHistory
,
tableStatus:
tableStatus
,
);
},
);
physics:
const
NeverScrollableScrollPhysics
(),
// to disable scrolling
shrinkWrap:
true
,
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:
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
This diff is collapsed.
Click to expand it.
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