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/labs/laboratory_result_page.dart

73 lines
3.0 KiB
Dart

5 years ago
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
5 years ago
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
5 years ago
import 'package:diplomaticquarterapp/widgets/data_display/medical/LabResult/laboratory_result_widget.dart';
5 years ago
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
5 years ago
class LaboratoryResultPage extends StatefulWidget {
5 years ago
final PatientLabOrders patientLabOrders;
LaboratoryResultPage({Key key, this.patientLabOrders});
@override
_LaboratoryResultPageState createState() => _LaboratoryResultPageState();
}
class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
5 years ago
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
5 years ago
return BaseView<LabsViewModel>(
onModelReady: (model) => model.getLaboratoryResult(
4 years ago
invoiceNo: widget.patientLabOrders.invoiceNo,
clinicID: widget.patientLabOrders.clinicID,
projectID: widget.patientLabOrders.projectID,
orderNo: widget.patientLabOrders.orderNo,
setupID: widget.patientLabOrders.setupID),
builder: (_, model, w) => AppScaffold(
5 years ago
isShowAppBar: true,
4 years ago
appBarTitle: widget.patientLabOrders.doctorName,
5 years ago
baseViewModel: model,
showNewAppBar: true,
showNewAppBarTitle: true,
backgroundColor: Color(0xffF8F8F8),
body: ListView.builder(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(bottom: 12),
itemBuilder: (context, index) => LaboratoryResultWidget(
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders, mes: TranslationBase.of(context).sendSuc, userObj: projectViewModel.user);
GifLoaderDialogUtils.hideDialog(context);
},
billNo: widget.patientLabOrders.invoiceNo,
3 years ago
// details: model.patientLabSpecialResult[index].resultDataHTML,
details: model.patientLabSpecialResult.isEmpty ? null : getSpecialResults(model),
orderNo: widget.patientLabOrders.orderNo,
patientLabOrder: widget.patientLabOrders,
5 years ago
),
3 years ago
itemCount: 1,
5 years ago
),
),
);
}
3 years ago
String getSpecialResults(LabsViewModel model) {
String labResults = "";
model.patientLabSpecialResult.forEach((element) {
if (element.resultDataHTML != null) {
labResults += (element.resultDataHTML + "<br/> <br/>");
} else {
labResults += ("<h6>No Result Available</h6>");
}
});
return labResults;
}
5 years ago
}