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.
diplomatic-quarter/lib/pages/medical/reports/reports_page.dart

205 lines
7.6 KiB
Dart

import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart';
4 years ago
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
4 years ago
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
4 years ago
import 'package:provider/provider.dart';
class MedicalReports extends StatelessWidget {
@override
Widget build(BuildContext context) {
Merge branch 'diplomatic-quarter-live' of https://gitlab.com/Cloud_Solution/diplomatic-quarter  Conflicts:  ios/Flutter/.last_build_id  lib/config/config.dart  lib/config/localized_values.dart  lib/config/shared_pref_kay.dart  lib/core/service/client/base_app_client.dart  lib/core/service/medical/prescriptions_service.dart  lib/core/viewModels/project_view_model.dart  lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart  lib/pages/BookAppointment/BookConfirm.dart  lib/pages/BookAppointment/DoctorProfile.dart  lib/pages/DrawerPages/family/my-family.dart  lib/pages/MyAppointments/MyAppointments.dart  lib/pages/MyAppointments/models/ArrivedButtons.dart  lib/pages/MyAppointments/widgets/AppointmentActions.dart  lib/pages/MyAppointments/widgets/AppointmentCardView.dart  lib/pages/ToDoList/ToDo.dart  lib/pages/feedback/send_feedback_page.dart  lib/pages/insurance/insurance_approval_screen.dart  lib/pages/insurance/insurance_card_screen.dart  lib/pages/landing/home_page.dart  lib/pages/landing/landing_page.dart  lib/pages/login/confirm-login.dart  lib/pages/login/login.dart  lib/pages/medical/balance/my_balance_page.dart  lib/pages/medical/labs/laboratory_result_page.dart  lib/pages/medical/labs/labs_home_page.dart  lib/pages/medical/medical_profile_page.dart  lib/pages/medical/patient_sick_leave_page.dart  lib/pages/medical/prescriptions/prescription_details_page.dart  lib/pages/medical/prescriptions/prescription_items_page.dart  lib/pages/medical/radiology/radiology_details_page.dart  lib/pages/medical/radiology/radiology_home_page.dart  lib/pages/medical/reports/report_home_page.dart  lib/pages/medical/reports/reports_page.dart  lib/pages/pharmacies/pharmacies_list_screen.dart  lib/pages/settings/profile_setting.dart  lib/services/authentication/auth_provider.dart  lib/uitl/translations_delegate_base.dart  lib/widgets/buttons/floatingActionButton.dart  lib/widgets/data_display/medical/LabResult/LabResultWidget.dart  lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart  lib/widgets/data_display/medical/doctor_card.dart  lib/widgets/drawer/app_drawer_widget.dart  lib/widgets/others/app_scaffold_widget.dart
4 years ago
void confirmBox(
AppointmentHistory model, ReportsViewModel reportsViewModel) {
showDialog(
context: context,
child: ConfirmDialog(
appointmentHistory: model,
4 years ago
onOkSelected: (model) => reportsViewModel.insertRequestForMedicalReport(model,TranslationBase.of(context).successSendReport),
),
);
}
4 years ago
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<ReportsViewModel>(
onModelReady: (model) => model.getPatentAppointmentHistory(),
builder: (_, model, widget) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
4 years ago
appBarTitle: TranslationBase.of(context).medReport,
body: ListView.builder(
itemCount: model.appointHistoryList.length,
itemBuilder: (context, index) => Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: double.infinity,
margin: EdgeInsets.only(left: 8, right: 8, top: 3),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 2),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(
Radius.circular(8.0),
)),
child: Row(
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5, right: 5),
child: LargeAvatar(
width: 50,
height: 50,
name: model.appointHistoryList[index].doctorNameObj,
url: model.appointHistoryList[index].doctorImageURL,
),
),
Expanded(
flex: 4,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 12,
),
Texts(model.appointHistoryList[index].projectName),
Texts(model.appointHistoryList[index].clinicName),
4 years ago
Texts(projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.appointHistoryList[index].appointmentDate):DateUtil.getMonthDayYearDateFormatted(model.appointHistoryList[index].appointmentDate)),
StarRating(
totalAverage: model
.appointHistoryList[index].actualDoctorRate
.toDouble(),
forceStars: true),
SizedBox(
height: 12,
),
],
),
),
),
InkWell(
onTap: () =>
confirmBox(model.appointHistoryList[index], model),
child: Container(
width: 120,
height: 50,
decoration: BoxDecoration(
color: Colors.black54,
border:
Border.all(color: Colors.transparent, width: 2),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(
Radius.circular(8.0),
),
),
child: Center(
child: Texts(
TranslationBase.of(context).requestReport,
fontSize: 12,
color: Colors.white,
),
),
),
),
SizedBox(
width: 12,
),
],
),
),
),
),
),
);
}
}
class ConfirmDialog extends StatefulWidget {
final Function(AppointmentHistory) onOkSelected;
final AppointmentHistory appointmentHistory;
ConfirmDialog({this.onOkSelected, this.appointmentHistory});
@override
_ConfirmDialogState createState() => _ConfirmDialogState();
}
class _ConfirmDialogState extends State<ConfirmDialog> {
@override
Widget build(BuildContext context) {
return SimpleDialog(
4 years ago
title: Texts(TranslationBase.of(context).confirm),
children: <Widget>[
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
4 years ago
Texts(TranslationBase.of(context).confirmMsgReport),
SizedBox(
height: 5.0,
),
Divider(
height: 2.5,
color: Colors.grey[500],
),
SizedBox(
height: 5,
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.pop(context),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Center(
child: Texts(
4 years ago
TranslationBase.of(context).cancel,
color: Colors.red,
),
),
),
),
),
),
Container(
width: 1,
height: 30,
color: Colors.grey[500],
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
widget.onOkSelected(widget.appointmentHistory);
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(
4 years ago
TranslationBase.of(context).ok,
fontWeight: FontWeight.w400,
),
),
),
),
),
],
)
],
),
)
],
);
}
}