// import 'package:flutter/material.dart';
// import 'package:provider/provider.dart';
// import 'package:test_sa/controllers/providers/api/service_requests_provider.dart';
// import 'package:test_sa/controllers/providers/api/user_provider.dart';
// import 'package:test_sa/extensions/context_extension.dart';
// import 'package:test_sa/extensions/int_extensions.dart';
// import 'package:test_sa/extensions/widget_extensions.dart';
// import 'package:test_sa/models/enums/user_types.dart';
// import 'package:test_sa/models/service_request/search_work_order.dart';
// import 'package:test_sa/models/service_request/service_request.dart';
// import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
// import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
// import 'package:test_sa/cm_module/views/components/activity_card_view.dart';
// import 'package:test_sa/views/pages/user/requests/work_order/create_service_report.dart';
// import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
//// //todo @delete
// class WorkOrderListPage extends StatelessWidget {
//   static const String id = "/work-order-list";
//   final ServiceRequest? serviceRequest;
//
//   WorkOrderListPage({Key? key, this.serviceRequest}) : super(key: key);
//
//   late ServiceRequestsProvider serviceRequestsProvider;
//   late UserProvider _userProvider;
//
//   @override
//   Widget build(BuildContext context) {
//     List<SearchWorkOrder> workOrders = [];
//     _userProvider = Provider.of<UserProvider>(context);
//     serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
//     return Scaffold(
//       appBar: DefaultAppBar(title: context.translation.activities),
//       //backgroundColor: const Color(0xfff8f9fb),
//       body: SafeArea(
//         child: FutureBuilder(
//           future: serviceRequestsProvider.searchWorkOrders(callId: serviceRequest!.requestCode!),
//           builder: (context, snap) {
//             if (snap.connectionState == ConnectionState.waiting) return const Center(child: CircularProgressIndicator());
//             workOrders = snap.data as List<SearchWorkOrder>;
//             return Column(
//               children: [
//                 (workOrders.isEmpty)
//                     ? NoDataFound(message: context.translation.noDataFound).expanded
//                     : ListView.separated(
//                         padding: const EdgeInsets.all(16),
//                         itemCount: workOrders.length,
//                         separatorBuilder: (czt, index) => 8.height,
//                         itemBuilder: (context, index) {
//                           return ActivityCardView(workOrders[index], serviceRequest!);
//
//                           //older code....
//                           //   Row(
//                           //   crossAxisAlignment: CrossAxisAlignment.start,
//                           //   children: [
//                           //     Column(
//                           //       mainAxisSize: MainAxisSize.min,
//                           //       crossAxisAlignment: CrossAxisAlignment.start,
//                           //       children: [
//                           //         StatusLabel(
//                           //           label: workOrders[index].currentSituation.name,
//                           //           textColor: AppColor.getRequestStatusTextColorByName(context, workOrders[index].currentSituation.name),
//                           //           backgroundColor: AppColor.getRequestStatusColorByName(context, workOrders[index].currentSituation.name),
//                           //         ),
//                           //         8.height,
//                           //         Text(serviceRequest.requestCode, style: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
//                           //         Text(
//                           //           '${context.translation.assetName}: ${workOrders[index].callRequest.asset.modelDefinition.assetName?.cleanupWhitespace?.capitalizeFirstOfEach}',
//                           //           style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
//                           //         ),
//                           //         Text(
//                           //           '${context.translation.currentSituation}:  ${workOrders[index].currentSituation.name}',
//                           //           style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
//                           //         ),
//                           //         16.height,
//                           //         Row(
//                           //           mainAxisSize: MainAxisSize.min,
//                           //           children: [
//                           //             Text(
//                           //               context.translation.viewDetails,
//                           //               style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
//                           //             ),
//                           //             4.width,
//                           //             Icon(Icons.arrow_forward, color: AppColor.blueStatus(context), size: 14)
//                           //           ],
//                           //         ),
//                           //       ],
//                           //     ).onPress(() {
//                           //       Navigator.push(
//                           //         context,
//                           //         MaterialPageRoute(builder: (context) => WorkOrderDetailsPage(workOrder: workOrders[index], serviceRequest: serviceRequest)),
//                           //       );
//                           //     }).expanded,
//                           //     Column(
//                           //       crossAxisAlignment: CrossAxisAlignment.end,
//                           //       mainAxisAlignment: MainAxisAlignment.start,
//                           //       children: [
//                           //         if (_userProvider.user.type == UsersTypes.engineer && serviceRequest.statusValue != 5 && serviceRequest.statusValue != 3)
//                           //           "edit".toSvgAsset(height: 48, width: 48).onPress(() {
//                           //             Navigator.of(context).push(
//                           //               MaterialPageRoute(builder: (_) => UpdateServiceReport(request: serviceRequest, workOrder: workOrders[index])),
//                           //             );
//                           //           }),
//                           //         if (_userProvider.user.type == UsersTypes.engineer && serviceRequest.statusValue != 5 && serviceRequest.statusValue != 3) 8.height,
//                           //         Text(workOrders[index].visitDate?.toServiceRequestCardFormat ?? "",
//                           //             textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : const Color(0xFF3B3D4A))),
//                           //       ],
//                           //     )
//                           //   ],
//                           // ).toShadowContainer(context);
//                         },
//                       ).expanded,
//                 if (_userProvider.user!.type == UsersTypes.engineer && (serviceRequest!.statusValue != 5 && serviceRequest!.statusValue != 3))
//                   AppFilledButton(
//                     label: context.translation.createWorkOrder,
//                     maxWidth: true,
//                     onPressed: () {
//                       Navigator.of(context).push(MaterialPageRoute(builder: (_) => CreateServiceReport(request: serviceRequest!)));
//                     },
//                   ).paddingOnly(start: 16, end: 16, bottom: 16)
//               ],
//             );
//           },
//         ),
//       ),
//     );
//   }
// }
