aman-kassa-flutter/lib/views/close_day_view/close_day_show_container.dart

86 lines
3.9 KiB
Dart

import 'package:aman_kassa_flutter/core/models/close_day_data.dart';
import 'package:aman_kassa_flutter/core/models/halyk/halyk_close_day_dao.dart';
import 'package:aman_kassa_flutter/core/models/transaction_item.dart';
import 'package:aman_kassa_flutter/shared/shared_styles.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class CloseDayShowContainer extends StatelessWidget {
final CloseDayData data;
DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm:ss");
CloseDayShowContainer(this.data);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(data.title ?? 'Отчет: Закрытие дня POS'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Общий итоги', style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 15) ),
Table(
children: [
TableRow(children: [
TableCell(child: Text('Оплат:', style: productTextStyle,)),
TableCell(child: Text('${data.paymentCount}', textAlign: TextAlign.center, style: productTextStyle)),
TableCell(child: Text('${data.paymentAmount} T', textAlign: TextAlign.end, style: productTextStyle)),
]),
TableRow(children: [
TableCell(child: Text('Отмен:', style: productTextStyle,)),
TableCell(child: Text('${data.cancelCount}', textAlign: TextAlign.center, style: productTextStyle)),
TableCell(child: Text('${data.cancelAmount} T', textAlign: TextAlign.end, style: productTextStyle)),
]),
TableRow(children: [
TableCell(child: Text('Возвратов:', style: productTextStyle,)),
TableCell(child: Text('${data.refundCount}', textAlign: TextAlign.center, style: productTextStyle)),
TableCell(child: Text('${data.refundAmount} T', textAlign: TextAlign.end, style: productTextStyle)),
]),
TableRow(children: [
TableCell(child: Text('Итого:', style: productTextStyle,)),
TableCell(child: Text('${data.totalCount}', textAlign: TextAlign.center, style: productTextStyle)),
TableCell(child: Text('${data.totalAmount} T', textAlign: TextAlign.end, style: productTextStyle)),
]),
],
)
],
),
),
Divider(),
Expanded(
child: ListView.separated(
itemCount: data.items?.length ?? 0,
separatorBuilder: (BuildContext context, int index) {
return Divider();
},
itemBuilder: (BuildContext context, int index) {
TransactionBean item = data.items!.elementAt(index);
return ListTile(
title: Text(item.instrumentSpecificData?.maskedPan ?? ''),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if(item.instrumentSpecificData!.cardholderName!=null)
Text(item.instrumentSpecificData!.cardholderName!),
Text('Операционный день № ${item.operationDay?.toString()}'),
],
),
trailing: Text('${item.amount / 100} T'),
);
},
),
),
],
)
);
}
}