update procedure fixes

merge-requests/213/head
hussam al-habibeh 5 years ago
parent 75eda8832d
commit 4ffeb31181

@ -156,6 +156,7 @@ const GET_CATEGORISE_PROCEDURE =
const UPDATE_PROCEDURE = 'Services/DoctorApplication.svc/REST/PatchProcedure'; const UPDATE_PROCEDURE = 'Services/DoctorApplication.svc/REST/PatchProcedure';
const UPDATE_PRESCRIPTION = const UPDATE_PRESCRIPTION =
'Services/DoctorApplication.svc/REST/PatchPrescription'; 'Services/DoctorApplication.svc/REST/PatchPrescription';
const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList';
const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile';

@ -34,7 +34,7 @@ class EntityList {
String genderValidation; String genderValidation;
String group; String group;
String orderedValidation; String orderedValidation;
int price; dynamic price;
String procedureId; String procedureId;
String procedureName; String procedureName;
String specialPermission; String specialPermission;

@ -0,0 +1,65 @@
class SearchDrugModel {
List<EntityList> entityList;
int rowcount;
dynamic statusMessage;
SearchDrugModel({this.entityList, this.rowcount, this.statusMessage});
SearchDrugModel.fromJson(Map<String, dynamic> json) {
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 {
dynamic description;
dynamic genericName;
dynamic itemId;
dynamic keywords;
dynamic price;
dynamic quantity;
EntityList(
{this.description,
this.genericName,
this.itemId,
this.keywords,
this.price,
this.quantity});
EntityList.fromJson(Map<String, dynamic> json) {
description = json['Description'];
genericName = json['GenericName'];
itemId = json['ItemId'];
keywords = json['Keywords'];
price = json['Price'];
quantity = json['Quantity'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Description'] = this.description;
data['GenericName'] = this.genericName;
data['ItemId'] = this.itemId;
data['Keywords'] = this.keywords;
data['Price'] = this.price;
data['Quantity'] = this.quantity;
return data;
}
}

@ -0,0 +1,18 @@
class SearchDrugRequestModel {
List<String> search;
String vidaAuthTokenID;
SearchDrugRequestModel({this.search, this.vidaAuthTokenID});
SearchDrugRequestModel.fromJson(Map<String, dynamic> json) {
search = json['Search'].cast<String>();
vidaAuthTokenID = json['VidaAuthTokenID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Search'] = this.search;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
return data;
}
}

@ -2,17 +2,26 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart';
import 'package:doctor_app_flutter/core/model/prescription_req_model.dart'; import 'package:doctor_app_flutter/core/model/prescription_req_model.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug_request_model.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
class PrescriptionService extends BaseService { class PrescriptionService extends BaseService {
List<PrescriptionModel> _prescriptionList = List(); List<PrescriptionModel> _prescriptionList = List();
List<PrescriptionModel> get prescriptionList => _prescriptionList; List<PrescriptionModel> get prescriptionList => _prescriptionList;
List<SearchDrugModel> _drugsList = List();
List<SearchDrugModel> get drugsList => _drugsList;
PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(
patientMRN: 3120877, patientMRN: 3120877,
vidaAuthT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IiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlVSU0VTIiwiRE9DVE9SUyIsIkhFQUQgRE9DVE9SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio",
);
PostPrescriptionReqModel _postPrescriptionReqModel = PostPrescriptionReqModel _postPrescriptionReqModel =
PostPrescriptionReqModel(); PostPrescriptionReqModel();
@ -30,6 +39,18 @@ class PrescriptionService extends BaseService {
}, body: _prescriptionReqModel.toJson()); }, body: _prescriptionReqModel.toJson());
} }
Future getDrugs() async {
hasError = false;
_drugsList.clear();
await baseAppClient.post(SEARCH_DRUG,
onSuccess: (dynamic response, int statusCode) {
_drugsList.add(SearchDrugModel.fromJson(response['MedicationList']));
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _drugRequestModel.toJson());
}
Future postPrescription( Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel) async { PostPrescriptionReqModel postProcedureReqModel) async {
hasError = false; hasError = false;

@ -14,10 +14,10 @@ class ProcedureService extends BaseService {
List<Procedures> procedureslist = List(); List<Procedures> procedureslist = List();
GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel(
clinicId: 0, clinicId: 17,
pageSize: 10, pageSize: 10,
pageIndex: 1, pageIndex: 1,
patientMRN: 0, patientMRN: 3120725,
//categoryId: null, //categoryId: null,
vidaAuthTokenID: vidaAuthTokenID:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI",

@ -1,6 +1,7 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug_model.dart';
import 'package:doctor_app_flutter/core/service/prescription_service.dart'; import 'package:doctor_app_flutter/core/service/prescription_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/locator.dart';
@ -11,6 +12,7 @@ class PrescriptionViewModel extends BaseViewModel {
List<PrescriptionModel> get prescriptionList => List<PrescriptionModel> get prescriptionList =>
_prescriptionService.prescriptionList; _prescriptionService.prescriptionList;
List<SearchDrugModel> get drugsList => _prescriptionService.drugsList;
Future getPrescription() async { Future getPrescription() async {
hasError = false; hasError = false;
@ -53,4 +55,16 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
Future getDrugs() async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.getDrugs();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
} }

@ -5,6 +5,7 @@ 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/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_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/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_screen.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/screens/prescription/prescription_warnings.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
@ -29,27 +30,35 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
final GlobalKey<FormState> formKey = GlobalKey<FormState>(); final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12; final double spaceBetweenTextFileds = 12;
showModalBottomSheet( showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: (BuildContext bc) { builder: (BuildContext bc) {
return DraggableScrollableSheet( return BaseView<PrescriptionViewModel>(
onModelReady: (model) => model.getDrugs(),
builder: (BuildContext context, PrescriptionViewModel model,
Widget child) =>
DraggableScrollableSheet(
initialChildSize: 0.90, initialChildSize: 0.90,
maxChildSize: 0.90, maxChildSize: 0.90,
minChildSize: 0.9, minChildSize: 0.9,
builder: (BuildContext context, ScrollController scrollController) { builder: (BuildContext context,
ScrollController scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
child: Container( child: Container(
height: 980, height: 980,
child: Padding( child: Padding(
padding: padding: EdgeInsets.symmetric(
EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), horizontal: 12.0, vertical: 10.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisAlignment: MainAxisAlignment.spaceEvenly, //mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
AppText( AppText(
TranslationBase.of(context).medicines.toUpperCase(), TranslationBase.of(context)
.medicines
.toUpperCase(),
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
SizedBox( SizedBox(
@ -69,13 +78,15 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: TranslationBase.of(context) hintText:
TranslationBase.of(context)
.searchMedicine, .searchMedicine,
controller: drugIdController, controller: drugIdController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
validator: (value) { validator: (value) {
if (value.isEmpty) if (value.isEmpty)
return TranslationBase.of(context) return TranslationBase.of(
context)
.emptyMessage; .emptyMessage;
else else
return null; return null;
@ -92,8 +103,8 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: hintText: TranslationBase.of(context)
TranslationBase.of(context).orderType, .orderType,
), ),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
@ -105,8 +116,8 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: hintText: TranslationBase.of(context)
TranslationBase.of(context).strength, .strength,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: strengthController, controller: strengthController,
validator: (value) { validator: (value) {
@ -127,7 +138,8 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: TranslationBase.of(context).route, hintText:
TranslationBase.of(context).route,
controller: routeController, controller: routeController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
validator: (value) { validator: (value) {
@ -148,8 +160,8 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: hintText: TranslationBase.of(context)
TranslationBase.of(context).frequency, .frequency,
controller: frequencyController, controller: frequencyController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
validator: (value) { validator: (value) {
@ -170,8 +182,8 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: hintText: TranslationBase.of(context)
TranslationBase.of(context).doseTime, .doseTime,
controller: doseController, controller: doseController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
validator: (value) { validator: (value) {
@ -192,8 +204,8 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: hintText: TranslationBase.of(context)
TranslationBase.of(context).indication, .indication,
controller: indicationController, controller: indicationController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
validator: (value) { validator: (value) {
@ -214,8 +226,8 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: hintText: TranslationBase.of(context)
TranslationBase.of(context).fromDate, .fromDate,
keyboardType: TextInputType.datetime, keyboardType: TextInputType.datetime,
validator: (value) { validator: (value) {
if (value.isEmpty) if (value.isEmpty)
@ -236,13 +248,15 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: hintText:
TranslationBase.of(context).duration, TranslationBase.of(context)
.duration,
// borderColor: Colors.white, // borderColor: Colors.white,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: durationController, controller: durationController,
validator: (value) { validator: (value) {
if (value.isEmpty) if (value.isEmpty)
return TranslationBase.of(context) return TranslationBase.of(
context)
.emptyMessage; .emptyMessage;
else else
return null; return null;
@ -257,8 +271,8 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"))), color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
hintText: hintText: TranslationBase.of(context)
TranslationBase.of(context).instruction, .instruction,
controller: indicationController, controller: indicationController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
validator: (value) { validator: (value) {
@ -283,20 +297,27 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
onPressed: () { onPressed: () {
formKey.currentState.save(); formKey.currentState.save();
if (formKey.currentState.validate()) { if (formKey.currentState
.validate()) {
postProcedure( postProcedure(
model: model, model: model,
duration: durationController.text, duration:
durationController.text,
dose: doseController.text, dose: doseController.text,
frequency: frequency:
frequencyController.text, frequencyController
.text,
route: routeController.text, route: routeController.text,
drugId: drugIdController.text, drugId:
strength: strengthController.text, drugIdController.text,
strength:
strengthController.text,
indication: indication:
indicationController.text, indicationController
.text,
instruction: instruction:
indicationController.text, indicationController
.text,
); );
Navigator.pop(context); Navigator.pop(context);
} }
@ -322,10 +343,28 @@ void addPrescriptionForm(context, PrescriptionViewModel model) {
), ),
), ),
); );
}); }),
);
}); });
} }
// openAllergiesList(BuildContext context) {
// showModalBottomSheet(
// backgroundColor: Colors.white,
// isScrollControlled: true,
// context: context,
// builder: (context) {
// return AddAllergies(
// addAllergiesFun: (MySelectedAllergy mySelectedAllergy) {
// setState(() {
// widget.myAllergiesList.add(mySelectedAllergy);
// Navigator.of(context).pop();
// });
// },
// );
// });
// }
postProcedure( postProcedure(
{String duration, {String duration,
String dose, String dose,

@ -420,7 +420,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
} }
} }
postProcedure({ProcedureViewModel model}) async { postProcedure({ProcedureViewModel model, String remarks}) async {
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
List<Controls> controls = List(); List<Controls> controls = List();
List<Procedures> controlsProcedure = List(); List<Procedures> controlsProcedure = List();
@ -433,10 +433,10 @@ postProcedure({ProcedureViewModel model}) async {
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQg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'Remarks', controlValue: 'Testing'), Controls(code: remarks.isEmpty ? '' : remarks, controlValue: 'sssssssss'),
); );
controlsProcedure.add( controlsProcedure.add(
Procedures(category: "02", procedure: "02011002", controls: controls)); Procedures(category: "02", procedure: "02011009", controls: controls));
postProcedureReqModel.procedures = controlsProcedure; postProcedureReqModel.procedures = controlsProcedure;
await model.postProcedure(postProcedureReqModel); await model.postProcedure(postProcedureReqModel);
@ -448,7 +448,8 @@ postProcedure({ProcedureViewModel model}) async {
} }
} }
updateProcedure({ProcedureViewModel model, String remarks}) async { updateProcedure(
{ProcedureViewModel model, String remarks, String procedureId}) async {
PostProcedureReqModel updateProcedureReqModel = new PostProcedureReqModel(); PostProcedureReqModel updateProcedureReqModel = new PostProcedureReqModel();
List<Controls> controls = List(); List<Controls> controls = List();
List<Procedures> controlsProcedure = List(); List<Procedures> controlsProcedure = List();
@ -500,6 +501,7 @@ class AddSelectedProcedure extends StatefulWidget {
class _AddSelectedProcedureState extends State<AddSelectedProcedure> { class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
TextEditingController procedureController = TextEditingController(); TextEditingController procedureController = TextEditingController();
TextEditingController remarksController = TextEditingController();
List<EntityList> entityList = List(); List<EntityList> entityList = List();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -559,6 +561,7 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
), ),
TextFields( TextFields(
hintText: 'Remarks', hintText: 'Remarks',
controller: remarksController,
minLines: 3, minLines: 3,
maxLines: 5, maxLines: 5,
), ),
@ -574,7 +577,9 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
title: 'add Selected Procedures'.toUpperCase(), title: 'add Selected Procedures'.toUpperCase(),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
postProcedure(model: widget.model); postProcedure(
model: widget.model,
remarks: remarksController.text);
}, },
), ),
], ],

@ -28,7 +28,6 @@ class UpdateAllergiesWidget extends StatefulWidget {
} }
class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> { class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
TextEditingController remarkController = TextEditingController(); TextEditingController remarkController = TextEditingController();
@override @override
@ -53,9 +52,7 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
// controller: messageController, // controller: messageController,
validator: (value) { validator: (value) {
if (value == null) if (value == null)
return TranslationBase return TranslationBase.of(context).emptyMessage;
.of(context)
.emptyMessage;
else else
return null; return null;
}), }),
@ -64,16 +61,14 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
height: 20, height: 20,
), ),
Container( Container(
margin: margin: EdgeInsets.only(left: 15, right: 15, top: 15),
EdgeInsets.only(left: 15, right: 15, top: 15),
child: Column( child: Column(
children: widget.myAllergiesList.map((selectedAllergy) { children: widget.myAllergiesList.map((selectedAllergy) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Texts(selectedAllergy.selectedAllergy.nameEn.toUpperCase(), Texts(selectedAllergy.selectedAllergy.nameEn.toUpperCase(),
variant: "bodyText", bold: true, color: Colors.black), variant: "bodyText", bold: true, color: Colors.black),
@ -126,10 +121,10 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
widget.myAllergiesList.add(mySelectedAllergy); widget.myAllergiesList.add(mySelectedAllergy);
Navigator.of(context).pop(); Navigator.of(context).pop();
}); });
},); },
);
}); });
} }
} }
class AddAllergies extends StatefulWidget { class AddAllergies extends StatefulWidget {
@ -149,9 +144,9 @@ class _AddAllergiesState extends State<AddAllergies> {
TextEditingController remarkController = TextEditingController(); TextEditingController remarkController = TextEditingController();
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>(); GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>();
InputDecoration textFieldSelectorDecoration(
InputDecoration textFieldSelectorDecoration(String hintText, String hintText, String selectedText, bool isDropDown,
String selectedText, bool isDropDown,{IconData icon}) { {IconData icon}) {
return InputDecoration( return InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
@ -177,9 +172,7 @@ class _AddAllergiesState extends State<AddAllergies> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
final screenSize = MediaQuery final screenSize = MediaQuery.of(context).size;
.of(context)
.size;
return FractionallySizedBox( return FractionallySizedBox(
heightFactor: 0.7, heightFactor: 0.7,
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
@ -191,8 +184,7 @@ class _AddAllergiesState extends State<AddAllergies> {
await model.getMasterLookup(MasterKeysService.AllergySeverity); await model.getMasterLookup(MasterKeysService.AllergySeverity);
} }
}, },
builder: (_, model, w) => builder: (_, model, w) => AppScaffold(
AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
@ -202,7 +194,6 @@ class _AddAllergiesState extends State<AddAllergies> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 16, height: 16,
), ),
@ -224,19 +215,43 @@ class _AddAllergiesState extends State<AddAllergies> {
}); });
} }
: null, : null,
child: _selectedAllergy==null? AutoCompleteTextField<MasterKeyModel>( child: _selectedAllergy == null
decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), ? AutoCompleteTextField<MasterKeyModel>(
itemSubmitted: (item) => setState(() => _selectedAllergy = item), decoration: textFieldSelectorDecoration(
"Select Allergy",
_selectedAllergy != null
? _selectedAllergy.nameEn
: null,
true,
icon: EvaIcons.search),
itemSubmitted: (item) =>
setState(() => _selectedAllergy = item),
key: key, key: key,
suggestions: model.allergiesList, suggestions: model.allergiesList,
itemBuilder: (context, suggestion) => new Padding( itemBuilder: (context, suggestion) =>
child:Texts( projectViewModel.isArabic? suggestion.nameAr: suggestion.nameEn), new Padding(
child: Texts(
projectViewModel.isArabic
? suggestion.nameAr
: suggestion.nameEn),
padding: EdgeInsets.all(8.0)), padding: EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1, itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) => itemFilter: (suggestion, input) =>
suggestion.nameAr.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.nameEn.toLowerCase().startsWith(input.toLowerCase()), suggestion.nameAr
):TextField( .toLowerCase()
decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), .startsWith(input.toLowerCase()) ||
suggestion.nameEn
.toLowerCase()
.startsWith(input.toLowerCase()),
)
: TextField(
decoration: textFieldSelectorDecoration(
"Select Allergy",
_selectedAllergy != null
? _selectedAllergy.nameEn
: null,
true,
icon: EvaIcons.search),
enabled: false, enabled: false,
), ),
), ),
@ -251,9 +266,7 @@ class _AddAllergiesState extends State<AddAllergies> {
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.allergySeverityList, list: model.allergySeverityList,
okText: TranslationBase okText: TranslationBase.of(context).ok,
.of(context)
.ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
_selectedAllergySeverity = _selectedAllergySeverity =
@ -292,8 +305,7 @@ class _AddAllergiesState extends State<AddAllergies> {
height: 10, height: 10,
), ),
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 0, right: 0, top: 15),
left: 0, right: 0, top: 15),
child: TextFields( child: TextFields(
hintText: "Remarks", hintText: "Remarks",
fontSize: 13.5, fontSize: 13.5,
@ -304,28 +316,28 @@ class _AddAllergiesState extends State<AddAllergies> {
controller: remarkController, controller: remarkController,
validator: (value) { validator: (value) {
if (value == null) if (value == null)
return TranslationBase return TranslationBase.of(context)
.of(context)
.emptyMessage; .emptyMessage;
else else
return null; return null;
}), }),
), SizedBox( ),
SizedBox(
height: 10, height: 10,
), ),
AppButton( AppButton(
title: "Add".toUpperCase(), title: "Add".toUpperCase(),
onPressed: () { onPressed: () {
MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( MySelectedAllergy mySelectedAllergy =
new MySelectedAllergy(
remark: remarkController.text, remark: remarkController.text,
selectedAllergy: _selectedAllergy, selectedAllergy: _selectedAllergy,
selectedAllergySeverity: _selectedAllergySeverity); selectedAllergySeverity:
_selectedAllergySeverity);
widget.addAllergiesFun(mySelectedAllergy); widget.addAllergiesFun(mySelectedAllergy);
}, },
), ),
] ]),
),
), ),
), ),
)), )),
@ -333,8 +345,3 @@ class _AddAllergiesState extends State<AddAllergies> {
); );
} }
} }

Loading…
Cancel
Save