import 'package:doctor_app_flutter/config/size_config.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/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approvals_details.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.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.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card_insurance.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.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']; return BaseView( onModelReady: patient.appointmentNo != null ? (model) => model.getInsuranceApproval(patient, appointmentNo: patient.appointmentNo, projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( appBar: PatientProfileHeaderNewDesignAppBar( patient, patientType.toString() ?? "0", patientType), isShowAppBar: true, baseViewModel: model, appBarTitle: TranslationBase.of(context).approvals, body: 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( 'Insurance', fontSize: 15.0, fontWeight: FontWeight.w600, fontFamily: 'Poppins', ), ], ), Row( children: [ AppText( 'Approvals', fontSize: 30.0, fontWeight: FontWeight.w700, ), ], ), ], ), ), ...List.generate( model.insuranceApproval.length, (index) => Container( child: InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => InsuranceApprovalsDetails( patient: patient, indexInsurance: index, )), ); }, 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('No Insurance Approval Found'), ) ], ), )), ), ), ); } }