added comment for payment, changed intent and added amount ui in operations

This commit is contained in:
Arseni
2026-03-12 00:09:38 +03:00
parent ddc2f1facc
commit 13b84e1e0f
26 changed files with 271 additions and 298 deletions

View File

@@ -1,6 +1,5 @@
import 'package:pweb/models/payment/multiple_payouts/csv_row.dart';
const String sampleFileName = 'sample.csv';
final List<CsvPayoutRow> sampleRows = [
@@ -11,6 +10,7 @@ final List<CsvPayoutRow> sampleRows = [
expMonth: 12,
expYear: 27,
amount: "500",
comment: "Salary payout",
),
CsvPayoutRow(
pan: "9022****12",
@@ -27,16 +27,26 @@ final List<CsvPayoutRow> sampleRows = [
expMonth: 3,
expYear: 28,
amount: "120",
comment: "Refund",
),
];
String buildSampleCsvContent() {
final rows = <String>[
'pan,first_name,last_name,exp_month,exp_year,amount',
'pan,first_name,last_name,exp_month,exp_year,amount,comment',
...sampleRows.map(
(row) =>
'${row.pan},${row.firstName},${row.lastName},${row.expMonth},${row.expYear},${row.amount}',
'${row.pan},${row.firstName},${row.lastName},${row.expMonth},${row.expYear},${row.amount},${_escapeCsvCell(row.comment)}',
),
];
return rows.join('\n');
}
String _escapeCsvCell(String? value) {
if (value == null || value.isEmpty) return '';
if (!value.contains(',') && !value.contains('"') && !value.contains('\n')) {
return value;
}
final escaped = value.replaceAll('"', '""');
return '"$escaped"';
}

View File

@@ -6,10 +6,7 @@ import 'package:pweb/generated/i18n/app_localizations.dart';
class FileFormatSampleTable extends StatelessWidget {
const FileFormatSampleTable({
super.key,
required this.rows,
});
const FileFormatSampleTable({super.key, required this.rows});
final List<CsvPayoutRow> rows;
@@ -24,6 +21,7 @@ class FileFormatSampleTable extends StatelessWidget {
DataColumn(label: Text(l10n.lastName)),
DataColumn(label: Text(l10n.expiryDate)),
DataColumn(label: Text(l10n.amountColumn)),
DataColumn(label: Text(l10n.commentColumn)),
],
rows: rows.map((row) {
return DataRow(
@@ -35,6 +33,7 @@ class FileFormatSampleTable extends StatelessWidget {
Text('${row.expMonth.toString().padLeft(2, '0')}/${row.expYear}'),
),
DataCell(Text(row.amount)),
DataCell(Text(row.comment ?? '')),
],
);
}).toList(),