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.
RSGDoctorApp/lib/screens/patients/profile/pharmacy-intervention/intervention_medication.dart

184 lines
9.8 KiB
Dart

import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/profile/intervention_medication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/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/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'intervention_medication_history_screen.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class InterventionMedicationScreen extends StatefulWidget {
final PatiantInformtion? patient;
final InterventionMedicationViewModel? previousModel;
const InterventionMedicationScreen(this.patient, {Key? key, this.previousModel}) : super(key: key);
@override
_InterventionMedicationScreenState createState() => _InterventionMedicationScreenState();
}
class _InterventionMedicationScreenState extends State<InterventionMedicationScreen> {
bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel = AuthenticationViewModel();
late ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context);
projectViewModel = Provider.of(context);
return BaseView<InterventionMedicationViewModel>(
onModelReady: (model) => model.getInterventionMedication(
patientId: widget.patient!.patientId,
//admissionNo: int.parse(widget.patient.admissionNo),
fromDate: widget.previousModel!.selectedFromDate,
toDate: widget.previousModel!.selectedToDate,
),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileAppBar(
widget.patient!,
isInpatient: true,
),
body: model.allInterventionList == null || model.allInterventionList.length == 0
? Center(
child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable,
),
)
: Container(
color: Colors.grey[200],
child: Column(
children: <Widget>[
Expanded(
child: Container(
child: ListView.builder(
itemCount: model.allInterventionList.length,
itemBuilder: (BuildContext ctxt, int index) {
return InkWell(
child: FractionallySizedBox(
widthFactor: 0.95,
child: CardWithBgWidget(
hasBorder: false,
bgColor: Colors.transparent,
widget: Column(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width * 0.60,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomRow(
valueSize: 14,
label: '',
value: model.allInterventionList[index].cS!,
)
],
),
),
Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(model.allInterventionList[index].startDatetime!),
isArabic: projectViewModel.isArabic, isMonthShort: true),
fontWeight: FontWeight.w600,
fontSize: 14,
color: Color(0xFF2B353E),
),
],
),
],
)
],
),
SizedBox(
height: 8,
),
CustomRow(
labelSize: 12,
valueSize: 12,
label: TranslationBase.of(context).description,
value: model.allInterventionList[index].description!,
),
SizedBox(
height: 8,
),
CustomRow(
labelSize: 12,
valueSize: 12,
label: TranslationBase.of(context).medication,
value: model.allInterventionList[index].medication!,
),
SizedBox(
height: 8,
),
CustomRow(
labelSize: 12,
valueSize: 12,
label: TranslationBase.of(context).doctorComments,
value: model.allInterventionList[index].doctorComments!,
),
SizedBox(
height: 8,
),
CustomRow(
labelSize: 12,
valueSize: 12,
label: TranslationBase.of(context).statusDescription,
value: model.allInterventionList[index].statusDescription!,
),
],
),
SizedBox(
height: 20,
),
],
),
),
),
onTap: () {
Navigator.push(
context,
FadePage(
page: InterventionMedicationHistoryScreen(widget.patient!, model.allInterventionList[index]),
),
);
},
);
}),
),
),
],
),
),
),
);
}
}