import 'package:flutter/material.dart';

import 'package:pshared/models/payment/operation.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';
import 'package:pweb/pages/report/cards/items.dart';


class OperationsCardsColumn extends StatelessWidget {
  final List<OperationItem> operations;
  final ValueChanged<OperationItem>? onTap;

  const OperationsCardsColumn({
    super.key,
    required this.operations,
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    final loc = AppLocalizations.of(context)!;
    final theme = Theme.of(context);
    final items = buildOperationCardItems(
      context,
      operations,
      onTap: onTap,
    );

    if (operations.isEmpty) {
      return Align(
        alignment: Alignment.centerLeft,
        child: Text(
          loc.reportPaymentsEmpty,
          style: theme.textTheme.bodyMedium,
        ),
      );
    }

    return Column(
      children: items,
    );
  }
}
