refund and close day release
parent
48398435e8
commit
a1b8223980
|
|
@ -53,7 +53,12 @@ public class CloseDayHandlerImpl implements CloseDayCallbackHandler<Result> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTransactionsListReceived(List<Transaction> transactionList, List<CloseDayResponseInfo> list1) {
|
public void onTransactionsListReceived(List<Transaction> transactionList, List<CloseDayResponseInfo> list1) {
|
||||||
plugin.getActivity().runOnUiThread(() -> Toast.makeText(plugin.getActivity(), "onTransactionsListReceived - " + transactionList, Toast.LENGTH_SHORT).show());
|
plugin.getActivity().runOnUiThread(() -> {
|
||||||
|
AmanDao<String> dao = new AmanDao<>();
|
||||||
|
dao.setSuccess(true);
|
||||||
|
this.result.success(gson.toJson(dao));
|
||||||
|
Toast.makeText(plugin.getActivity(), "На закрытие дня: - " + transactionList, Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -56,44 +56,7 @@ class _BankSettingViewState extends State<BankSettingView> {
|
||||||
_dialogService.showDialog(description: 'Данные сохранены');
|
_dialogService.showDialog(description: 'Данные сохранены');
|
||||||
}
|
}
|
||||||
|
|
||||||
void _closeDay(BuildContext _context) async {
|
|
||||||
FocusScope.of(_context).unfocus();
|
|
||||||
|
|
||||||
//Инициализация
|
|
||||||
bool initialized = await _bankService.init();
|
|
||||||
if (!initialized) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Проверка связи
|
|
||||||
bool connected = await _bankService.connect();
|
|
||||||
if (!connected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//Авторизация
|
|
||||||
BankState bankState = Redux.store.state.bankState;
|
|
||||||
AmanDao authDao = await _bankService.auth(
|
|
||||||
login: bankState.login, password: bankState.password);
|
|
||||||
if (!authDao.success) {
|
|
||||||
if (authDao.msg != null) {
|
|
||||||
_dialogService.showDialog(description: authDao.msg);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AmanDao closeDayDao = await _bankService.closeDay();
|
|
||||||
|
|
||||||
if (!closeDayDao.success) {
|
|
||||||
if (closeDayDao.msg != null) {
|
|
||||||
_dialogService.showDialog(description: closeDayDao.msg);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_dialogService.showDialog(description: 'Закрытие дня: операция прошла успешно!');
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -137,17 +100,7 @@ class _BankSettingViewState extends State<BankSettingView> {
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(vertical: 5.0, horizontal: 20.0),
|
const EdgeInsets.symmetric(vertical: 5.0, horizontal: 20.0),
|
||||||
),
|
),
|
||||||
verticalSpaceLarge,
|
|
||||||
RaisedButton(
|
|
||||||
onPressed: () => this._closeDay(context),
|
|
||||||
child: Text(
|
|
||||||
'Закрыть день',
|
|
||||||
style: TextStyle(color: whiteColor, fontSize: 25.0),
|
|
||||||
),
|
|
||||||
color: primaryColor,
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(vertical: 5.0, horizontal: 20.0),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,20 @@
|
||||||
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
||||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/models/aman_dao.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/money.dart';
|
import 'package:aman_kassa_flutter/core/models/money.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/response.dart';
|
import 'package:aman_kassa_flutter/core/models/response.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/dialog_models.dart';
|
import 'package:aman_kassa_flutter/core/models/dialog_models.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/user.dart';
|
import 'package:aman_kassa_flutter/core/models/user.dart';
|
||||||
import 'package:aman_kassa_flutter/core/route_names.dart';
|
import 'package:aman_kassa_flutter/core/route_names.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/ApiService.dart';
|
import 'package:aman_kassa_flutter/core/services/ApiService.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/services/BankService.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/DataService.dart';
|
import 'package:aman_kassa_flutter/core/services/DataService.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/dialog_service.dart';
|
import 'package:aman_kassa_flutter/core/services/dialog_service.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
||||||
import 'package:aman_kassa_flutter/redux/actions/user_actions.dart';
|
import 'package:aman_kassa_flutter/redux/actions/user_actions.dart';
|
||||||
import 'package:aman_kassa_flutter/redux/actions/setting_actions.dart';
|
import 'package:aman_kassa_flutter/redux/actions/setting_actions.dart';
|
||||||
import 'package:aman_kassa_flutter/redux/constants/setting_const.dart';
|
import 'package:aman_kassa_flutter/redux/constants/setting_const.dart';
|
||||||
|
import 'package:aman_kassa_flutter/redux/state/bank_state.dart';
|
||||||
import 'package:aman_kassa_flutter/redux/state/setting_state.dart';
|
import 'package:aman_kassa_flutter/redux/state/setting_state.dart';
|
||||||
import 'package:aman_kassa_flutter/redux/store.dart';
|
import 'package:aman_kassa_flutter/redux/store.dart';
|
||||||
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
||||||
|
|
@ -38,10 +41,12 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
ApiService _api = locator<ApiService>();
|
ApiService _api = locator<ApiService>();
|
||||||
NavigatorService _navigator = locator<NavigatorService>();
|
NavigatorService _navigator = locator<NavigatorService>();
|
||||||
DialogService _dialog = locator<DialogService>();
|
DialogService _dialog = locator<DialogService>();
|
||||||
|
final BankService _bankService = locator<BankService>();
|
||||||
DataService _dataService = locator<DataService>();
|
DataService _dataService = locator<DataService>();
|
||||||
final GlobalKey<State> _keyLoader = new GlobalKey<State>();
|
final GlobalKey<State> _keyLoader = new GlobalKey<State>();
|
||||||
|
|
||||||
bool isMoneyCheckBusy;
|
bool isMoneyCheckBusy;
|
||||||
|
bool isClosePosBusy;
|
||||||
bool closeSmenaBusy;
|
bool closeSmenaBusy;
|
||||||
bool openSmenaBusy;
|
bool openSmenaBusy;
|
||||||
bool depositBusy;
|
bool depositBusy;
|
||||||
|
|
@ -59,6 +64,7 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
withdrawalBusy = false;
|
withdrawalBusy = false;
|
||||||
xReportBusy = false;
|
xReportBusy = false;
|
||||||
updateCatalog = false;
|
updateCatalog = false;
|
||||||
|
isClosePosBusy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _closeSmena() async {
|
void _closeSmena() async {
|
||||||
|
|
@ -209,6 +215,70 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _closeDay() async {
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
isClosePosBusy = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
int version = await _bankService.version();
|
||||||
|
if (version < 24 ) {
|
||||||
|
setState(() {
|
||||||
|
isClosePosBusy = false;
|
||||||
|
});
|
||||||
|
_dialog.showDialog(description: 'Функция Tap2Phone доступна c Android версии 7.0');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Инициализация
|
||||||
|
bool initialized = await _bankService.init();
|
||||||
|
if (!initialized) {
|
||||||
|
setState(() {
|
||||||
|
isClosePosBusy = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Проверка связи
|
||||||
|
bool connected = await _bankService.connect();
|
||||||
|
if (!connected) {
|
||||||
|
setState(() {
|
||||||
|
isClosePosBusy = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Авторизация
|
||||||
|
BankState bankState = Redux.store.state.bankState;
|
||||||
|
AmanDao authDao = await _bankService.auth(
|
||||||
|
login: bankState.login, password: bankState.password);
|
||||||
|
if (!authDao.success) {
|
||||||
|
if (authDao.msg != null) {
|
||||||
|
_dialog.showDialog(description: authDao.msg);
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
isClosePosBusy = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AmanDao closeDayDao = await _bankService.closeDay();
|
||||||
|
|
||||||
|
if (!closeDayDao.success) {
|
||||||
|
if (closeDayDao.msg != null) {
|
||||||
|
_dialog.showDialog(description: closeDayDao.msg);
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
isClosePosBusy = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_dialog.showDialog(description: 'Закрытие дня: операция прошла успешно!');
|
||||||
|
setState(() {
|
||||||
|
isClosePosBusy = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|
@ -256,52 +326,72 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
verticalSpaceMedium,
|
verticalSpaceMedium,
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
child: Center(
|
child: Row(
|
||||||
child: Column(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: [
|
||||||
Text(
|
Column(
|
||||||
'Денег в кассе:',
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
style: TextStyle(color: primaryColor, fontSize: 15),
|
children: <Widget>[
|
||||||
),
|
Row(
|
||||||
SizedBox(
|
children: [
|
||||||
height: 50,
|
Icon(Icons.money, color: primaryColor),
|
||||||
width: double.infinity,
|
Text(
|
||||||
child: StoreConnector<AppState, Money>(
|
'Денег в кассе:',
|
||||||
converter: (store) => store.state.userState.money,
|
style: TextStyle(color: primaryColor, fontSize: 15),
|
||||||
builder: (_, vm) {
|
),
|
||||||
if (vm.loading == true) {
|
],
|
||||||
return Center(
|
),
|
||||||
child: SizedBox(
|
SizedBox(
|
||||||
width: 30,
|
height: 50,
|
||||||
height: 30,
|
// width: double.infinity,
|
||||||
child: Padding(
|
child: StoreConnector<AppState, Money>(
|
||||||
padding: const EdgeInsets.all(8.0),
|
converter: (store) => store.state.userState.money,
|
||||||
child: CircularProgressIndicator(
|
builder: (_, vm) {
|
||||||
strokeWidth: 2,
|
if (vm.loading == true) {
|
||||||
valueColor: new AlwaysStoppedAnimation<Color>(
|
return Center(
|
||||||
primaryColor),
|
child: SizedBox(
|
||||||
|
width: 30,
|
||||||
|
height: 30,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
valueColor:
|
||||||
|
new AlwaysStoppedAnimation<Color>(
|
||||||
|
primaryColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Center(
|
||||||
|
child: Text(
|
||||||
|
vm.total != null
|
||||||
|
? '${vm.total} тенге'
|
||||||
|
: 'нет информации',
|
||||||
|
style: TextStyle(
|
||||||
|
color: vm.total != null
|
||||||
|
? primaryColor
|
||||||
|
: Colors.grey.withOpacity(0.5),
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}),
|
||||||
}
|
),
|
||||||
return Center(
|
],
|
||||||
child: Text(
|
),
|
||||||
vm.total != null
|
Container(
|
||||||
? '${vm.total} тенге'
|
child: AmanIconButton(
|
||||||
: 'нет информации',
|
title: 'Обновить',
|
||||||
style: TextStyle(
|
onPressed: _checkMoney,
|
||||||
color: vm.total != null
|
busy: isMoneyCheckBusy,
|
||||||
? primaryColor
|
icon: Icons.replay_circle_filled,
|
||||||
: Colors.grey.withOpacity(0.5),
|
mainColor: primaryColor,
|
||||||
fontSize: 25,
|
),
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
),
|
),
|
||||||
verticalSpaceMedium,
|
verticalSpaceMedium,
|
||||||
Wrap(
|
Wrap(
|
||||||
|
|
@ -325,12 +415,19 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
busy: closeSmenaBusy,
|
busy: closeSmenaBusy,
|
||||||
icon: Icons.lock_outline,
|
icon: Icons.lock_outline,
|
||||||
),
|
),
|
||||||
|
// AmanIconButton(
|
||||||
|
// title: 'Денег в кассе',
|
||||||
|
// onPressed: _checkMoney,
|
||||||
|
// busy: isMoneyCheckBusy,
|
||||||
|
// icon: MdiIcons.walletOutline,
|
||||||
|
// mainColor: primaryColor,
|
||||||
|
// ),
|
||||||
AmanIconButton(
|
AmanIconButton(
|
||||||
title: 'Денег в кассе',
|
title: 'Закрыть POS',
|
||||||
onPressed: _checkMoney,
|
onPressed: _closeDay,
|
||||||
busy: isMoneyCheckBusy,
|
busy: isClosePosBusy,
|
||||||
icon: MdiIcons.walletOutline,
|
icon: Icons.phonelink_lock_outlined,
|
||||||
mainColor: primaryColor,
|
mainColor: purpleColor,
|
||||||
),
|
),
|
||||||
AmanIconButton(
|
AmanIconButton(
|
||||||
title: 'Х Отчет',
|
title: 'Х Отчет',
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ class _PaymentNfcViewState extends State<PaymentNfcView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
status = 3;
|
status = 9;
|
||||||
isPhoneScaled = false;
|
isPhoneScaled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,17 @@ class _PhoneViewState extends State<PhoneView> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(widget.status == 9){
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(MdiIcons.checkBold, color: greenColor,size: ScreenUtil().setSp(90.0),),
|
||||||
|
verticalSpaceSmall,
|
||||||
|
AutoSizeText('Возврат транзакции', style: TextStyle(fontWeight: FontWeight.bold),)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue