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.
HMG_Patient_App/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart

227 lines
9.2 KiB
Dart

import 'package:diplomaticquarterapp/core/model/er/PatientER.dart';
import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart';
4 years ago
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
2 years ago
import 'package:diplomaticquarterapp/theme/colors.dart';
5 years ago
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
4 years ago
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
4 years ago
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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';
2 years ago
import 'package:url_launcher/url_launcher.dart';
class Summary extends StatefulWidget {
2 years ago
final Function(int)? changeCurrentTab;
final PatientER patientER;
final PatientER_RC patientER_RC;
final AmRequestViewModel amRequestViewModel;
2 years ago
final TabController tabController;
Summary({Key? key, required this.changeCurrentTab, required this.patientER, required this.patientER_RC, required this.amRequestViewModel, required this.tabController});
@override
_SummaryState createState() => _SummaryState();
}
class _SummaryState extends State<Summary> {
2 years ago
@override
Widget build(BuildContext context) {
4 years ago
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowDecPage: false,
isShowAppBar: false,
body: SingleChildScrollView(
child: Container(
4 years ago
margin: EdgeInsets.only(left: 12, right: 12, top: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
4 years ago
Text(TranslationBase.of(context).RRTSummary, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)),
4 years ago
SizedBox(
height: 5,
),
Container(
width: double.infinity,
padding: EdgeInsets.all(10),
4 years ago
// margin: EdgeInsets.only(top: 12),
decoration: cardRadius(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
4 years ago
_getNormalText(TranslationBase.of(context).transportMethod),
4 years ago
projectViewModel.isArabic
4 years ago
? _getNormalText(
'${widget.patientER_RC.patientERTransportationMethod!.textN}',
4 years ago
isBold: true,
4 years ago
)
4 years ago
: _getNormalText(
'${widget.patientER_RC.patientERTransportationMethod!.text}',
4 years ago
isBold: true,
4 years ago
),
SizedBox(
height: 8,
),
4 years ago
_getNormalText(TranslationBase.of(context).directions),
_getNormalText(
widget.patientER_RC.transportationDetails!.direction == 0 ? TranslationBase.of(context).toHospital : TranslationBase.of(context).fromHospital,
4 years ago
isBold: true,
),
SizedBox(
height: 8,
),
4 years ago
_getNormalText(
TranslationBase.of(context).pickupLocation,
),
4 years ago
_getNormalText(
'${widget.patientER_RC.transportationDetails!.pickupLocationName}',
4 years ago
isBold: true,
),
SizedBox(
height: 8,
),
4 years ago
_getNormalText(TranslationBase.of(context).dropoffLocation),
_getNormalText(
'${widget.patientER_RC.transportationDetails!.dropoffLocationName}',
4 years ago
isBold: true,
),
SizedBox(
height: 8,
),
2 years ago
_getNormalText(TranslationBase.of(context).way),
4 years ago
_getNormalText(
widget.patientER_RC.transportationDetails!.tripType == 0 ? TranslationBase.of(context).twoDirec : TranslationBase.of(context).oneDirec,
4 years ago
isBold: true,
),
SizedBox(
height: 8,
),
2 years ago
// // _getNormalText(TranslationBase.of(context).notes),
// // _getNormalText(
// // '${widget.patientER_RC.transportationDetails.notes ?? '---'}',
// // isBold: true,
// // ),
// SizedBox(
// height: 8,
// ),
],
),
),
2 years ago
// SizedBox(
// height: 20,
// ),
// Text(TranslationBase.of(context).billAmount, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)),
// SizedBox(
// height: 5,
// ),
Container(
margin: EdgeInsets.only(top: 12),
decoration: cardRadius(12),
padding: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(TranslationBase.of(context).billAmount + " : ", style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)),
SizedBox(height: 16.0),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(TranslationBase.of(context).patientShareTotalToDo, style: TextStyle(fontSize: 13.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)),
Text(
TranslationBase.of(context).sar +
(widget.patientER_RC.transportationDetails!.tripType == 1
? ' ${widget.patientER_RC.patientERTransportationMethod!.priceTotal}'
: ' ${(widget.patientER_RC.patientERTransportationMethod!.priceTotal * 2)}'),
2 years ago
style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.bold),
),
],
)
],
),
4 years ago
),
Container(
2 years ago
margin: EdgeInsets.only(top: 12),
4 years ago
decoration: cardRadius(12),
2 years ago
padding: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
4 years ago
children: [
2 years ago
Text(TranslationBase.of(context).contactRRT + " : ", style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)),
SizedBox(height: 16.0),
InkWell(
onTap: () {
launchUrl(
Uri.parse("tel://0115259555"),
);
},
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("0115259555", style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.bold)),
Icon(
Icons.headset_mic_rounded,
size: 30.0,
)
],
),
)
4 years ago
],
),
),
2 years ago
SizedBox(height: 80),
],
),
),
),
bottomSheet: Container(
4 years ago
color: Theme.of(context).scaffoldBackgroundColor,
padding: EdgeInsets.all(12.0),
2 years ago
child: Row(
children: [
Expanded(
flex: 1,
child: DefaultButton(
TranslationBase.of(context).back,
() {
widget.changeCurrentTab!(1);
2 years ago
},
),
),
SizedBox(width: 12.0),
Expanded(
flex: 1,
child: DefaultButton(
TranslationBase.of(context).submit,
() async {
await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER_RC);
2 years ago
widget.tabController.animateTo(1);
2 years ago
},
color: CustomColors.green,
),
),
],
),
),
);
}
4 years ago
_getNormalText(text, {bool isBold = false, bool isTotal = false}) {
return Text(
text,
style: TextStyle(
fontSize: isBold
? isTotal
? 16
: 12
: 10,
letterSpacing: -0.5,
color: isBold ? Colors.black : Colors.grey[700],
fontWeight: FontWeight.w600,
),
);
}
}