Скидки
parent
8122dc94db
commit
d528e44abc
|
|
@ -19,6 +19,7 @@
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
|
android:exported="true"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.5.31'
|
ext.kotlin_version = '1.8.22'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +26,6 @@ subprojects {
|
||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register("clean", Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ class DialogRequest {
|
||||||
required this.buttonTitle,
|
required this.buttonTitle,
|
||||||
this.cancelTitle,
|
this.cancelTitle,
|
||||||
this.requestPrice,
|
this.requestPrice,
|
||||||
this.requestCount
|
this.requestCount,
|
||||||
|
this.requestDiscount,
|
||||||
|
this.requestDiscountPercent,
|
||||||
});
|
});
|
||||||
final String title;
|
final String title;
|
||||||
final String description;
|
final String description;
|
||||||
|
|
@ -16,6 +18,8 @@ class DialogRequest {
|
||||||
|
|
||||||
final String? requestPrice;
|
final String? requestPrice;
|
||||||
final String? requestCount;
|
final String? requestCount;
|
||||||
|
final String? requestDiscount;
|
||||||
|
final bool? requestDiscountPercent;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -25,10 +29,15 @@ class DialogResponse {
|
||||||
required this.confirmed,
|
required this.confirmed,
|
||||||
this.responsePrice,
|
this.responsePrice,
|
||||||
this.responseCount,
|
this.responseCount,
|
||||||
|
this.responseDiscount,
|
||||||
|
this.responseDiscountPercent,
|
||||||
});
|
});
|
||||||
final String? responsePrice;
|
final String? responsePrice;
|
||||||
final String? responseCount;
|
final String? responseCount;
|
||||||
final bool confirmed;
|
final bool confirmed;
|
||||||
|
final String? responseDiscount;
|
||||||
|
final bool? responseDiscountPercent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ class ProductDao {
|
||||||
categoryId = map['categoryId'] as int? ;
|
categoryId = map['categoryId'] as int? ;
|
||||||
count = map['count'] as double;
|
count = map['count'] as double;
|
||||||
price = map['price'] as double;
|
price = map['price'] as double;
|
||||||
|
discount = cast<double>(map['discount']);
|
||||||
|
discountPercent = cast<bool>(map['discountPercent']);
|
||||||
productName = cast<String>(map['productName']) ?? '';
|
productName = cast<String>(map['productName']) ?? '';
|
||||||
categoryName = cast<String>(map['categoryName']);
|
categoryName = cast<String>(map['categoryName']);
|
||||||
eanCode = cast<String>(map['eanCode']);
|
eanCode = cast<String>(map['eanCode']);
|
||||||
|
|
@ -20,6 +22,8 @@ class ProductDao {
|
||||||
int? categoryId;
|
int? categoryId;
|
||||||
double? count;
|
double? count;
|
||||||
double? price;
|
double? price;
|
||||||
|
double? discount;
|
||||||
|
bool? discountPercent;
|
||||||
String productName = '';
|
String productName = '';
|
||||||
String? categoryName;
|
String? categoryName;
|
||||||
String? eanCode;
|
String? eanCode;
|
||||||
|
|
@ -33,6 +37,8 @@ class ProductDao {
|
||||||
'categoryId': categoryId,
|
'categoryId': categoryId,
|
||||||
'count': count,
|
'count': count,
|
||||||
'price': price,
|
'price': price,
|
||||||
|
'discount': discount,
|
||||||
|
'discountPercent': discountPercent,
|
||||||
'productName': productName,
|
'productName': productName,
|
||||||
'categoryName': categoryName,
|
'categoryName': categoryName,
|
||||||
'eanCode': eanCode,
|
'eanCode': eanCode,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class ItemBean {
|
||||||
String? articul;
|
String? articul;
|
||||||
double? cnt;
|
double? cnt;
|
||||||
double? price;
|
double? price;
|
||||||
|
double? discount;
|
||||||
String? excise;
|
String? excise;
|
||||||
|
|
||||||
static ItemBean fromMap(dynamic map) {
|
static ItemBean fromMap(dynamic map) {
|
||||||
|
|
@ -23,6 +24,7 @@ class ItemBean {
|
||||||
itemsBean.articul = cast<String>(map['articul']);
|
itemsBean.articul = cast<String>(map['articul']);
|
||||||
itemsBean.cnt = cast<double>(map['cnt']);
|
itemsBean.cnt = cast<double>(map['cnt']);
|
||||||
itemsBean.price = cast<double>(map['price']);
|
itemsBean.price = cast<double>(map['price']);
|
||||||
|
itemsBean.discount = cast<double>(map['discount']);
|
||||||
itemsBean.excise = cast<String>(map['excise']);
|
itemsBean.excise = cast<String>(map['excise']);
|
||||||
return itemsBean;
|
return itemsBean;
|
||||||
}
|
}
|
||||||
|
|
@ -33,6 +35,7 @@ class ItemBean {
|
||||||
'articul': articul,
|
'articul': articul,
|
||||||
'cnt': cnt,
|
'cnt': cnt,
|
||||||
'price': price,
|
'price': price,
|
||||||
|
'discount': discount,
|
||||||
'excise': excise,
|
'excise': excise,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +31,7 @@ final Logger log = getLogger('SetSellStateAction');
|
||||||
final DbService _dbService = locator<DbService>();
|
final DbService _dbService = locator<DbService>();
|
||||||
|
|
||||||
ThunkAction<AppState> counterOrEditSellItem(
|
ThunkAction<AppState> counterOrEditSellItem(
|
||||||
{required int transactionId, required double counter, double? price}) {
|
{required int transactionId, required double counter, double? price , double? discount ,bool? discountPercent }) {
|
||||||
return (Store<AppState> store) async {
|
return (Store<AppState> store) async {
|
||||||
log.i(
|
log.i(
|
||||||
'counterSellItem id = $transactionId counter = $counter, price = $price',
|
'counterSellItem id = $transactionId counter = $counter, price = $price',
|
||||||
|
|
@ -50,6 +50,17 @@ ThunkAction<AppState> counterOrEditSellItem(
|
||||||
final String val = ((item.count ?? 0) + counter).toStringAsFixed(5);
|
final String val = ((item.count ?? 0) + counter).toStringAsFixed(5);
|
||||||
item.count = double.parse(val);
|
item.count = double.parse(val);
|
||||||
}
|
}
|
||||||
|
if(discountPercent != null)
|
||||||
|
item.discountPercent = discountPercent;
|
||||||
|
if(discount != null) {
|
||||||
|
if(discountPercent == true && discount! > 100) {
|
||||||
|
discount = 100;
|
||||||
|
} else if(item.price! < discount!) {
|
||||||
|
discount = item.price;
|
||||||
|
}
|
||||||
|
item.discount = discount;
|
||||||
|
}
|
||||||
|
|
||||||
transactionRec.data = jsonEncode(item.toMap());
|
transactionRec.data = jsonEncode(item.toMap());
|
||||||
_dbService.update(transactionRecTableName, transactionRec.toMap());
|
_dbService.update(transactionRecTableName, transactionRec.toMap());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ class DialogService {
|
||||||
required String title,
|
required String title,
|
||||||
required String requestCount,
|
required String requestCount,
|
||||||
String? requestPrice,
|
String? requestPrice,
|
||||||
|
String? requestDiscount,
|
||||||
|
bool requestDiscountPercent = false,
|
||||||
String? description,
|
String? description,
|
||||||
String confirmationTitle = 'ПОДТВЕРДИТЬ',
|
String confirmationTitle = 'ПОДТВЕРДИТЬ',
|
||||||
String cancelTitle = 'Отмена',
|
String cancelTitle = 'Отмена',
|
||||||
|
|
@ -67,7 +69,10 @@ class DialogService {
|
||||||
buttonTitle: confirmationTitle,
|
buttonTitle: confirmationTitle,
|
||||||
cancelTitle: cancelTitle,
|
cancelTitle: cancelTitle,
|
||||||
requestPrice: requestPrice,
|
requestPrice: requestPrice,
|
||||||
requestCount: requestCount));
|
requestCount: requestCount,
|
||||||
|
requestDiscount: requestDiscount,
|
||||||
|
requestDiscountPercent: requestDiscountPercent
|
||||||
|
));
|
||||||
return _dialogCompleter!.future;
|
return _dialogCompleter!.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import 'package:satu/core/redux/store.dart';
|
||||||
import 'package:satu/core/utils/locator.dart';
|
import 'package:satu/core/utils/locator.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
|
import '../../views/work/tabs/utils/product_utils.dart';
|
||||||
import '../models/dictionary/contragent/contragent_response_entity.dart';
|
import '../models/dictionary/contragent/contragent_response_entity.dart';
|
||||||
import 'api_service.dart';
|
import 'api_service.dart';
|
||||||
import 'db_service.dart';
|
import 'db_service.dart';
|
||||||
|
|
@ -172,6 +173,10 @@ class SellService extends BaseService {
|
||||||
..name = product.productName
|
..name = product.productName
|
||||||
..excise = product.excise
|
..excise = product.excise
|
||||||
..articul = product.article?.toString();
|
..articul = product.article?.toString();
|
||||||
|
if(product.discount != null) {
|
||||||
|
var priceWithDiscount = sumPriceByDiscount(product.price!, product.discount!, product.discountPercent);
|
||||||
|
item.discount = product.price! - priceWithDiscount;
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class _LoginViewState extends State<LoginView> {
|
||||||
),
|
),
|
||||||
verticalSpaceLarge,
|
verticalSpaceLarge,
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(MdiIcons.qrcodeScan),
|
icon: Icon(MdiIcons.qrcodeScan),
|
||||||
iconSize: ScreenUtil().setSp(40.0),
|
iconSize: ScreenUtil().setSp(40.0),
|
||||||
tooltip: 'Scan',
|
tooltip: 'Scan',
|
||||||
onPressed: scan,
|
onPressed: scan,
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,11 @@ import 'package:satu/core/utils/locator.dart';
|
||||||
import 'package:satu/core/utils/utils_parse.dart';
|
import 'package:satu/core/utils/utils_parse.dart';
|
||||||
import 'package:satu/shared/app_colors.dart';
|
import 'package:satu/shared/app_colors.dart';
|
||||||
import 'package:satu/shared/shared_styles.dart';
|
import 'package:satu/shared/shared_styles.dart';
|
||||||
|
import 'package:satu/shared/ui_helpers.dart';
|
||||||
import 'package:satu/widgets/ui/product_title_widget.dart';
|
import 'package:satu/widgets/ui/product_title_widget.dart';
|
||||||
|
|
||||||
import '../../../views/select_by_scan/add_by_barcode_view.dart';
|
import '../../../views/select_by_scan/add_by_barcode_view.dart';
|
||||||
|
import '../../utils/product_utils.dart';
|
||||||
|
|
||||||
|
|
||||||
class ProductSellTile extends StatefulWidget {
|
class ProductSellTile extends StatefulWidget {
|
||||||
|
|
@ -23,7 +25,10 @@ class ProductSellTile extends StatefulWidget {
|
||||||
this.price,
|
this.price,
|
||||||
this.count,
|
this.count,
|
||||||
this.isOdd,
|
this.isOdd,
|
||||||
this.transactionId})
|
this.transactionId,
|
||||||
|
this.discountPercent = false,
|
||||||
|
this.discount = 0
|
||||||
|
})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
final String name;
|
final String name;
|
||||||
|
|
@ -31,6 +36,8 @@ class ProductSellTile extends StatefulWidget {
|
||||||
final String? categoryName;
|
final String? categoryName;
|
||||||
final num? price;
|
final num? price;
|
||||||
final num? count;
|
final num? count;
|
||||||
|
final num discount;
|
||||||
|
final bool discountPercent;
|
||||||
final bool? isOdd;
|
final bool? isOdd;
|
||||||
final int? transactionId;
|
final int? transactionId;
|
||||||
|
|
||||||
|
|
@ -41,11 +48,6 @@ class ProductSellTile extends StatefulWidget {
|
||||||
class _ProductSellTileState extends State<ProductSellTile> {
|
class _ProductSellTileState extends State<ProductSellTile> {
|
||||||
final DialogService _dialogService = locator<DialogService>();
|
final DialogService _dialogService = locator<DialogService>();
|
||||||
|
|
||||||
void _onItemTapped(BuildContext context) {
|
|
||||||
Navigator.of(context).push(MaterialPageRoute(
|
|
||||||
builder: (BuildContext context) => const SelectByScanView()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Dismissible(
|
return Dismissible(
|
||||||
|
|
@ -103,13 +105,29 @@ class _ProductSellTileState extends State<ProductSellTile> {
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 3.0),
|
padding: const EdgeInsets.only(bottom: 3.0),
|
||||||
child: Text(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
if(widget.discount > 0)
|
||||||
|
Text(
|
||||||
|
'${sumPriceByDiscount(widget.price!.toDouble()
|
||||||
|
, widget.discount.toDouble(), widget.discountPercent)} ₸',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: dangerColor),
|
||||||
|
),
|
||||||
|
if(widget.discount > 0)
|
||||||
|
horizontalSpaceTiny,
|
||||||
|
Text(
|
||||||
'${widget.price} ₸',
|
'${widget.price} ₸',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: textColor),
|
color: textColor),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
|
@ -206,14 +224,20 @@ class _ProductSellTileState extends State<ProductSellTile> {
|
||||||
await _dialogService.showConfirmationDialogInput(
|
await _dialogService.showConfirmationDialogInput(
|
||||||
title: widget.name,
|
title: widget.name,
|
||||||
requestCount: formatDecimal(widget.count!.toDouble()),
|
requestCount: formatDecimal(widget.count!.toDouble()),
|
||||||
requestPrice: formatDecimal(widget.price!.toDouble()));
|
requestPrice: formatDecimal(widget.price!.toDouble()),
|
||||||
|
requestDiscount: formatDecimal(widget.discount.toDouble()),
|
||||||
|
requestDiscountPercent: widget.discountPercent == true,
|
||||||
|
);
|
||||||
if (response.confirmed) {
|
if (response.confirmed) {
|
||||||
if (isNumeric(response.responsePrice) &&
|
if (isNumeric(response.responsePrice) &&
|
||||||
isNumeric(response.responseCount)) {
|
isNumeric(response.responseCount)) {
|
||||||
|
|
||||||
Redux.store!.dispatch(counterOrEditSellItem(
|
Redux.store!.dispatch(counterOrEditSellItem(
|
||||||
transactionId: widget.transactionId!,
|
transactionId: widget.transactionId!,
|
||||||
counter: double.parse(response.responseCount!),
|
counter: double.parse(response.responseCount!),
|
||||||
price: double.parse(response.responsePrice!),
|
price: double.parse(response.responsePrice!),
|
||||||
|
discount: double.parse(response.responseDiscount! == '' ? '0' : response.responseDiscount!),
|
||||||
|
discountPercent: response.responseDiscountPercent,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
_dialogService.showDialog(description: 'Не верный формат');
|
_dialogService.showDialog(description: 'Не верный формат');
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,12 @@ class SellView extends StatelessWidget {
|
||||||
final ProductDao product =
|
final ProductDao product =
|
||||||
state.items!.elementAt(index);
|
state.items!.elementAt(index);
|
||||||
return ProductSellTile(
|
return ProductSellTile(
|
||||||
key: UniqueKey(),
|
key: product.id !=null ? Key(product.id.toString()) : UniqueKey(),
|
||||||
ean: product.eanCode,
|
ean: product.eanCode,
|
||||||
isOdd: index % 2 == 0,
|
isOdd: index % 2 == 0,
|
||||||
name: product.productName,
|
name: product.productName,
|
||||||
|
discount: product.discount ?? 0,
|
||||||
|
discountPercent: product.discountPercent ?? false,
|
||||||
price: product.price,
|
price: product.price,
|
||||||
count: product.count,
|
count: product.count,
|
||||||
categoryName: product.categoryName,
|
categoryName: product.categoryName,
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,24 @@ double sumProducts(List<ProductDao> list) {
|
||||||
double result = 0.0;
|
double result = 0.0;
|
||||||
if (list.isNotEmpty) {
|
if (list.isNotEmpty) {
|
||||||
for( final ProductDao product in list) {
|
for( final ProductDao product in list) {
|
||||||
final String val = (product.price! * product.count!).toStringAsFixed(5);
|
double price = product.price! * product.count!;
|
||||||
|
double discount = product.discount ?? 0;
|
||||||
|
bool discountPercent = product.discountPercent ?? false;
|
||||||
|
price = sumPriceByDiscount(price, discount, discountPercent);
|
||||||
|
final String val = (price).toStringAsFixed(5);
|
||||||
// result += product.price! * product.count!;
|
// result += product.price! * product.count!;
|
||||||
result += double.parse(val);
|
result += double.parse(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double sumPriceByDiscount(double price, double? discount, bool? discountPercent) {
|
||||||
|
double result = 0.0;
|
||||||
|
if(discountPercent != null && discountPercent) {
|
||||||
|
result = price - (price * (discount ?? 0) / 100);
|
||||||
|
} else {
|
||||||
|
result = price - (discount ?? 0);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,15 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
final DialogService _dialogService = locator<DialogService>();
|
final DialogService _dialogService = locator<DialogService>();
|
||||||
late TextEditingController _controllerPrice;
|
late TextEditingController _controllerPrice;
|
||||||
late TextEditingController _controllerCount;
|
late TextEditingController _controllerCount;
|
||||||
|
late TextEditingController _controllerDiscount;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_controllerPrice = TextEditingController();
|
_controllerPrice = TextEditingController();
|
||||||
_controllerCount = TextEditingController();
|
_controllerCount = TextEditingController();
|
||||||
|
_controllerDiscount = TextEditingController();
|
||||||
_dialogService.registerDialogListener(_showDialog, _showDialogInput);
|
_dialogService.registerDialogListener(_showDialog, _showDialogInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,6 +36,7 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controllerPrice.dispose();
|
_controllerPrice.dispose();
|
||||||
_controllerCount.dispose();
|
_controllerCount.dispose();
|
||||||
|
_controllerDiscount.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,10 +78,16 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final String _price = _controllerPrice.text;
|
final String _price = _controllerPrice.text;
|
||||||
final String _count = _controllerCount.text;
|
final String _count = _controllerCount.text;
|
||||||
|
|
||||||
_dialogService.dialogComplete(DialogResponse(
|
_dialogService.dialogComplete(DialogResponse(
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
responsePrice: _price.replaceAll(',', '.'),
|
responsePrice: _price.replaceAll(',', '.'),
|
||||||
responseCount: _count.replaceAll(',', '.')));
|
responseCount: _count.replaceAll(',', '.'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -104,13 +114,17 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
|
|
||||||
void _showDialogInput(DialogRequest request) {
|
void _showDialogInput(DialogRequest request) {
|
||||||
final bool isConfirmationDialog = request.cancelTitle != null;
|
final bool isConfirmationDialog = request.cancelTitle != null;
|
||||||
|
|
||||||
_controllerPrice.text = request.requestPrice ?? '';
|
_controllerPrice.text = request.requestPrice ?? '';
|
||||||
_controllerCount.text = request.requestCount ?? '';
|
_controllerCount.text = request.requestCount ?? '';
|
||||||
|
_controllerDiscount.text = request.requestDiscount ?? '';
|
||||||
|
|
||||||
final dialogController = showDialog(
|
final dialogController = showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) {
|
||||||
|
bool discountPercent = request.requestDiscountPercent ?? false;
|
||||||
|
return StatefulBuilder(
|
||||||
|
builder: (stfContext, stfSetState) {
|
||||||
|
return AlertDialog(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
|
|
@ -151,6 +165,53 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
suffixText: 'шт',
|
suffixText: 'шт',
|
||||||
labelText: 'Количество товара',
|
labelText: 'Количество товара',
|
||||||
),
|
),
|
||||||
|
if(request.requestDiscount != null)
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
verticalSpaceSmall,
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'Скидка',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12, color: placeholderColor),
|
||||||
|
),
|
||||||
|
horizontalSpaceMedium,
|
||||||
|
const Text(
|
||||||
|
'₸',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12, color: placeholderColor),
|
||||||
|
),
|
||||||
|
Switch(
|
||||||
|
activeColor: Colors.white,
|
||||||
|
inactiveThumbColor: Colors.white,
|
||||||
|
activeTrackColor: primaryColor.withOpacity(0.5),
|
||||||
|
inactiveTrackColor: primaryColor.withOpacity(0.5),
|
||||||
|
value: discountPercent,
|
||||||
|
onChanged: (vl) {
|
||||||
|
stfSetState(() {
|
||||||
|
discountPercent = vl;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
'%',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12, color: placeholderColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
verticalSpaceTiny,
|
||||||
|
InputFieldRounded(
|
||||||
|
textInputType:
|
||||||
|
const TextInputType.numberWithOptions(decimal: true),
|
||||||
|
controller: _controllerDiscount,
|
||||||
|
placeholder: '',
|
||||||
|
suffixText: discountPercent ? '%' : '₸',
|
||||||
|
labelText: 'Скидка',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
verticalSpaceSmall,
|
verticalSpaceSmall,
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
|
@ -176,10 +237,14 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final String _price = _controllerPrice.text;
|
final String _price = _controllerPrice.text;
|
||||||
final String _count = _controllerCount.text;
|
final String _count = _controllerCount.text;
|
||||||
|
final String _discount = _controllerDiscount.text;
|
||||||
_dialogService.dialogComplete(DialogResponse(
|
_dialogService.dialogComplete(DialogResponse(
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
responsePrice: _price.replaceAll(',', '.'),
|
responsePrice: _price.replaceAll(',', '.'),
|
||||||
responseCount: _count.replaceAll(',', '.')));
|
responseCount: _count.replaceAll(',', '.'),
|
||||||
|
responseDiscount: _discount.replaceAll(',', '.'),
|
||||||
|
responseDiscountPercent: discountPercent,
|
||||||
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -188,7 +253,10 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
dialogController.whenComplete(() {
|
dialogController.whenComplete(() {
|
||||||
//hook when press overlay and response not completed
|
//hook when press overlay and response not completed
|
||||||
if (_dialogService.completer != null) {
|
if (_dialogService.completer != null) {
|
||||||
|
|
|
||||||
726
pubspec.lock
726
pubspec.lock
File diff suppressed because it is too large
Load Diff
42
pubspec.yaml
42
pubspec.yaml
|
|
@ -15,11 +15,11 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.0.1+2
|
version: 1.0.2+3
|
||||||
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.2 <3.0.0"
|
sdk: '>=3.0.5 <4.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|
@ -30,30 +30,30 @@ dependencies:
|
||||||
redux_thunk: ^0.4.0
|
redux_thunk: ^0.4.0
|
||||||
redux_persist: ^0.9.0
|
redux_persist: ^0.9.0
|
||||||
redux_persist_flutter: ^0.9.0
|
redux_persist_flutter: ^0.9.0
|
||||||
responsive_builder: ^0.4.3
|
responsive_builder: ^0.7.0
|
||||||
provider: ^6.0.4
|
provider: ^6.0.5
|
||||||
logger: ^1.1.0
|
logger: ^1.4.0
|
||||||
get_it: ^7.2.0
|
get_it: ^7.6.0
|
||||||
equatable: ^2.0.5
|
equatable: ^2.0.5
|
||||||
http: ^0.13.5
|
http: ^1.0.0
|
||||||
sqflite: ^2.2.0+3
|
sqflite: ^2.2.8+4
|
||||||
path_provider: ^2.0.11
|
path_provider: ^2.0.15
|
||||||
material_design_icons_flutter: ^5.0.6996
|
material_design_icons_flutter: ^7.0.7296
|
||||||
intl: ^0.17.0
|
intl: ^0.18.1
|
||||||
device_info: ^2.0.3
|
device_info: ^2.0.3
|
||||||
auto_size_text: ^3.0.0
|
auto_size_text: ^3.0.0
|
||||||
url_launcher: ^6.1.6
|
url_launcher: ^6.1.11
|
||||||
qr_flutter: ^4.0.0
|
qr_flutter: ^4.1.0
|
||||||
mask_text_input_formatter: ^2.4.0
|
mask_text_input_formatter: ^2.4.0
|
||||||
flutter_screenutil: ^5.6.0
|
flutter_screenutil: ^5.8.4
|
||||||
shared_preferences: ^2.0.15
|
shared_preferences: ^2.1.2
|
||||||
material_floating_search_bar: ^0.3.7
|
material_floating_search_bar: ^0.3.7
|
||||||
implicitly_animated_reorderable_list: ^0.4.2
|
implicitly_animated_reorderable_list: ^0.4.2
|
||||||
uuid: ^3.0.6
|
uuid: ^3.0.7
|
||||||
charset_converter: ^2.1.0
|
charset_converter: ^2.1.1
|
||||||
ai_barcode: ^3.2.4
|
ai_barcode: ^3.2.4
|
||||||
permission_handler: ^10.2.0
|
permission_handler: ^10.3.0
|
||||||
flutter_svg: ^1.1.6
|
flutter_svg: ^2.0.7
|
||||||
grouped_list: ^5.1.2
|
grouped_list: ^5.1.2
|
||||||
infinite_scroll_pagination: ^3.2.0
|
infinite_scroll_pagination: ^3.2.0
|
||||||
flutter_bluetooth_basic: ^0.1.7
|
flutter_bluetooth_basic: ^0.1.7
|
||||||
|
|
@ -61,10 +61,10 @@ dependencies:
|
||||||
esc_pos_utils: ^1.1.0
|
esc_pos_utils: ^1.1.0
|
||||||
esc_pos_bluetooth: ^0.4.1
|
esc_pos_bluetooth: ^0.4.1
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.3.2
|
build_runner: ^2.4.5
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
json_serializable: ^6.5.4
|
json_serializable: ^6.7.0
|
||||||
|
|
||||||
# The "flutter_lints" package below contains a set of recommended lints to
|
# The "flutter_lints" package below contains a set of recommended lints to
|
||||||
# encourage good coding practices. The lint set provided by the package is
|
# encourage good coding practices. The lint set provided by the package is
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue