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
1296ca98
Commit
1296ca98
authored
Oct 03, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s
parent
41f23cb1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
411 additions
and
171 deletions
+411
-171
config.json
assets/config.json
+1
-1
api.dart
lib/api/api.dart
+15
-12
helper.dart
lib/helper/helper.dart
+8
-0
prefs.dart
lib/helper/prefs.dart
+45
-0
main.dart
lib/main.dart
+183
-124
bill.dart
lib/models/bill.dart
+1
-1
no_route.dart
lib/ui/no_route.dart
+53
-8
splash.dart
lib/ui/splash.dart
+54
-23
app_bar.dart
lib/ui/viewbill/app_bar.dart
+2
-2
GeneratedPluginRegistrant.swift
macos/Flutter/GeneratedPluginRegistrant.swift
+2
-0
pubspec.lock
pubspec.lock
+42
-0
pubspec.yaml
pubspec.yaml
+1
-0
generated_plugin_registrant.cc
windows/flutter/generated_plugin_registrant.cc
+3
-0
generated_plugins.cmake
windows/flutter/generated_plugins.cmake
+1
-0
No files found.
assets/config.json
View file @
1296ca98
{
"base_url"
:
"https://
neo.ravku.com
/"
,
"base_url"
:
"https://
58a4-125-165-98-228.ap.ngrok.io
/"
,
"title"
:
"Ravintola Dev BYOD"
,
"isResponsive"
:
true
,
"debug"
:
true
...
...
lib/api/api.dart
View file @
1296ca98
...
...
@@ -47,7 +47,8 @@ class Api {
String
role
,
String
cashierName
,
String
orderId
)
async
{
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
'
$baseUrl${endPoint}
get_branch'
;
String
latitude
=
getLatitude
();
String
longitude
=
getLongitude
();
String
currentSessionId
=
getSessionId
();
const
uuidInit
=
Uuid
();
var
uuid
=
uuidInit
.
v4
();
...
...
@@ -65,7 +66,10 @@ class Api {
"cashier_name"
:
cashierName
,
"order_id"
:
orderId
,
"session_id"
:
sessionId
,
"from"
:
fromByod
"from"
:
fromByod
,
"url_lookup"
:
'https://dimas.com'
,
"customer_lat"
:
latitude
,
"customer_long"
:
longitude
,
};
var
bodies
=
json
.
encode
(
data
);
// var apiResult = await http.post(Uri.parse(apiUrl), body: bodies);
...
...
@@ -102,14 +106,12 @@ class Api {
setListHistory
(
listHistory
);
}
setOrderId
(
jsonObject
[
'data'
][
'order_id'
]);
// setTableMode(jsonObject['data']['table_mode']);
setLogoUrl
(
jsonObject
[
'data'
][
'logo'
]);
setSesssionId
(
jsonObject
[
'data'
][
'session_id'
]);
setSecretKey
(
jsonObject
[
'data'
][
'secret_key'
]);
setSessionCounter
(
jsonObject
[
'data'
][
'session_counter'
]);
//** save sessionID and Table Mode */
// return jsonObject['data']['name'];
setBranch
(
jsonObject
[
'data'
][
'code'
]);
setBrand
(
jsonObject
[
'data'
][
'brand_code'
]);
return
responseByodBranchExist
;
}
else
if
(
jsonObject
[
'status'
]
==
'error'
&&
(
jsonObject
[
'code'
]
==
'BYOD_ALWAYS_OFF'
||
...
...
@@ -325,8 +327,8 @@ class Api {
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"branch_code"
:
getBranchPref
()
,
"brand_code"
:
getBrand
()
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
"secure_token"
:
tokenUser
,
...
...
@@ -803,7 +805,7 @@ class Api {
"total"
:
orderDetail
[
d
][
'total'
],
"service"
:
orderDetail
[
d
][
'service'
],
"service_tax"
:
orderDetail
[
d
][
'service_tax'
],
"order_status"
:
orderDetail
[
d
][
'order_
status
'
],
"order_status"
:
orderDetail
[
d
][
'order_
detail_state
'
],
"notes"
:
orderDetail
[
d
][
'notes'
],
"image"
:
orderDetail
[
d
][
'image_small'
],
"variant"
:
variants
...
...
@@ -827,13 +829,14 @@ class Api {
"total"
:
orderDetail
[
d
][
'total'
],
"service"
:
orderDetail
[
d
][
'service'
],
"service_tax"
:
orderDetail
[
d
][
'service_tax'
],
"order_status"
:
orderDetail
[
d
][
'order_
status
'
],
"order_status"
:
orderDetail
[
d
][
'order_
detail_state
'
],
"notes"
:
orderDetail
[
d
][
'notes'
],
"image"
:
orderDetail
[
d
][
'image_small'
],
"variant"
:
variants
};
billDetail
.
add
(
BillDetail
.
createBillDetail
(
z
));
int
totalPerCustomer
=
amountParseToInt
(
z
[
'total'
]);
var
i
=
{
"id"
:
jsonObject
[
'data'
][
'id'
],
"total"
:
jsonObject
[
'data'
][
'total'
],
...
...
@@ -842,7 +845,7 @@ class Api {
"customer_name"
:
orderDetail
[
d
][
'customer_name'
],
"table_status"
:
jsonObject
[
'data'
][
'table_status'
],
"order_status"
:
jsonObject
[
'data'
][
'order_status'
],
"
state"
:
jsonObject
[
'data'
][
'
state'
],
"
order_state"
:
jsonObject
[
'data'
][
'order_
state'
],
"order_detail"
:
billDetail
,
"payment_list"
:
paymentList
,
"outstanding"
:
jsonObject
[
'data'
][
'outstanding'
],
...
...
@@ -852,7 +855,7 @@ class Api {
"my_self_outstanding"
:
jsonObject
[
'data'
]
[
'my_self_outstanding'
],
"discount_total"
:
jsonObject
[
'data'
][
'discount'
],
"table_number"
:
jsonObject
[
'data'
][
'table_number'
],
"table_number"
:
jsonObject
[
'data'
][
'table_number'
]
??
''
,
"is_feedback"
:
jsonObject
[
'data'
][
'is_feedback'
],
"doku_minimum_payment"
:
jsonObject
[
'data'
]
[
'doku_minimum_payment'
],
...
...
lib/helper/helper.dart
View file @
1296ca98
...
...
@@ -581,4 +581,12 @@ const int typeMenu = 3;
//** constanta redirect */
const
String
goBill
=
'go'
;
//** constanta redirect */
//** No Route Identification */
String
emptyUri
=
'emptyUri'
;
String
gpsNotActive
=
'gpsDisabled'
;
String
locationPermissinDenied
=
'locationdisabled'
;
String
configError
=
'configError'
;
String
titleError
=
'titleError'
;
//** No Route Identification */
//** END CONSTANT */
lib/helper/prefs.dart
View file @
1296ca98
...
...
@@ -19,6 +19,11 @@ const String _listHistory = 'list_history';
const
String
_logo
=
'logo'
;
const
String
_role
=
'role'
;
const
String
_cashierName
=
'cashier_name'
;
const
String
_urlLookUp
=
'url'
;
const
String
_latitude
=
'lat'
;
const
String
_longitude
=
'long'
;
const
String
_titleWeb
=
'title'
;
const
String
_isDeliveryPickup
=
'is_delivery_pickup'
;
String
getBaseUrl
(
)
{
return
prefs
.
getString
(
_baseUrl
)
??
''
;
...
...
@@ -159,3 +164,43 @@ String getCashierName() {
Future
<
void
>
setCashierName
(
String
value
)
async
{
prefs
.
setString
(
_cashierName
,
value
);
}
String
getUrlLookUp
(
)
{
return
prefs
.
getString
(
_urlLookUp
)
??
''
;
}
Future
<
void
>
setUrlLookUp
(
String
value
)
async
{
prefs
.
setString
(
_urlLookUp
,
value
);
}
String
getLatitude
(
)
{
return
prefs
.
getString
(
_latitude
)
??
''
;
}
Future
<
void
>
setLatitude
(
String
value
)
async
{
prefs
.
setString
(
_latitude
,
value
);
}
String
getLongitude
(
)
{
return
prefs
.
getString
(
_longitude
)
??
''
;
}
Future
<
void
>
setLongitude
(
String
value
)
async
{
prefs
.
setString
(
_longitude
,
value
);
}
String
getTitleWeb
(
)
{
return
prefs
.
getString
(
_titleWeb
)
??
''
;
}
Future
<
void
>
setTitleWeb
(
String
value
)
async
{
prefs
.
setString
(
_titleWeb
,
value
);
}
bool
getIsDeliveryPickup
(
)
{
return
prefs
.
getBool
(
_isDeliveryPickup
)
??
false
;
}
Future
<
void
>
setIsDeliveryPickup
(
bool
value
)
async
{
prefs
.
setBool
(
_isDeliveryPickup
,
value
);
}
lib/main.dart
View file @
1296ca98
This diff is collapsed.
Click to expand it.
lib/models/bill.dart
View file @
1296ca98
...
...
@@ -58,7 +58,7 @@ class Bill {
customerName:
json
[
'customer_name'
],
tableStatus:
json
[
'table_status'
],
orderStatus:
json
[
'order_status'
],
state:
json
[
'state'
],
state:
json
[
'
order_
state'
],
billDetail:
json
[
'order_detail'
],
paymentList:
json
[
'payment_list'
],
outStandingPay:
json
[
'outstanding'
],
...
...
lib/ui/no_route.dart
View file @
1296ca98
// ignore_for_file: must_be_immutable
// ignore_for_file: must_be_immutable
, avoid_unnecessary_containers
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/main.dart'
;
import
'package:flutter/material.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'../helper/widget/button_modal.dart'
;
class
NoRoute
extends
StatelessWidget
{
String
identification
;
...
...
@@ -32,26 +37,66 @@ class NoRoute extends StatelessWidget {
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.05
,
),
(
identification
==
'titleError'
)
(
identification
==
titleError
)
?
defaultText
(
context
,
"Scan QR Atau Kunjungi Alamat Outlet (Error: title)"
,
textAlign:
TextAlign
.
center
,
style:
textStyleNormalFont
(
context
),
)
:
(
identification
==
'configError'
)
:
(
identification
==
configError
)
?
defaultText
(
context
,
"Scan QR Atau Kunjungi Alamat Outlet (Error: config)"
,
textAlign:
TextAlign
.
center
,
style:
textStyleNormalFont
(
context
),
)
:
defaultText
(
context
,
"Scan QR Atau Kunjungi Alamat Outlet"
,
textAlign:
TextAlign
.
center
,
style:
textStyleNormalFont
(
context
),
:
(
identification
==
gpsNotActive
)
?
defaultText
(
context
,
"Delivery/Pickup order memerlukan akses GPS"
,
textAlign:
TextAlign
.
center
,
style:
textStyleNormalFont
(
context
),
)
:
(
identification
==
locationPermissinDenied
)
?
defaultText
(
context
,
"Delivery/Pickup order memerlukan akses lokasi anda"
,
textAlign:
TextAlign
.
center
,
style:
textStyleNormalFont
(
context
),
)
:
defaultText
(
context
,
"Scan QR Atau Kunjungi Alamat Outlet"
,
textAlign:
TextAlign
.
center
,
style:
textStyleNormalFont
(
context
),
),
(
identification
==
locationPermissinDenied
)
?
GestureDetector
(
onTap:
()
{
Geolocator
.
requestPermission
().
then
((
value
)
{
if
(
value
!=
LocationPermission
.
denied
)
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
MyApp
(
title:
getTitleWeb
(),
),
),
);
}
});
},
child:
Container
(
margin:
const
EdgeInsets
.
only
(
top:
15
),
width:
200
,
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'Aktifkan Lokasi'
,
),
),
)
:
const
SizedBox
()
],
),
)));
...
...
lib/ui/splash.dart
View file @
1296ca98
...
...
@@ -9,28 +9,41 @@ import 'package:byod/ui/no_route.dart';
import
'package:byod/ui/viewbill/view_bill_new.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'../bloc/branch_exist.dart'
;
import
'../main.dart'
;
import
'package:flutter/services.dart'
as
bundle_root
;
import
'home/new_home2.dart'
;
import
'home/shimmer_menu.dart'
;
import
'home/shimmer_menu_new.dart'
;
import
'screen_responsive.dart'
;
class
Splash
extends
StatefulWidget
{
final
String
branch
,
brand
,
tn
,
role
,
cashierName
,
toBill
,
orderId
,
token
;
const
Splash
(
{
Key
?
key
,
required
this
.
branch
,
required
this
.
brand
,
required
this
.
tn
,
required
this
.
role
,
required
this
.
cashierName
,
required
this
.
toBill
,
required
this
.
orderId
,
required
this
.
token
})
:
super
(
key:
key
);
final
String
branch
,
brand
,
tn
,
role
,
cashierName
,
toBill
,
orderId
,
token
,
url
,
lat
,
long
;
const
Splash
({
Key
?
key
,
required
this
.
branch
,
required
this
.
brand
,
required
this
.
tn
,
required
this
.
role
,
required
this
.
cashierName
,
required
this
.
toBill
,
required
this
.
orderId
,
required
this
.
token
,
this
.
url
=
''
,
this
.
lat
=
''
,
this
.
long
=
''
,
})
:
super
(
key:
key
);
@override
State
<
Splash
>
createState
()
=>
_SplashState
();
...
...
@@ -55,16 +68,34 @@ class _SplashState extends State<Splash> {
@override
void
initState
()
{
loadBaseUrl
().
then
((
baseUrl
)
{
setBaseUrl
(
baseUrl
);
context
.
read
<
BranchExist
>().
branchExist
(
widget
.
branch
,
widget
.
brand
,
widget
.
role
,
widget
.
cashierName
,
widget
.
orderId
,
Geolocator
.
checkPermission
().
then
((
permission
)
{
if
(
permission
!=
LocationPermission
.
denied
)
{
Geolocator
.
getCurrentPosition
().
then
((
position
)
{
setLatitude
(
position
.
latitude
.
toString
());
setLongitude
(
position
.
longitude
.
toString
());
setBaseUrl
(
baseUrl
);
context
.
read
<
BranchExist
>().
branchExist
(
widget
.
branch
,
widget
.
brand
,
widget
.
role
,
widget
.
cashierName
,
widget
.
orderId
,
context
,
getMenu:
true
,
);
});
}
else
{
Navigator
.
pushReplacement
(
context
,
getMenu:
true
,
MaterialPageRoute
(
builder:
(
_
)
=>
NoRoute
(
identification:
locationPermissinDenied
,
),
),
);
}
});
// context.read<CategoryMenu>().catAndMenu(widget.branch, widget.brand,
// widget.role, widget.cashierName, widget.token);
...
...
@@ -76,8 +107,8 @@ class _SplashState extends State<Splash> {
}
Future
.
delayed
(
const
Duration
(
milliseconds:
1000
),
()
async
{
setToken
(
widget
.
token
);
setBranch
(
widget
.
branch
);
setBrand
(
widget
.
brand
);
//
setBranch(widget.branch);
//
setBrand(widget.brand);
setTableNumber
(
widget
.
tn
);
setRole
(
widget
.
role
);
setCashierName
(
widget
.
cashierName
);
...
...
lib/ui/viewbill/app_bar.dart
View file @
1296ca98
...
...
@@ -23,7 +23,7 @@ class CustomAppBar extends StatelessWidget {
String
brandCode
=
getBrand
();
String
role
=
getRole
();
String
cashierName
=
getCashierName
();
String
session
Id
=
getOrderId
();
String
order
Id
=
getOrderId
();
return
Container
(
padding:
const
EdgeInsets
.
only
(
top:
15
,
...
...
@@ -46,7 +46,7 @@ class CustomAppBar extends StatelessWidget {
brandCode
,
role
,
cashierName
,
session
Id
,
order
Id
,
context
,
);
}
else
{
...
...
macos/Flutter/GeneratedPluginRegistrant.swift
View file @
1296ca98
...
...
@@ -5,10 +5,12 @@
import
FlutterMacOS
import
Foundation
import
geolocator_apple
import
shared_preferences_macos
import
url_launcher_macos
func
RegisterGeneratedPlugins
(
registry
:
FlutterPluginRegistry
)
{
GeolocatorPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"GeolocatorPlugin"
))
SharedPreferencesPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"SharedPreferencesPlugin"
))
UrlLauncherPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"UrlLauncherPlugin"
))
}
pubspec.lock
View file @
1296ca98
...
...
@@ -135,6 +135,48 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
geolocator:
dependency: "direct main"
description:
name: geolocator
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.2"
geolocator_android:
dependency: transitive
description:
name: geolocator_android
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.3"
geolocator_apple:
dependency: transitive
description:
name: geolocator_apple
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.2"
geolocator_platform_interface:
dependency: transitive
description:
name: geolocator_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.6"
geolocator_web:
dependency: transitive
description:
name: geolocator_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.6"
geolocator_windows:
dependency: transitive
description:
name: geolocator_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
html:
dependency: transitive
description:
...
...
pubspec.yaml
View file @
1296ca98
...
...
@@ -33,6 +33,7 @@ dependencies:
sdk
:
flutter
flutter_bloc
:
^8.0.1
flutter_easyloading
:
^3.0.3
geolocator
:
^9.0.2
http
:
^0.13.4
intl
:
^0.17.0
loading_animations
:
^2.2.0
...
...
windows/flutter/generated_plugin_registrant.cc
View file @
1296ca98
...
...
@@ -6,9 +6,12 @@
#include "generated_plugin_registrant.h"
#include <geolocator_windows/geolocator_windows.h>
#include <url_launcher_windows/url_launcher_windows.h>
void
RegisterPlugins
(
flutter
::
PluginRegistry
*
registry
)
{
GeolocatorWindowsRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"GeolocatorWindows"
));
UrlLauncherWindowsRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"UrlLauncherWindows"
));
}
windows/flutter/generated_plugins.cmake
View file @
1296ca98
...
...
@@ -3,6 +3,7 @@
#
list
(
APPEND FLUTTER_PLUGIN_LIST
geolocator_windows
url_launcher_windows
)
...
...
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