import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/service_request/pending_service_request_model.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';

class PendingRequestBottomSheet extends StatelessWidget {
  final PendingAssetServiceRequest pendingAssetServiceRequest;
  final Asset device;

  const PendingRequestBottomSheet(this.pendingAssetServiceRequest, this.device, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(21),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisSize: MainAxisSize.min,
        children: [
          "Alert!".heading4(context),
          12.height,
          Text(
            "${pendingAssetServiceRequest.details!.length} pending corrective maintenance found",
            style: TextStyle(
              fontSize: 16.toScreenWidth,
              fontWeight: FontWeight.w500,
              fontStyle: FontStyle.normal,
              decoration: TextDecoration.none,
            ),
          ),
          "${device.assetNumber} (${device.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? ""})".bodyText(context),
          16.height,
          Row(
            children: [
              AppFilledButton(
                  label: context.translation.cancel,
                  textColor: AppColor.blueStatus(context),
                  buttonColor: AppColor.background(context),
                  maxWidth: true,
                  showBorder: true,
                  onPressed: () {
                    Navigator.pop(context, false);
                  }).expanded,
              16.width,
              AppFilledButton(
                  label: "View",
                  maxWidth: true,
                  onPressed: () {
                    Navigator.pop(context, true);
                  }).expanded,
            ],
          ),
          8.height,
        ],
      ),
    );
  }
}
