Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into SOAP
commit
d8ac550357
@ -1,18 +1,90 @@
|
||||
class CategoriseProcedureModel {
|
||||
String categoryID;
|
||||
String categoryName;
|
||||
List<EntityList> entityList;
|
||||
int rowcount;
|
||||
dynamic statusMessage;
|
||||
|
||||
CategoriseProcedureModel({this.categoryID, this.categoryName});
|
||||
CategoriseProcedureModel(
|
||||
{this.entityList, this.rowcount, this.statusMessage});
|
||||
|
||||
CategoriseProcedureModel.fromJson(Map<String, dynamic> json) {
|
||||
categoryID = json['CategoryID'];
|
||||
categoryName = json['CategoryName'];
|
||||
if (json['entityList'] != null) {
|
||||
entityList = new List<EntityList>();
|
||||
json['entityList'].forEach((v) {
|
||||
entityList.add(new EntityList.fromJson(v));
|
||||
});
|
||||
}
|
||||
rowcount = json['rowcount'];
|
||||
statusMessage = json['statusMessage'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.entityList != null) {
|
||||
data['entityList'] = this.entityList.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['rowcount'] = this.rowcount;
|
||||
data['statusMessage'] = this.statusMessage;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class EntityList {
|
||||
bool allowedClinic;
|
||||
String category;
|
||||
String categoryID;
|
||||
String genderValidation;
|
||||
String group;
|
||||
String orderedValidation;
|
||||
dynamic price;
|
||||
String procedureId;
|
||||
String procedureName;
|
||||
String specialPermission;
|
||||
String subGroup;
|
||||
String template;
|
||||
|
||||
EntityList(
|
||||
{this.allowedClinic,
|
||||
this.category,
|
||||
this.categoryID,
|
||||
this.genderValidation,
|
||||
this.group,
|
||||
this.orderedValidation,
|
||||
this.price,
|
||||
this.procedureId,
|
||||
this.procedureName,
|
||||
this.specialPermission,
|
||||
this.subGroup,
|
||||
this.template});
|
||||
|
||||
EntityList.fromJson(Map<String, dynamic> json) {
|
||||
allowedClinic = json['allowedClinic'];
|
||||
category = json['category'];
|
||||
categoryID = json['categoryID'];
|
||||
genderValidation = json['genderValidation'];
|
||||
group = json['group'];
|
||||
orderedValidation = json['orderedValidation'];
|
||||
price = json['price'];
|
||||
procedureId = json['procedureId'];
|
||||
procedureName = json['procedureName'];
|
||||
specialPermission = json['specialPermission'];
|
||||
subGroup = json['subGroup'];
|
||||
template = json['template'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['CategoryID'] = this.categoryID;
|
||||
data['CategoryName'] = this.categoryName;
|
||||
data['allowedClinic'] = this.allowedClinic;
|
||||
data['category'] = this.category;
|
||||
data['categoryID'] = this.categoryID;
|
||||
data['genderValidation'] = this.genderValidation;
|
||||
data['group'] = this.group;
|
||||
data['orderedValidation'] = this.orderedValidation;
|
||||
data['price'] = this.price;
|
||||
data['procedureId'] = this.procedureId;
|
||||
data['procedureName'] = this.procedureName;
|
||||
data['specialPermission'] = this.specialPermission;
|
||||
data['subGroup'] = this.subGroup;
|
||||
data['template'] = this.template;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,212 +1,372 @@
|
||||
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart';
|
||||
import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart';
|
||||
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
void addPrescriptionForm(context) {
|
||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
void addPrescriptionForm(context, PrescriptionViewModel model) {
|
||||
TextEditingController durationController = TextEditingController();
|
||||
TextEditingController strengthController = TextEditingController();
|
||||
TextEditingController routeController = TextEditingController();
|
||||
TextEditingController frequencyController = TextEditingController();
|
||||
TextEditingController indicationController = TextEditingController();
|
||||
TextEditingController instructions = TextEditingController();
|
||||
|
||||
TextEditingController drugIdController = TextEditingController();
|
||||
TextEditingController doseController = TextEditingController();
|
||||
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
final double spaceBetweenTextFileds = 12;
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
builder: (BuildContext bc) {
|
||||
return SingleChildScrollView(
|
||||
child: Container(
|
||||
height: 700,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context).medicines.toUpperCase(),
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
SizedBox(
|
||||
height: spaceBetweenTextFileds,
|
||||
),
|
||||
Container(
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
//mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText:
|
||||
TranslationBase.of(context).searchMedicine,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.text,
|
||||
inputFormatter: ONLY_LETTERS,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: spaceBetweenTextFileds,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText: TranslationBase.of(context).orderType,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText: TranslationBase.of(context).strength,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText: TranslationBase.of(context).route,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText: TranslationBase.of(context).frequency,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText: TranslationBase.of(context).doseTime,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText: TranslationBase.of(context).indication,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText: TranslationBase.of(context).fromDate,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText: TranslationBase.of(context).duration,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0, color: HexColor("#CCCCCC"))),
|
||||
child: AppTextFormField(
|
||||
labelText:
|
||||
TranslationBase.of(context).instruction,
|
||||
borderColor: Colors.white,
|
||||
textInputType: TextInputType.number,
|
||||
inputFormatter: ONLY_NUMBERS,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
children: <Widget>[
|
||||
AppButton(
|
||||
title:
|
||||
TranslationBase.of(context).addMedication,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
prescriptionWarning(context);
|
||||
},
|
||||
return DraggableScrollableSheet(
|
||||
initialChildSize: 0.90,
|
||||
maxChildSize: 0.90,
|
||||
minChildSize: 0.9,
|
||||
builder: (BuildContext context, ScrollController scrollController) {
|
||||
return SingleChildScrollView(
|
||||
child: Container(
|
||||
height: 980,
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context).medicines.toUpperCase(),
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
SizedBox(
|
||||
height: spaceBetweenTextFileds,
|
||||
),
|
||||
Container(
|
||||
child: Form(
|
||||
key: formKey,
|
||||
child: Column(
|
||||
//mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText: TranslationBase.of(context)
|
||||
.searchMedicine,
|
||||
controller: drugIdController,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
SizedBox(
|
||||
height: spaceBetweenTextFileds,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText:
|
||||
TranslationBase.of(context).orderType,
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText:
|
||||
TranslationBase.of(context).strength,
|
||||
keyboardType: TextInputType.number,
|
||||
controller: strengthController,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText: TranslationBase.of(context).route,
|
||||
controller: routeController,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText:
|
||||
TranslationBase.of(context).frequency,
|
||||
controller: frequencyController,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText:
|
||||
TranslationBase.of(context).doseTime,
|
||||
controller: doseController,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText:
|
||||
TranslationBase.of(context).indication,
|
||||
controller: indicationController,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText:
|
||||
TranslationBase.of(context).fromDate,
|
||||
keyboardType: TextInputType.datetime,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText:
|
||||
TranslationBase.of(context).duration,
|
||||
// borderColor: Colors.white,
|
||||
keyboardType: TextInputType.number,
|
||||
controller: durationController,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: HexColor("#CCCCCC"))),
|
||||
child: TextFields(
|
||||
hintText:
|
||||
TranslationBase.of(context).instruction,
|
||||
controller: indicationController,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value.isEmpty)
|
||||
return TranslationBase.of(context)
|
||||
.emptyMessage;
|
||||
else
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: spaceBetweenTextFileds),
|
||||
Container(
|
||||
margin: EdgeInsets.all(
|
||||
SizeConfig.widthMultiplier * 5),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
children: <Widget>[
|
||||
AppButton(
|
||||
title: TranslationBase.of(context)
|
||||
.addMedication,
|
||||
onPressed: () {
|
||||
formKey.currentState.save();
|
||||
|
||||
if (formKey.currentState.validate()) {
|
||||
postPrescription(
|
||||
model: model,
|
||||
duration: durationController.text,
|
||||
dose: doseController.text,
|
||||
frequency:
|
||||
frequencyController.text,
|
||||
route: routeController.text,
|
||||
drugId: drugIdController.text,
|
||||
strength: strengthController.text,
|
||||
indication:
|
||||
indicationController.text,
|
||||
instruction:
|
||||
indicationController.text,
|
||||
);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
{
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// NewPrescriptionScreen()),
|
||||
// );
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
postPrescription(
|
||||
{String duration,
|
||||
String dose,
|
||||
String drugId,
|
||||
String strength,
|
||||
String route,
|
||||
String frequency,
|
||||
String indication,
|
||||
String instruction,
|
||||
PrescriptionViewModel model}) async {
|
||||
PostPrescriptionReqModel postProcedureReqModel =
|
||||
new PostPrescriptionReqModel();
|
||||
List<PrescriptionRequestModel> sss = List();
|
||||
|
||||
postProcedureReqModel.appointmentNo = 2016055159;
|
||||
postProcedureReqModel.clinicID = 17;
|
||||
postProcedureReqModel.episodeID = 200012330;
|
||||
postProcedureReqModel.patientMRN = 3120877;
|
||||
postProcedureReqModel.vidaAuthTokenID =
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY";
|
||||
sss.add(PrescriptionRequestModel(
|
||||
covered: true,
|
||||
dose: int.parse(dose),
|
||||
itemId: int.parse(drugId),
|
||||
doseUnitId: 1,
|
||||
route: int.parse(route),
|
||||
frequency: int.parse(frequency),
|
||||
remarks: instruction,
|
||||
approvalRequired: true,
|
||||
icdcode10Id: "test2",
|
||||
doseTime: 1,
|
||||
duration: int.parse(duration),
|
||||
doseStartDate: "2020-12-20T13:07:41.769Z"));
|
||||
postProcedureReqModel.prescriptionRequestModel = sss;
|
||||
//postProcedureReqModel.procedures = controlsProcedure;
|
||||
|
||||
await model.postPrescription(postProcedureReqModel);
|
||||
|
||||
if (model.state == ViewState.ErrorLocal) {
|
||||
helpers.showErrorToast(model.error);
|
||||
} else if (model.state == ViewState.Idle) {
|
||||
DrAppToastMsg.showSuccesToast('Medication has been added');
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,148 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EntityListCheckboxSearchWidget extends StatefulWidget {
|
||||
final ProcedureViewModel model;
|
||||
final Function addSelectedHistories;
|
||||
final Function(EntityList) removeHistory;
|
||||
final Function(EntityList) addHistory;
|
||||
final bool Function(EntityList) isEntityListSelected;
|
||||
final List<EntityList> masterList;
|
||||
|
||||
EntityListCheckboxSearchWidget(
|
||||
{Key key,
|
||||
this.model,
|
||||
this.addSelectedHistories,
|
||||
this.removeHistory,
|
||||
this.masterList,
|
||||
this.addHistory,
|
||||
this.isEntityListSelected})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_EntityListCheckboxSearchWidgetState createState() => _EntityListCheckboxSearchWidgetState();
|
||||
}
|
||||
|
||||
class _EntityListCheckboxSearchWidgetState extends State<EntityListCheckboxSearchWidget> {
|
||||
List<EntityList> items = List();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
items.addAll(widget.masterList);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Column(
|
||||
children: [
|
||||
NetworkBaseView(
|
||||
baseViewModel: widget.model,
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.5,
|
||||
child: Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white),
|
||||
child: ListView(
|
||||
children: [
|
||||
TextFields(
|
||||
hintText: 'Search ',
|
||||
suffixIcon: EvaIcons.search,
|
||||
onChanged: (value) {
|
||||
filterSearchResults(value);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 15,),
|
||||
Column(
|
||||
children: items.map((historyInfo) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value:
|
||||
widget.isEntityListSelected(historyInfo),
|
||||
activeColor: Colors.red[800],
|
||||
onChanged: (bool newValue) {
|
||||
setState(() {
|
||||
if (widget
|
||||
.isEntityListSelected(historyInfo)) {
|
||||
widget.removeHistory(historyInfo);
|
||||
} else {
|
||||
widget.addHistory(historyInfo);
|
||||
}
|
||||
});
|
||||
}),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 0),
|
||||
child: Texts(historyInfo.procedureName,
|
||||
variant: "bodyText",
|
||||
bold: true,
|
||||
color: Colors.black),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
DividerWithSpacesAround(),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
if (widget.model.state == ViewState.Idle)
|
||||
AppButton(//TODO change the button name
|
||||
title: "Add ".toUpperCase(),
|
||||
onPressed: () {
|
||||
widget.addSelectedHistories();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void filterSearchResults(String query) {
|
||||
List<EntityList> dummySearchList = List();
|
||||
dummySearchList.addAll(widget.masterList);
|
||||
if (query.isNotEmpty) {
|
||||
List<EntityList> dummyListData = List();
|
||||
dummySearchList.forEach((item) {
|
||||
if (item.procedureName.toLowerCase().contains(query.toLowerCase()) ) {
|
||||
dummyListData.add(item);
|
||||
}
|
||||
});
|
||||
setState(() {
|
||||
items.clear();
|
||||
items.addAll(dummyListData);
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
setState(() {
|
||||
items.clear();
|
||||
items.addAll(widget.masterList);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MasterKeyCheckboxSearchWidget extends StatefulWidget {
|
||||
final SOAPViewModel model;
|
||||
final Function addSelectedHistories;
|
||||
final Function(MasterKeyModel) removeHistory;
|
||||
final Function(MasterKeyModel) addHistory;
|
||||
final bool Function(MasterKeyModel) isServiceSelected;
|
||||
final List<MasterKeyModel> masterList;
|
||||
final String buttonName;
|
||||
final String hintSearchText;
|
||||
|
||||
MasterKeyCheckboxSearchWidget(
|
||||
{Key key,
|
||||
this.model,
|
||||
this.addSelectedHistories,
|
||||
this.removeHistory,
|
||||
this.masterList,
|
||||
this.addHistory,
|
||||
this.isServiceSelected, this.buttonName, this.hintSearchText})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_MasterKeyCheckboxSearchWidgetState createState() => _MasterKeyCheckboxSearchWidgetState();
|
||||
}
|
||||
|
||||
class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchWidget> {
|
||||
List<MasterKeyModel> items = List();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
items.addAll(widget.masterList);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Column(
|
||||
children: [
|
||||
NetworkBaseView(
|
||||
baseViewModel: widget.model,
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.5,
|
||||
child: Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white),
|
||||
child: ListView(
|
||||
children: [
|
||||
TextFields(
|
||||
hintText: widget.hintSearchText??'Search history',
|
||||
suffixIcon: EvaIcons.search,
|
||||
onChanged: (value) {
|
||||
filterSearchResults(value);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 15,),
|
||||
Column(
|
||||
children: items.map((historyInfo) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value:
|
||||
widget.isServiceSelected(historyInfo),
|
||||
activeColor: Colors.red[800],
|
||||
onChanged: (bool newValue) {
|
||||
setState(() {
|
||||
if (widget
|
||||
.isServiceSelected(historyInfo)) {
|
||||
widget.removeHistory(historyInfo);
|
||||
} else {
|
||||
widget.addHistory(historyInfo);
|
||||
}
|
||||
});
|
||||
}),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 0),
|
||||
child: Texts(historyInfo.nameEn,
|
||||
variant: "bodyText",
|
||||
bold: true,
|
||||
color: Colors.black),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
DividerWithSpacesAround(),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
if (widget.model.state == ViewState.Idle)
|
||||
AppButton(
|
||||
title: widget.buttonName?? "Add SELECTED HISTORIES".toUpperCase(),
|
||||
onPressed: () {
|
||||
widget.addSelectedHistories();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void filterSearchResults(String query) {
|
||||
List<MasterKeyModel> dummySearchList = List();
|
||||
dummySearchList.addAll(widget.masterList);
|
||||
if (query.isNotEmpty) {
|
||||
List<MasterKeyModel> dummyListData = List();
|
||||
dummySearchList.forEach((item) {
|
||||
if (item.nameAr.toLowerCase().contains(query.toLowerCase()) ||
|
||||
item.nameEn.toLowerCase().contains(query.toLowerCase())) {
|
||||
dummyListData.add(item);
|
||||
}
|
||||
});
|
||||
setState(() {
|
||||
items.clear();
|
||||
items.addAll(dummyListData);
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
setState(() {
|
||||
items.clear();
|
||||
items.addAll(widget.masterList);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue