import 'package:flutter/material.dart';
import 'package:niogu_app/core/constants/app_font_size.dart';
import 'package:niogu_app/features/report/transaction/domain/entities/transaction_report.dart';
import 'package:sizer/sizer.dart';

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

  @override
  Widget build(BuildContext context) {
    final bool isTablet = 100.w > 600;
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: 5.w, vertical: 2.h),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          if (purchaseDetail.supplierName != null) ...[
            Row(
              children: [
                Icon(Icons.person_outline, size: 4.w, color: Colors.grey),
                SizedBox(width: 2.w),
                Text(
                  "Informasi Pemasok",
                  style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: isTablet
                        ? AppFontSize.medium.sp
                        : AppFontSize.small.sp,
                  ),
                ),
              ],
            ),
            SizedBox(height: 1.h),
            Container(
              width: double.infinity,
              padding: EdgeInsets.all(3.w),
              decoration: BoxDecoration(
                color: Colors.grey[50],
                borderRadius: BorderRadius.circular(2.w),
              ),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    purchaseDetail.supplierName!,
                    style: TextStyle(
                      fontWeight: FontWeight.bold,
                      fontSize: isTablet
                          ? AppFontSize.medium.sp
                          : AppFontSize.small.sp,
                    ),
                  ),
                  if (purchaseDetail.supplierPhone != null) ...[
                    SizedBox(height: 1.h),
                    Text(
                      purchaseDetail.supplierPhone!,
                      style: TextStyle(
                        color: Colors.grey[600],
                        fontSize: isTablet
                            ? AppFontSize.medium.sp
                            : AppFontSize.small.sp,
                      ),
                    ),
                  ],
                ],
              ),
            ),
            SizedBox(height: 2.h),
          ],

          if (purchaseDetail.note != null && purchaseDetail.note!.isNotEmpty) ...[
            Row(
              children: [
                Icon(Icons.note_alt_outlined, size: 4.w, color: Colors.grey),
                SizedBox(width: 2.w),
                Text(
                  "Catatan",
                  style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: isTablet
                        ? AppFontSize.medium.sp
                        : AppFontSize.small.sp,
                  ),
                ),
              ],
            ),
            SizedBox(height: 1.h),
            Text(
              purchaseDetail.note!,
              style: TextStyle(
                fontSize: isTablet
                    ? AppFontSize.medium.sp
                    : AppFontSize.small.sp,
                color: Colors.grey[700],
                fontStyle: FontStyle.italic,
              ),
            ),
          ],
        ],
      ),
    );
  
  }
}