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'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; 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'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class Summary extends StatefulWidget { final Function(int)? changeCurrentTab; final PatientER patientER; final PatientER_RC patientER_RC; final AmRequestViewModel amRequestViewModel; 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 { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowDecPage: false, isShowAppBar: false, body: SingleChildScrollView( child: Container( margin: EdgeInsets.only(left: 12, right: 12, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(TranslationBase.of(context).RRTSummary, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), Container( width: double.infinity, padding: EdgeInsets.all(10), // margin: EdgeInsets.only(top: 12), decoration: cardRadius(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ _getNormalText(TranslationBase.of(context).transportMethod), projectViewModel.isArabic ? _getNormalText( '${widget.patientER_RC.patientERTransportationMethod!.textN}', isBold: true, ) : _getNormalText( '${widget.patientER_RC.patientERTransportationMethod!.text}', isBold: true, ), SizedBox( height: 8, ), _getNormalText(TranslationBase.of(context).directions), _getNormalText( widget.patientER_RC.transportationDetails!.direction == 0 ? TranslationBase.of(context).toHospital : TranslationBase.of(context).fromHospital, isBold: true, ), SizedBox( height: 8, ), _getNormalText( TranslationBase.of(context).pickupLocation, ), _getNormalText( '${widget.patientER_RC.transportationDetails!.pickupLocationName}', isBold: true, ), SizedBox( height: 8, ), _getNormalText(TranslationBase.of(context).dropoffLocation), _getNormalText( '${widget.patientER_RC.transportationDetails!.dropoffLocationName}', isBold: true, ), SizedBox( height: 8, ), _getNormalText(TranslationBase.of(context).way), _getNormalText( widget.patientER_RC.transportationDetails!.tripType == 0 ? TranslationBase.of(context).twoDirec : TranslationBase.of(context).oneDirec, isBold: true, ), SizedBox( height: 8, ), // // _getNormalText(TranslationBase.of(context).notes), // // _getNormalText( // // '${widget.patientER_RC.transportationDetails.notes ?? '---'}', // // isBold: true, // // ), // SizedBox( // height: 8, // ), ], ), ), // 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)}'), style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.bold), ), ], ) ], ), ), Container( margin: EdgeInsets.only(top: 12), decoration: cardRadius(12), padding: EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ 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, ) ], ), ) ], ), ), SizedBox(height: 80), ], ), ), ), bottomSheet: Container( color: Theme.of(context).scaffoldBackgroundColor, padding: EdgeInsets.all(12.0), child: Row( children: [ Expanded( flex: 1, child: DefaultButton( TranslationBase.of(context).back, () { widget.changeCurrentTab!(1); }, ), ), SizedBox(width: 12.0), Expanded( flex: 1, child: DefaultButton( TranslationBase.of(context).submit, () async { await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER_RC); widget.tabController.animateTo(1); }, color: CustomColors.green, ), ), ], ), ), ); } _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, ), ); } }