|
|
|
@ -3,8 +3,10 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/Comprehens
|
|
|
|
|
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/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.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';
|
|
|
|
@ -17,12 +19,7 @@ class NewCMCStepOnePage extends StatefulWidget {
|
|
|
|
|
final Function changePageViewIndex;
|
|
|
|
|
final CMCViewModel model;
|
|
|
|
|
|
|
|
|
|
const NewCMCStepOnePage(
|
|
|
|
|
{Key key,
|
|
|
|
|
this.cMCInsertPresOrderRequestModel,
|
|
|
|
|
this.model,
|
|
|
|
|
this.changePageViewIndex})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_NewCMCStepOnePageState createState() => _NewCMCStepOnePageState();
|
|
|
|
@ -44,175 +41,107 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(12),
|
|
|
|
|
margin: EdgeInsets.only(left: 12, right: 12),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.94,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
TranslationBase.of(context).selectService,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children:
|
|
|
|
|
widget.model.cmcAllServicesList.map((service) {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 15),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border:
|
|
|
|
|
Border.all(color: Colors.grey, width: 1),
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Theme.of(context).primaryColor),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Row(
|
|
|
|
|
children: [
|
|
|
|
|
Radio(
|
|
|
|
|
value: service.serviceID,
|
|
|
|
|
value: widget.model.cmcAllServicesList[index].serviceID,
|
|
|
|
|
activeColor: Colors.red[800],
|
|
|
|
|
onChanged: (newValue) async {
|
|
|
|
|
PatientERCMCInsertServicesList
|
|
|
|
|
patientERCMCInsertServicesList =
|
|
|
|
|
new PatientERCMCInsertServicesList(
|
|
|
|
|
price: service.price,
|
|
|
|
|
serviceID: service.serviceID
|
|
|
|
|
.toString(),
|
|
|
|
|
selectedServiceName:
|
|
|
|
|
service.description,
|
|
|
|
|
selectedServiceNameAR:
|
|
|
|
|
service.descriptionN,
|
|
|
|
|
PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList(
|
|
|
|
|
price: widget.model.cmcAllServicesList[index].price,
|
|
|
|
|
serviceID: widget.model.cmcAllServicesList[index].serviceID.toString(),
|
|
|
|
|
selectedServiceName: widget.model.cmcAllServicesList[index].description,
|
|
|
|
|
selectedServiceNameAR: widget.model.cmcAllServicesList[index].descriptionN,
|
|
|
|
|
recordID: 1,
|
|
|
|
|
totalPrice:
|
|
|
|
|
service.totalPrice,
|
|
|
|
|
vAT: service.vAT);
|
|
|
|
|
totalPrice: widget.model.cmcAllServicesList[index].totalPrice,
|
|
|
|
|
vAT: widget.model.cmcAllServicesList[index].vAT);
|
|
|
|
|
setState(() {
|
|
|
|
|
widget
|
|
|
|
|
.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList = [
|
|
|
|
|
patientERCMCInsertServicesList
|
|
|
|
|
];
|
|
|
|
|
widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
|
|
|
|
|
});
|
|
|
|
|
CMCGetItemsRequestModel
|
|
|
|
|
cMCGetItemsRequestModel =
|
|
|
|
|
new CMCGetItemsRequestModel(
|
|
|
|
|
checkupType: newValue);
|
|
|
|
|
await widget.model.getCheckupItems(
|
|
|
|
|
cMCGetItemsRequestModel:
|
|
|
|
|
cMCGetItemsRequestModel);
|
|
|
|
|
CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue);
|
|
|
|
|
await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel);
|
|
|
|
|
},
|
|
|
|
|
groupValue: widget
|
|
|
|
|
.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList
|
|
|
|
|
.length >
|
|
|
|
|
0
|
|
|
|
|
? int.parse(widget
|
|
|
|
|
.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList[
|
|
|
|
|
0]
|
|
|
|
|
.serviceID)
|
|
|
|
|
groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length > 0
|
|
|
|
|
? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList[0].serviceID)
|
|
|
|
|
: 1),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(20.0),
|
|
|
|
|
child: Texts(
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? service.descriptionN
|
|
|
|
|
: service.description,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 10,
|
|
|
|
|
right: 10,
|
|
|
|
|
top: 20,
|
|
|
|
|
bottom: 20,
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
projectViewModel.isArabic ? widget.model.cmcAllServicesList[index].descriptionN : widget.model.cmcAllServicesList[index].description,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.45,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
|
return mDivider(Colors.grey);
|
|
|
|
|
},
|
|
|
|
|
itemCount: widget.model.cmcAllServicesList.length),
|
|
|
|
|
Card(
|
|
|
|
|
shape: cardRadius(12),
|
|
|
|
|
elevation: 4,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 10, left: 10),
|
|
|
|
|
child: Texts(
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 12,right: 12,top: 12),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).coveredService,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.45,
|
|
|
|
|
),
|
|
|
|
|
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: Theme.of(context).primaryColor),
|
|
|
|
|
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:
|
|
|
|
|
Theme.of(context).primaryColor),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
right: 10, left: 10),
|
|
|
|
|
child: Texts(item.itemName,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.model.checkupItems[index].itemName,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.45,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
|
return mDivider(Colors.grey);
|
|
|
|
|
},
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: widget.model.checkupItems.length,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList()),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
mHeight(MediaQuery.of(context).size.height * 0.12),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -221,44 +150,30 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.10,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
color: CustomColors.appBackgroudGreyColor,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.9,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
label: TranslationBase.of(context).next,
|
|
|
|
|
textColor: Theme.of(context).backgroundColor,
|
|
|
|
|
color: Colors.grey[800],
|
|
|
|
|
color: CustomColors.accentColor,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (widget.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList.length !=
|
|
|
|
|
0 ||
|
|
|
|
|
widget.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList ==
|
|
|
|
|
null) {
|
|
|
|
|
if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length != 0 || widget.cMCInsertPresOrderRequestModel.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].descriptionN,
|
|
|
|
|
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].descriptionN,
|
|
|
|
|
recordID: 1,
|
|
|
|
|
totalPrice: widget
|
|
|
|
|
.model.cmcAllServicesList[index - 1].totalPrice,
|
|
|
|
|
vAT:
|
|
|
|
|
widget.model.cmcAllServicesList[index - 1].vAT);
|
|
|
|
|
totalPrice: widget.model.cmcAllServicesList[index - 1].totalPrice,
|
|
|
|
|
vAT: widget.model.cmcAllServicesList[index - 1].vAT);
|
|
|
|
|
|
|
|
|
|
widget.cMCInsertPresOrderRequestModel
|
|
|
|
|
.patientERCMCInsertServicesList = [
|
|
|
|
|
patientERCMCInsertServicesList
|
|
|
|
|
];
|
|
|
|
|
widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
|
|
|
|
|
await widget.model.getCustomerInfo();
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Utils.showErrorToast();
|
|
|
|
|