|
|
|
|
@ -2,12 +2,15 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.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';
|
|
|
|
|
|
|
|
|
|
class NewCMCStepOnePage extends StatefulWidget {
|
|
|
|
|
final CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel;
|
|
|
|
|
@ -33,6 +36,8 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
baseViewModel: widget.model,
|
|
|
|
|
@ -52,17 +57,17 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"Select Home Health Care Services",
|
|
|
|
|
TranslationBase.of(context).selectService,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children:
|
|
|
|
|
widget.model.cmcAllServicesList.map((service) {
|
|
|
|
|
widget.model.cmcAllServicesList.map((service) {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 15),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border:
|
|
|
|
|
Border.all(color: Colors.grey, width: 1),
|
|
|
|
|
Border.all(color: Colors.grey, width: 1),
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
@ -74,50 +79,53 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
|
|
|
|
|
activeColor: Colors.red[800],
|
|
|
|
|
onChanged: (newValue) async {
|
|
|
|
|
PatientERCMCInsertServicesList
|
|
|
|
|
patientERCMCInsertServicesList =
|
|
|
|
|
new PatientERCMCInsertServicesList(
|
|
|
|
|
price: service.price,
|
|
|
|
|
serviceID: service.serviceID
|
|
|
|
|
.toString(),
|
|
|
|
|
selectedServiceName:
|
|
|
|
|
service.description,
|
|
|
|
|
selectedServiceNameAR:
|
|
|
|
|
service.description,
|
|
|
|
|
recordID: 1,
|
|
|
|
|
totalPrice:
|
|
|
|
|
service.totalPrice,
|
|
|
|
|
vAT: service.vAT);
|
|
|
|
|
patientERCMCInsertServicesList =
|
|
|
|
|
new PatientERCMCInsertServicesList(
|
|
|
|
|
price: service.price,
|
|
|
|
|
serviceID: service.serviceID
|
|
|
|
|
.toString(),
|
|
|
|
|
selectedServiceName:
|
|
|
|
|
service.description,
|
|
|
|
|
selectedServiceNameAR:
|
|
|
|
|
service.descriptionN,
|
|
|
|
|
recordID: 1,
|
|
|
|
|
totalPrice:
|
|
|
|
|
service.totalPrice,
|
|
|
|
|
vAT: service.vAT);
|
|
|
|
|
setState(() {
|
|
|
|
|
widget
|
|
|
|
|
.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList = [
|
|
|
|
|
.patientERCMCInsertServicesList =
|
|
|
|
|
[
|
|
|
|
|
patientERCMCInsertServicesList
|
|
|
|
|
];
|
|
|
|
|
});
|
|
|
|
|
CMCGetItemsRequestModel
|
|
|
|
|
cMCGetItemsRequestModel =
|
|
|
|
|
new CMCGetItemsRequestModel(
|
|
|
|
|
checkupType: newValue);
|
|
|
|
|
cMCGetItemsRequestModel =
|
|
|
|
|
new CMCGetItemsRequestModel(
|
|
|
|
|
checkupType: newValue);
|
|
|
|
|
await widget.model.getCheckupItems(
|
|
|
|
|
cMCGetItemsRequestModel:
|
|
|
|
|
cMCGetItemsRequestModel);
|
|
|
|
|
cMCGetItemsRequestModel);
|
|
|
|
|
},
|
|
|
|
|
groupValue: widget
|
|
|
|
|
.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList
|
|
|
|
|
.length >
|
|
|
|
|
0
|
|
|
|
|
.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList
|
|
|
|
|
.length >
|
|
|
|
|
0
|
|
|
|
|
? int.parse(widget
|
|
|
|
|
.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList[
|
|
|
|
|
0]
|
|
|
|
|
.serviceID)
|
|
|
|
|
.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList[
|
|
|
|
|
0]
|
|
|
|
|
.serviceID)
|
|
|
|
|
: 1),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(20.0),
|
|
|
|
|
child: Texts(
|
|
|
|
|
service.description,
|
|
|
|
|
projectViewModel.isArabic ? service
|
|
|
|
|
.descriptionN : service
|
|
|
|
|
.description,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -139,52 +147,67 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: widget.model.checkupItems.map((item) {
|
|
|
|
|
return Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 1,
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 15),
|
|
|
|
|
decoration: BoxDecoration(color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 15, bottom: 5, top: 5),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: BorderDirectional(
|
|
|
|
|
bottom: BorderSide(
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 0.5,
|
|
|
|
|
color: Colors.grey)),
|
|
|
|
|
//borderRadius: ,
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(margin: EdgeInsets.only(
|
|
|
|
|
right: 10, left: 10), child: Texts(TranslationBase.of(context).coveredService, fontWeight: FontWeight.bold,))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: widget.model.checkupItems.map((item) {
|
|
|
|
|
return Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 1,
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 15),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 15, bottom: 5, top: 5),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: BorderDirectional(
|
|
|
|
|
bottom: BorderSide(
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 0.5,
|
|
|
|
|
color: Colors.grey)),
|
|
|
|
|
//borderRadius: ,
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(
|
|
|
|
|
item.itemName,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
children: [
|
|
|
|
|
Container(margin: EdgeInsets.only(
|
|
|
|
|
right: 10, left: 10),
|
|
|
|
|
child: Texts(
|
|
|
|
|
item.itemName,
|
|
|
|
|
fontSize: 15, fontWeight: FontWeight.bold
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList()),
|
|
|
|
|
);
|
|
|
|
|
}).toList()),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -199,40 +222,44 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.9,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
label: "Next",
|
|
|
|
|
textColor: Theme.of(context).backgroundColor,
|
|
|
|
|
label: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.next,
|
|
|
|
|
textColor: Theme
|
|
|
|
|
.of(context)
|
|
|
|
|
.backgroundColor,
|
|
|
|
|
color: Colors.grey[800],
|
|
|
|
|
onTap: () async {
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (widget.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList.length !=
|
|
|
|
|
0 ||
|
|
|
|
|
.patientERCMCInsertServicesList.length !=
|
|
|
|
|
0 ||
|
|
|
|
|
widget.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList ==
|
|
|
|
|
.patientERCMCInsertServicesList ==
|
|
|
|
|
null) {
|
|
|
|
|
int index = widget.model.cmcAllServicesList.length;
|
|
|
|
|
PatientERCMCInsertServicesList
|
|
|
|
|
patientERCMCInsertServicesList =
|
|
|
|
|
new PatientERCMCInsertServicesList(
|
|
|
|
|
price: widget
|
|
|
|
|
.model.cmcAllServicesList[index - 1].price,
|
|
|
|
|
serviceID: widget
|
|
|
|
|
.model.cmcAllServicesList[index - 1].serviceID
|
|
|
|
|
.toString(),
|
|
|
|
|
selectedServiceName: widget.model
|
|
|
|
|
.cmcAllServicesList[index - 1].description,
|
|
|
|
|
selectedServiceNameAR: widget.model
|
|
|
|
|
.cmcAllServicesList[index - 1].description,
|
|
|
|
|
recordID: 1,
|
|
|
|
|
totalPrice: widget
|
|
|
|
|
.model.cmcAllServicesList[index - 1].totalPrice,
|
|
|
|
|
vAT: widget.model.cmcAllServicesList[index-1].vAT);
|
|
|
|
|
patientERCMCInsertServicesList =
|
|
|
|
|
new PatientERCMCInsertServicesList(
|
|
|
|
|
price: widget
|
|
|
|
|
.model.cmcAllServicesList[index - 1].price,
|
|
|
|
|
serviceID: widget
|
|
|
|
|
.model.cmcAllServicesList[index - 1].serviceID
|
|
|
|
|
.toString(),
|
|
|
|
|
selectedServiceName: widget.model
|
|
|
|
|
.cmcAllServicesList[index - 1].description,
|
|
|
|
|
selectedServiceNameAR: widget.model
|
|
|
|
|
.cmcAllServicesList[index - 1].descriptionN,
|
|
|
|
|
recordID: 1,
|
|
|
|
|
totalPrice: widget
|
|
|
|
|
.model.cmcAllServicesList[index - 1].totalPrice,
|
|
|
|
|
vAT: widget.model.cmcAllServicesList[index - 1].vAT);
|
|
|
|
|
|
|
|
|
|
widget.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList = [
|
|
|
|
|
patientERCMCInsertServicesList
|
|
|
|
|
];
|
|
|
|
|
await widget.model.getCustomerInfo();
|
|
|
|
|
if(widget.model.state == ViewState.ErrorLocal){
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Utils.showErrorToast();
|
|
|
|
|
} else {
|
|
|
|
|
widget.changePageViewIndex(1);
|
|
|
|
|
|