release 1.0.2
parent
5dcb99ec67
commit
4d4ea42c6a
|
|
@ -4,9 +4,9 @@
|
||||||
<item android:drawable="@android:color/white" />
|
<item android:drawable="@android:color/white" />
|
||||||
|
|
||||||
<!-- You can insert your own image assets here -->
|
<!-- You can insert your own image assets here -->
|
||||||
<!-- <item>
|
<!-- <item>-->
|
||||||
<bitmap
|
<!-- <bitmap-->
|
||||||
android:gravity="center"
|
<!-- android:gravity="clip_vertical"-->
|
||||||
android:src="@mipmap/launch_image" />
|
<!-- android:src="@mipmap/splash" />-->
|
||||||
</item> -->
|
<!-- </item>-->
|
||||||
</layer-list>
|
</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 |
|
|
@ -0,0 +1,4 @@
|
||||||
|
class Money {
|
||||||
|
final num total;
|
||||||
|
Money({this.total});
|
||||||
|
}
|
||||||
|
|
@ -141,7 +141,22 @@ class DataService extends BaseService {
|
||||||
return null;
|
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 {
|
Future<bool> getDataFromServer(User user) async {
|
||||||
|
log.i('Get Data from server');
|
||||||
try {
|
try {
|
||||||
String token = user.token;
|
String token = user.token;
|
||||||
Response<dynamic> goods = await _api.getGoodsFromServer(token);
|
Response<dynamic> goods = await _api.getGoodsFromServer(token);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/message.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/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/response.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/smena.dart';
|
import 'package:aman_kassa_flutter/core/models/smena.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/user.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) {
|
ThunkAction<AppState> authenticateToken(String token) {
|
||||||
return (Store<AppState> store) async {
|
return (Store<AppState> store) async {
|
||||||
store.dispatch(SetUserStateAction(UserState(isLoading: true)));
|
store.dispatch(SetUserStateAction(UserState(isLoading: true)));
|
||||||
|
|
@ -139,6 +153,7 @@ Future<void> closeSmena(Store<AppState> store) async {
|
||||||
String token = store.state.userState.user.token;
|
String token = store.state.userState.user.token;
|
||||||
Response<Smena> result = await _api.closeSmena(token);
|
Response<Smena> result = await _api.closeSmena(token);
|
||||||
store.dispatch(SetUserStateAction(UserState(smena: result.body)));
|
store.dispatch(SetUserStateAction(UserState(smena: result.body)));
|
||||||
|
store.dispatch(checkMoney);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> openSmena(Store<AppState> store) async {
|
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)));
|
store.dispatch(SetUserStateAction(UserState(smena: result.body)));
|
||||||
if(result.operation){
|
if(result.operation){
|
||||||
store.dispatch(checkSmena);
|
store.dispatch(checkSmena);
|
||||||
|
store.dispatch(checkMoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,9 @@ userReducer(UserState prevState, SetUserStateAction action) {
|
||||||
isAuthenticated: payload.isAuthenticated,
|
isAuthenticated: payload.isAuthenticated,
|
||||||
loginFormMessage: payload.loginFormMessage,
|
loginFormMessage: payload.loginFormMessage,
|
||||||
smena: payload.smena,
|
smena: payload.smena,
|
||||||
|
money: payload.money,
|
||||||
|
password: payload.password,
|
||||||
|
login: payload.login,
|
||||||
|
authenticateType: payload.authenticateType,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -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/smena.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/user.dart';
|
import 'package:aman_kassa_flutter/core/models/user.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
@ -13,6 +14,7 @@ class UserState {
|
||||||
final LoginFormMessage loginFormMessage;
|
final LoginFormMessage loginFormMessage;
|
||||||
final User user;
|
final User user;
|
||||||
final Smena smena;
|
final Smena smena;
|
||||||
|
final Money money;
|
||||||
|
|
||||||
UserState(
|
UserState(
|
||||||
{this.isError,
|
{this.isError,
|
||||||
|
|
@ -23,7 +25,8 @@ class UserState {
|
||||||
this.password,
|
this.password,
|
||||||
this.user,
|
this.user,
|
||||||
this.loginFormMessage,
|
this.loginFormMessage,
|
||||||
this.smena});
|
this.smena,
|
||||||
|
this.money});
|
||||||
|
|
||||||
factory UserState.initial(UserState payload) => UserState(
|
factory UserState.initial(UserState payload) => UserState(
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
|
@ -35,6 +38,7 @@ class UserState {
|
||||||
authenticateType: payload?.authenticateType ?? null,
|
authenticateType: payload?.authenticateType ?? null,
|
||||||
login: payload?.login ?? null,
|
login: payload?.login ?? null,
|
||||||
password: payload?.password ?? null,
|
password: payload?.password ?? null,
|
||||||
|
money: Money(),
|
||||||
);
|
);
|
||||||
|
|
||||||
UserState copyWith(
|
UserState copyWith(
|
||||||
|
|
@ -47,6 +51,7 @@ class UserState {
|
||||||
@required String authenticateType,
|
@required String authenticateType,
|
||||||
@required String login,
|
@required String login,
|
||||||
@required String password,
|
@required String password,
|
||||||
|
@required Money money,
|
||||||
}) {
|
}) {
|
||||||
return UserState(
|
return UserState(
|
||||||
isError: isError ?? this.isError,
|
isError: isError ?? this.isError,
|
||||||
|
|
@ -58,6 +63,7 @@ class UserState {
|
||||||
authenticateType: authenticateType ?? this.authenticateType,
|
authenticateType: authenticateType ?? this.authenticateType,
|
||||||
login: login ?? this.login,
|
login: login ?? this.login,
|
||||||
password: password ?? this.password,
|
password: password ?? this.password,
|
||||||
|
money: money ?? this.money,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
const List<Choice> choices = const <Choice>[
|
const List<Choice> choices = const <Choice>[
|
||||||
const Choice(title: 'Обновить номенклатуру', icon: Icons.update, command: 'update'),
|
const Choice(title: 'Обновить номенклатуру', icon: Icons.update, command: 'update'),
|
||||||
const Choice(title: 'Помощь', icon: Icons.help, command: 'help'),
|
//const Choice(title: 'Помощь', icon: Icons.help, command: 'help'),
|
||||||
const Choice(title: 'О Программе', icon: Icons.info_outline, command: 'info'),
|
//const Choice(title: 'О Программе', icon: Icons.info_outline, command: 'info'),
|
||||||
const Choice(title: 'Язык', icon: Icons.language, command: 'language'),
|
//const Choice(title: 'Язык', icon: Icons.language, command: 'language'),
|
||||||
const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit')
|
const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit')
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ class _HomeViewState extends State<HomeView> {
|
||||||
selectedTabIndex = 0;
|
selectedTabIndex = 0;
|
||||||
pageController = new PageController(initialPage: selectedTabIndex);
|
pageController = new PageController(initialPage: selectedTabIndex);
|
||||||
Redux.store.dispatch(checkSmena);
|
Redux.store.dispatch(checkSmena);
|
||||||
|
_dataService.checkDbFill(Redux.store.state.userState.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/message.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/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/smena.dart';
|
import 'package:aman_kassa_flutter/core/models/smena.dart';
|
||||||
|
|
@ -104,9 +105,10 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
if (response.confirmed) {
|
if (response.confirmed) {
|
||||||
Response<dynamic> result = await _api.deposit(
|
Response<dynamic> result = await _api.deposit(
|
||||||
Redux.store.state.userState.user.token, response.responseText);
|
Redux.store.state.userState.user.token, response.responseText);
|
||||||
//if(result.operation) {
|
|
||||||
_dialog.showDialog(description: result.body['message']);
|
_dialog.showDialog(description: result.body['message']);
|
||||||
//}
|
if(result.operation) {
|
||||||
|
await Redux.store.dispatch(checkMoney);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
|
@ -130,9 +132,10 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
if (response.confirmed) {
|
if (response.confirmed) {
|
||||||
Response<dynamic> result = await _api.withdrawal(
|
Response<dynamic> result = await _api.withdrawal(
|
||||||
Redux.store.state.userState.user.token, response.responseText);
|
Redux.store.state.userState.user.token, response.responseText);
|
||||||
//if(result.operation) {
|
|
||||||
_dialog.showDialog(description: result.body['message']);
|
_dialog.showDialog(description: result.body['message']);
|
||||||
//}
|
if(result.operation) {
|
||||||
|
await Redux.store.dispatch(checkMoney);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
|
@ -148,16 +151,18 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
isMoneyCheckBusy = true;
|
isMoneyCheckBusy = true;
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
Response<dynamic> result =
|
Response<dynamic> result = await Redux.store.dispatch(checkMoney);
|
||||||
await _api.money(Redux.store.state.userState.user.token);
|
//await _api.money(.state.userState.user.token);
|
||||||
setState(() {
|
setState(() {
|
||||||
isMoneyCheckBusy = false;
|
isMoneyCheckBusy = false;
|
||||||
});
|
});
|
||||||
if (result.operation) {
|
if(result != null) {
|
||||||
_dialog.showDialog(
|
if (result.operation) {
|
||||||
description: 'Денег в кассе: ${result.body['money']}');
|
_dialog.showDialog(
|
||||||
} else {
|
description: 'Денег в кассе: ${result.body['money']}');
|
||||||
_dialog.showDialog(description: '${result.body['message']}');
|
} else {
|
||||||
|
_dialog.showDialog(description: '${result.body['message']}');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
|
@ -220,12 +225,17 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
'Денег в кассе:',
|
'Денег в кассе:',
|
||||||
style: TextStyle(color: primaryColor, fontSize: 15),
|
style: TextStyle(color: primaryColor, fontSize: 15),
|
||||||
),
|
),
|
||||||
Text(
|
StoreConnector<AppState,Money>(
|
||||||
'250 024.38 тенге',
|
converter: (store) => store.state.userState.money,
|
||||||
style: TextStyle(
|
builder: (_, vm) {
|
||||||
color: primaryColor,
|
return Text(
|
||||||
fontSize: 25,
|
vm.total !=null ? '${vm.total} тенге' : 'нет информации',
|
||||||
fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
|
color: vm.total !=null ? primaryColor : Colors.grey.withOpacity(0.5),
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
);
|
||||||
|
}
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
|
|
|
||||||
|
|
@ -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/core/services/navigator_service.dart';
|
||||||
import 'package:aman_kassa_flutter/redux/actions/calc_actions.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/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/operation_const.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/calc_state.dart';
|
import 'package:aman_kassa_flutter/redux/state/calc_state.dart';
|
||||||
|
|
@ -141,12 +142,12 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
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'];
|
||||||
|
if(_mode == SettingModeCalc){
|
||||||
// if(_mode == SettingModeCalc){
|
Redux.store.dispatch(cleanCalcItems);
|
||||||
// Redux.store.dispatch(cleanCalcItems);
|
} else if(_mode == SettingModeKassa) {
|
||||||
// } else if(_mode == SettingModeKassa) {
|
Redux.store.dispatch(cleanKassaItems);
|
||||||
// Redux.store.dispatch(cleanKassaItems);
|
}
|
||||||
// }
|
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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue