import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/InsuranceViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approvals_details.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card_insurance.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../base/base_view.dart'; class InsuranceApprovalScreenNew extends StatefulWidget { final int appointmentNo; InsuranceApprovalScreenNew({this.appointmentNo}); @override _InsuranceApprovalScreenNewState createState() => _InsuranceApprovalScreenNewState(); } class _InsuranceApprovalScreenNewState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; patient = routeArgs['patient']; String patientType = routeArgs['patientType']; bool isInpatient = routeArgs['isInpatient']; return BaseView( onModelReady: patient.admissionNo != null ? (model) => model.getInsuranceInPatient(mrn: patient.patientId) : patient.appointmentNo != null ? (model) => model.getInsuranceApproval(patient, appointmentNo: int.parse(patient?.appointmentNo.toString()), projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( appBar: PatientProfileAppBar( patient, isInpatient: isInpatient, ), isShowAppBar: true, baseViewModel: model, appBarTitle: TranslationBase.of(context).approvals, body: patient.admissionNo != null ? SingleChildScrollView( child: Container( margin: EdgeInsets.only( left: SizeConfig.screenWidth * 0.004, right: SizeConfig.screenWidth * 0.004, top: SizeConfig.screenWidth * 0.04, ), child: model.insuranceApprovalInPatient.length != 0 ? Column( children: [ Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Row( children: [ AppText( TranslationBase.of(context).insurance22, fontSize: 15.0, fontWeight: FontWeight.w600, fontFamily: 'Poppins', ), ], ), Row( children: [ AppText( TranslationBase.of(context).approvals22, fontSize: 30.0, fontWeight: FontWeight.w700, ), ], ), ], ), ), ...List.generate( model.insuranceApprovalInPatient.length, (index) => Container( child: InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => InsuranceApprovalsDetails( patient: patient, indexInsurance: index, patientType: patientType, ), settings: RouteSettings(name: 'InsuranceApprovalsDetails'), ), ); }, child: DoctorCardInsurance( patientOut: "In Patient", profileUrl: model.insuranceApprovalInPatient[index].doctorImage, clinic: model.insuranceApprovalInPatient[index].clinicName, doctorName: model.insuranceApprovalInPatient[index].doctorName, branch: model.insuranceApprovalInPatient[index].approvalNo.toString(), isPrescriptions: true, approvalStatus: model.insuranceApprovalInPatient[index].approvalStatusDescption ?? '', branch2: model.insuranceApprovalInPatient[index].projectName, ), ), ), ), ], ) : Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 100, ), Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), child: AppText(TranslationBase.of(context).noInsuranceApprovalFound), ), SizedBox( height: 150.0, ) ], ), ), ), ) : SingleChildScrollView( child: Container( margin: EdgeInsets.only( left: SizeConfig.screenWidth * 0.004, right: SizeConfig.screenWidth * 0.004, top: SizeConfig.screenWidth * 0.04, ), child: model.insuranceApproval.length != 0 ? Column( children: [ Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Row( children: [ AppText( TranslationBase.of(context).insurance22, fontSize: 15.0, fontWeight: FontWeight.w600, fontFamily: 'Poppins', ), ], ), Row( children: [ AppText( TranslationBase.of(context).approvals22, fontSize: 30.0, fontWeight: FontWeight.w700, ), ], ), ], ), ), ...List.generate( model.insuranceApproval.length, (index) => Container( child: InkWell( onTap: () async { await locator().logEvent( eventCategory: "Insurance Approval Screen New", eventAction: "Insurance Approval Details", ); Navigator.push( context, MaterialPageRoute( builder: (context) => InsuranceApprovalsDetails( patient: patient, indexInsurance: index, patientType: patientType, ), settings: RouteSettings(name: 'InsuranceApprovalsDetails'), ), ); }, child: DoctorCardInsurance( patientOut: model.insuranceApproval[index].patientDescription, profileUrl: model.insuranceApproval[index].doctorImage, clinic: model.insuranceApproval[index].clinicName, doctorName: model.insuranceApproval[index].doctorName, branch: model.insuranceApproval[index].approvalNo.toString(), isPrescriptions: true, approvalStatus: model.insuranceApproval[index].approvalStatusDescption ?? '', branch2: model.insuranceApproval[index].projectName, ), ), ), ), ], ) : Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 100, ), Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), child: AppText(TranslationBase.of(context).noInsuranceApprovalFound), ) ], ), )), ), ), ); } }