Commit afc75ab7 authored by Izol's avatar Izol

simply #3

parent dbead1a0
...@@ -101,6 +101,7 @@ class StartService { ...@@ -101,6 +101,7 @@ class StartService {
String approvalCode, String approvalCode,
String paymentMethod, String paymentMethod,
String paymentProvider, String paymentProvider,
String paymentNotes,
) async { ) async {
var result; var result;
try { try {
...@@ -112,6 +113,7 @@ class StartService { ...@@ -112,6 +113,7 @@ class StartService {
'approval_code': approvalCode, 'approval_code': approvalCode,
'payment_method': paymentMethod, 'payment_method': paymentMethod,
'payment_provider': paymentProvider, 'payment_provider': paymentProvider,
'payment_notes': paymentNotes,
}); });
} catch (error) { } catch (error) {
result = error.toString(); result = error.toString();
......
...@@ -423,6 +423,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -423,6 +423,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
samReport, samReport,
paymentMethod, paymentMethod,
paymentProvider, paymentProvider,
paymentNotes,
metodeBayar, metodeBayar,
status; status;
...@@ -430,16 +431,20 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -430,16 +431,20 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
infoMap = jsonDecode(info); infoMap = jsonDecode(info);
lastBalance = infoMap['balance'].toString(); lastBalance = infoMap['balance'].toString();
samReport = infoMap['report'].toString(); samReport = infoMap['report'].toString();
paymentMethod = 'QRIS'; paymentMethod = 'Qris';
// paymentProvider = PreferencesHelper.getString('provider');
paymentProvider = ''; var infoPaymentNotes = jsonDecode(info);
var reffNo = trxId.toString();
paymentProvider = '';
paymentNotes = "reffNo: $reffNo\nprovider: $paymentNotes";
print("ini adalag test hasil payment notes:$paymentNotes");
tid = PreferencesHelper.getString('outletname'); tid = PreferencesHelper.getString('outletname');
tid = tid.substring(tid.length -4); tid = tid.substring(tid.length -4);
if (int.parse(lastBalance) > int.parse(prevBalance!)) { if (int.parse(lastBalance) > int.parse(prevBalance!)) {
countMax = 0; countMax = 0;
var result = await StartService.topUpConfirm(cardNumber, lastBalance, tid, var result = await StartService.topUpConfirm(cardNumber, lastBalance, tid,
samReport, approvalCode, paymentMethod, paymentProvider); samReport, approvalCode, paymentMethod, paymentProvider, paymentNotes);
print('topUpConfirm result: $result'); print('topUpConfirm result: $result');
String readerDate, String readerDate,
...@@ -942,6 +947,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -942,6 +947,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
).show().then((value) { ).show().then((value) {
denom(outletName, infoCard); denom(outletName, infoCard);
// isShowingDialog = false;
// if (timer != null) timer?.cancel();
// tapIdle();
}); });
} }
if (duration == 0 && !isShowingDialog) { if (duration == 0 && !isShowingDialog) {
...@@ -954,8 +962,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -954,8 +962,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}); });
} }
void tapDial() async { void tapDial() async {
Future.delayed(const Duration(milliseconds: 500), () async { Future.delayed(const Duration(milliseconds: 500), () async {
var isTap = await StartService.getCard(); var isTap = await StartService.getCard();
...@@ -1239,19 +1245,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1239,19 +1245,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
Future.delayed(Duration(seconds: int.parse(idle)), () {
Navigator.of(context).pop(true);
setState(() {
isShowingDialog = true;
if (timer != null) timer?.cancel();
dataQris = null;
_showTap();
tapIdle();
});// Menutup dialog setelah durasi tertentu
});
return StatefulBuilder(builder: (context, StateSetter setState) { return StatefulBuilder(builder: (context, StateSetter setState) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: lightBackgroundColor image: const DecorationImage(
fit: BoxFit.cover,
image: AssetImage(
'assets/img_bg_card.png',
),
),
color: purpleColor
), ),
child: Stack( child: Stack(
children: [ children: [
BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Container(
color: Colors.black.withOpacity(0.2),
),
),
Center( Center(
child: SingleChildScrollView( child: SingleChildScrollView(
child: AlertDialog( child: AlertDialog(
...@@ -1269,16 +1285,15 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1269,16 +1285,15 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
), ),
width: 1100, width: 1100,
margin: margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
child: Row( child: Row(
children: [ children: [
Align( Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
Navigator.pop(context);
setState(() { setState(() {
Navigator.pop(context);
timer?.cancel(); timer?.cancel();
dataQris = null; dataQris = null;
isShowingDialog = true; isShowingDialog = true;
...@@ -1432,105 +1447,142 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1432,105 +1447,142 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
], ],
), ),
), ),
Column( Container(
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.symmetric(horizontal: 17),
children: [ child: Column(
SizedBox(height: 15,), crossAxisAlignment: CrossAxisAlignment.start,
Text( children: [
'Pilih nominal isi ulang', SizedBox(height: 15,),
style: blackTextStyle.copyWith( Text(
fontSize: 20, 'Pilih nominal isi ulang',
fontWeight: bold, style: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
), ),
), Text(
Text( 'Choose topup amount',
'Choose topup amount', style: greyTextStyle.copyWith(
style: greyTextStyle.copyWith( fontSize: 15,
fontSize: 15, fontStyle: FontStyle.italic,
fontStyle: FontStyle.italic, fontWeight: light,
fontWeight: light, ),
), ),
), SizedBox(
SizedBox( height: 20,
height: 20, ),
), Row(
Row( children: [
children: [ Expanded(
Expanded( child: GestureDetector(
child: GestureDetector( onTap: () {
onTap: () { if (timer != null) timer?.cancel();
if (timer != null) timer?.cancel(); tapIdle();
tapIdle();
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp1; amountController!.text = cTopUp1;
}); });
} }
}, },
child: Container( child: Container(
padding: padding:
EdgeInsets.symmetric(vertical: 15), EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: amountController!.text == color: amountController!.text ==
cTopUp1 cTopUp1
? purpleColor ? purpleColor
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
), ),
child: Center( child: Center(
child: Text("50,000", child: Text("50,000",
style: blackTextStyle.copyWith( style: blackTextStyle.copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
)), )),
),
), ),
), )),
)), SizedBox(
SizedBox( width: 10,
width: 10, ),
), Expanded(
Expanded( child: GestureDetector(
child: GestureDetector( onTap: () {
onTap: () { if (timer != null) timer?.cancel();
if (timer != null) timer?.cancel(); tapIdle();
tapIdle();
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp2; amountController!.text = cTopUp2;
}); });
} }
}, },
child: Container( child: Container(
padding: padding:
EdgeInsets.symmetric(vertical: 15), EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: (amountController!.text == color: (amountController!.text ==
cTopUp2) cTopUp2)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
),
child: Center(
child: Text("150,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
),
), ),
child: Center( ))
child: Text("150,000", ],
style: blackTextStyle.copyWith( ),
fontSize: 25, SizedBox(
fontWeight: bold, height: 10,
)), ),
Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
tapIdle();
if (mounted) {
setState(() {
amountController!.text = cTopUp3;
});
}
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
border: Border.all(
color: (amountController!.text ==
cTopUp3)
? Color(0xff005DAC)
: Colors.black12),
borderRadius: BorderRadius.circular(7),
),
child: Center(
child: Text("100,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
),
), ),
), )),
)) SizedBox(
], width: 10,
), ),
SizedBox( Expanded(
height: 10,
),
Row(
children: [
Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null) timer?.cancel();
...@@ -1538,7 +1590,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1538,7 +1590,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp3; amountController!.text = cTopUp4;
}); });
} }
}, },
...@@ -1548,126 +1600,119 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1548,126 +1600,119 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: (amountController!.text == color: (amountController!.text ==
cTopUp3) cTopUp4)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius:
BorderRadius.circular(7),
), ),
child: Center( child: Center(
child: Text("100,000", child: Text("200,000",
style: blackTextStyle.copyWith( style: blackTextStyle.copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
)), )),
), ),
), ),
)),
SizedBox(
width: 10,
),
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
tapIdle();
if (mounted) {
setState(() {
amountController!.text = cTopUp4;
});
}
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
border: Border.all(
color: (amountController!.text ==
cTopUp4)
? Color(0xff005DAC)
: Colors.black12),
borderRadius:
BorderRadius.circular(7),
),
child: Center(
child: Text("200,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
),
), ),
), ),
), ],
], ),
), ],
], ),
), ),
SizedBox(height: 30), SizedBox(height: 30),
Column( Container(
children: [ margin: const EdgeInsets.only(right:300, left:300),
Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: CustomFilledButton( child: CustomFilledButton(
title: 'lanjut', title: 'lanjut',
subtitle: ' / proceed', subtitle: ' / proceed',
onPressed: () { onPressed: () {
setState(() { setState(() {
if (timer != null) if (timer != null)
timer?.cancel(); timer?.cancel();
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.info, dialogType: DialogType.info,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2), autoHide: Duration(seconds: 2),
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...', title: 'Mohon Tunggu Sebentar ...',
titleTextStyle: blackTextStyle.copyWith( titleTextStyle: blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
), ),
desc: "Please wait a moment ...", desc: "Please wait a moment ...",
descTextStyle: greyTextStyle.copyWith( descTextStyle: greyTextStyle.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: light, fontWeight: light,
), ),
).show().then((value) { ).show().then((value) {
if(amountController!.text.isEmpty){ if(amountController!.text.isEmpty){
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.error, dialogType: DialogType.error,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Terjadi Kesalahan', title: 'Terjadi Kesalahan',
desc: "Anda belum mengisi saldo", desc: "Anda belum mengisi saldo",
btnOkOnPress: () { btnOkOnPress: () {
if (timer != null) timer?.cancel(); if (timer != null) timer?.cancel();
tapIdle(); tapIdle();
}, },
btnOkIcon: Icons.cancel, btnOkIcon: Icons.cancel,
btnOkColor: Colors.red, btnOkColor: Colors.red,
).show(); ).show();
} }
if (mounted) { if (mounted) {
denomLimits( denomLimits(
outletName, outletName,
info, info,
int.parse(amountController! int.parse(amountController!
.text .text
.replaceAll(",", ""))); .replaceAll(",", "")));
} }
});
}); });
}, });
},
),
),
],
),
),
SizedBox(height: 20),
Positioned(
bottom: 20,
right: 0,
child: Stack(
alignment: Alignment.center,
children: [
ValueListenableBuilder(
valueListenable: idleDuration,
builder: (context, value, child) => CircularProgressIndicator(
strokeWidth: 5,
value: (idleDuration.value.toDouble()) / _maxDuration,
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
),
),
RotatedBox(
quarterTurns: 4,
child: ValueListenableBuilder(
valueListenable: idleDuration,
builder: (context, value, child) => Text(
value.toString(),
style: TextStyle(fontSize: 18),
), ),
), ),
], ),
), ],
], ),
), ),
], ],
), ),
......
...@@ -103,6 +103,8 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin{ ...@@ -103,6 +103,8 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin{
checkActivation(); checkActivation();
}); });
} }
void navigationToSetConfig() { void navigationToSetConfig() {
Navigator.pushReplacement( Navigator.pushReplacement(
context, context,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment