import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:niogu_app/core/enums/payment_status.dart';
import 'package:niogu_app/core/utils/time_zone.dart';
import 'package:niogu_app/features/report/transaction/domain/entities/transaction_report.dart';
import 'package:niogu_app/features/report/transaction/presentation/widgets/info_row.dart';
import 'package:sizer/sizer.dart';

class GeneralPurchaseInfo extends StatelessWidget {
  final PurchaseDetail purchaseDetail;
  const GeneralPurchaseInfo({super.key, required this.purchaseDetail});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: 5.w, vertical: 2.h),
      child: Column(
        children: [
          InfoRow(
            label: "No. Transaksi",
            value: purchaseDetail.purchaseNumber,
            isBoldValue: true,
          ),
          SizedBox(height: 1.h),
          InfoRow(
            label: "Waktu",
            value:
                "${DateFormat("dd MMMM yyyy HH:mm").format(purchaseDetail.purchaseDate)} ${TimeZone.getCurrentTimeZone()}",
          ),
          SizedBox(height: 1.h),
          InfoRow(
            label: "Status Pembayaran",
            value: purchaseDetail.paymentStatus == PaymentStatus.paid
                ? "Lunas"
                : purchaseDetail.paymentStatus == PaymentStatus.partial
                ? "Bayar Sebagian"
                : "Hutang",
          ),
          SizedBox(height: 1.h),
          InfoRow(label: "Pembeli", value: purchaseDetail.userName),
        ],
      ),
    );
  }
}
