parent
a80eb5874f
commit
0b4424a0e4
|
|
@ -12,6 +12,7 @@ const String Voucher_columnUrl = 'url';
|
||||||
|
|
||||||
|
|
||||||
const String VoucherTypePayment = 'payment';
|
const String VoucherTypePayment = 'payment';
|
||||||
|
const String VoucherTypeReturnPay = 'returnPay';
|
||||||
const String VoucherTypeReport = 'report';
|
const String VoucherTypeReport = 'report';
|
||||||
|
|
||||||
class Voucher {
|
class Voucher {
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,6 @@ const String HomeViewRoute = "HomeView";
|
||||||
const String ImageShowRoute = "ImageShowRoute";
|
const String ImageShowRoute = "ImageShowRoute";
|
||||||
const String PaymentViewRoute = "PaymentView";
|
const String PaymentViewRoute = "PaymentView";
|
||||||
const String HistoryViewRoute = "HistoryView";
|
const String HistoryViewRoute = "HistoryView";
|
||||||
|
const String InfoKkmViewRoute = "InfoKkmViewRoute";
|
||||||
|
const String QrViewRoute = "QrViewRoute";
|
||||||
// Generate the views here
|
// Generate the views here
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:aman_kassa_flutter/views/check/image_show_container.dart';
|
import 'package:aman_kassa_flutter/views/check/image_show_container.dart';
|
||||||
import 'package:aman_kassa_flutter/views/history/history_view.dart';
|
import 'package:aman_kassa_flutter/views/history/history_view.dart';
|
||||||
|
import 'package:aman_kassa_flutter/views/info_kkm/info_kkm_view.dart';
|
||||||
import 'package:aman_kassa_flutter/views/payment/payment_view.dart';
|
import 'package:aman_kassa_flutter/views/payment/payment_view.dart';
|
||||||
|
import 'package:aman_kassa_flutter/views/qr_view/qr_view.dart';
|
||||||
|
|
||||||
import './route_names.dart';
|
import './route_names.dart';
|
||||||
import 'package:aman_kassa_flutter/views/home/home_view.dart';
|
import 'package:aman_kassa_flutter/views/home/home_view.dart';
|
||||||
|
|
@ -30,9 +32,24 @@ Route<dynamic> generateRoute(RouteSettings settings) {
|
||||||
routeName: settings.name,
|
routeName: settings.name,
|
||||||
viewToShow: HistoryView(),
|
viewToShow: HistoryView(),
|
||||||
);
|
);
|
||||||
|
case InfoKkmViewRoute:
|
||||||
|
return _getPageRoute(
|
||||||
|
routeName: settings.name,
|
||||||
|
viewToShow: InfoKkmView(),
|
||||||
|
);
|
||||||
|
case QrViewRoute:
|
||||||
|
ImageShowModel data = settings.arguments as ImageShowModel;
|
||||||
|
return _getPageRoute(
|
||||||
|
routeName: settings.name,
|
||||||
|
viewToShow: QrView(data),
|
||||||
|
);
|
||||||
case ImageShowRoute:
|
case ImageShowRoute:
|
||||||
ImageShowModel data = settings.arguments as ImageShowModel;
|
ImageShowModel data = settings.arguments as ImageShowModel;
|
||||||
return SlideRightRoute(widget: ImageShowContainer(data));
|
//return SlideRightRoute(widget: ImageShowContainer(data));
|
||||||
|
return _getPageRoute(
|
||||||
|
routeName: settings.name,
|
||||||
|
viewToShow: ImageShowContainer(data),
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (_) => Scaffold(
|
builder: (_) => Scaffold(
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,10 @@ import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
/// The service responsible for networking requests
|
/// The service responsible for networking requests
|
||||||
class ApiService extends BaseService {
|
class ApiService extends BaseService {
|
||||||
static const test_endpoint = 'https://kassa-test.aman.com.kz/ru/api/v2';
|
static const test_host = 'https://kassa-test.aman.com.kz';
|
||||||
static const endpoint = 'https://kassa.aman.com.kz/ru/api/v2';
|
static const test_endpoint = '$test_host/ru/api/v2';
|
||||||
|
static const host = 'https://kassa.aman.com.kz';
|
||||||
|
static const endpoint = '$host/ru/api/v2';
|
||||||
final NavigatorService _navigatorService = locator<NavigatorService>();
|
final NavigatorService _navigatorService = locator<NavigatorService>();
|
||||||
final DialogService _dialogService = locator<DialogService>();
|
final DialogService _dialogService = locator<DialogService>();
|
||||||
|
|
||||||
|
|
@ -64,6 +66,12 @@ class ApiService extends BaseService {
|
||||||
return Response.fromJsonDynamic(json.decode(response));
|
return Response.fromJsonDynamic(json.decode(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Response<dynamic>> infoKkm(String token) async {
|
||||||
|
Map<String, String> requestBody = <String, String>{'api_token': token};
|
||||||
|
var response = await requestFormData('/info', requestBody);
|
||||||
|
return Response.fromJsonDynamic(json.decode(response));
|
||||||
|
}
|
||||||
|
|
||||||
Future<Response<dynamic>> deposit(String token, String sum) async {
|
Future<Response<dynamic>> deposit(String token, String sum) async {
|
||||||
Map<String, String> requestBody = <String, String>{'api_token': token, 'summ': sum};
|
Map<String, String> requestBody = <String, String>{'api_token': token, 'summ': sum};
|
||||||
var response = await requestFormData('/deposit', requestBody);
|
var response = await requestFormData('/deposit', requestBody);
|
||||||
|
|
@ -172,4 +180,5 @@ class ApiService extends BaseService {
|
||||||
var response = await requestFormData('/services', requestBody);
|
var response = await requestFormData('/services', requestBody);
|
||||||
return Response.fromJsonDynamic(json.decode(response));
|
return Response.fromJsonDynamic(json.decode(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,11 +151,18 @@ class DataService extends BaseService {
|
||||||
User user = Redux.store.state.userState.user;
|
User user = Redux.store.state.userState.user;
|
||||||
String check = response?.body['check'];
|
String check = response?.body['check'];
|
||||||
dynamic journal = response?.body['journal'];
|
dynamic journal = response?.body['journal'];
|
||||||
print(journal);
|
String url = response?.body['link'];
|
||||||
int checkNum = journal['check_num'];
|
int checkNum = journal['check_num'];
|
||||||
var summ = journal['summ'];
|
var summ = journal['summ'];
|
||||||
double total = summ!= null ? double.parse(summ.toString()) : 0.0;
|
double total = summ!= null ? double.parse(summ.toString()) : 0.0;
|
||||||
this.insertVoucher(user: user, name: 'Чек №$checkNum', data: data , base64Data: check, total: total );
|
this.insertVoucher(
|
||||||
|
user: user,
|
||||||
|
name: 'Чек №$checkNum',
|
||||||
|
data: data ,
|
||||||
|
base64Data: check,
|
||||||
|
total: total,
|
||||||
|
url: url,
|
||||||
|
type: operationType == OperationTypeReturn ? VoucherTypeReturnPay : VoucherTypePayment );
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
import 'package:aman_kassa_flutter/core/locator.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/route_names.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/shared/app_colors.dart';
|
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
||||||
import 'package:aman_kassa_flutter/shared/ui_helpers.dart';
|
import 'package:aman_kassa_flutter/shared/ui_helpers.dart';
|
||||||
import 'package:aman_kassa_flutter/widgets/fields/busy_button.dart';
|
import 'package:aman_kassa_flutter/widgets/fields/busy_button.dart';
|
||||||
|
|
@ -41,8 +43,9 @@ Padding imageFromBase64String(String base64String) {
|
||||||
class ImageShowModel {
|
class ImageShowModel {
|
||||||
final String data;
|
final String data;
|
||||||
final String title;
|
final String title;
|
||||||
|
final String url;
|
||||||
|
|
||||||
ImageShowModel(this.data, this.title);
|
ImageShowModel({ this.data, this.title, this.url});
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyFloatingActionButton extends StatefulWidget {
|
class MyFloatingActionButton extends StatefulWidget {
|
||||||
|
|
@ -55,6 +58,7 @@ class MyFloatingActionButton extends StatefulWidget {
|
||||||
class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
||||||
bool showFab = true;
|
bool showFab = true;
|
||||||
DialogService _dialog = locator<DialogService>();
|
DialogService _dialog = locator<DialogService>();
|
||||||
|
NavigatorService _navigatorService = locator<NavigatorService>();
|
||||||
// String _batteryLevel = 'Unknown battery level.';
|
// String _batteryLevel = 'Unknown battery level.';
|
||||||
// static const platform = const MethodChannel('samples.flutter.dev/battery');
|
// static const platform = const MethodChannel('samples.flutter.dev/battery');
|
||||||
//
|
//
|
||||||
|
|
@ -93,21 +97,22 @@ class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
||||||
spreadRadius: 5)
|
spreadRadius: 5)
|
||||||
]),
|
]),
|
||||||
//color: Colors.grey[900],
|
//color: Colors.grey[900],
|
||||||
height: 200,
|
height: 260,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
//verticalSpaceSmall,
|
|
||||||
//BusyButton(title: 'Электронная почта', onPressed: shareFile , mainColor: primaryColor, icon: Icons.mail, enabled: false, ),
|
|
||||||
verticalSpaceSmall,
|
verticalSpaceSmall,
|
||||||
BusyButton(
|
BusyButton(
|
||||||
title: 'WhatsApp',
|
title: 'WhatsApp',
|
||||||
onPressed: callWhatsApp,
|
onPressed: callWhatsApp,
|
||||||
mainColor: greenColor,
|
mainColor: greenColor,
|
||||||
icon: MdiIcons.whatsapp,
|
icon: MdiIcons.whatsapp,
|
||||||
|
enabled: widget.data.url != null,
|
||||||
),
|
),
|
||||||
verticalSpaceSmall,
|
verticalSpaceSmall,
|
||||||
|
BusyButton(title: 'QR-код чека', onPressed: qrGenerate , mainColor: primaryColor, icon: MdiIcons.qrcode, enabled: widget.data.url != null, ),
|
||||||
|
verticalSpaceSmall,
|
||||||
BusyButton(
|
BusyButton(
|
||||||
title: '',
|
title: 'Поделиться',
|
||||||
onPressed: shareFile,
|
onPressed: shareFile,
|
||||||
mainColor: yellowColor,
|
mainColor: yellowColor,
|
||||||
icon: Icons.share,
|
icon: Icons.share,
|
||||||
|
|
@ -132,6 +137,10 @@ class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qrGenerate() async {
|
||||||
|
_navigatorService.push(QrViewRoute, arguments: ImageShowModel(data: widget.data.url, title: 'Спасибо за покупку'));
|
||||||
|
}
|
||||||
|
|
||||||
void callWhatsApp() async {
|
void callWhatsApp() async {
|
||||||
DialogResponse response = await _dialog.showConfirmationDialogInput(
|
DialogResponse response = await _dialog.showConfirmationDialogInput(
|
||||||
description: 'Номер телефона',
|
description: 'Номер телефона',
|
||||||
|
|
@ -140,7 +149,7 @@ class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
||||||
);
|
);
|
||||||
if (response.confirmed) {
|
if (response.confirmed) {
|
||||||
String phoneNumber = response.responseText;
|
String phoneNumber = response.responseText;
|
||||||
String msg = "Спасибо за покупку! \r\n https://picsum.photos/200/300 ";
|
String msg = "Спасибо за покупку! \r\n ${widget.data.url} ";
|
||||||
|
|
||||||
launchWhatsApp(phone: phoneNumber, message: msg);
|
launchWhatsApp(phone: phoneNumber, message: msg);
|
||||||
//FlutterOpenWhatsapp.sendSingleMessage(phoneNumber, "Спасибо что выбераете нас \r\n https://picsum.photos/200/300 ");
|
//FlutterOpenWhatsapp.sendSingleMessage(phoneNumber, "Спасибо что выбераете нас \r\n https://picsum.photos/200/300 ");
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,16 @@ class _HistoryViewState extends State<HistoryView> {
|
||||||
NavigatorService _navigatorService = locator<NavigatorService>();
|
NavigatorService _navigatorService = locator<NavigatorService>();
|
||||||
List<Voucher> data = [];
|
List<Voucher> data = [];
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
load() async {
|
load() async {
|
||||||
List<Map> list = await _dbService.queryAllRowsOrderBy(Voucher_tableName, '$Voucher_columnDateTime desc');
|
List<Map> list = await _dbService.queryAllRowsOrderBy(
|
||||||
print(list);
|
Voucher_tableName, '$Voucher_columnDateTime desc');
|
||||||
setState(() {
|
setState(() {
|
||||||
data = list.map((e) => Voucher.fromMap(e)).toList();
|
data = list.map((e) => Voucher.fromMap(e)).toList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,39 +42,62 @@ class _HistoryViewState extends State<HistoryView> {
|
||||||
title: Text('История чеков'),
|
title: Text('История чеков'),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text('Очистить', style: TextStyle(color: whiteColor, fontSize: 15, fontWeight: FontWeight.bold),),
|
child: Text(
|
||||||
onPressed: () async {
|
'Очистить',
|
||||||
await _dbService.deleteAll(Voucher_tableName);
|
style: TextStyle(
|
||||||
await this.load();
|
color: whiteColor,
|
||||||
})
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
await _dbService.deleteAll(Voucher_tableName);
|
||||||
|
await this.load();
|
||||||
|
})
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: ListView.separated(
|
body: ListView.separated(
|
||||||
itemCount: data.length,
|
itemCount: data.length,
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return Divider();
|
return Divider();
|
||||||
},
|
},
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
Voucher voucher = data[index];
|
Voucher voucher = data[index];
|
||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: (){
|
onTap: () {
|
||||||
_navigatorService.push(ImageShowRoute,
|
_navigatorService.push(ImageShowRoute,
|
||||||
arguments: ImageShowModel(voucher.base64Data, voucher.name));
|
arguments: ImageShowModel(
|
||||||
},
|
data: voucher.base64Data,
|
||||||
title: buildText(voucher),
|
title: voucher.name,
|
||||||
subtitle: Text(dateFormat.format(voucher.dateTime)),
|
url: voucher.url));
|
||||||
trailing: Icon(Icons.arrow_right),
|
},
|
||||||
leading: voucher.type == VoucherTypePayment ? Icon(MdiIcons.cashRegister, size: 40,) : Icon(Icons.description, size: 40,),
|
title: buildText(voucher),
|
||||||
);
|
subtitle: Text(dateFormat.format(voucher.dateTime)),
|
||||||
},
|
trailing: Icon(Icons.arrow_right),
|
||||||
|
leading: voucher.type == VoucherTypePayment
|
||||||
|
? Icon(
|
||||||
|
MdiIcons.cashRegister,
|
||||||
|
size: 40,
|
||||||
|
)
|
||||||
|
: voucher.type == VoucherTypeReturnPay ?
|
||||||
|
Icon(
|
||||||
|
MdiIcons.backupRestore,
|
||||||
|
size: 40,
|
||||||
|
)
|
||||||
|
: Icon(
|
||||||
|
Icons.description,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Text buildText(Voucher voucher) {
|
Text buildText(Voucher voucher) {
|
||||||
if( voucher.type == VoucherTypePayment ){
|
if (voucher.type == VoucherTypePayment || voucher.type == VoucherTypeReturnPay) {
|
||||||
return Text('${voucher.name} на сумму: ${voucher.total.toStringAsFixed(2)}');
|
return Text(
|
||||||
|
'${voucher.name} на сумму: ${voucher.total.toStringAsFixed(2)}');
|
||||||
}
|
}
|
||||||
return Text('${voucher.name}');
|
return Text('${voucher.name}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ 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: 'infokkm'),
|
||||||
//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')
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import 'package:aman_kassa_flutter/core/locator.dart';
|
||||||
import 'package:aman_kassa_flutter/core/logger.dart';
|
import 'package:aman_kassa_flutter/core/logger.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/choice.dart';
|
import 'package:aman_kassa_flutter/core/models/choice.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/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/DataService.dart';
|
import 'package:aman_kassa_flutter/core/services/DataService.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
||||||
|
|
@ -61,11 +62,8 @@ class _HomeViewState extends State<HomeView> {
|
||||||
Redux.store.dispatch(logoutAction);
|
Redux.store.dispatch(logoutAction);
|
||||||
}
|
}
|
||||||
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
||||||
} else if (choice.command == 'update') {
|
} else if (choice.command == 'infokkm') {
|
||||||
Dialogs.showLoadingDialog(context, _keyLoader);
|
_navigatorService.push(InfoKkmViewRoute);
|
||||||
bool result = await _dataService.getDataFromServer(Redux.store.state.userState.user);
|
|
||||||
log.i('result: $result');
|
|
||||||
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,18 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
xReportBusy = true;
|
xReportBusy = true;
|
||||||
});
|
});
|
||||||
User user = Redux.store.state.userState.user;
|
User user = Redux.store.state.userState.user;
|
||||||
Response response =
|
Response response = await _api.xReport(user.token);
|
||||||
await _api.xReport(user.token);
|
if (response.operation) {
|
||||||
if (response.operation) {
|
|
||||||
_navigator.push(ImageShowRoute,
|
_navigator.push(ImageShowRoute,
|
||||||
arguments: ImageShowModel(response.body['check'], 'X Отчет'));
|
arguments:
|
||||||
_dataService.insertVoucher(user: user, name: 'X Отчет', base64Data: response.body['check'], type: VoucherTypeReport);
|
ImageShowModel(data: response.body['check'], title: 'X Отчет'));
|
||||||
|
String url = response?.body['link'];
|
||||||
|
_dataService.insertVoucher(
|
||||||
|
user: user,
|
||||||
|
name: 'X Отчет',
|
||||||
|
base64Data: response.body['check'],
|
||||||
|
type: VoucherTypeReport,
|
||||||
|
url: url);
|
||||||
} else {
|
} else {
|
||||||
_dialog.showDialog(description: response.body['message']);
|
_dialog.showDialog(description: response.body['message']);
|
||||||
}
|
}
|
||||||
|
|
@ -104,16 +110,15 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
setState(() {
|
setState(() {
|
||||||
updateCatalog = true;
|
updateCatalog = true;
|
||||||
});
|
});
|
||||||
Dialogs.showLoadingDialog(context, _keyLoader);
|
Dialogs.showLoadingDialog(context, _keyLoader);
|
||||||
bool result = await _dataService.getDataFromServer(Redux.store.state.userState.user);
|
bool result =
|
||||||
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
await _dataService.getDataFromServer(Redux.store.state.userState.user);
|
||||||
|
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
||||||
setState(() {
|
setState(() {
|
||||||
updateCatalog = false;
|
updateCatalog = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _deposit() async {
|
void _deposit() async {
|
||||||
setState(() {
|
setState(() {
|
||||||
depositBusy = true;
|
depositBusy = true;
|
||||||
|
|
@ -318,7 +323,7 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
),
|
),
|
||||||
AmanIconButton(
|
AmanIconButton(
|
||||||
title: 'История чеков',
|
title: 'История чеков',
|
||||||
onPressed: (){
|
onPressed: () {
|
||||||
_navigator.push(HistoryViewRoute);
|
_navigator.push(HistoryViewRoute);
|
||||||
},
|
},
|
||||||
mainColor: yellowColor,
|
mainColor: yellowColor,
|
||||||
|
|
@ -331,7 +336,6 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
mainColor: greenColor,
|
mainColor: greenColor,
|
||||||
icon: MdiIcons.databaseRefresh,
|
icon: MdiIcons.databaseRefresh,
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
verticalSpaceMedium,
|
verticalSpaceMedium,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/models/response.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/services/ApiService.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
||||||
|
import 'package:aman_kassa_flutter/redux/store.dart';
|
||||||
|
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
||||||
|
import 'package:aman_kassa_flutter/views/check/image_show_container.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
||||||
|
class InfoKkmView extends StatefulWidget {
|
||||||
|
InfoKkmView();
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InfoKkmViewState createState() => _InfoKkmViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InfoKkmViewState extends State<InfoKkmView> {
|
||||||
|
DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm:ss");
|
||||||
|
ApiService _apiService = locator<ApiService>();
|
||||||
|
List<dynamic> data = [];
|
||||||
|
bool loading = false;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
load() async {
|
||||||
|
setState(() {
|
||||||
|
loading = true;
|
||||||
|
});
|
||||||
|
User user = Redux.store.state.userState.user;
|
||||||
|
Response<dynamic> response = await _apiService.infoKkm(user.token);
|
||||||
|
if (response.operation) {
|
||||||
|
List<dynamic> list = [];
|
||||||
|
for (var key in response.body.keys) {
|
||||||
|
switch (key) {
|
||||||
|
case 'sn':
|
||||||
|
list.add({'key': 'Серийный номер', 'value': response.body[key]});
|
||||||
|
break;
|
||||||
|
case 'name':
|
||||||
|
list.add(
|
||||||
|
{'key': 'Наименование компании', 'value': response.body[key]});
|
||||||
|
break;
|
||||||
|
case 'biniin':
|
||||||
|
list.add({'key': 'ИИН/БИН', 'value': response.body[key]});
|
||||||
|
break;
|
||||||
|
case 'address':
|
||||||
|
list.add({'key': 'Адрес', 'value': response.body[key]});
|
||||||
|
break;
|
||||||
|
case 'kkmreg':
|
||||||
|
list.add({
|
||||||
|
'key': 'Регистрационный номер в органах НК',
|
||||||
|
'value': response.body[key]
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
data = list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
title: Text('Информация о ККМ'),
|
||||||
|
),
|
||||||
|
body: loading
|
||||||
|
? Container(child: Center(child: CircularProgressIndicator()))
|
||||||
|
: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.all(8.0),
|
||||||
|
child: Table(
|
||||||
|
//defaultVerticalAlignment: TableCellVerticalAlignment.top,
|
||||||
|
children: data.map((e) {
|
||||||
|
return this.buildRow(e['key'], e['value']);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
TableRow buildRow(String key, String value) {
|
||||||
|
return TableRow(
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
'$key :',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 15.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
margin: EdgeInsets.only(bottom: 8.0),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: TextStyle(fontSize: 15.0),
|
||||||
|
),
|
||||||
|
margin: EdgeInsets.only(bottom: 8.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,8 +20,8 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
||||||
class LoginView extends StatelessWidget {
|
class LoginView extends StatelessWidget {
|
||||||
final emailController = TextEditingController(text: 'test@kkm-kassa.kz');
|
final emailController = TextEditingController();
|
||||||
final passwordController = TextEditingController(text: 'qwe123');
|
final passwordController = TextEditingController();
|
||||||
|
|
||||||
final FocusNode passwordNode = new FocusNode();
|
final FocusNode passwordNode = new FocusNode();
|
||||||
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import 'package:aman_kassa_flutter/core/models/calc_model.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/product_dao.dart';
|
import 'package:aman_kassa_flutter/core/models/product_dao.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/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/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';
|
||||||
|
|
@ -188,28 +189,38 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
tradeType: _tradeType,
|
tradeType: _tradeType,
|
||||||
calcItems: calcItems,
|
calcItems: calcItems,
|
||||||
mode: _mode);
|
mode: _mode);
|
||||||
Navigator.of(context, rootNavigator: true).pop();
|
|
||||||
setState(() {
|
setState(() {
|
||||||
isBusy = false;
|
isBusy = false;
|
||||||
});
|
});
|
||||||
if (response.operation) {
|
if( response != null) {
|
||||||
String message = response.body['message'];
|
if (response.operation) {
|
||||||
String check = response.body['check'];
|
String message = response.body['message'];
|
||||||
if (_mode == SettingModeCalc) {
|
String check = response.body['check'];
|
||||||
Redux.store.dispatch(cleanCalcItems);
|
String url = response?.body['link'];
|
||||||
} else if (_mode == SettingModeKassa) {
|
print('url : $url');
|
||||||
Redux.store.dispatch(cleanKassaItems);
|
if (_mode == SettingModeCalc) {
|
||||||
|
Redux.store.dispatch(cleanCalcItems);
|
||||||
|
} else if (_mode == SettingModeKassa) {
|
||||||
|
Redux.store.dispatch(cleanKassaItems);
|
||||||
|
}
|
||||||
|
Redux.store.dispatch(checkMoney);
|
||||||
|
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
||||||
|
_navigatorService.pop();
|
||||||
|
_navigatorService.push(ImageShowRoute,
|
||||||
|
arguments: ImageShowModel(data:check, title: message, url: url ));
|
||||||
|
} else if (!response.operation && response.status != 500) {
|
||||||
|
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
||||||
|
_dialogService.showDialog(description: response.body['message']);
|
||||||
}
|
}
|
||||||
Redux.store.dispatch(checkMoney);
|
} else {
|
||||||
_navigatorService.pop();
|
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
||||||
_navigatorService.push(ImageShowRoute,
|
|
||||||
arguments: ImageShowModel(check, message));
|
|
||||||
} else if (!response.operation && response.status != 500) {
|
|
||||||
_dialogService.showDialog(description: response.body['message']);
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
print(e);
|
||||||
Navigator.of(context, rootNavigator: true).pop();
|
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
//Navigator.of(context, rootNavigator: true).pop();
|
||||||
setState(() {
|
setState(() {
|
||||||
isBusy = false;
|
isBusy = false;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
||||||
|
import 'package:aman_kassa_flutter/views/check/image_show_container.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
|
class QrView extends StatefulWidget {
|
||||||
|
final ImageShowModel data;
|
||||||
|
|
||||||
|
QrView(this.data);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_QrViewState createState() => _QrViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _QrViewState extends State<QrView> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
title: Text( widget.data.title),
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
child: Center(
|
||||||
|
child: QrImage(
|
||||||
|
data: widget.data.data,
|
||||||
|
version: QrVersions.auto,
|
||||||
|
size: 220.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
pubspec.lock
14
pubspec.lock
|
|
@ -310,6 +310,20 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.4"
|
version: "1.4.4"
|
||||||
|
qr:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: qr
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.0"
|
||||||
|
qr_flutter:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: qr_flutter
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.0"
|
||||||
quiver:
|
quiver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ dependencies:
|
||||||
esys_flutter_share: ^1.0.2
|
esys_flutter_share: ^1.0.2
|
||||||
auto_size_text: ^2.1.0
|
auto_size_text: ^2.1.0
|
||||||
url_launcher: ^5.4.11
|
url_launcher: ^5.4.11
|
||||||
|
qr_flutter: ^3.2.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue