|
|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/rrt/RRTProcedureList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/rrt/service_price.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/reports/user_agreement_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
@ -18,8 +20,9 @@ import 'package:flutter/material.dart';
|
|
|
|
|
class RRTRequestPage extends StatefulWidget {
|
|
|
|
|
final List<GetCMCAllOrdersResponseModel> pendingOrders;
|
|
|
|
|
final ServicePrice servicePrice;
|
|
|
|
|
RRTViewModel viewModel;
|
|
|
|
|
|
|
|
|
|
RRTRequestPage({this.pendingOrders, this.servicePrice});
|
|
|
|
|
RRTRequestPage({this.pendingOrders, this.servicePrice, this.viewModel});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<StatefulWidget> createState() => RRTRequestPageState();
|
|
|
|
|
@ -27,13 +30,20 @@ class RRTRequestPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
|
bool acceptTerms = false;
|
|
|
|
|
RRTViewModel viewModel;
|
|
|
|
|
VidaProcedureList selectedProcedure;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
// getProcedureDetails();
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<RRTViewModel>(
|
|
|
|
|
onModelReady: (vm) {
|
|
|
|
|
viewModel = vm;
|
|
|
|
|
// viewModel = vm;
|
|
|
|
|
selectedProcedure = widget.viewModel.rrtProcedureList[0];
|
|
|
|
|
},
|
|
|
|
|
builder: (ctx, vm, widgetState) {
|
|
|
|
|
if (widget.pendingOrders.isNotEmpty)
|
|
|
|
|
@ -53,10 +63,69 @@ class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
|
children: [
|
|
|
|
|
serviceDescription(context),
|
|
|
|
|
SizedBox(height: 20),
|
|
|
|
|
Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
...List.generate(
|
|
|
|
|
widget.viewModel.rrtProcedureList.length,
|
|
|
|
|
(index) => Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 1,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedProcedure = widget.viewModel.rrtProcedureList[index];
|
|
|
|
|
// getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Radio(
|
|
|
|
|
value: widget.viewModel.rrtProcedureList[index],
|
|
|
|
|
groupValue: selectedProcedure,
|
|
|
|
|
activeColor: Colors.red[800],
|
|
|
|
|
toggleable: true,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedProcedure = value;
|
|
|
|
|
print(selectedProcedure.procedureName);
|
|
|
|
|
// getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
// projectViewModel.isArabic ? widget.proceduresList[index].procedureNameN : widget.proceduresList[index].procedureName,
|
|
|
|
|
widget.viewModel.rrtProcedureList[index].procedureName,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12.0,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
priceTable(context),
|
|
|
|
|
|
|
|
|
|
acceptPolicy(),
|
|
|
|
|
|
|
|
|
|
Container(height: 0.5, color: Theme.of(context).appBarTheme.color), // Seperator
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
@ -90,15 +159,15 @@ class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).rrtDDetails,
|
|
|
|
|
textAlign: TextAlign.justify,
|
|
|
|
|
style: TextStyle(color: Theme.of(context).appBarTheme.color, fontSize: 15, height: 1.5, fontWeight: FontWeight.w300),
|
|
|
|
|
style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w300),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget priceTable(BuildContext context) {
|
|
|
|
|
var radius = Radius.circular(8);
|
|
|
|
|
String amount = widget.servicePrice.price.toString();
|
|
|
|
|
String vat = widget.servicePrice.vat.toString();
|
|
|
|
|
String total = widget.servicePrice.totalPrice.toString();
|
|
|
|
|
String amount = selectedProcedure.patientShare.toString();
|
|
|
|
|
String vat = selectedProcedure.patientTaxAmount.toString();
|
|
|
|
|
String total = selectedProcedure.patientShareWithTax.toString();
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
@ -119,21 +188,21 @@ class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
|
|
|
|
|
|
Widget pricingRow({@required String label, @required String value, bool labelBold = false, bool valueBold = false}) {
|
|
|
|
|
return Container(
|
|
|
|
|
height: 40,
|
|
|
|
|
height: 35,
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 10),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(label, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: labelBold ? FontWeight.bold : FontWeight.normal)),
|
|
|
|
|
Text(label, style: TextStyle(fontSize: 12, color: CustomColors.textColor, fontWeight: labelBold ? FontWeight.bold : FontWeight.normal)),
|
|
|
|
|
Spacer(),
|
|
|
|
|
Container(
|
|
|
|
|
height: 40,
|
|
|
|
|
height: 35,
|
|
|
|
|
color: Theme.of(context).appBarTheme.color,
|
|
|
|
|
width: 0.5,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.25,
|
|
|
|
|
child: Text(value, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: valueBold ? FontWeight.bold : FontWeight.normal))),
|
|
|
|
|
child: Text(value, style: TextStyle(fontSize: 12, color: CustomColors.textColor, fontWeight: valueBold ? FontWeight.bold : FontWeight.normal))),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -150,7 +219,7 @@ class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
|
setState(() => acceptTerms = v);
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(width: 10),
|
|
|
|
|
Expanded(child: Text(TranslationBase.of(context).iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2)),
|
|
|
|
|
Expanded(child: Text(TranslationBase.of(context).iAcceptTermsConditions, style: TextStyle(fontSize: 12, color: CustomColors.textColor), maxLines: 2)),
|
|
|
|
|
Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.25,
|
|
|
|
|
@ -187,7 +256,7 @@ class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).next,
|
|
|
|
|
() {
|
|
|
|
|
if (acceptTerms)
|
|
|
|
|
if (acceptTerms && selectedProcedure != null)
|
|
|
|
|
goToPickupAddress();
|
|
|
|
|
else
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms);
|
|
|
|
|
@ -200,23 +269,37 @@ class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getProcedureDetails() {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.getRRTProcedures(15).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(res['Vida_ProcedureList']);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goToPickupAddress() async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: RRTRequestPickupAddressPage(
|
|
|
|
|
servicePrice: widget.servicePrice,
|
|
|
|
|
selectedProcedure: selectedProcedure,
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
deleteOrder(GetCMCAllOrdersResponseModel order) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
var success = await viewModel.cancelOrderRC(order);
|
|
|
|
|
var success = await widget.viewModel.cancelOrderRC(order);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (success)
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.pendingOrders.remove(order);
|
|
|
|
|
});
|
|
|
|
|
await viewModel.getAllOrdersRC();
|
|
|
|
|
await widget.viewModel.getAllOrdersRC();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|