working on livecare

merge-requests/689/head
mosazaid 5 years ago
parent 957cf96c16
commit 0cd7fa0cb2

@ -12,6 +12,7 @@ class LiveCarePatientServices extends BaseService{
bool get isFinished => _isFinished;
var endCallResponse = {};
var transferToAdminResponse = {};
Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{
hasError = false;
@ -58,4 +59,23 @@ class LiveCarePatientServices extends BaseService{
},
);
}
Future transferToAdmin(int vcID, String notes) async{
hasError = false;
await baseAppClient.post(
TRANSFERT_TO_ADMIN,
onSuccess: (dynamic response, int statusCode) {
transferToAdminResponse = response;
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
"VC_ID": vcID,
"IsOutKsa": false,
"Notes": notes,
},
);
}
}

@ -70,6 +70,19 @@ class LiveCarePatientViewModel extends BaseViewModel {
}
}
Future transferToAdmin(int vcID, String notes) async {
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.transferToAdmin(vcID, notes);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
} else {
await getPendingPatientERForDoctorApp();
setState(ViewState.Idle);
}
}
searchData(String str) {
var strExist= str.length > 0 ? true : false;
if (strExist) {

@ -59,10 +59,13 @@ class _EndCallScreenState extends State<EndCallScreen> {
() async {
Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
liveCareModel.endCallWithCharge(0);
liveCareModel.endCallWithCharge(widget.patient.vcId);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
} else {
Navigator.of(context).pop();
Navigator.of(context).pop();
}
});
}, isDartIcon: true, dartIcon: DoctorApp.end_consultaion),

@ -1,12 +1,19 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/button_bottom_sheet.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
@ -30,6 +37,7 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
ProjectViewModel projectViewModel;
TextEditingController noteController = TextEditingController();
String noteError;
void initState() {
requestPermissions();
@ -51,10 +59,84 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
onModelReady: (model) {},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
appBarTitle:
"${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
isShowAppBar: true,
body: Container(),
body: Container(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Container(
color: Colors.white,
margin: EdgeInsets.all(16),
child: Stack(
children: [
AppTextFieldCustom(
hintText: TranslationBase.of(context).notes,
//TranslationBase.of(context).addProgressNote,
controller: noteController,
maxLines: 35,
minLines: 25,
hasBorder: true,
validationError: noteError,
),
Positioned(
top: -2, //MediaQuery.of(context).size.height * 0,
right: projectViewModel.isArabic
? MediaQuery.of(context).size.width * 0.75
: 15,
child: Column(
children: [
IconButton(
icon: Icon(DoctorApp.speechtotext,
color: Colors.black, size: 35),
onPressed: () {
initSpeechState()
.then((value) => {onVoiceText()});
},
),
],
))
],
),
),
),
),
ButtonBottomSheet(
title:
"${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
onPressed: () {
setState(() {
if (noteController.text.isEmpty) {
noteError = TranslationBase.of(context).emptyMessage;
} else {
noteError = null;
}
if (noteController.text.isNotEmpty) {
Helpers.showConfirmationDialog(context,
"${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin} ?",
() async {
Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
model.endCallWithCharge(widget.patient.vcId);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
Navigator.of(context).pop();
Navigator.of(context).pop();
Navigator.of(context).pop();
}
});
}
});
},
)
],
),
),
),
);
}

@ -42,23 +42,27 @@ class ButtonBottomSheet extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: AppButton(
title: title,
onPressed: onPressed,
fontWeight: fontWeight,
color: color,
fontSize: fontSize,
padding: padding,
disabled: disabled,
radius: radius,
hasBorder: hasBorder,
fontColor: fontColor,
icon: icon,
iconData: iconData,
hPadding: hPadding,
vPadding: vPadding,
borderColor: borderColor,
loading: loading,
child: Column(
children: [
AppButton(
title: title,
onPressed: onPressed,
fontWeight: fontWeight,
color: color,
fontSize: fontSize,
padding: padding,
disabled: disabled,
radius: radius,
hasBorder: hasBorder,
fontColor: fontColor,
icon: icon,
iconData: iconData,
hPadding: hPadding,
vPadding: vPadding,
borderColor: borderColor,
loading: loading,
),
],
),
);
}

Loading…
Cancel
Save