You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
8.6 KiB
Dart
172 lines
8.6 KiB
Dart
import 'package:doctor_app_flutter/core/enum/PatientType.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-detail-screen.dart';
|
|
import 'package:doctor_app_flutter/screens/patients/profile/referral/referral_patient_detail_in-paint.dart';
|
|
import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.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/patient-referral-item-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/loader/gif_loader_dialog_utils.dart';
|
|
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
import 'my-referral-patient-screen.dart';
|
|
|
|
class MyReferralInPatientScreen extends StatefulWidget {
|
|
@override
|
|
_MyReferralInPatientScreenState createState() =>
|
|
_MyReferralInPatientScreenState();
|
|
}
|
|
|
|
class _MyReferralInPatientScreenState extends State<MyReferralInPatientScreen> {
|
|
PatientType patientType = PatientType.IN_PATIENT;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<PatientReferralViewModel>(
|
|
onModelReady: (model) => model.getMyReferralPatientService(),
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
isShowAppBar: false,
|
|
appBarTitle: TranslationBase.of(context).referPatient,
|
|
body: Column(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(top: 70),
|
|
child: PatientTypeRadioWidget(
|
|
(patientType) async {
|
|
setState(() {
|
|
this.patientType = patientType;
|
|
});
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
if (patientType == PatientType.IN_PATIENT) {
|
|
await model.getMyReferralPatientService(localBusy: true);
|
|
} else {
|
|
await model.getMyReferralOutPatientService(localBusy: true);
|
|
}
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
},
|
|
),
|
|
),
|
|
model.myReferralPatients.isEmpty
|
|
? 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).referralEmptyMsg,
|
|
color: Theme.of(context).errorColor,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
: Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
ListView.builder(
|
|
itemCount: model.myReferralPatients.length,
|
|
scrollDirection: Axis.vertical,
|
|
physics: ScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemBuilder: (context, index) {
|
|
return InkWell(
|
|
onTap: () {
|
|
if (patientType ==
|
|
PatientType.OUT_PATIENT) {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: MyReferralDetailScreen(
|
|
referralPatient: model
|
|
.myReferralPatients[index]),
|
|
),
|
|
);
|
|
} else {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: ReferralPatientDetailScreen(
|
|
model.myReferralPatients[index],
|
|
model),
|
|
),
|
|
);
|
|
}
|
|
},
|
|
child: PatientReferralItemWidget(
|
|
referralStatus:
|
|
model.getReferralStatusNameByCode(
|
|
model.myReferralPatients[index]
|
|
.referralStatus,
|
|
context),
|
|
referralStatusCode: model
|
|
.myReferralPatients[index]
|
|
.referralStatus,
|
|
patientName: model
|
|
.myReferralPatients[index]
|
|
.patientName,
|
|
patientGender: model
|
|
.myReferralPatients[index].gender,
|
|
referredDate: AppDateUtils
|
|
.getDayMonthYearDateFormatted(model
|
|
.myReferralPatients[index]
|
|
.referralDate),
|
|
referredTime: AppDateUtils.getTimeHHMMA(
|
|
model.myReferralPatients[index]
|
|
.referralDate),
|
|
patientID:
|
|
"${model.myReferralPatients[index].patientID}",
|
|
isSameBranch: false,
|
|
isReferral: true,
|
|
isReferralClinic: true,
|
|
referralClinic:
|
|
"${model.myReferralPatients[index].referringClinicDescription}",
|
|
remark: model.myReferralPatients[index]
|
|
.referringDoctorRemarks,
|
|
nationality: model
|
|
.myReferralPatients[index]
|
|
.nationalityName,
|
|
nationalityFlag: model
|
|
.myReferralPatients[index]
|
|
.nationalityFlagURL,
|
|
doctorAvatar: model
|
|
.myReferralPatients[index]
|
|
.doctorImageURL,
|
|
referralDoctorName: model
|
|
.myReferralPatients[index]
|
|
.referringDoctorName,
|
|
clinicDescription: model
|
|
.myReferralPatients[index]
|
|
.referringClinicDescription,
|
|
infoIcon: Icon(
|
|
FontAwesomeIcons.arrowRight,
|
|
size: 25,
|
|
color: Colors.black),
|
|
),
|
|
);
|
|
})
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|