price dot fix
parent
72df9c777c
commit
2826d56a73
|
|
@ -51,7 +51,7 @@ class _ProductAddBottomSheetState extends State<ProductAddBottomSheet> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 10),
|
padding: const EdgeInsets.only(top: 15, left: 10, right: 15),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
controller: widget.scrollController,
|
controller: widget.scrollController,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|
@ -74,7 +74,9 @@ class _ProductAddBottomSheetState extends State<ProductAddBottomSheet> {
|
||||||
labelText: 'Количество',
|
labelText: 'Количество',
|
||||||
prefixText: ' ',
|
prefixText: ' ',
|
||||||
),
|
),
|
||||||
keyboardType: const TextInputType.numberWithOptions(decimal: false,),
|
keyboardType: const TextInputType.numberWithOptions(
|
||||||
|
decimal: false,
|
||||||
|
),
|
||||||
inputFormatters: <TextInputFormatter>[
|
inputFormatters: <TextInputFormatter>[
|
||||||
WhitelistingTextInputFormatter.digitsOnly
|
WhitelistingTextInputFormatter.digitsOnly
|
||||||
],
|
],
|
||||||
|
|
@ -90,7 +92,8 @@ class _ProductAddBottomSheetState extends State<ProductAddBottomSheet> {
|
||||||
labelText: 'Стоимость',
|
labelText: 'Стоимость',
|
||||||
prefixText: ' ',
|
prefixText: ' ',
|
||||||
),
|
),
|
||||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
keyboardType:
|
||||||
|
const TextInputType.numberWithOptions(decimal: true),
|
||||||
inputFormatters: <TextInputFormatter>[
|
inputFormatters: <TextInputFormatter>[
|
||||||
WhitelistingTextInputFormatter(RegExp("^[0-9.]*")),
|
WhitelistingTextInputFormatter(RegExp("^[0-9.]*")),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -49,23 +49,36 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
if (!isBusy)
|
if (!isBusy) Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
|
||||||
return new Future(() => false);
|
return new Future(() => false);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
brightness: Brightness.light,
|
||||||
backgroundColor: whiteColor,
|
backgroundColor: whiteColor,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
leading: IconButton(icon: Icon(Icons.arrow_back_ios), color: Colors.black87, onPressed: () => Navigator.pop(context),),
|
leading: IconButton(
|
||||||
title: Text(dataTitle(), style: TextStyle(color: Colors.black87),),
|
icon: Icon(Icons.arrow_back_ios),
|
||||||
|
color: Colors.black87,
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
dataTitle(),
|
||||||
|
style: TextStyle(color: Colors.black87),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0),
|
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(dataText() , style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black26, fontSize: 15 ),),
|
Text(
|
||||||
|
dataText(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black26,
|
||||||
|
fontSize: 15),
|
||||||
|
),
|
||||||
buildStoreConnector(),
|
buildStoreConnector(),
|
||||||
verticalSpaceLarge,
|
verticalSpaceLarge,
|
||||||
_buildBodyContent(),
|
_buildBodyContent(),
|
||||||
|
|
@ -76,28 +89,34 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String dataTitle() => widget.model.operationType == OperationTypePay ? 'Оплата' : 'Возврат';
|
String dataTitle() =>
|
||||||
|
widget.model.operationType == OperationTypePay ? 'Оплата' : 'Возврат';
|
||||||
|
|
||||||
String dataText() => widget.model.operationType == OperationTypePay ? 'К оплате' : 'К возврату';
|
String dataText() => widget.model.operationType == OperationTypePay
|
||||||
|
? 'К оплате'
|
||||||
|
: 'К возврату';
|
||||||
|
|
||||||
StoreConnector buildStoreConnector() {
|
StoreConnector buildStoreConnector() {
|
||||||
if (widget.model.mode == SettingModeCalc) {
|
if (widget.model.mode == SettingModeCalc) {
|
||||||
return StoreConnector<AppState, CalcState>(
|
return StoreConnector<AppState, CalcState>(
|
||||||
converter: (store) => store.state.calcState,
|
converter: (store) => store.state.calcState,
|
||||||
builder: (_, vm) {
|
builder: (_, vm) {
|
||||||
return Text('${totalCalc(vm.calcItems)} тнг', style: TextStyle(
|
return Text('${totalCalc(vm.calcItems)} тнг',
|
||||||
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
fontSize: 35));
|
fontSize: 35));
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return StoreConnector<AppState, KassaState>(
|
return StoreConnector<AppState, KassaState>(
|
||||||
converter: (store) => store.state.kassaState,
|
converter: (store) => store.state.kassaState,
|
||||||
builder: (_, vm) {
|
builder: (_, vm) {
|
||||||
return Text('${totalKassa(vm.kassaItems)} тнг', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black87, fontSize: 35 ));
|
return Text('${totalKassa(vm.kassaItems)} тнг',
|
||||||
}
|
style: TextStyle(
|
||||||
);
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black87,
|
||||||
|
fontSize: 35));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Expanded _buildBodyContent() {
|
Expanded _buildBodyContent() {
|
||||||
|
|
@ -109,22 +128,47 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(child: BusyButton(title: 'Оплатить картой', onPressed:() { pressPayment('card');}, mainColor: greenColor,)),
|
Expanded(
|
||||||
|
child: BusyButton(
|
||||||
|
title: 'Оплатить картой',
|
||||||
|
onPressed: () {
|
||||||
|
pressPayment('card');
|
||||||
|
},
|
||||||
|
mainColor: greenColor,
|
||||||
|
)),
|
||||||
horizontalSpaceSmall,
|
horizontalSpaceSmall,
|
||||||
Expanded(child: BusyButton(title: 'Наличными', onPressed:() { pressPayment('cash');}, mainColor: primaryColor,)),
|
Expanded(
|
||||||
|
child: BusyButton(
|
||||||
|
title: 'Наличными',
|
||||||
|
onPressed: () {
|
||||||
|
pressPayment('cash');
|
||||||
|
},
|
||||||
|
mainColor: primaryColor,
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
verticalSpaceLarge,
|
verticalSpaceLarge,
|
||||||
Expanded(child: Container(),),
|
Expanded(
|
||||||
Container(child: BusyButton(title: 'Отмена', onPressed:() { Navigator.pop(context);} , mainColor: redColor,)),
|
child: Container(),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: BusyButton(
|
||||||
|
title: 'Отмена',
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
mainColor: redColor,
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pressPayment(String type) async {
|
pressPayment(String type) async {
|
||||||
setState(() { isBusy = true; });
|
setState(() {
|
||||||
|
isBusy = true;
|
||||||
|
});
|
||||||
Dialogs.showLoadingDialog(context, _keyLoader);
|
Dialogs.showLoadingDialog(context, _keyLoader);
|
||||||
try {
|
try {
|
||||||
AppState _state = Redux.store.state;
|
AppState _state = Redux.store.state;
|
||||||
|
|
@ -136,9 +180,18 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
}
|
}
|
||||||
List<ProductDao> kassaItems = _state.kassaState.kassaItems;
|
List<ProductDao> kassaItems = _state.kassaState.kassaItems;
|
||||||
List<CalcModel> calcItems = _state.calcState.calcItems;
|
List<CalcModel> calcItems = _state.calcState.calcItems;
|
||||||
Response<dynamic> response = await _dataService.sellOrReturn(token: _token, kassaItems: kassaItems, paymentType: type, operationType: widget.model.operationType, tradeType: _tradeType, calcItems: calcItems, mode: _mode );
|
Response<dynamic> response = await _dataService.sellOrReturn(
|
||||||
|
token: _token,
|
||||||
|
kassaItems: kassaItems,
|
||||||
|
paymentType: type,
|
||||||
|
operationType: widget.model.operationType,
|
||||||
|
tradeType: _tradeType,
|
||||||
|
calcItems: calcItems,
|
||||||
|
mode: _mode);
|
||||||
Navigator.of(context, rootNavigator: true).pop();
|
Navigator.of(context, rootNavigator: true).pop();
|
||||||
setState(() { isBusy = false; });
|
setState(() {
|
||||||
|
isBusy = false;
|
||||||
|
});
|
||||||
if (response.operation) {
|
if (response.operation) {
|
||||||
String message = response.body['message'];
|
String message = response.body['message'];
|
||||||
String check = response.body['check'];
|
String check = response.body['check'];
|
||||||
|
|
@ -149,17 +202,18 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
}
|
}
|
||||||
Redux.store.dispatch(checkMoney);
|
Redux.store.dispatch(checkMoney);
|
||||||
_navigatorService.pop();
|
_navigatorService.pop();
|
||||||
_navigatorService.push(ImageShowRoute, arguments: ImageShowModel(check, message));
|
_navigatorService.push(ImageShowRoute,
|
||||||
|
arguments: ImageShowModel(check, message));
|
||||||
} else if (!response.operation && response.status != 500) {
|
} else if (!response.operation && response.status != 500) {
|
||||||
_dialogService.showDialog(description: response.body['message']);
|
_dialogService.showDialog(description: response.body['message']);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
//Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
||||||
Navigator.of(context, rootNavigator: true).pop();
|
Navigator.of(context, rootNavigator: true).pop();
|
||||||
setState(() { isBusy = false; });
|
setState(() {
|
||||||
|
isBusy = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String totalKassa(List<ProductDao> kassaItems) {
|
String totalKassa(List<ProductDao> kassaItems) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue