histry release
parent
4fddf634e9
commit
4be3bafe92
|
|
@ -1,5 +1,3 @@
|
|||
import 'package:sqflite/sqflite.dart';
|
||||
|
||||
const String Service_tableName = 'services';
|
||||
const String Service_columnId = 'id';
|
||||
const String Service_columnArticul = 'articul';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
const String Voucher_tableName = 'vouches';
|
||||
const String Voucher_columnId = 'id';
|
||||
const String Voucher_columnName = 'name';
|
||||
const String Voucher_columnTotal = 'total';
|
||||
const String Voucher_columnBase64Data = 'base64Data';
|
||||
const String Voucher_columnData = 'data';
|
||||
const String Voucher_columnDateTime = 'dateTime';
|
||||
const String Voucher_columnAppCompanyId = 'app_company_id';
|
||||
const String Voucher_columnKassaId = 'kassaId';
|
||||
const String Voucher_columnType = 'type';
|
||||
const String Voucher_columnUrl = 'url';
|
||||
|
||||
|
||||
const String VoucherTypePayment = 'payment';
|
||||
const String VoucherTypeReport = 'report';
|
||||
|
||||
class Voucher {
|
||||
int id;
|
||||
String name;
|
||||
double total;
|
||||
String data;
|
||||
String base64Data;
|
||||
DateTime dateTime;
|
||||
int appCompanyId;
|
||||
int kassaId;
|
||||
String type;
|
||||
String url;
|
||||
|
||||
Voucher();
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
var map = <String, dynamic>{
|
||||
Voucher_columnName: name,
|
||||
Voucher_columnTotal: total,
|
||||
Voucher_columnData: data,
|
||||
Voucher_columnBase64Data: base64Data,
|
||||
Voucher_columnDateTime: dateTime.toIso8601String(),
|
||||
Voucher_columnKassaId: kassaId,
|
||||
Voucher_columnAppCompanyId: appCompanyId,
|
||||
Voucher_columnType: type,
|
||||
Voucher_columnUrl: url,
|
||||
};
|
||||
if (id != null) {
|
||||
map[Voucher_columnId] = id;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
Voucher.fromMap(Map<String, dynamic> map) {
|
||||
id = map[Voucher_columnId];
|
||||
name = map[Voucher_columnName];
|
||||
total = map[Voucher_columnTotal]?.toDouble();
|
||||
data = map[Voucher_columnData];
|
||||
base64Data = map[Voucher_columnBase64Data];
|
||||
dateTime = DateTime.parse(map[Voucher_columnDateTime]);
|
||||
appCompanyId= map[Voucher_columnAppCompanyId];
|
||||
kassaId = map[Voucher_columnKassaId];
|
||||
type = map[Voucher_columnType];
|
||||
url = map[Voucher_columnUrl];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -2,4 +2,5 @@ const String LoginViewRoute = "LoginView";
|
|||
const String HomeViewRoute = "HomeView";
|
||||
const String ImageShowRoute = "ImageShowRoute";
|
||||
const String PaymentViewRoute = "PaymentView";
|
||||
const String HistoryViewRoute = "HistoryView";
|
||||
// Generate the views here
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
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/payment/payment_view.dart';
|
||||
|
||||
import './route_names.dart';
|
||||
|
|
@ -24,9 +25,14 @@ Route<dynamic> generateRoute(RouteSettings settings) {
|
|||
routeName: settings.name,
|
||||
viewToShow: PaymentView(model: model),
|
||||
);
|
||||
case ImageShowRoute:
|
||||
ImageShowModel data = settings.arguments as ImageShowModel;
|
||||
return SlideRightRoute(widget:ImageShowContainer(data));
|
||||
case HistoryViewRoute:
|
||||
return _getPageRoute(
|
||||
routeName: settings.name,
|
||||
viewToShow: HistoryView(),
|
||||
);
|
||||
case ImageShowRoute:
|
||||
ImageShowModel data = settings.arguments as ImageShowModel;
|
||||
return SlideRightRoute(widget: ImageShowContainer(data));
|
||||
default:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => Scaffold(
|
||||
|
|
@ -48,21 +54,21 @@ class SlideRightRoute extends PageRouteBuilder {
|
|||
final Widget widget;
|
||||
SlideRightRoute({this.widget})
|
||||
: super(
|
||||
pageBuilder: (BuildContext context, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
return widget;
|
||||
},
|
||||
transitionsBuilder: (BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child) {
|
||||
return new SlideTransition(
|
||||
position: new Tween<Offset>(
|
||||
begin: const Offset(1.0, 0.0),
|
||||
end: Offset.zero,
|
||||
).animate(animation),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
);
|
||||
pageBuilder: (BuildContext context, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
return widget;
|
||||
},
|
||||
transitionsBuilder: (BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child) {
|
||||
return new SlideTransition(
|
||||
position: new Tween<Offset>(
|
||||
begin: const Offset(1.0, 0.0),
|
||||
end: Offset.zero,
|
||||
).animate(animation),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import 'package:aman_kassa_flutter/core/base/base_service.dart';
|
|||
import 'package:aman_kassa_flutter/core/entity/Category.dart';
|
||||
import 'package:aman_kassa_flutter/core/entity/Goods.dart';
|
||||
import 'package:aman_kassa_flutter/core/entity/Service.dart';
|
||||
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||
import 'package:aman_kassa_flutter/core/models/calc_model.dart';
|
||||
import 'package:aman_kassa_flutter/core/models/check_data.dart';
|
||||
|
|
@ -15,6 +16,7 @@ import 'package:aman_kassa_flutter/core/services/DbService.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/store.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'ApiService.dart';
|
||||
|
||||
|
|
@ -76,7 +78,7 @@ class DataService extends BaseService {
|
|||
CheckItem item = CheckItem(
|
||||
name: 'Позиция $iterator',
|
||||
cnt: el.num2 != null ? double.parse(el.num2) : 1.0,
|
||||
price: double.parse(el.num1) ,
|
||||
price: double.parse(el.num1),
|
||||
articul: articul);
|
||||
|
||||
summ += item.cnt * item.price;
|
||||
|
|
@ -90,6 +92,34 @@ class DataService extends BaseService {
|
|||
return checkData;
|
||||
}
|
||||
|
||||
/* save data to db
|
||||
* data,
|
||||
* dateTime,
|
||||
* check,
|
||||
* appCompanyId,
|
||||
* kassaId,
|
||||
* total,
|
||||
* name,
|
||||
* type
|
||||
*/
|
||||
Future<Response<dynamic>> insertVoucher({ @required User user, String data, String base64Data, @required String name, double total = 0.0, String type = VoucherTypePayment, String url }) {
|
||||
assert(user != null);
|
||||
assert(name != null);
|
||||
Voucher voucher = Voucher()
|
||||
..name=name
|
||||
..url=url
|
||||
..total = total
|
||||
..appCompanyId = user.appCompanyId
|
||||
..kassaId = user.kassaId
|
||||
..data = data
|
||||
..base64Data = base64Data
|
||||
..dateTime = DateTime.now()
|
||||
..type = type;
|
||||
log.i(
|
||||
'save to db appCompanyId: ${user.appCompanyId}, kassaId: ${user.kassaId}');
|
||||
_db.insert(Voucher_tableName, voucher.toMap());
|
||||
}
|
||||
|
||||
Future<Response<dynamic>> sellOrReturn(
|
||||
{String paymentType,
|
||||
String tradeType,
|
||||
|
|
@ -100,17 +130,16 @@ class DataService extends BaseService {
|
|||
String mode}) async {
|
||||
try {
|
||||
String data;
|
||||
if(mode == SettingModeKassa) {
|
||||
if (mode == SettingModeKassa) {
|
||||
CheckData checkData = _transformProductsToCheckData(
|
||||
paymentType: paymentType, tradeType: tradeType, items: kassaItems);
|
||||
data = jsonEncode(checkData.toJson());
|
||||
} else if(mode == SettingModeCalc) {
|
||||
} else if (mode == SettingModeCalc) {
|
||||
CheckData checkData = _transformCalcModelToCheckData(
|
||||
paymentType: paymentType, tradeType: tradeType, items: calcItems);
|
||||
data = jsonEncode(checkData.toJson());
|
||||
}
|
||||
|
||||
|
||||
log.i('token: $token');
|
||||
log.i('data: $data');
|
||||
Response<dynamic> response = await (operationType == OperationTypePay
|
||||
|
|
@ -119,18 +148,14 @@ class DataService extends BaseService {
|
|||
log.i('response status: ${response.status}');
|
||||
log.i('response operation: ${response.operation}');
|
||||
if (response.status == 200 && response.operation == true) {
|
||||
log.i(
|
||||
'save to db appCompanyId: ${Redux.store.state.userState.user.appCompanyId}, kassaId: ${Redux.store.state.userState.user.kassaId}');
|
||||
/* save data to db
|
||||
* data,
|
||||
* dateTime,
|
||||
* check,
|
||||
* appCompanyId,
|
||||
* kassaId,
|
||||
* total,
|
||||
* name,
|
||||
* type
|
||||
*/
|
||||
User user = Redux.store.state.userState.user;
|
||||
String check = response?.body['check'];
|
||||
dynamic journal = response?.body['journal'];
|
||||
print(journal);
|
||||
int checkNum = journal['check_num'];
|
||||
var summ = journal['summ'];
|
||||
double total = summ!= null ? double.parse(summ.toString()) : 0.0;
|
||||
this.insertVoucher(user: user, name: 'Чек №$checkNum', data: data , base64Data: check, total: total );
|
||||
}
|
||||
return response;
|
||||
} catch (e) {
|
||||
|
|
@ -141,9 +166,9 @@ class DataService extends BaseService {
|
|||
|
||||
Future<void> checkDbFill(User user) async {
|
||||
int serviceCount = await _db.queryRowCount(Service_tableName);
|
||||
if( serviceCount ==0) {
|
||||
if (serviceCount == 0) {
|
||||
int goodCount = await _db.queryRowCount(Goog_tableName);
|
||||
if(goodCount == 0){
|
||||
if (goodCount == 0) {
|
||||
await getDataFromServer(user);
|
||||
} else {
|
||||
log.i('$Goog_tableName is Fill');
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ import 'package:aman_kassa_flutter/core/base/base_service.dart';
|
|||
import 'package:aman_kassa_flutter/core/entity/Goods.dart';
|
||||
import 'package:aman_kassa_flutter/core/entity/Category.dart';
|
||||
import 'package:aman_kassa_flutter/core/entity/Service.dart';
|
||||
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
class DbService extends BaseService {
|
||||
static final _databaseName = "AmanFlutterDb.db";
|
||||
static final _databaseVersion = 15;
|
||||
static final _databaseVersion = 16;
|
||||
|
||||
// make this a singleton class
|
||||
DbService._privateConstructor();
|
||||
|
|
@ -32,18 +33,21 @@ class DbService extends BaseService {
|
|||
Directory documentsDirectory = await getApplicationDocumentsDirectory();
|
||||
String path = join(documentsDirectory.path, _databaseName);
|
||||
return await openDatabase(path,
|
||||
version: _databaseVersion,
|
||||
onUpgrade: _onUpdate,
|
||||
onCreate: _onCreate
|
||||
);
|
||||
version: _databaseVersion, onUpgrade: _onUpdate, onCreate: _onCreate);
|
||||
}
|
||||
|
||||
Future _onUpdate(Database db, int oldVersion, int newVersion) async {
|
||||
log.i('update from $oldVersion to $newVersion');
|
||||
//Goods table
|
||||
await db.execute('DROP TABLE IF EXISTS $Goog_tableName;');
|
||||
await db.execute('DROP TABLE IF EXISTS $Category_tableName;');
|
||||
await db.execute('DROP TABLE IF EXISTS $Service_tableName;');
|
||||
//await db.execute('DROP TABLE IF EXISTS $Voucher_tableName;');
|
||||
log.i('dropped tables');
|
||||
if (newVersion > 16) {
|
||||
//Не удалять таблицу с чеками
|
||||
}
|
||||
|
||||
_onCreate(db, newVersion);
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +91,21 @@ class DbService extends BaseService {
|
|||
$Service_columnDiscount real
|
||||
);
|
||||
''');
|
||||
|
||||
//Voucher
|
||||
await db.execute('''
|
||||
CREATE TABLE IF NOT EXISTS $Voucher_tableName (
|
||||
$Voucher_columnId integer primary key AUTOINCREMENT,
|
||||
$Voucher_columnName text not null,
|
||||
$Voucher_columnTotal real,
|
||||
$Voucher_columnData text,
|
||||
$Voucher_columnBase64Data text,
|
||||
$Voucher_columnDateTime text not null,
|
||||
$Service_columnAppCompanyId integer,
|
||||
$Voucher_columnKassaId integer,
|
||||
$Voucher_columnType text not null,
|
||||
$Voucher_columnUrl text
|
||||
);
|
||||
''');
|
||||
}
|
||||
|
||||
// Inserts a row in the database where each key in the Map is a column name
|
||||
|
|
@ -105,9 +123,15 @@ class DbService extends BaseService {
|
|||
return await db.query(table);
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> queryRowsWithWhere(String table, String where, List<dynamic> args ) async {
|
||||
Future<List<Map<String, dynamic>>> queryAllRowsOrderBy(String table, String orderBy) async {
|
||||
Database db = await instance.database;
|
||||
return await db.query(table, where: where, whereArgs: args );
|
||||
return await db.query(table, orderBy: orderBy);
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> queryRowsWithWhere(
|
||||
String table, String where, List<dynamic> args) async {
|
||||
Database db = await instance.database;
|
||||
return await db.query(table, where: where, whereArgs: args);
|
||||
}
|
||||
|
||||
// All of the methods (insert, query, update, delete) can also be done using
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
import 'dart:convert';
|
||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||
import 'package:aman_kassa_flutter/core/models/dialog_models.dart';
|
||||
import 'package:aman_kassa_flutter/core/services/dialog_service.dart';
|
||||
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
||||
import 'package:aman_kassa_flutter/shared/ui_helpers.dart';
|
||||
import 'package:aman_kassa_flutter/widgets/fields/busy_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
||||
//import 'package:flutter/services.dart';
|
||||
import 'package:flutter_open_whatsapp/flutter_open_whatsapp.dart';
|
||||
|
||||
class ImageShowContainer extends StatelessWidget {
|
||||
final ImageShowModel data;
|
||||
|
|
@ -51,6 +54,7 @@ class MyFloatingActionButton extends StatefulWidget {
|
|||
|
||||
class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
||||
bool showFab = true;
|
||||
DialogService _dialog = locator<DialogService>();
|
||||
// String _batteryLevel = 'Unknown battery level.';
|
||||
// static const platform = const MethodChannel('samples.flutter.dev/battery');
|
||||
//
|
||||
|
|
@ -77,7 +81,7 @@ class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
|||
onPressed: () {
|
||||
var bottomSheetController = showBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => Container(
|
||||
builder: (bottomSheetContext) => Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0 ),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
|
|
@ -87,13 +91,13 @@ class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
|||
blurRadius: 10, color: Colors.grey[300], spreadRadius: 5)
|
||||
]),
|
||||
//color: Colors.grey[900],
|
||||
height: 280,
|
||||
height: 200,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
//verticalSpaceSmall,
|
||||
//BusyButton(title: 'Электронная почта', onPressed: shareFile , mainColor: primaryColor, icon: Icons.mail, enabled: false, ),
|
||||
verticalSpaceSmall,
|
||||
BusyButton(title: 'Электронная почта', onPressed: shareFile , mainColor: primaryColor, icon: Icons.mail, enabled: false, ),
|
||||
verticalSpaceSmall,
|
||||
BusyButton(title: 'WhatsApp', onPressed: shareFile , mainColor: greenColor, icon: MdiIcons.whatsapp, enabled: false,),
|
||||
BusyButton(title: 'WhatsApp', onPressed: callWhatsApp , mainColor: greenColor, icon: MdiIcons.whatsapp,),
|
||||
verticalSpaceSmall,
|
||||
BusyButton(title: '', onPressed: shareFile , mainColor: yellowColor, icon: Icons.share,),
|
||||
],
|
||||
|
|
@ -116,6 +120,17 @@ class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
|
|||
print('error: $e');
|
||||
}
|
||||
}
|
||||
void callWhatsApp() async {
|
||||
DialogResponse response = await _dialog.showConfirmationDialogInput(
|
||||
description: 'Номер телефона',
|
||||
cancelTitle: 'Отмена',
|
||||
confirmationTitle: 'Отправить',
|
||||
);
|
||||
if (response.confirmed) {
|
||||
String phoneNumber = response.responseText;
|
||||
FlutterOpenWhatsapp.sendSingleMessage(phoneNumber, "Спасибо что выбераете нас \r\n https://picsum.photos/200/300 ");
|
||||
}
|
||||
}
|
||||
void showFoatingActionButton(bool value) {
|
||||
setState(() {
|
||||
showFab = value;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
||||
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||
import 'package:aman_kassa_flutter/core/route_names.dart';
|
||||
import 'package:aman_kassa_flutter/core/services/DbService.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/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 HistoryView extends StatefulWidget {
|
||||
HistoryView();
|
||||
|
||||
@override
|
||||
_HistoryViewState createState() => _HistoryViewState();
|
||||
}
|
||||
|
||||
class _HistoryViewState extends State<HistoryView> {
|
||||
DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm:ss");
|
||||
DbService _dbService = locator<DbService>();
|
||||
NavigatorService _navigatorService = locator<NavigatorService>();
|
||||
List<Voucher> data = [];
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
load();
|
||||
}
|
||||
|
||||
load() async {
|
||||
List<Map> list = await _dbService.queryAllRowsOrderBy(Voucher_tableName, '$Voucher_columnDateTime desc');
|
||||
print(list);
|
||||
setState(() {
|
||||
data = list.map((e) => Voucher.fromMap(e)).toList();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('История чеков'),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text('Очистить', style: TextStyle(color: whiteColor, fontSize: 15, fontWeight: FontWeight.bold),),
|
||||
onPressed: () async {
|
||||
await _dbService.deleteAll(Voucher_tableName);
|
||||
await this.load();
|
||||
})
|
||||
],
|
||||
),
|
||||
body: ListView.separated(
|
||||
itemCount: data.length,
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider();
|
||||
},
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
Voucher voucher = data[index];
|
||||
return ListTile(
|
||||
onTap: (){
|
||||
_navigatorService.push(ImageShowRoute,
|
||||
arguments: ImageShowModel(voucher.base64Data, voucher.name));
|
||||
},
|
||||
title: buildText(voucher),
|
||||
subtitle: Text(dateFormat.format(voucher.dateTime)),
|
||||
trailing: Icon(Icons.arrow_right),
|
||||
leading: voucher.type == VoucherTypePayment ? Icon(MdiIcons.cashRegister, size: 40,) : Icon(Icons.description, size: 40,),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Text buildText(Voucher voucher) {
|
||||
if( voucher.type == VoucherTypePayment ){
|
||||
return Text('${voucher.name} на сумму: ${voucher.total.toStringAsFixed(2)}');
|
||||
}
|
||||
return Text('${voucher.name}');
|
||||
}
|
||||
}
|
||||
|
|
@ -24,15 +24,6 @@ import './tabs/CalculatorTab.dart';
|
|||
import './components/popup_menu.dart';
|
||||
import 'components/bottom_bar.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.exit_to_app, command: 'exit')
|
||||
];
|
||||
|
||||
class HomeView extends StatefulWidget {
|
||||
@override
|
||||
_HomeViewState createState() => _HomeViewState();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import 'package:aman_kassa_flutter/core/entity/Voucher.dart';
|
||||
import 'package:aman_kassa_flutter/core/locator.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/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/DataService.dart';
|
||||
|
|
@ -83,11 +85,13 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
|||
setState(() {
|
||||
xReportBusy = true;
|
||||
});
|
||||
User user = Redux.store.state.userState.user;
|
||||
Response response =
|
||||
await _api.xReport(Redux.store.state.userState.user.token);
|
||||
await _api.xReport(user.token);
|
||||
if (response.operation) {
|
||||
_navigator.push(ImageShowRoute,
|
||||
arguments: ImageShowModel(response.body['check'], 'X Отчет'));
|
||||
_dataService.insertVoucher(user: user, name: 'X Отчет', base64Data: response.body['check'], type: VoucherTypeReport);
|
||||
} else {
|
||||
_dialog.showDialog(description: response.body['message']);
|
||||
}
|
||||
|
|
@ -302,7 +306,7 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
|||
),
|
||||
verticalSpaceTiny,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AmanIconButton(
|
||||
|
|
@ -312,6 +316,14 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
|||
mainColor: primaryColor,
|
||||
icon: Icons.description,
|
||||
),
|
||||
AmanIconButton(
|
||||
title: 'История чеков',
|
||||
onPressed: (){
|
||||
_navigator.push(HistoryViewRoute);
|
||||
},
|
||||
mainColor: yellowColor,
|
||||
icon: MdiIcons.history,
|
||||
),
|
||||
AmanIconButton(
|
||||
title: 'Обновить номенклатуру',
|
||||
onPressed: _updateCatalog,
|
||||
|
|
@ -319,6 +331,7 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
|||
mainColor: greenColor,
|
||||
icon: MdiIcons.databaseRefresh,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
verticalSpaceMedium,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:aman_kassa_flutter/core/locator.dart';
|
||||
import 'package:aman_kassa_flutter/core/models/dialog_models.dart';
|
||||
import 'package:aman_kassa_flutter/core/services/dialog_service.dart';
|
||||
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
|
|
@ -67,37 +68,67 @@ class _DialogManagerState extends State<DialogManager> {
|
|||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(request.title),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(request.description),
|
||||
TextField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
WhitelistingTextInputFormatter(RegExp("^[0-9.]*")),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
if (isConfirmationDialog)
|
||||
FlatButton(
|
||||
child: Text(request.cancelTitle),
|
||||
onPressed: () {
|
||||
_dialogService
|
||||
.dialogComplete(DialogResponse(confirmed: false));
|
||||
},
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(request.buttonTitle),
|
||||
onPressed: () {
|
||||
_dialogService
|
||||
.dialogComplete(DialogResponse(confirmed: true, responseText: controller.text));
|
||||
},
|
||||
),
|
||||
],
|
||||
));
|
||||
actionsPadding: const EdgeInsets.only(right: 15, bottom: 5),
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
request.title,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
//Divider(),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
//Text(request.description),
|
||||
TextField(
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(labelText: request.description ),
|
||||
controller: controller,
|
||||
onSubmitted: (value) {
|
||||
_dialogService
|
||||
.dialogComplete(DialogResponse(confirmed: false));
|
||||
},
|
||||
keyboardType: TextInputType.phone,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
WhitelistingTextInputFormatter(RegExp("^[0-9.]*")),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
if (isConfirmationDialog)
|
||||
RaisedButton(
|
||||
color: redColor,
|
||||
child: Text(
|
||||
request.cancelTitle,
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
onPressed: () {
|
||||
_dialogService
|
||||
.dialogComplete(DialogResponse(confirmed: false));
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
RaisedButton(
|
||||
color: primaryColor,
|
||||
child: Text(
|
||||
request.buttonTitle,
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
onPressed: () {
|
||||
_dialogService.dialogComplete(DialogResponse(
|
||||
confirmed: true, responseText: controller.text));
|
||||
},
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
51
pubspec.lock
51
pubspec.lock
|
|
@ -91,7 +91,7 @@ packages:
|
|||
name: equatable
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
version: "1.2.0"
|
||||
esys_flutter_share:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -99,6 +99,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.2.1"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -111,6 +118,13 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_open_whatsapp:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_open_whatsapp
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
flutter_redux:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -218,7 +232,14 @@ packages:
|
|||
name: path_provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.9"
|
||||
version: "1.6.11"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+2"
|
||||
path_provider_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -239,7 +260,7 @@ packages:
|
|||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0+1"
|
||||
version: "1.9.0"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -261,6 +282,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: process
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.13"
|
||||
protobuf:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -274,7 +302,7 @@ packages:
|
|||
name: provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
version: "4.1.3"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -363,14 +391,14 @@ packages:
|
|||
name: sqflite
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0+2"
|
||||
version: "1.3.1"
|
||||
sqflite_common:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite_common
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "1.0.2+1"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -398,7 +426,7 @@ packages:
|
|||
name: synchronized
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.2.0+1"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -427,6 +455,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.8"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -435,5 +470,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.6.1"
|
||||
sdks:
|
||||
dart: ">=2.7.0 <3.0.0"
|
||||
dart: ">=2.8.0 <3.0.0"
|
||||
flutter: ">=1.17.0 <2.0.0"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ dependencies:
|
|||
device_info: ^0.4.2+4
|
||||
esys_flutter_share: ^1.0.2
|
||||
auto_size_text: ^2.1.0
|
||||
flutter_open_whatsapp: ^0.1.2
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
|
|
|||
Loading…
Reference in New Issue