|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/helpers.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/patients/profile/PatientProfileButton.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget_search.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/borderedButton.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../routes.dart';
|
|
|
|
|
|
|
|
|
|
class MyReferralDetailScreen extends StatelessWidget {
|
|
|
|
|
PendingReferral pendingReferral;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8;
|
|
|
|
|
|
|
|
|
|
AuthViewModel authProvider = Provider.of(context);
|
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
pendingReferral = routeArgs['referral'];
|
|
|
|
|
|
|
|
|
|
return BaseView<PatientReferralViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getPatientDetails(
|
|
|
|
|
DateUtils.convertStringToDateFormat(
|
|
|
|
|
DateTime.now()/*.subtract(Duration(days: 350))*/.toString(),
|
|
|
|
|
"yyyy-MM-dd"),
|
|
|
|
|
DateUtils.convertStringToDateFormat(
|
|
|
|
|
DateTime.now().toString(), "yyyy-MM-dd"),
|
|
|
|
|
pendingReferral.patientID,
|
|
|
|
|
pendingReferral.sourceAppointmentNo),
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).referPatient,
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
body: model.patientArrivalList != null &&
|
|
|
|
|
model.patientArrivalList.length > 0
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 0, right: 5, bottom: 5, top: 5),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 10, right: 10, bottom: 10),
|
|
|
|
|
margin: EdgeInsets.only(top: 50),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 12.0),
|
|
|
|
|
child: Row(children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.arrow_back_ios),
|
|
|
|
|
color: Colors.black, //Colors.black,
|
|
|
|
|
onPressed: () => Navigator.pop(context),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: AppText(
|
|
|
|
|
(Helpers.capitalize(model.patientArrivalList[0].patientDetails.fullName)),
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.5,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
backGroundcolor: Colors.white,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
model.patientArrivalList[0].patientDetails.gender == 1
|
|
|
|
|
? Icon(
|
|
|
|
|
DoctorApp.male_2,
|
|
|
|
|
color: Colors.blue,
|
|
|
|
|
)
|
|
|
|
|
: Icon(
|
|
|
|
|
DoctorApp.female_1,
|
|
|
|
|
color: Colors.pink,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
/*ProfileWelcomeWidget(
|
|
|
|
|
AppText(
|
|
|
|
|
authProvider.selectedClinicName != null
|
|
|
|
|
? authProvider.selectedClinicName
|
|
|
|
|
: authProvider
|
|
|
|
|
.doctorProfile.clinicDescription,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.7,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
height: 100,
|
|
|
|
|
),*/
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 16,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.symmetric(horizontal: 16.0),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).myReferralPatient,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
PatientReferralItemWidget(
|
|
|
|
|
"${pendingReferral.patientID}",
|
|
|
|
|
patientName: pendingReferral.patientName,
|
|
|
|
|
referralStatus: pendingReferral.referralStatus,
|
|
|
|
|
isReferredTo: false,
|
|
|
|
|
isSameBranch:
|
|
|
|
|
pendingReferral.isReferralDoctorSameBranch,
|
|
|
|
|
referralDoctorName:
|
|
|
|
|
pendingReferral.referredByDoctorInfo,
|
|
|
|
|
clinicDescription: null,
|
|
|
|
|
remark: pendingReferral.remarksFromSource,
|
|
|
|
|
referredOn: pendingReferral.referredOn,
|
|
|
|
|
patientInfo: pendingReferral,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
child: ProfileMedicalInfoWidgetSearch(
|
|
|
|
|
patient: model.patientArrivalList[0],
|
|
|
|
|
patientType: "7",
|
|
|
|
|
from: null,
|
|
|
|
|
to: null,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: BorderedButton(
|
|
|
|
|
TranslationBase.of(context).accept,
|
|
|
|
|
backgroundColor: Color(0xFF4BA821),
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
hPadding: 8,
|
|
|
|
|
vPadding: 12,
|
|
|
|
|
handler: () async {
|
|
|
|
|
await model.responseReferral(
|
|
|
|
|
pendingReferral, true);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: BorderedButton(
|
|
|
|
|
TranslationBase.of(context).reject,
|
|
|
|
|
backgroundColor: Color(0xFFB9382C),
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
hPadding: 8,
|
|
|
|
|
vPadding: 12,
|
|
|
|
|
handler: () async {
|
|
|
|
|
await model.responseReferral(
|
|
|
|
|
pendingReferral, true);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).patientNoDetailErrMsg,
|
|
|
|
|
color: HexColor("#B8382B"),
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|