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
be178cf2
Commit
be178cf2
authored
Oct 10, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add promo cc mandiri
parent
28c996e2
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
249 additions
and
87 deletions
+249
-87
api.dart
lib/api/api.dart
+71
-6
branch_exist.dart
lib/bloc/branch_exist.dart
+14
-2
bill.dart
lib/models/bill.dart
+25
-22
new_home2.dart
lib/ui/home/new_home2.dart
+1
-2
splash.dart
lib/ui/splash.dart
+5
-2
app_bar.dart
lib/ui/viewbill/app_bar.dart
+17
-3
view_bill.dart
lib/ui/viewbill/view_bill.dart
+4
-2
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+112
-48
No files found.
lib/api/api.dart
View file @
be178cf2
...
...
@@ -295,12 +295,15 @@ class Api {
String
brandCode
,
String
role
,
String
cashierName
,
String
tokenUser
)
async
{
String
tokenUser
,
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
'
${baseUrl}
romi/api/v2/byod/get_menu'
;
// List<FilterMenu> filterMenu = [];
List
<
FilterMenu
>
filterMenu
=
[];
// List<FilterMenu> filterMenuResult = [];
String
sessionID
=
prefs
.
getString
(
'sessionId'
)
??
''
;
try
{
Map
data
=
{
"branch_code"
:
branchCode
,
...
...
@@ -308,7 +311,8 @@ class Api {
"role"
:
role
,
"cashier_name"
:
cashierName
,
"secure_token"
:
tokenUser
,
"from"
:
fromByod
"from"
:
fromByod
,
"session_id"
:
sessionID
,
};
var
bodies
=
jsonEncode
(
data
);
// var apiResult = await http.post(Uri.parse(apiUrl), body: bodies);
...
...
@@ -828,6 +832,8 @@ class Api {
"doku_minimum_payment"
:
jsonObject
[
'data'
]
[
'doku_minimum_payment'
],
"order_date"
:
jsonObject
[
'data'
][
'order_date'
],
"is_allow_promotion"
:
jsonObject
[
'data'
][
'is_allow_promotion'
]
??
"0"
,
};
bill
.
add
(
Bill
.
createBill
(
i
));
// billDetail.add(BillDetail.createBillDetail(orderDetail[d]));
...
...
@@ -1679,4 +1685,63 @@ class Api {
return
feedBack
;
}
}
static
Future
<
bool
>
addCancelPromotion
(
String
orderID
,
bool
isAdd
)
async
{
await
EasyLoading
.
show
(
status:
'Please wait...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
;
if
(
isAdd
)
{
apiUrl
=
"
${baseUrl}
romi/api/byod/add_promotions"
;
}
else
{
apiUrl
=
"
${baseUrl}
romi/api/byod/cancel_promotions"
;
}
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
userName
=
prefs
.
getString
(
'userName'
)
??
''
;
try
{
Map
data
=
{
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
"from"
:
fromByod
,
"order_id"
:
orderID
,
};
var
bodies
=
jsonEncode
(
data
);
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'addPromotion'
);
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
if
(
isAdd
)
{
await
prefs
.
setBool
(
'isPromoActive'
,
true
);
EasyLoading
.
showToast
(
'Promosi aktif'
);
}
else
{
await
prefs
.
setBool
(
'isPromoActive'
,
false
);
EasyLoading
.
showToast
(
'Promosi tidak aktif'
);
}
return
true
;
}
else
{
EasyLoading
.
showToast
(
jsonObject
[
'msg'
]);
return
false
;
}
}
else
{
EasyLoading
.
showToast
(
'Something went wrong'
);
return
false
;
}
}
catch
(
e
)
{
if
(
debug
)
{
logd
(
'API CLASS ON API.DART, FUNGSI: addPromotion, URL :
$apiUrl
'
,
'ERROR CONNECT TO SERVER, ERROR CATCH :
$e
'
);
}
EasyLoading
.
showToast
(
'Cant connect to server'
);
return
false
;
}
}
}
lib/bloc/branch_exist.dart
View file @
be178cf2
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../api/api.dart'
;
import
'../helper/helper.dart'
;
import
'filter_menu.dart'
;
class
BranchExist
extends
Cubit
<
String
>
{
BranchExist
()
:
super
(
responseApiWaiting
);
...
...
@@ -13,10 +15,20 @@ class BranchExist extends Cubit<String> {
return
apiGetBranch
;
}
void
branchExist
(
String
branchCode
,
String
brandCode
,
String
role
,
String
cashierName
,
String
sessionId
)
{
void
branchExist
(
BuildContext
context
,
String
branchCode
,
String
brandCode
,
String
role
,
String
cashierName
,
String
sessionId
,
{
bool
getMenu
=
false
,
String
token
=
''
})
{
getBranch
(
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
)
.
then
((
value
)
{
if
(
getMenu
)
{
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
branchCode
,
brandCode
,
role
,
cashierName
,
token
,
);
}
emit
(
value
);
});
}
...
...
lib/models/bill.dart
View file @
be178cf2
...
...
@@ -22,10 +22,11 @@ class Bill {
String
tableName
;
bool
isFeedBack
;
String
dokuMinPay
;
String
isPromotionAllow
;
// List<MemberInfo> memberInfo;
Bill
(
{
required
this
.
id
,
Bill
(
{
required
this
.
id
,
required
this
.
totalSeluruhOrderan
,
required
this
.
subTotalSeluruhOrderan
,
required
this
.
totalPerCustomer
,
...
...
@@ -43,7 +44,8 @@ class Bill {
required
this
.
discountTotal
,
required
this
.
tableName
,
required
this
.
isFeedBack
,
required
this
.
dokuMinPay
required
this
.
dokuMinPay
,
this
.
isPromotionAllow
=
"0"
,
// this.memberInfo = const []
});
...
...
@@ -68,6 +70,7 @@ class Bill {
isFeedBack:
json
[
'is_feedback'
],
dokuMinPay:
json
[
'doku_minimum_payment'
],
dateOrder:
json
[
'order_date'
],
isPromotionAllow:
json
[
'is_allow_promotion'
]
??
"0"
,
// memberInfo: json['member_info']
);
}
...
...
lib/ui/home/new_home2.dart
View file @
be178cf2
...
...
@@ -947,14 +947,13 @@ class _NewHome2State extends State<NewHome2> {
style:
const
TextStyle
(
fontFamily:
'OpenSans'
,
fontSize:
14
,
color:
textColor
ModalHeaderNama
,
color:
textColor
Black
,
),
decoration:
const
InputDecoration
(
labelText:
'Nama panggilan'
,
labelStyle:
TextStyle
(
fontFamily:
'OpenSans'
,
fontSize:
14
,
fontWeight:
FontWeight
.
w600
,
color:
textColorModalHeaderNama
,
),
),
...
...
lib/ui/splash.dart
View file @
be178cf2
...
...
@@ -57,17 +57,20 @@ class _SplashState extends State<Splash> {
loadBaseUrl
().
then
((
baseUrl
)
{
prefs
.
setString
(
'baseUrl'
,
baseUrl
);
context
.
read
<
BranchExist
>().
branchExist
(
context
,
widget
.
param
,
widget
.
brand
,
widget
.
role
,
widget
.
cashierName
,
widget
.
sessionId
,
getMenu:
true
,
token:
widget
.
token
,
);
// context.read<CategoryMenu>().catAndMenu(widget.param, widget.brand,
// widget.role, widget.cashierName, widget.token);
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
widget
.
param
,
widget
.
brand
,
widget
.
role
,
widget
.
cashierName
,
widget
.
token
);
//
context.read<FilterMenuBloc>().catAndMenu(widget.param, widget.brand,
//
widget.role, widget.cashierName, widget.token);
if
(
widget
.
token
!=
''
)
{
context
.
read
<
MemberInfoBloc
>().
getMemberInfo
(
widget
.
token
);
...
...
lib/ui/viewbill/app_bar.dart
View file @
be178cf2
...
...
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../bloc/branch_exist.dart'
;
import
'../../bloc/filter_menu.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../../main.dart'
;
...
...
@@ -24,6 +25,7 @@ class CustomAppBar extends StatelessWidget {
String
role
=
prefs
.
getString
(
'role'
)
??
''
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
sessionId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
tokenMember
=
prefs
.
getString
(
'token'
)
??
''
;
return
Container
(
padding:
const
EdgeInsets
.
only
(
top:
15
,
...
...
@@ -39,10 +41,22 @@ class CustomAppBar extends StatelessWidget {
GestureDetector
(
onTap:
()
{
if
(!
isHistory
)
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
(),
),
);
context
.
read
<
BranchExist
>().
branchExist
(
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
);
context
,
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
,
getMenu:
true
,
token:
tokenMember
,
);
}
else
{
Navigator
.
pop
(
context
);
}
...
...
lib/ui/viewbill/view_bill.dart
View file @
be178cf2
...
...
@@ -410,6 +410,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
context
.
read
<
BranchExist
>()
.
branchExist
(
context
,
branchCode
,
brandCode
,
role
,
...
...
@@ -745,6 +746,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
GestureDetector
(
onTap:
()
{
context
.
read
<
BranchExist
>().
branchExist
(
context
,
branchCode
,
brandCode
,
role
,
...
...
@@ -1249,8 +1251,8 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
if
(!
widget
.
isHistory
)
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
context
.
read
<
BranchExist
>().
branchExist
(
bran
chCode
,
bran
dCode
,
role
,
cashierName
,
sessionId
);
context
.
read
<
BranchExist
>().
branchExist
(
context
,
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
);
}
else
{
Navigator
.
pop
(
context
);
}
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
be178cf2
...
...
@@ -16,6 +16,7 @@ import 'package:uuid/uuid.dart';
import
'../../api/api.dart'
;
import
'../../bloc/branch_exist.dart'
;
import
'../../bloc/feedback_option.dart'
;
import
'../../bloc/filter_menu.dart'
;
import
'../../bloc/view_bill.dart'
;
import
'../../bloc/voucher_list.dart'
;
import
'../../helper/widget/button_dialog.dart'
;
...
...
@@ -362,6 +363,7 @@ class CoreBill extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
bool
isPromotionActive
=
prefs
.
getBool
(
'isPromoActive'
)
??
false
;
return
BlocBuilder
<
MemberInfoBloc
,
MemberInfo
>(
builder:
(
contextMember
,
memberinfo
)
{
int
outStandingTopayMember
=
0
;
...
...
@@ -384,6 +386,7 @@ class CoreBill extends StatelessWidget {
),
Expanded
(
child:
SingleChildScrollView
(
physics:
const
AlwaysScrollableScrollPhysics
(),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -831,6 +834,24 @@ class CoreBill extends StatelessWidget {
width:
widthScreen
,
child:
Column
(
children:
[
(
dataBill
[
0
].
isPromotionAllow
==
"1"
&&
!
isPromotionActive
&&
memberinfo
.
id
==
''
)
?
GestureDetector
(
onTap:
()
{
Api
.
addCancelPromotion
(
dataBill
[
0
].
id
,
true
)
.
then
((
value
)
{
if
(
value
)
{
context
.
read
<
ViewBillBloc
>().
getBill
();
}
});
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'Promo CC Mandiri'
,
),
)
:
const
SizedBox
(),
GestureDetector
(
onTap:
()
{
if
(
dataBill
[
0
].
tableStatus
==
tableStatusOpen
)
{
...
...
@@ -1099,7 +1120,8 @@ class CoreBill extends StatelessWidget {
),
),
),
(
dataBill
[
0
].
isFeedBack
==
false
&&
(!
isPromotionActive
)
?
(
dataBill
[
0
].
isFeedBack
==
false
&&
dataBill
[
0
].
tableStatus
==
tableStatusOpen
)
?
Column
(
children:
[
...
...
@@ -1112,7 +1134,8 @@ class CoreBill extends StatelessWidget {
tableStatusOpen
)
{
onTapCashier
();
}
else
{
if
(
dataBill
[
0
].
isFeedBack
==
false
)
{
if
(
dataBill
[
0
].
isFeedBack
==
false
)
{
ratingModal
(
context
,
dataBill
,
...
...
@@ -1122,12 +1145,10 @@ class CoreBill extends StatelessWidget {
}
}
},
child:
ButtonComponent
(
child:
const
ButtonComponent
(
buttonColor:
successColor
,
teksButton:
(
dataBill
[
0
].
tableStatus
==
tableStatusOpen
)
?
'Tutup Pesanan & Minta Bill'
:
'Beri Penilaian'
,
teksButton:
'Tutup Pesanan & Minta Bill'
,
)
// child: Container(
// margin: const EdgeInsets.only(top: 12),
...
...
@@ -1150,7 +1171,31 @@ class CoreBill extends StatelessWidget {
),
],
)
:
const
SizedBox
(),
:
const
SizedBox
()
:
Column
(
children:
[
const
SizedBox
(
height:
12
,
),
GestureDetector
(
onTap:
()
{
Api
.
addCancelPromotion
(
dataBill
[
0
].
id
,
false
,
).
then
((
value
)
{
if
(
value
)
{
context
.
read
<
ViewBillBloc
>().
getBill
();
}
});
},
child:
ButtonComponent
(
buttonColor:
cancelColorButton
,
teksButton:
'Batalkan Promo CC Mandiri'
,
teksButtonColor:
textColorBlack
,
),
),
],
),
const
SizedBox
(
height:
5
,
),
...
...
@@ -1304,6 +1349,7 @@ class EmptyBill extends StatelessWidget {
GestureDetector
(
onTap:
()
{
context
.
read
<
BranchExist
>().
branchExist
(
context
,
branchCode
,
brandCode
,
role
,
...
...
@@ -1313,7 +1359,9 @@ class EmptyBill extends StatelessWidget {
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
builder:
(
_
)
=>
const
NewHome2
(),
),
);
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
...
...
@@ -1835,6 +1883,12 @@ class AddMoreOrder extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
''
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
sessionId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
tokenMember
=
prefs
.
getString
(
'token'
)
??
''
;
return
Container
(
height:
80
,
...
...
@@ -1863,6 +1917,16 @@ class AddMoreOrder extends StatelessWidget {
),
GestureDetector
(
onTap:
()
{
context
.
read
<
BranchExist
>().
branchExist
(
context
,
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
,
getMenu:
true
,
token:
tokenMember
,
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
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