import 'package:flutter/material.dart';
import 'package:gymlink_module_web/components/app_bar.dart';
import 'package:gymlink_module_web/components/heading.dart';
import 'package:gymlink_module_web/components/history_item_card.dart';
import 'package:gymlink_module_web/tools/relative.dart';

List<Map<String, String>> orders = [
  {"image": "product.png", "price": "120", "id": "66", "date": "11.09.2001"},
  {
    "image": "product.png",
    "price": "150",
    "id": "56",
    "date": "11.09.2001",
  },
  {
    "image": "product.png",
    "price": "250",
    "id": "98",
    "date": "11.09.2001",
  },
  {
    "image": "product.png",
    "price": "300",
    "id": "50",
    "date": "11.09.2001",
  },
  {
    "image": "product.png",
    "price": "100",
    "id": "30",
    "date": "11.09.2001",
  }
];

class HistoryPage extends StatelessWidget {
  const HistoryPage({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const GymLinkAppBar(),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          const GymLinkHeader(title: 'История заказов'),
          Expanded(
            child: Row(
              children: [
                Expanded(
                  child: ListView.builder(
                    itemCount: orders.length,
                    itemBuilder: (context, index) {
                      final item = orders[index];
                      return HistoryItemCard(
                        id: item['id']!,
                        cost: item['price']!,
                        date: item['date']!,
                        image: Image(
                          image: AssetImage('assets/${item['image']!}'),
                          width: 50,
                        ),
                        status: OrderStatus.completed,
                      );
                    },
                  ),
                ),
                getSpacer(context: context)
              ],
            ),
          ),
        ],
      ),
    );
  }
}
