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.
144 lines
6.3 KiB
Dart
144 lines
6.3 KiB
Dart
import 'package:circular_countdown_timer/circular_countdown_timer.dart';
|
|
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
|
|
import 'package:hmg_patient_app/models/FamilyFiles/PatientERVirtualHistoryResponse.dart';
|
|
import 'package:hmg_patient_app/services/livecare_services/livecare_provider.dart';
|
|
import 'package:hmg_patient_app/theme/colors.dart';
|
|
import 'package:hmg_patient_app/uitl/app_toast.dart';
|
|
import 'package:hmg_patient_app/uitl/date_uitl.dart';
|
|
import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart';
|
|
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
|
|
import 'package:hmg_patient_app/uitl/utils_new.dart';
|
|
import 'package:hmg_patient_app/widgets/buttons/defaultButton.dart';
|
|
import 'package:hmg_patient_app/widgets/my_rich_text.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class LiveCarePendingRequest extends StatefulWidget {
|
|
ErRequestHistoryList? pendingERRequestHistoryList;
|
|
final Function getLiveCareHistory;
|
|
|
|
LiveCarePendingRequest({required this.getLiveCareHistory, this.pendingERRequestHistoryList});
|
|
|
|
@override
|
|
_LiveCarePendingRequestState createState() => _LiveCarePendingRequestState();
|
|
}
|
|
|
|
class _LiveCarePendingRequestState extends State<LiveCarePendingRequest> {
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
return Container(
|
|
margin: EdgeInsets.fromLTRB(21, 21, 21, 12),
|
|
padding: EdgeInsets.all(10.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
decoration: cardRadius(15.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.fromLTRB(16, 21, 16, 23),
|
|
child: Text(TranslationBase.of(context).waitingTime, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)),
|
|
),
|
|
Container(
|
|
height: MediaQuery.of(context).size.height * 0.25,
|
|
transform: Matrix4.translationValues(0.0, -10.0, 0.0),
|
|
alignment: Alignment.center,
|
|
child: CircularCountDownTimer(
|
|
duration: widget.pendingERRequestHistoryList!.watingtimeInteger! * 60,
|
|
width: MediaQuery.of(context).size.width / 2,
|
|
height: MediaQuery.of(context).size.height / 2,
|
|
ringColor: Colors.white,
|
|
fillColor: CustomColors.green,
|
|
strokeWidth: 7.0,
|
|
textStyle: TextStyle(fontSize: 32.0, color: Color(0xff2E303A), fontWeight: FontWeight.w400),
|
|
isReverse: true,
|
|
isTimerTextShown: true,
|
|
onComplete: () {
|
|
print('Countdown Ended');
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: const EdgeInsets.fromLTRB(0, 12, 0, 0),
|
|
padding: const EdgeInsets.fromLTRB(16, 21, 16, 12),
|
|
width: MediaQuery.of(context).size.width,
|
|
decoration: cardRadius(15.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
decoration: cardRadius(15.0, color: Color(0xffCC9B14)),
|
|
padding: const EdgeInsets.all(5.0),
|
|
child: Text(widget.pendingERRequestHistoryList!.stringCallStatus!, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4)),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.all(5.0),
|
|
child: MyRichText(TranslationBase.of(context).requestedDateLiveCare,
|
|
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.pendingERRequestHistoryList!.arrivalTime!)), projectViewModel.isArabic),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.all(5.0),
|
|
child: Text(TranslationBase.of(context).yourTurn + " " + widget.pendingERRequestHistoryList!.patCount.toString() + " " + TranslationBase.of(context).patients,
|
|
style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.48)),
|
|
),
|
|
// Row(
|
|
// children: [
|
|
// Container(
|
|
// padding: const EdgeInsets.all(5.0),
|
|
// child: Text(TranslationBase.of(context).liveCareSupportContact, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.48)),
|
|
// ),
|
|
// Directionality(textDirection: TextDirection.ltr, child: Text("011 525 9553", style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.48)))
|
|
// ],
|
|
// ),
|
|
mHeight(12.0),
|
|
Container(
|
|
child: DefaultButton(TranslationBase.of(context).callLiveCareSupport, () {
|
|
launchUrl(Uri.parse("tel://" + "011 525 9553"));
|
|
// cancelLiveCareRequest();
|
|
}),
|
|
),
|
|
// DefaultButton(
|
|
// TranslationBase.of(context).cancel,
|
|
// () {
|
|
// cancelLiveCareRequest();
|
|
// },
|
|
// ),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
callLiveCareSupport() {}
|
|
|
|
cancelLiveCareRequest() {
|
|
LiveCareService service = new LiveCareService();
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
service.cancelLiveCareRequest(widget.pendingERRequestHistoryList!.vCID!, context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showSuccessToast(message: "LiveCare request cancelled successfully");
|
|
widget.getLiveCareHistory();
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(err);
|
|
});
|
|
}
|
|
}
|