import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class AnicllaryOrders extends StatefulWidget { @override _AnicllaryOrdersState createState() => _AnicllaryOrdersState(); } class _AnicllaryOrdersState extends State with SingleTickerProviderStateMixin { TabController _tabController; ProjectViewModel projectViewModel; void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); } void dispose() { super.dispose(); _tabController.dispose(); } @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getOrders(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, showNewAppBar: true, showNewAppBarTitle: true, baseViewModel: model, appBarTitle: TranslationBase.of(context).anicllaryOrders, body: SingleChildScrollView( padding: EdgeInsets.all(12), child: model.ancillaryLists.length > 0 ? Column(children: [getPatientInfo(model), getAncillaryOrdersList(model)]) : getNoDataWidget(context)))); } Widget getPatientInfo(AnciallryOrdersViewModel model) { return Padding( child: Column( children: [ Container( width: double.infinity, child: Container( decoration: cardRadius(12), margin: EdgeInsets.zero, child: Padding( padding: const EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Text( TranslationBase.of(context).patientName + ":", style: TextStyle( fontWeight: FontWeight.w600, fontSize: 10, letterSpacing: -0.6, color: CustomColors.grey, ), ), mWidth(3), Text( projectViewModel.user.firstName + " " + projectViewModel.user.lastName, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.48, ), ), ], ), Row( children: [ Text( TranslationBase.of(context).mrn + ":", style: TextStyle( fontWeight: FontWeight.w600, fontSize: 10, letterSpacing: -0.6, color: CustomColors.grey, ), ), mWidth(3), Text( projectViewModel.user.patientID.toString(), style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.48, ), ), ], ), Row( children: [ Text( TranslationBase.of(context).nationalIdNumber + ":", style: TextStyle( fontWeight: FontWeight.w600, fontSize: 10, letterSpacing: -0.6, color: CustomColors.grey, ), ), mWidth(3), Text( projectViewModel.user.patientIdentificationNo, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.48, ), ), ], ), ], ), ), ), ), Divider() ], ), padding: EdgeInsets.only(top: 5.0, bottom: 10.0), ); } Widget getAncillaryOrdersList(AnciallryOrdersViewModel model) { return Column(children: [ ListView.separated( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), reverse: true, itemBuilder: (context, index) { return DoctorCard( onTap: () => ancillaryOrdersDetails(model.ancillaryLists[0].ancillaryOrderList[index], model.ancillaryLists[0].projectID), isInOutPatient: true, name: TranslationBase.of(context).dr.toString() + " " + (model.ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""), billNo: model.ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(), profileUrl: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", subName: model.ancillaryLists[0].projectName, isLiveCareAppointment: false, date: DateUtil.convertStringToDate(model.ancillaryLists[0].ancillaryOrderList[index].orderDate), isSortByClinic: true, ); }, itemCount: model.ancillaryLists[0].ancillaryOrderList.length, separatorBuilder: (context, index) => SizedBox(height: 14), ), ]); } ancillaryOrdersDetails(item, projectId) { Navigator.push( context, FadePage( page: AnicllaryOrdersDetails(item.appointmentNo, item.orderNo, projectId), ), ); } }