release 1.0.2

4.4
Serik.Uvaissov 2020-06-25 13:48:18 +06:00
parent 5dcb99ec67
commit 4d4ea42c6a
15 changed files with 89 additions and 32 deletions

View File

@ -4,9 +4,9 @@
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
<!-- <item>-->
<!-- <bitmap-->
<!-- android:gravity="clip_vertical"-->
<!-- android:src="@mipmap/splash" />-->
<!-- </item>-->
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,4 @@
class Money {
final num total;
Money({this.total});
}

View File

@ -141,7 +141,22 @@ class DataService extends BaseService {
return null;
}
Future<void> checkDbFill(User user) async {
int serviceCount = await _db.queryRowCount(Service_tableName);
if( serviceCount ==0) {
int goodCount = await _db.queryRowCount(Goog_tableName);
if(goodCount == 0){
await getDataFromServer(user);
} else {
log.i('$Goog_tableName is Fill');
}
} else {
log.i('$Service_tableName is Fill');
}
}
Future<bool> getDataFromServer(User user) async {
log.i('Get Data from server');
try {
String token = user.token;
Response<dynamic> goods = await _api.getGoodsFromServer(token);

View File

@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:aman_kassa_flutter/core/locator.dart';
import 'package:aman_kassa_flutter/core/models/message.dart';
import 'package:aman_kassa_flutter/core/models/auth_response.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/smena.dart';
import 'package:aman_kassa_flutter/core/models/user.dart';
@ -77,6 +78,19 @@ Future<void> logoutAction(Store<AppState> store) async {
}
}
Future<Response<dynamic>> checkMoney(Store<AppState> store) async {
try {
Response<dynamic> result = await _api.money(store.state.userState.user.token);
if (result.operation) {
store.dispatch(SetUserStateAction(
UserState(money: Money(total: double.parse(result.body['money'])))));
}
return result;
} catch (error) {
return null;
}
}
ThunkAction<AppState> authenticateToken(String token) {
return (Store<AppState> store) async {
store.dispatch(SetUserStateAction(UserState(isLoading: true)));
@ -139,6 +153,7 @@ Future<void> closeSmena(Store<AppState> store) async {
String token = store.state.userState.user.token;
Response<Smena> result = await _api.closeSmena(token);
store.dispatch(SetUserStateAction(UserState(smena: result.body)));
store.dispatch(checkMoney);
}
Future<void> openSmena(Store<AppState> store) async {
@ -147,5 +162,6 @@ Future<void> openSmena(Store<AppState> store) async {
store.dispatch(SetUserStateAction(UserState(smena: result.body)));
if(result.operation){
store.dispatch(checkSmena);
store.dispatch(checkMoney);
}
}

View File

@ -11,5 +11,9 @@ userReducer(UserState prevState, SetUserStateAction action) {
isAuthenticated: payload.isAuthenticated,
loginFormMessage: payload.loginFormMessage,
smena: payload.smena,
money: payload.money,
password: payload.password,
login: payload.login,
authenticateType: payload.authenticateType,
);
}

View File

@ -1,3 +1,4 @@
import 'package:aman_kassa_flutter/core/models/money.dart';
import 'package:aman_kassa_flutter/core/models/smena.dart';
import 'package:aman_kassa_flutter/core/models/user.dart';
import 'package:meta/meta.dart';
@ -13,6 +14,7 @@ class UserState {
final LoginFormMessage loginFormMessage;
final User user;
final Smena smena;
final Money money;
UserState(
{this.isError,
@ -23,7 +25,8 @@ class UserState {
this.password,
this.user,
this.loginFormMessage,
this.smena});
this.smena,
this.money});
factory UserState.initial(UserState payload) => UserState(
isLoading: false,
@ -35,6 +38,7 @@ class UserState {
authenticateType: payload?.authenticateType ?? null,
login: payload?.login ?? null,
password: payload?.password ?? null,
money: Money(),
);
UserState copyWith(
@ -47,6 +51,7 @@ class UserState {
@required String authenticateType,
@required String login,
@required String password,
@required Money money,
}) {
return UserState(
isError: isError ?? this.isError,
@ -58,6 +63,7 @@ class UserState {
authenticateType: authenticateType ?? this.authenticateType,
login: login ?? this.login,
password: password ?? this.password,
money: money ?? this.money,
);
}

View File

@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
const List<Choice> choices = const <Choice>[
const Choice(title: 'Обновить номенклатуру', icon: Icons.update, command: 'update'),
const Choice(title: 'Помощь', icon: Icons.help, command: 'help'),
const Choice(title: 'О Программе', icon: Icons.info_outline, command: 'info'),
const Choice(title: 'Язык', icon: Icons.language, command: 'language'),
//const Choice(title: 'Помощь', icon: Icons.help, command: 'help'),
//const Choice(title: 'О Программе', icon: Icons.info_outline, command: 'info'),
//const Choice(title: 'Язык', icon: Icons.language, command: 'language'),
const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit')
];

View File

@ -55,6 +55,7 @@ class _HomeViewState extends State<HomeView> {
selectedTabIndex = 0;
pageController = new PageController(initialPage: selectedTabIndex);
Redux.store.dispatch(checkSmena);
_dataService.checkDbFill(Redux.store.state.userState.user);
}
@override

View File

@ -1,5 +1,6 @@
import 'package:aman_kassa_flutter/core/locator.dart';
import 'package:aman_kassa_flutter/core/models/message.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/dialog_models.dart';
import 'package:aman_kassa_flutter/core/models/smena.dart';
@ -104,9 +105,10 @@ class _AdditionalTabState extends State<AdditionalTab> {
if (response.confirmed) {
Response<dynamic> result = await _api.deposit(
Redux.store.state.userState.user.token, response.responseText);
//if(result.operation) {
_dialog.showDialog(description: result.body['message']);
//}
if(result.operation) {
await Redux.store.dispatch(checkMoney);
}
}
} catch (e) {
print(e);
@ -130,9 +132,10 @@ class _AdditionalTabState extends State<AdditionalTab> {
if (response.confirmed) {
Response<dynamic> result = await _api.withdrawal(
Redux.store.state.userState.user.token, response.responseText);
//if(result.operation) {
_dialog.showDialog(description: result.body['message']);
//}
if(result.operation) {
await Redux.store.dispatch(checkMoney);
}
}
} catch (e) {
print(e);
@ -148,16 +151,18 @@ class _AdditionalTabState extends State<AdditionalTab> {
isMoneyCheckBusy = true;
});
try {
Response<dynamic> result =
await _api.money(Redux.store.state.userState.user.token);
Response<dynamic> result = await Redux.store.dispatch(checkMoney);
//await _api.money(.state.userState.user.token);
setState(() {
isMoneyCheckBusy = false;
});
if (result.operation) {
_dialog.showDialog(
description: 'Денег в кассе: ${result.body['money']}');
} else {
_dialog.showDialog(description: '${result.body['message']}');
if(result != null) {
if (result.operation) {
_dialog.showDialog(
description: 'Денег в кассе: ${result.body['money']}');
} else {
_dialog.showDialog(description: '${result.body['message']}');
}
}
} catch (e) {
print(e);
@ -220,12 +225,17 @@ class _AdditionalTabState extends State<AdditionalTab> {
'Денег в кассе:',
style: TextStyle(color: primaryColor, fontSize: 15),
),
Text(
'250 024.38 тенге',
style: TextStyle(
color: primaryColor,
fontSize: 25,
fontWeight: FontWeight.bold),
StoreConnector<AppState,Money>(
converter: (store) => store.state.userState.money,
builder: (_, vm) {
return Text(
vm.total !=null ? '${vm.total} тенге' : 'нет информации',
style: TextStyle(
color: vm.total !=null ? primaryColor : Colors.grey.withOpacity(0.5),
fontSize: 25,
fontWeight: FontWeight.bold),
);
}
),
],
)),

View File

@ -8,6 +8,7 @@ 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/redux/actions/calc_actions.dart';
import 'package:aman_kassa_flutter/redux/actions/kassa_actions.dart';
import 'package:aman_kassa_flutter/redux/actions/user_actions.dart';
import 'package:aman_kassa_flutter/redux/constants/operation_const.dart';
import 'package:aman_kassa_flutter/redux/constants/setting_const.dart';
import 'package:aman_kassa_flutter/redux/state/calc_state.dart';
@ -141,12 +142,12 @@ class _PaymentViewState extends State<PaymentView> {
if(response.operation){
String message = response.body['message'];
String check = response.body['check'];
// if(_mode == SettingModeCalc){
// Redux.store.dispatch(cleanCalcItems);
// } else if(_mode == SettingModeKassa) {
// Redux.store.dispatch(cleanKassaItems);
// }
if(_mode == SettingModeCalc){
Redux.store.dispatch(cleanCalcItems);
} else if(_mode == SettingModeKassa) {
Redux.store.dispatch(cleanKassaItems);
}
Redux.store.dispatch(checkMoney);
_navigatorService.pop();
_navigatorService.push(ImageShowRoute, arguments: ImageShowModel(check, message));
} else if(!response.operation && response.status !=500) {