Commit 23a8182d authored by Dio Maulana's avatar Dio Maulana

pull to refresh viewbill

parent 427674c0
...@@ -245,6 +245,7 @@ double heightTombol = 0.06; // untuk dikalikan di height media query ...@@ -245,6 +245,7 @@ double heightTombol = 0.06; // untuk dikalikan di height media query
//** core warna */ //** core warna */
// const Color backgroundColor = Colors.white; // const Color backgroundColor = Colors.white;
const Color backgroundColor = Color(0xffF4F4F4); const Color backgroundColor = Color(0xffF4F4F4);
const Color backgroundColorViewBill = Color(0xffE5E5E5);
const Color backgroundWhite = Color(0xffFFFFFF); const Color backgroundWhite = Color(0xffFFFFFF);
const Color dividerGrey = Color(0xff898A8D); const Color dividerGrey = Color(0xff898A8D);
const textColorTabel = Color(0xff333333); const textColorTabel = Color(0xff333333);
......
...@@ -337,10 +337,10 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -337,10 +337,10 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
height: 11, height: 11,
) )
: const SizedBox(), : const SizedBox(),
(widget.lastItem) (!widget.lastItem)
? const Divider( ? const Divider(
thickness: 1, thickness: 2,
color: dividerGrey, color: backgroundColorViewBill,
) )
: const SizedBox() : const SizedBox()
], ],
......
...@@ -5,7 +5,6 @@ import 'package:byod/helper/widget/style.dart'; ...@@ -5,7 +5,6 @@ import 'package:byod/helper/widget/style.dart';
import 'package:byod/ui/screen_responsive.dart'; import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import '../../api/api.dart'; import '../../api/api.dart';
...@@ -93,7 +92,18 @@ class ViewBillNew extends StatelessWidget { ...@@ -93,7 +92,18 @@ class ViewBillNew extends StatelessWidget {
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
backgroundColor: backgroundWhite, backgroundColor: backgroundWhite,
body: BlocBuilder<ViewBillBloc, List<Bill>>( body: RefreshIndicator(
color: buttonColor,
backgroundColor: backgroundColor,
onRefresh: () {
return Future.delayed(
const Duration(milliseconds: 1500),
() {
context.read<ViewBillBloc>().getBill();
},
);
},
child: BlocBuilder<ViewBillBloc, List<Bill>>(
builder: (ctxViewBill, dataBill) { builder: (ctxViewBill, dataBill) {
if (dataBill.isNotEmpty) { if (dataBill.isNotEmpty) {
if (dataBill[0].id == defaultViewBill) { if (dataBill[0].id == defaultViewBill) {
...@@ -114,70 +124,71 @@ class ViewBillNew extends StatelessWidget { ...@@ -114,70 +124,71 @@ class ViewBillNew extends StatelessWidget {
} else { } else {
saveBillDetail(dataBill); saveBillDetail(dataBill);
int totalService = 0; // int totalService = 0;
int totalServiceTax = 0; // int totalServiceTax = 0;
int individuTotalPayment = 0; // int individuTotalPayment = 0;
int individuPaymentPaid = 0; // int individuPaymentPaid = 0;
int outStandingIndividu = 0; // int outStandingIndividu = 0;
int allPaymentPaid = 0; // int allPaymentPaid = 0;
int outStandingAll = 0; int outStandingAll = 0;
int totalDiscount = 0; int totalDiscount = 0;
bool isIndividuHaveWaitingPayment = false; // bool isIndividuHaveWaitingPayment = false;
String paymentToRedirect = ''; // String paymentToRedirect = '';
String paymentId = ''; // String paymentId = '';
// check payment pending ketika table di lock backend // check payment pending ketika table di lock backend
bool isStillHavePaymentPending = false; // bool isStillHavePaymentPending = false;
if (dataBill.isNotEmpty) { if (dataBill.isNotEmpty) {
int indexWherePendingPayment = dataBill[0] // int indexWherePendingPayment = dataBill[0]
.paymentList // .paymentList
.indexWhere((element) => element.isApproved == false); // .indexWhere((element) => element.isApproved == false);
if (indexWherePendingPayment != -1) { // if (indexWherePendingPayment != -1) {
isStillHavePaymentPending = true; // isStillHavePaymentPending = true;
} // }
//service and servicetax //service and servicetax
totalService = amountParseToInt(dataBill[0].totalService); // totalService = amountParseToInt(dataBill[0].totalService);
totalServiceTax = // totalServiceTax =
amountParseToInt(dataBill[0].totalServiceTax); // amountParseToInt(dataBill[0].totalServiceTax);
for (var x in dataBill) { // for (var x in dataBill) {
if (x.customerName == customerName) { // if (x.customerName == customerName) {
individuTotalPayment = x.totalPerCustomer; // // individuTotalPayment = x.totalPerCustomer;
} // }
//service and tax // //service and tax
// for (var bd in x.billDetail) { // // for (var bd in x.billDetail) {
// totalService += amountParseToInt(bd.service); // // totalService += amountParseToInt(bd.service);
// totalServiceTax += amountParseToInt(bd.serviceTax); // // totalServiceTax += amountParseToInt(bd.serviceTax);
// // }
// } // }
} // if (dataBill[0].paymentList.isNotEmpty) {
if (dataBill[0].paymentList.isNotEmpty) { // for (var p in dataBill[0].paymentList) {
for (var p in dataBill[0].paymentList) { // // if (p.isApproved && p.customerNamePay == customerName) {
// if (p.isApproved && p.customerNamePay == customerName) { // // individuPaymentPaid += amountParseToInt(p.amount);
// individuPaymentPaid += amountParseToInt(p.amount); // // }
// if (p.isApproved) {
// allPaymentPaid += amountParseToInt(p.amount);
// } // }
if (p.isApproved) { // if (!p.isApproved) {
allPaymentPaid += amountParseToInt(p.amount); // if (p.paymentUrl != '' &&
} // p.customerNamePay == customerName) {
if (!p.isApproved) { // isIndividuHaveWaitingPayment = true;
if (p.paymentUrl != '' && // paymentToRedirect = p.paymentUrl;
p.customerNamePay == customerName) { // paymentId = p.id;
isIndividuHaveWaitingPayment = true; // }
paymentToRedirect = p.paymentUrl; // }
paymentId = p.id; // }
} // }
} outStandingAll =
} amountParseToInt(dataBill[0].outStandingPay);
}
outStandingAll = amountParseToInt(dataBill[0].outStandingPay);
totalDiscount = amountParseToInt(dataBill[0].discountTotal); totalDiscount = amountParseToInt(dataBill[0].discountTotal);
outStandingIndividu = // outStandingIndividu =
amountParseToInt(dataBill[0].outStandingIndividu); // amountParseToInt(dataBill[0].outStandingIndividu);
} }
void ontapOkAfterCashier() async { void ontapOkAfterCashier() async {
...@@ -219,9 +230,9 @@ class ViewBillNew extends StatelessWidget { ...@@ -219,9 +230,9 @@ class ViewBillNew extends StatelessWidget {
// Navigator.pop(context); // Navigator.pop(context);
title = 'Tutup Pesanan'; title = 'Tutup Pesanan';
description = ''' description = '''
Selesaikan transaksi dan tutup pesanan ? Selesaikan transaksi dan tutup pesanan ?
Mohon menuju kasir untuk meminta bukti pembayaran'''; Mohon menuju kasir untuk meminta bukti pembayaran''';
// } else { // } else {
// // // Navigator.pop(context); // // // Navigator.pop(context);
// // EasyLoading.showInfo('Tidak ada tagihan yang perlu dibayar'); // // EasyLoading.showInfo('Tidak ada tagihan yang perlu dibayar');
...@@ -270,6 +281,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -270,6 +281,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
}, },
), ),
), ),
),
); );
} }
...@@ -494,7 +506,7 @@ class CoreBill extends StatelessWidget { ...@@ -494,7 +506,7 @@ class CoreBill extends StatelessWidget {
height: 18, height: 18,
), ),
const Divider( const Divider(
color: backgroundColor, color: backgroundColorViewBill,
thickness: 24, thickness: 24,
), ),
const SizedBox( const SizedBox(
...@@ -519,12 +531,12 @@ class CoreBill extends StatelessWidget { ...@@ -519,12 +531,12 @@ class CoreBill extends StatelessWidget {
height: 11, height: 11,
), ),
const Divider( const Divider(
color: backgroundColor, color: backgroundColorViewBill,
thickness: 24, thickness: 24,
), ),
const AddMoreOrder(), const AddMoreOrder(),
const Divider( const Divider(
color: backgroundColor, color: backgroundColorViewBill,
thickness: 24, thickness: 24,
), ),
RincianPembayaran( RincianPembayaran(
...@@ -533,7 +545,7 @@ class CoreBill extends StatelessWidget { ...@@ -533,7 +545,7 @@ class CoreBill extends StatelessWidget {
outStandingAll: outStandingAll, outStandingAll: outStandingAll,
), ),
const Divider( const Divider(
color: backgroundColor, color: backgroundColorViewBill,
thickness: 24, thickness: 24,
), ),
], ],
......
...@@ -261,13 +261,6 @@ packages: ...@@ -261,13 +261,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.3" version: "6.0.3"
pull_to_refresh:
dependency: "direct main"
description:
name: pull_to_refresh
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
scrollable_positioned_list: scrollable_positioned_list:
dependency: "direct main" dependency: "direct main"
description: description:
......
...@@ -34,7 +34,6 @@ dependencies: ...@@ -34,7 +34,6 @@ dependencies:
http: ^0.13.4 http: ^0.13.4
intl: ^0.17.0 intl: ^0.17.0
loading_animations: ^2.2.0 loading_animations: ^2.2.0
pull_to_refresh: ^2.0.0
scrollable_positioned_list: ^0.3.4 scrollable_positioned_list: ^0.3.4
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
shimmer: ^2.0.0 shimmer: ^2.0.0
......
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