Commit babf7522 authored by Dio Maulana's avatar Dio Maulana

payment balance

parent 603e48d1
...@@ -266,7 +266,8 @@ const Color backgroundColor = Color(0xffF4F4F4); ...@@ -266,7 +266,8 @@ const Color backgroundColor = Color(0xffF4F4F4);
const Color backgroundColorViewBill = Color(0xffE5E5E5); 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 Color dividerGrey2 = Color(0xffF2F2F2); const Color dividerGrey2 = Color(0xffCCCCCC);
const Color greyBalancePayment = Color(0xffF2F2F2);
const Color greyColor = Color(0xffD9D9D9); const Color greyColor = Color(0xffD9D9D9);
const textColorTabel = Color(0xff333333); const textColorTabel = Color(0xff333333);
const textColorBlack = Color(0xff000000); const textColorBlack = Color(0xff000000);
...@@ -400,6 +401,7 @@ const double textScaleFactor = 1.0; ...@@ -400,6 +401,7 @@ const double textScaleFactor = 1.0;
//** Rounded Value */ //** Rounded Value */
double roundedButton = 10; double roundedButton = 10;
double roundedButtonComponent = 40;
double roundedSmallButton = 5; double roundedSmallButton = 5;
double roundedImage = 20; double roundedImage = 20;
double roundedDetailPayment = 10; double roundedDetailPayment = 10;
......
...@@ -45,7 +45,7 @@ Future<dynamic> buttonDialogGlobal( ...@@ -45,7 +45,7 @@ Future<dynamic> buttonDialogGlobal(
onTap: () { onTap: () {
ontapOk(); ontapOk();
}, },
child: ButtonModal( child: ButtonComponent(
buttonColor: okButtonColor, buttonColor: okButtonColor,
teksButton: textOnOk, teksButton: textOnOk,
), ),
...@@ -55,7 +55,7 @@ Future<dynamic> buttonDialogGlobal( ...@@ -55,7 +55,7 @@ Future<dynamic> buttonDialogGlobal(
onTap: () { onTap: () {
ontapCancel(); ontapCancel();
}, },
child: ButtonModal( child: ButtonComponent(
buttonColor: Colors.transparent, buttonColor: Colors.transparent,
teksButton: textOnCancel, teksButton: textOnCancel,
teksButtonColor: textColorBlack, teksButtonColor: textColorBlack,
......
...@@ -3,25 +3,31 @@ import 'package:flutter/material.dart'; ...@@ -3,25 +3,31 @@ import 'package:flutter/material.dart';
import 'style.dart'; import 'style.dart';
class ButtonModal extends StatelessWidget { class ButtonComponent extends StatelessWidget {
const ButtonModal({ const ButtonComponent({
Key? key, Key? key,
required this.buttonColor, required this.buttonColor,
required this.teksButton, required this.teksButton,
this.teksButtonColor = textInButton, this.teksButtonColor = textInButton,
this.height = 43,
this.width = double.infinity,
this.fontTeksSize = 14,
}) : super(key: key); }) : super(key: key);
final Color buttonColor; final Color buttonColor;
final String teksButton; final String teksButton;
final Color teksButtonColor; final Color teksButtonColor;
final double height;
final double width;
final double fontTeksSize;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: double.infinity, width: width,
height: 43, height: height,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(roundedButtonComponent),
color: buttonColor, color: buttonColor,
), ),
child: Center( child: Center(
...@@ -29,7 +35,7 @@ class ButtonModal extends StatelessWidget { ...@@ -29,7 +35,7 @@ class ButtonModal extends StatelessWidget {
context, context,
teksButton, teksButton,
style: addButton( style: addButton(
font: 14, font: fontTeksSize,
color: teksButtonColor, color: teksButtonColor,
), ),
), ),
......
// ignore_for_file: sized_box_for_whitespace // ignore_for_file: sized_box_for_whitespace
import 'package:byod/ui/viewbill/view_bill_new.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 '../../bloc/search_history.dart'; import '../../bloc/search_history.dart';
...@@ -28,7 +29,8 @@ class CustomAppBar extends StatelessWidget { ...@@ -28,7 +29,8 @@ class CustomAppBar extends StatelessWidget {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pushReplacement(context,
MaterialPageRoute(builder: (_) => const ViewBillNew()));
}, },
child: Container( child: Container(
width: 24, width: 24,
......
// ignore_for_file: sized_box_for_whitespace, avoid_unnecessary_containers // ignore_for_file: sized_box_for_whitespace, avoid_unnecessary_containers
import 'package:byod/helper/widget/button_modal.dart';
import 'package:byod/helper/widget/plus_minus_button.dart'; import 'package:byod/helper/widget/plus_minus_button.dart';
import 'package:byod/models/orders.dart'; import 'package:byod/models/orders.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -339,27 +340,40 @@ class FavGridMenu extends StatelessWidget { ...@@ -339,27 +340,40 @@ class FavGridMenu extends StatelessWidget {
} }
} }
}, },
child: Container( // child: Container(
// height: 30,
// width: widthGrid - (2 * paddingLeftRigthGrid),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(6),
// color: (menuFav.isSell) ? buttonColor : Colors.grey,
// ),
// child: Center(
// child: defaultText(
// context,
// (menuFav.isSell == false)
// ? 'Habis'
// : (initialValue == 0)
// ? 'Tambah'
// : (initialValue > 0 &&
// menuFav.variantCat.isNotEmpty)
// ? variantButtonCount
// : 'Tambah',
// style: addButtonGridFav(),
// ),
// ),
// ),
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: (menuFav.isSell == false)
? 'Habis'
: (initialValue == 0)
? 'Tambah'
: (initialValue > 0 &&
menuFav.variantCat.isNotEmpty)
? variantButtonCount
: 'Tambah',
height: 30, height: 30,
width: widthGrid - (2 * paddingLeftRigthGrid), fontTeksSize: 12,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: (menuFav.isSell) ? buttonColor : Colors.grey,
),
child: Center(
child: defaultText(
context,
(menuFav.isSell == false)
? 'Habis'
: (initialValue == 0)
? 'Tambah'
: (initialValue > 0 &&
menuFav.variantCat.isNotEmpty)
? variantButtonCount
: 'Tambah',
style: addButtonGridFav(),
),
),
), ),
) )
: Container( : Container(
......
// ignore_for_file: sized_box_for_whitespace // ignore_for_file: sized_box_for_whitespace
import 'package:byod/bloc/order_bloc.dart'; import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/helper/widget/button_modal.dart';
import 'package:byod/helper/widget/plus_minus_button.dart'; import 'package:byod/helper/widget/plus_minus_button.dart';
import 'package:byod/models/orders.dart'; import 'package:byod/models/orders.dart';
import 'package:byod/ui/home/variant_cat.dart'; import 'package:byod/ui/home/variant_cat.dart';
...@@ -362,27 +363,41 @@ class MenuListUtama extends StatelessWidget { ...@@ -362,27 +363,41 @@ class MenuListUtama extends StatelessWidget {
} }
} }
}, },
child: Container( // child: Container(
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), // borderRadius: BorderRadius.circular(10),
color: buttonColor, // color: buttonColor,
), // ),
height: double.infinity, // height: double.infinity,
// width: 125,
// child: Center(
// child: defaultText(
// context,
// (menuUtama.isSell == false)
// ? 'Habis'
// : (initialValue == 0)
// ? 'Tambah'
// : (initialValue > 0 &&
// menuUtama.variantCat.isNotEmpty)
// ? variantButtonCount
// : 'Tambah',
// style: addButton(),
// ),
// ),
// ),
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: (menuUtama.isSell == false)
? 'Habis'
: (initialValue == 0)
? 'Tambah'
: (initialValue > 0 &&
menuUtama.variantCat.isNotEmpty)
? variantButtonCount
: 'Tambah',
fontTeksSize: 12,
height: 36,
width: 125, width: 125,
child: Center(
child: defaultText(
context,
(menuUtama.isSell == false)
? 'Habis'
: (initialValue == 0)
? 'Tambah'
: (initialValue > 0 &&
menuUtama.variantCat.isNotEmpty)
? variantButtonCount
: 'Tambah',
style: addButton(),
),
),
), ),
) )
], ],
......
import 'package:flutter/cupertino.dart';
import '../../api/api.dart'; import '../../api/api.dart';
void addPayment( void addPayment(
...@@ -14,3 +16,9 @@ void addPayment( ...@@ -14,3 +16,9 @@ void addPayment(
Api.addPayment(context, orderId, branchCode, brandCode, customerName, method, Api.addPayment(context, orderId, branchCode, brandCode, customerName, method,
paymentType, codeVoucher, amount); paymentType, codeVoucher, amount);
} }
void addPaymentBalance(BuildContext context, String orderId, String branchCode,
String brandCode, String customerName, int amout) {
Api.addPaymentBalance(
context, orderId, branchCode, brandCode, customerName, amout);
}
...@@ -366,11 +366,12 @@ class _PaymentState extends State<Payment> { ...@@ -366,11 +366,12 @@ class _PaymentState extends State<Payment> {
if (widget.isUsingBalance) { if (widget.isUsingBalance) {
// using balance karena hanya excelso untuk saat ini jadi overide outstandingindividu dulu // using balance karena hanya excelso untuk saat ini jadi overide outstandingindividu dulu
addPaymentBalance( addPaymentBalance(
widget.dataBill[0].id, widget.dataBill[0].id,
branchCode, branchCode,
brandCode, brandCode,
customerName, customerName,
widget.outstandingIndividu); widget.outstandingIndividu,
);
} else { } else {
addPayment( addPayment(
context, context,
......
// ignore_for_file: sized_box_for_whitespace
import 'dart:math';
import 'package:byod/helper/widget/button_modal.dart';
import 'package:byod/ui/payment/function.dart';
import 'package:flutter/material.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../../main.dart';
import '../screen_responsive.dart';
import '../viewbill/view_bill_new.dart';
class PaymentBalance extends StatelessWidget {
const PaymentBalance({
super.key,
required this.balanceMember,
required this.outStanding,
required this.orderId,
});
final int balanceMember;
final int outStanding;
final String orderId;
@override
Widget build(BuildContext context) {
double currentScreen = MediaQuery.of(context).size.width;
return SafeArea(
child: Scaffold(
backgroundColor: backgroundColor,
body: ScreenResponsive(
widget: CorePaymentBalance(
outStanding: outStanding,
balanceMember: balanceMember,
orderId: orderId,
),
isCoreLayout: true,
widthScreen: currentScreen,
),
),
);
}
}
class CorePaymentBalance extends StatelessWidget {
const CorePaymentBalance({
super.key,
required this.balanceMember,
required this.outStanding,
required this.orderId,
});
final int balanceMember;
final int outStanding;
final String orderId;
@override
Widget build(BuildContext context) {
int outStandingTopayMember = min(outStanding, balanceMember);
double widthScreen = responsiveWidthScreen(context);
String branchCode = prefs.getString("outlet") ?? '';
String brandCode = prefs.getString("brand") ?? '';
String customerName = prefs.getString("userName") ?? '';
return Container(
width: widthScreen,
child: Stack(
children: [
Column(
children: [
const CustomAppBarBalance(),
const SizedBox(
height: 24,
),
Container(
width: widthScreen,
color: backgroundWhite,
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
top: 16,
),
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
decoration: BoxDecoration(
color: greyBalancePayment,
borderRadius: BorderRadius.circular(13),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
defaultText(context, 'Total Tagihan',
style: rincianPembayaran(
font: 14,
)),
defaultText(
context,
"Rp ${formatNumber().format(outStanding)}",
style: rincianPembayaran(
font: 14,
),
)
],
),
const SizedBox(
height: 10,
),
const Divider(
thickness: 1,
color: dividerGrey2,
),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
defaultText(
context,
'Excelso Balance',
style: rincianPembayaran(
font: 14,
),
),
defaultText(context,
"Rp ${formatNumber().format(balanceMember)}",
style: rincianPembayaran(
font: 14,
))
],
),
const SizedBox(
height: 10,
),
const Divider(
thickness: 1,
color: dividerGrey2,
),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
defaultText(
context,
'Nilai Bayar',
style: rincianPembayaran(
font: 14,
),
),
defaultText(
context,
"Rp ${formatNumber().format(outStandingTopayMember)}",
style: rincianPembayaran(
font: 14,
),
)
],
),
],
),
),
),
Expanded(
child: Container(
width: widthScreen,
color: backgroundWhite,
),
)
],
),
Positioned(
bottom: 0,
child: Container(
width: widthScreen,
height: 83,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: backgroundWhite,
boxShadow: const [
BoxShadow(
color: Colors.grey,
blurRadius: 5.0,
)
],
),
padding: const EdgeInsets.all(20),
child: GestureDetector(
onTap: () {
addPaymentBalance(context, orderId, branchCode, brandCode,
customerName, outStandingTopayMember);
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: 'Bayar',
),
),
),
)
],
),
);
}
}
class CustomAppBarBalance extends StatelessWidget {
const CustomAppBarBalance({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(
top: 15,
bottom: 22,
left: paddingLeftRight,
right: paddingLeftRight,
),
// padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
color: backgroundWhite,
child: Column(
children: [
Row(
// mainAxisAlignment: MainAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (_) => const ViewBillNew()),
);
},
child: Container(
width: 24,
height: 24,
child: Center(
child: fontAwesomeNew(
arrowBack,
arrowBackSize,
),
),
),
),
const SizedBox(
width: 16,
),
Center(
child: defaultText(
context,
'Excelso Member',
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: appBarNameViewBill(),
),
),
],
),
],
),
);
}
}
...@@ -29,17 +29,18 @@ class PaymentVoucher extends StatelessWidget { ...@@ -29,17 +29,18 @@ class PaymentVoucher extends StatelessWidget {
context.read<VoucherCheck>().changeVoucher(); context.read<VoucherCheck>().changeVoucher();
double currentScreen = MediaQuery.of(context).size.width; double currentScreen = MediaQuery.of(context).size.width;
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
body: ScreenResponsive( body: ScreenResponsive(
widget: CorePaymentVoucher( widget: CorePaymentVoucher(
outstandingAll: outstandingAll, outstandingAll: outstandingAll,
dataBill: dataBill, dataBill: dataBill,
),
isCoreLayout: true,
widthScreen: currentScreen,
), ),
isCoreLayout: true,
widthScreen: currentScreen,
), ),
)); );
} }
} }
...@@ -170,7 +171,7 @@ class CorePaymentVoucher extends StatelessWidget { ...@@ -170,7 +171,7 @@ class CorePaymentVoucher extends StatelessWidget {
color: backgroundWhite, color: backgroundWhite,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight, vertical: 16), horizontal: paddingLeftRight, vertical: 16),
child: ButtonModal( child: ButtonComponent(
buttonColor: buttonColor:
(listVoucher.isNotEmpty && listVoucher[0] != '0') (listVoucher.isNotEmpty && listVoucher[0] != '0')
? buttonColor ? buttonColor
...@@ -219,7 +220,11 @@ class ListVoucherView extends StatelessWidget { ...@@ -219,7 +220,11 @@ class ListVoucherView extends StatelessWidget {
? selectedColorVoucher ? selectedColorVoucher
: backgroundWhite, : backgroundWhite,
), ),
padding: const EdgeInsets.all(16), padding: const EdgeInsets.only(
top: 16,
left: 16,
right: 16,
),
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: paddingLeftRight, left: paddingLeftRight,
right: paddingLeftRight, right: paddingLeftRight,
...@@ -235,18 +240,20 @@ class ListVoucherView extends StatelessWidget { ...@@ -235,18 +240,20 @@ class ListVoucherView extends StatelessWidget {
topLeft: Radius.circular(8), topLeft: Radius.circular(8),
topRight: Radius.circular(8), topRight: Radius.circular(8),
), ),
image: DecorationImage( image: (voucherListData[index].titleImageUrl != '')
colorFilter: (!isCanSelect) ? DecorationImage(
? const ColorFilter.mode( colorFilter: (!isCanSelect)
Colors.grey, ? const ColorFilter.mode(
BlendMode.saturation, Colors.grey,
) BlendMode.saturation,
: null, )
fit: BoxFit.fill, : null,
image: NetworkImage( fit: BoxFit.fill,
voucherListData[index].titleImageUrl, image: NetworkImage(
), voucherListData[index].titleImageUrl,
), ),
)
: null,
), ),
// child: const ClipRRect( // child: const ClipRRect(
...@@ -360,7 +367,7 @@ class ListVoucherView extends StatelessWidget { ...@@ -360,7 +367,7 @@ class ListVoucherView extends StatelessWidget {
? Column( ? Column(
children: [ children: [
const SizedBox( const SizedBox(
height: 10, height: 16,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
...@@ -433,7 +440,7 @@ class RincianPembayaranVoucher extends StatelessWidget { ...@@ -433,7 +440,7 @@ class RincianPembayaranVoucher extends StatelessWidget {
height: 16, height: 16,
), ),
const Divider( const Divider(
thickness: 0.5, thickness: 1,
color: dividerGrey2, color: dividerGrey2,
), ),
const SizedBox( const SizedBox(
...@@ -444,7 +451,7 @@ class RincianPembayaranVoucher extends StatelessWidget { ...@@ -444,7 +451,7 @@ class RincianPembayaranVoucher extends StatelessWidget {
children: [ children: [
defaultText( defaultText(
context, context,
'Discount Potongan', 'Discount E-Voucher',
style: rincianPembayaran( style: rincianPembayaran(
font: 12, font: 12,
color: textGreyBill, color: textGreyBill,
...@@ -467,7 +474,7 @@ class RincianPembayaranVoucher extends StatelessWidget { ...@@ -467,7 +474,7 @@ class RincianPembayaranVoucher extends StatelessWidget {
height: 16, height: 16,
), ),
const Divider( const Divider(
thickness: 0.5, thickness: 1,
color: dividerGrey2, color: dividerGrey2,
), ),
const SizedBox( const SizedBox(
...@@ -581,6 +588,7 @@ class CustomAppBarVoucher extends StatelessWidget { ...@@ -581,6 +588,7 @@ class CustomAppBarVoucher extends StatelessWidget {
), ),
textAlignVertical: TextAlignVertical.center, textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration( decoration: InputDecoration(
// hintText: 'Kode Voucher',
filled: true, filled: true,
fillColor: Colors.white, fillColor: Colors.white,
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
......
This diff is collapsed.
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