Get General instructions implemented

merge-update-with-lab-changes
haroon amjad 3 years ago
parent 0e4e285954
commit 9d2df00d87

@ -593,6 +593,9 @@ var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLog
// Check If InPatient API
var CHECK_IF_INPATIENT = 'Services/Patients.svc/REST/GetInPatientAdmissionInfo';
// Get General Instructions API
var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions';
class AppGlobal {
static var context;

@ -35,6 +35,7 @@ class ProjectViewModel extends BaseViewModel {
bool isLogin = false;
int laserSelectionDuration;
bool isPatientAdmitted = false;
int inPatientProjectID = 0;
double _latitude;
double _longitude;
@ -116,6 +117,11 @@ class ProjectViewModel extends BaseViewModel {
notifyListeners();
}
setInPatientProjectID(int projectID) {
this.inPatientProjectID = projectID;
notifyListeners();
}
setPrivilegeModelList({List<PrivilegeModel> privilege}) {
this.isLoginChild = isLoginChild;
privilegeRootUser = privilege;

@ -0,0 +1,52 @@
class GetGeneralInstructions {
int rowID;
int iD;
int projectID;
String text;
String textN;
bool isActive;
int createdBy;
String createdOn;
dynamic editedBy;
dynamic editedOn;
GetGeneralInstructions(
{this.rowID,
this.iD,
this.projectID,
this.text,
this.textN,
this.isActive,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn});
GetGeneralInstructions.fromJson(Map<String, dynamic> json) {
rowID = json['RowID'];
iD = json['ID'];
projectID = json['ProjectID'];
text = json['Text'];
textN = json['TextN'];
isActive = json['IsActive'];
createdBy = json['CreatedBy'];
createdOn = json['CreatedOn'];
editedBy = json['EditedBy'];
editedOn = json['EditedOn'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['RowID'] = this.rowID;
data['ID'] = this.iD;
data['ProjectID'] = this.projectID;
data['Text'] = this.text;
data['TextN'] = this.textN;
data['IsActive'] = this.isActive;
data['CreatedBy'] = this.createdBy;
data['CreatedOn'] = this.createdOn;
data['EditedBy'] = this.editedBy;
data['EditedOn'] = this.editedOn;
return data;
}
}

@ -0,0 +1,93 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_general_instructions_response_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
class GeneralInstructions extends StatelessWidget {
List<GetGeneralInstructions> getGeneralInstructionsList;
ProjectViewModel projectViewModel;
GeneralInstructions({@required this.getGeneralInstructionsList});
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
showNewAppBarTitle: true,
showNewAppBar: true,
appBarTitle: TranslationBase.of(context).InPatientServicesHeader,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("General Instructions",
overflow: TextOverflow.clip,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
)),
),
Expanded(
child: Container(
width: MediaQuery.of(context).size.width,
child: Card(
elevation: 0.0,
margin: EdgeInsets.all(16),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(color: Colors.transparent, width: 0.0),
),
child: Padding(
padding: EdgeInsets.all(16.0),
child: Container(
child: ListView.separated(
itemCount: getGeneralInstructionsList.length,
itemBuilder: (BuildContext context, int index) {
return Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: SvgPicture.asset("assets/images/new-design/ionic-ios-checkmark-circle.svg"),
),
Container(
width: MediaQuery.of(context).size.width * 0.75,
margin: EdgeInsets.only(left: 5.0, right: 5.0),
child: Text(projectViewModel.isArabic ? getGeneralInstructionsList[index].textN : getGeneralInstructionsList[index].text,
overflow: TextOverflow.clip,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
)),
),
],
));
},
separatorBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.only(left: 14, right: 14),
child: mHeight(16.0),
);
},
)),
),
),
),
)
],
));
}
}

@ -1,7 +1,12 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_general_instructions_response_model.dart';
import 'package:diplomaticquarterapp/pages/InPatientServices/general_instructions.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -64,7 +69,7 @@ class InPatientServicesHome extends StatelessWidget {
serviceList.add(
InkWell(
onTap: () {
// Navigator.push(context, FadePage(page: AdvancePaymentPage()));
openGeneralInstructions(context);
},
child: MedicalProfileItem(
title: TranslationBase.of(context).generalInstructionsTitle,
@ -140,7 +145,25 @@ class InPatientServicesHome extends StatelessWidget {
),
),
);
return serviceList;
}
void openGeneralInstructions(BuildContext context) {
ClinicListService service = new ClinicListService();
GifLoaderDialogUtils.showMyDialog(context);
service.getGeneralInstructions(projectViewModel.inPatientProjectID, context).then((res) {
List<GetGeneralInstructions> getGeneralInstructionsList = [];
res['generalInstructions'].forEach((v) {
getGeneralInstructionsList.add(new GetGeneralInstructions.fromJson(v));
});
GifLoaderDialogUtils.hideDialog(context);
print(res['generalInstructions']);
Navigator.push(context, FadePage(page: GeneralInstructions(getGeneralInstructionsList: getGeneralInstructionsList)));
}).catchError((err) {
print(err);
});
}
}

@ -672,6 +672,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
if (res['List_PatientAdmissionInfo'].length != 0) {
print("INPATIENT!!!");
projectViewModel.setIsPatientAdmitted(true);
projectViewModel.setInPatientProjectID(res['List_PatientAdmissionInfo'][0]['ProjectID']);
} else {
print("OUTPATIENT!!!");
projectViewModel.setIsPatientAdmitted(false);

@ -399,6 +399,7 @@ class _Login extends State<Login> {
if (res['List_PatientAdmissionInfo'].length != 0) {
print("INPATIENT!!!");
projectViewModel.setIsPatientAdmitted(true);
projectViewModel.setInPatientProjectID(res['List_PatientAdmissionInfo'][0]['ProjectID']);
} else {
print("OUTPATIENT!!!");
projectViewModel.setIsPatientAdmitted(false);

@ -77,6 +77,22 @@ class ClinicListService extends BaseService {
return Future.value(localRes);
}
Future<Map> getGeneralInstructions(int projectID, context) async {
Map<String, dynamic> request;
request = {
"ProjectID": projectID
};
dynamic localRes;
await baseAppClient.post(GET_GENERAL_INSTRUCTIONS, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request, isAllowAny: true);
return Future.value(localRes);
}
Future<Map> getProjectsList(context) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');

@ -548,6 +548,7 @@ class _AppDrawerState extends State<AppDrawer> {
await _privilegeService.getPrivilege();
projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList);
projectProvider.setIsPatientAdmitted(false);
projectProvider.setInPatientProjectID(0);
var appLanguage = await sharedPref.getString(APP_LANGUAGE);
await sharedPref.clear();
await sharedPref.setString(APP_LANGUAGE, appLanguage);

Loading…
Cancel
Save