Merge branch 'privileges' into 'master'

Privileges

See merge request Cloud_Solution/diplomatic-quarter!167
merge-requests/224/merge
Mohammad Aljammal 4 years ago
commit f7ee16f115

@ -243,6 +243,9 @@ const GET_USER_TERMS = '/Services/Patients.svc/REST/GetUserTermsAndConditions';
const UPDATE_HEALTH_TERMS =
'/services/Patients.svc/REST/UpdatePateintHealthSummaryReport';
///
const GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege';
//URL to get medicine and pharmacies list
const CHANNEL = 3;
const GENERAL_ID = 'Cs2020@2016\$2958';

@ -0,0 +1,24 @@
class PrivilegeModel {
int iD;
String serviceName;
bool privilege;
dynamic region;
PrivilegeModel({this.iD, this.serviceName, this.privilege, this.region});
PrivilegeModel.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
serviceName = json['ServiceName'];
privilege = json['Previlege'];
region = json['Region'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['ServiceName'] = this.serviceName;
data['Previlege'] = this.privilege;
data['Region'] = this.region;
return data;
}
}

@ -0,0 +1,22 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
class PrivilegeService extends BaseService {
List<PrivilegeModel> privilegeModelList = List();
Future getPrivilege() async {
Map<String, dynamic> body = Map();
body['PatientType'] = 4;
await baseAppClient.post(GET_PRIVILEGE,
onSuccess: (dynamic response, int statusCode) {
response['ServicePrivilegeList'].forEach((item) {
privilegeModelList.add(PrivilegeModel.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}

@ -2,6 +2,8 @@ import 'dart:async';
import 'package:connectivity/connectivity.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart';
import 'package:diplomaticquarterapp/core/service/privilege_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
@ -18,9 +20,7 @@ class ProjectViewModel extends BaseViewModel {
bool isError = false;
String error = '';
dynamic searchvalue;
bool isLogin
= false;
bool isLogin = false;
dynamic get searchValue => searchvalue;
@ -30,12 +30,18 @@ class ProjectViewModel extends BaseViewModel {
bool get isArabic => _isArabic;
// BaseViewModel baseViewModel = locator<BaseViewModel>()
bool isLoginChild = false;
List<PrivilegeModel> privilegeRootUser = List();
List<PrivilegeModel> privilegeChildUser = List();
List<PrivilegeModel> get privileges =>
isLoginChild ? privilegeChildUser : privilegeChildUser;
StreamSubscription subscription;
ProjectViewModel() {
loadSharedPrefLanguage();
subscription = Connectivity()
.onConnectivityChanged
.listen((ConnectivityResult result) {
@ -78,6 +84,49 @@ class ProjectViewModel extends BaseViewModel {
notifyListeners();
}
setPrivilegeModelList(
{List<PrivilegeModel> privilege}) {
this.isLoginChild = isLoginChild;
privilegeRootUser = privilege;
notifyListeners();
}
setPrivilege({privilegeList, bool isLoginChild = false}) {
List<PrivilegeModel> privilege = List();
privilegeList['List'][0]['ListPrivilege'].forEach((item) {
privilege.add(PrivilegeModel.fromJson(item));
});
this.isLoginChild = isLoginChild;
if (isLoginChild)
privilegeChildUser = privilege;
else
privilegeRootUser = privilege;
notifyListeners();
}
setIsLoginChild({@required bool isLoginChild}){
this.isLoginChild = isLoginChild;
notifyListeners();
}
bool havePrivilege(int id) {
bool isHavePrivilege = false;
if(isLoginChild)
privilegeChildUser.forEach((element) {
if (element.iD == id) isHavePrivilege = element.privilege;
});
else{
privilegeRootUser.forEach((element) {
if (element.iD == id) isHavePrivilege = element.privilege;
});
}
return isHavePrivilege;
}
@override
void dispose() {
if (subscription != null) subscription.cancel();

@ -47,6 +47,7 @@ import 'core/service/medical/reports_monthly_service.dart';
import 'core/service/medical/vital_sign_service.dart';
import 'core/service/parmacyModule/order-preview-service.dart';
import 'core/service/notifications_service.dart';
import 'core/service/privilege_service.dart';
import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'core/service/parmacyModule/parmacy_module_service.dart';
@ -144,6 +145,7 @@ void setupLocator() {
locator.registerLazySingleton(() => PharmacyModuleService());
locator.registerLazySingleton(() => OrderPreviewService());
locator.registerLazySingleton(() => CustomerAddressesService());
locator.registerLazySingleton(() => PrivilegeService());
/// View Model

@ -270,7 +270,7 @@ class CheckActivationCode {
}
}
class List {
class Lists {
String setupID;
int patientType;
int patientID;
@ -330,7 +330,7 @@ class List {
dynamic tempAddress;
dynamic zipCode;
List({
Lists({
this.setupID,
this.patientType,
this.patientID,
@ -391,7 +391,7 @@ class List {
this.zipCode,
});
List.fromJson(Map<String, dynamic> json) {
Lists.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
patientType = json['PatientType'];
patientID = json['PatientID'];

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart';
@ -31,6 +32,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class AllHabibMedicalService extends StatefulWidget {
@ -57,6 +59,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).alhabiServices,
@ -149,6 +152,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
'assets/images/new-design/booking_icon_active.png',
title: TranslationBase.of(context).bookAppo,
),
if(projectViewModel.havePrivilege(58))
ServicesContainer(
onTap: () => Navigator.push(
context,
@ -225,6 +229,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
'assets/images/new-design/family_menu_icon_red.png',
title: TranslationBase.of(context).family,
),
if(projectViewModel.havePrivilege(35))
ServicesContainer(
onTap: () => Navigator.push(
context,
@ -245,6 +250,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
'assets/images/new-design/upcoming_icon_bottom_bar.png',
title: TranslationBase.of(context).todoList,
),
if(projectViewModel.havePrivilege(42))
ServicesContainer(
onTap: () => Navigator.push(
context,
@ -252,6 +258,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
),
imageLocation: 'assets/images/new-design/body_icon.png',
title: 'Symptom Checker'),
if(projectViewModel.havePrivilege(36))
ServicesContainer(
onTap: () => Navigator.push(
context,
@ -282,6 +289,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
'assets/images/new-design/health_convertor_icon.png',
title: 'Health Converter',
),
if(projectViewModel.havePrivilege(38))
ServicesContainer(
onTap: () => Navigator.push(
context,
@ -292,6 +300,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
imageLocation: 'assets/images/new-design/water_icon.png',
title: 'H2O',
),
if(projectViewModel.havePrivilege(41))
ServicesContainer(
onTap: () => Navigator.push(
context,

@ -1,27 +1,22 @@
import 'dart:ui';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as list;
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -37,7 +32,6 @@ class MyFamily extends StatefulWidget {
}
class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
List<ImagesInfo> imagesInfo = List();
final familyFileProvider = FamilyFilesProvider();
AppSharedPreferences sharedPref = new AppSharedPreferences();
var userID;
@ -49,6 +43,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
locator<AppointmentRateViewModel>();
ProjectViewModel projectViewModel;
AuthenticatedUser user;
List<ImagesInfo> imagesInfo = List();
@override
void initState() {
_tabController = new TabController(length: 2, vsync: this, initialIndex: 0);
@ -646,26 +641,9 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
loginAfter(result, context) async{
GifLoaderDialogUtils.hideDialog(context);
// var familyFile = await sharedPref.getObject(FAMILY_FILE);
// var mainUser = await sharedPref.getObject(MAIN_USER);
// result = CheckActivationCode.fromJson(result);
// this.sharedPref.clear();
// this.sharedPref.setObject(FAMILY_FILE, familyFile);
// this.sharedPref.setObject(MAIN_USER, mainUser);
// result.list.isFamily = true;
// this.sharedPref.setObject(USER_PROFILE, result.list);
// this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID);
// this.sharedPref.setString(TOKEN, result.authenticationTokenID);
//
// authenticatedUserObject.isLogin = true;
// appointmentRateViewModel.isLogin = true;
// projectViewModel.isLogin = true;
// //this.checkIfUserAgreedBefore(result),
// Navigator.of(context).pushNamed(
// HOME,
// );
result = list.CheckActivationCode.fromJson(result);
var familyFile = await sharedPref.getObject(FAMILY_FILE);
Provider.of<ProjectViewModel>(context, listen: false).setPrivilege(privilegeList: result,isLoginChild: true);
result = CheckActivationCode.fromJson(result);
var mainUser = await sharedPref.getObject(MAIN_USER);
this.sharedPref.clear();
if (mainUser["PatientID"] != result.list.patientID) {

@ -435,11 +435,13 @@ class _HomePageState extends State<HomePage> {
),
],
),
if(projectViewModel.havePrivilege(64)||projectViewModel.havePrivilege(65)||projectViewModel.havePrivilege(67))
Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if(projectViewModel.havePrivilege(64))
DashboardItem(
onTap: () {
Navigator.push(
@ -478,6 +480,7 @@ class _HomePageState extends State<HomePage> {
imageName: 'home_healthcare_service_bg.png',
opacity: 0.5,
),
if(projectViewModel.havePrivilege(65))
DashboardItem(
//onTap: () => Navigator.push(context, FadePage(page: PharmacyPage())),
@ -508,6 +511,7 @@ class _HomePageState extends State<HomePage> {
height: MediaQuery.of(context).size.width * 0.4,
imageName: 'al-habib_onlne_pharmacy_bg.png',
),
if(projectViewModel.havePrivilege(67))
DashboardItem(
onTap: (){
Navigator.push(
@ -623,6 +627,7 @@ class _HomePageState extends State<HomePage> {
borderRadius: BorderRadius.circular(6.0),
color: Colors.white,
)),
if(projectViewModel.havePrivilege(60))
Container(
width: MediaQuery.of(context).size.width * 0.29,
child: InkWell(

@ -444,7 +444,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
index: currentTab,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: currentTab == 0
floatingActionButton: (projectViewModel.havePrivilege(34) && currentTab == 0)
? FloatingButton(
elevation: true,
onTap: () {

@ -515,6 +515,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
.then((result) => {
if (result is Map)
{
projectViewModel.setPrivilege(privilegeList: result),
result = CheckActivationCode.fromJson(result),
if (this.registerd_data != null &&
this.registerd_data.isRegister == true)

@ -242,6 +242,7 @@ class _Login extends State<Login> {
// request.isRegister = false;
this.authService.checkActivationCode(request, code).then((result) => {
sharedPref.remove(FAMILY_FILE),
projectViewModel.setPrivilege(privilegeList: result),
result = CheckActivationCode.fromJson(result),
result.list.isFamily = false,
this.sharedPref.setObject(USER_PROFILE, result.list),

@ -1,10 +1,12 @@
import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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 ContactLensPage extends StatelessWidget {
final ListHISGetContactLensPerscription listHISGetContactLensPerscription;
@ -14,6 +16,7 @@ class ContactLensPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
body: SingleChildScrollView(
child: Container(
@ -82,6 +85,7 @@ class ContactLensPage extends StatelessWidget {
SizedBox(
height: 17,
),
if(projectViewModel.havePrivilege(15))
Container(
width: double.infinity,
child: SecondaryButton(

@ -17,6 +17,7 @@ import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details
import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_widget.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -47,11 +48,14 @@ class MedicalProfilePage extends StatefulWidget {
class _MedicalProfilePageState extends State<MedicalProfilePage> {
var authProvider = new AuthProvider();
List<Medical> medical=List();
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
projectViewModel = Provider.of(context);
var appoCountProvider = Provider.of<ToDoCountProviderModel>(context);
List<Widget> myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel,context: context,count: appoCountProvider.count,isLogin: projectViewModel.isLogin);
return BaseView<MedicalViewModel>(
onModelReady: (model) => model.getAppointmentHistory(),
builder: (_, model, widget) => AppScaffold(
@ -92,456 +96,29 @@ class _MedicalProfilePageState extends State<MedicalProfilePage> {
],
),
),
SizedBox(height: 50,),
Padding(
padding: EdgeInsets.symmetric(vertical: 5.0),
child: Column(
children: <Widget>[
if(model.isLogin)
Container(
width: double.infinity,
height: 55,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: MyAppointments(),
),
);
},
child: authProvider.isLogin
? Stack(children: [
MedicalProfileItem(
title:
TranslationBase.of(context)
.myAppointments,
imagePath:
'my_appointment_icon.png',
subTitle:
TranslationBase.of(context)
.myAppointmentsList,
hasBadge: true,
),
Positioned(
right: 0.0,
child: Badge(
toAnimate: false,
position:
BadgePosition.topEnd(),
shape: BadgeShape.circle,
badgeColor: Colors
.red[800].withOpacity(1.0),
borderRadius:
BorderRadius.circular(8),
badgeContent: Container(
padding:
EdgeInsets.all(2.0),
child: Text(
appoCountProvider.count
.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 16.0)),
),
),
),
])
: MedicalProfileItem(
title: TranslationBase.of(context)
.myAppointments,
imagePath:
'my_appointment_icon.png',
subTitle:
TranslationBase.of(context)
.myAppointmentsList,
hasBadge: true,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.push(context,
FadePage(page: LabsHomePage())),
child: MedicalProfileItem(
title: TranslationBase.of(context).lab,
imagePath: 'lab_result_icon.png',
subTitle: TranslationBase.of(context).labSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.push(context,
FadePage(page: RadiologyHomePage())),
child: MedicalProfileItem(
title: TranslationBase.of(context)
.radiology,
imagePath: 'radiology_icon.png',
subTitle: TranslationBase.of(context)
.radiologySubtitle,
),
),
),
],
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: HomePrescriptionsPage(),
),
);
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.medicines,
imagePath: 'prescription_icon.png',
subTitle: TranslationBase.of(context)
.medicinesSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: VitalSignDetailsScreen(),
),
),
child: MedicalProfileItem(
title: TranslationBase.of(context)
.vitalSigns,
imagePath: 'vital_signs.png',
subTitle: TranslationBase.of(context)
.vitalSignsSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.push(context,
FadePage(page: ActiveMedicationsPage())),
child: MedicalProfileItem(
title: TranslationBase.of(context)
.myMedical,
imagePath: 'active_medications.png',
subTitle: TranslationBase.of(context)
.myMedicalSubtitle,
),
),
),
],
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: DoctorHomePage(),
),
);
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.myDoctor,
imagePath: 'doctor_icon.png',
subTitle: TranslationBase.of(context)
.myDoctorSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: EyeMeasurementsPage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).eye,
imagePath: 'eye_measurement_icon.png',
subTitle: TranslationBase.of(context)
.eyeSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: InsuranceCard()));
child: GridView.builder(
shrinkWrap: true,
primary: false,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 2.40),
),
itemCount: myMedicalList.length,
itemBuilder: (BuildContext context, int index) {
return myMedicalList[index];
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.insurance,
imagePath: 'insurance_card_icon.png',
subTitle: TranslationBase.of(context)
.insuranceSubtitle,
),
),
),
)
],
),
Row(children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: InsuranceUpdate()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.updateInsurance,
imagePath: 'insurance_update_icon_.png',
subTitle: TranslationBase.of(context)
.updateInsuranceSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: InsuranceApproval()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.insuranceApproval,
imagePath: 'insurance_approvals_icon.png',
subTitle: TranslationBase.of(context)
.insuranceApprovalSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap:()=> Navigator.push(context, FadePage(page: AllergiesPage())) ,
child: MedicalProfileItem(
title: TranslationBase.of(context).allergies,
imagePath: 'my_allergies_icon.png',
subTitle: TranslationBase.of(context)
.allergiesSubtitle,
),
),
),
]),
Row(children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: MyVaccines()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.myVaccines,
imagePath: 'my_vaccines_icon.png',
subTitle: TranslationBase.of(context)
.myVaccinesSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: HomeReportPage()));
},
child: MedicalProfileItem(
title:
TranslationBase.of(context).medical,
imagePath: 'medical_reports_icon.png',
subTitle: TranslationBase.of(context)
.medicalSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: MonthlyReportsPage()));
},
child: MedicalProfileItem(
title:
TranslationBase.of(context).monthly,
imagePath: 'monthly_reports_icon.png',
subTitle: TranslationBase.of(context)
.monthlySubtitle,
),
),
),
]),
Row(children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: PatientSickLeavePage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).sick,
imagePath: 'sick_leaves_icons.png',
subTitle: TranslationBase.of(context)
.sickSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: MyBalancePage()));
},
child: MedicalProfileItem(
title:
TranslationBase.of(context).myBalance,
imagePath: 'check-in.png',
subTitle: TranslationBase.of(context)
.myBalanceSubtitle,
),
),
),
Expanded(
flex: 1,
child: MedicalProfileItem(
title:
TranslationBase.of(context).patientCall,
imagePath: 'medical_history_icon.png',
subTitle: TranslationBase.of(context)
.patientCallSubtitle,
),
),
]),
Row(children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
//TODO
onTap: () {
Navigator.push(
context, FadePage(page: SmartWatchInstructions()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.smartWatches,
imagePath: 'smartwatch_icon.png',
subTitle: TranslationBase.of(context)
.smartWatchesSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: MyTrackers()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.myTrackers,
imagePath: 'my_tracker_icon.png',
subTitle: TranslationBase.of(context)
.myTrackersSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: (){
Navigator.push(context,
FadePage(page: AskDoctorHomPage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).askYour,
imagePath: 'ask_doctor_icon.png',
subTitle: TranslationBase.of(context)
.askYourSubtitle,
),
),
),
]),
Row(children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
//TODO
// onTap: () {
// Navigator.push(
// context, FadePage(page: DoctorHomePage()));
// },
child: MedicalProfileItem(
title:
TranslationBase.of(context).internet,
imagePath: 'insurance_card_icon.png',
subTitle: TranslationBase.of(context)
.internetSubtitle,
),
),
),
Expanded(
flex: 1,
child: InkWell(
// onTap: () {
// Navigator.push(
// context, FadePage(page: InsuranceApproval()));
// },
child: MedicalProfileItem(
title:
TranslationBase.of(context).chatbot,
imagePath: 'insurance_approvals_icon.png',
subTitle: TranslationBase.of(context)
.chatbotSubtitle,
),
),
),
Expanded(
flex: 1,
child: Container(),
),
]),
SizedBox(
height:
MediaQuery.of(context).size.height * 0.12,
)
],
),
)
],
),
if (model.user != null && model.isLogin)
Positioned(
@ -604,4 +181,20 @@ class _MedicalProfilePageState extends State<MedicalProfilePage> {
),
);
}
fullMedicalData(){
if(projectViewModel.havePrivilege(5))
{}
}
}
class Medical{
final String title;
final String imagePath;
final String subTitle;
final Widget page;
Medical({this.title, this.imagePath, this.subTitle, this.page});
}

@ -39,6 +39,7 @@ class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
subName: model.sickLeaveList[index].projectName,
isInOutPatient:
model.sickLeaveList[index].isInOutPatient,
onEmailTap: () {
model.sendSickLeaveEmail(
message: TranslationBase.of(context).emailSentSuccessfully,

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -11,6 +12,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PrescriptionItemsPage extends StatelessWidget {
final Prescriptions prescriptions;
@ -19,6 +21,7 @@ class PrescriptionItemsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PrescriptionsViewModel>(
onModelReady: (model) =>
model.getPrescriptionReport(prescriptions: prescriptions),
@ -148,6 +151,7 @@ class PrescriptionItemsPage extends StatelessWidget {
child: Column(
children: <Widget>[
Divider(),
if(projectViewModel.havePrivilege(13))
Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Button(

@ -1,12 +1,14 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.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';
import 'package:url_launcher/url_launcher.dart';
class RadiologyDetailsPage extends StatelessWidget {
@ -16,6 +18,7 @@ class RadiologyDetailsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<RadiologyViewModel>(
onModelReady: (model) => model.getRadImageURL(
projectId: finalRadiology.projectID,
@ -29,17 +32,23 @@ class RadiologyDetailsPage extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('${finalRadiology.reportData}',textAlign: TextAlign.center,),
Text(
'${finalRadiology.reportData}',
textAlign: TextAlign.center,
),
],
),
),
bottomSheet: Container(
bottomSheet: (projectViewModel.havePrivilege(9) ||
projectViewModel.havePrivilege(8))
? Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.2,
color: Colors.grey[100],
child: Column(
children: <Widget>[
Divider(),
if (projectViewModel.havePrivilege(9))
Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Button(
@ -50,6 +59,7 @@ class RadiologyDetailsPage extends StatelessWidget {
backgroundColor: Colors.grey[800],
),
),
if (projectViewModel.havePrivilege(8))
Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Button(
@ -62,7 +72,8 @@ class RadiologyDetailsPage extends StatelessWidget {
)
],
),
)),
)
: Container()),
);
}
}

@ -2,6 +2,7 @@ import 'dart:ui';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart';
@ -12,6 +13,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class HomeReportPage extends StatefulWidget {
@override
@ -37,6 +39,7 @@ class _HomeReportPageState extends State<HomeReportPage>
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png'));
imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png'));
imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png'));
@ -147,7 +150,7 @@ class _HomeReportPageState extends State<HomeReportPage>
SizedBox(height: 110,)
],
),
bottomSheet: Container(
bottomSheet: projectViewModel.havePrivilege(21) ?Container(
width: double.infinity,
height: 90,
margin: EdgeInsets.all(8.0),
@ -161,7 +164,7 @@ class _HomeReportPageState extends State<HomeReportPage>
),
),
),
),
):null,
),
),
);

@ -26,6 +26,7 @@ class PaymentService extends StatelessWidget {
children: [
Row(
children: [
if(projectViewModel.havePrivilege(33))
Expanded(
child: InkWell(
onTap: () => Navigator.push(
@ -61,6 +62,45 @@ class PaymentService extends StatelessWidget {
),
),
),
if(!projectViewModel.havePrivilege(33))
Expanded(
child: InkWell(
onTap: () => Navigator.push(
context, FadePage(page: MyBalancePage())),
child: Container(
margin: EdgeInsets.all(5.0),
padding: EdgeInsets.all(9),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.0),
shape: BoxShape.rectangle),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
'My Balances',
color: HexColor('#B61422'),
bold: true,
),
Texts(
TranslationBase.of(context).payment,
fontSize: 14,
fontWeight: FontWeight.normal,
),
Align(
alignment: projectViewModel.isArabic
? Alignment.centerRight
: Alignment.centerLeft,
child: Image.asset(
'assets/images/al-habib_online_payment_service_icon.png',
height: 55,
),
),
],
),
),
),
),
Expanded(
child: Container(
margin: EdgeInsets.all(5.0),
@ -97,6 +137,7 @@ class PaymentService extends StatelessWidget {
)
],
),
if(!projectViewModel.havePrivilege(33))
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
@ -6,6 +7,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart';
import '../base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart';
@ -22,6 +24,7 @@ class MyVaccines extends StatefulWidget {
class _MyVaccinesState extends State<MyVaccines> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<VaccineViewModel>(
onModelReady: (model) => model.getVaccine(),
builder: (BuildContext context, VaccineViewModel model, Widget child) =>
@ -171,6 +174,7 @@ class _MyVaccinesState extends State<MyVaccines> {
Navigator.push(context, FadePage(page: MyVaccinesItemPage())),
),
),
if(projectViewModel.havePrivilege(27))
Container(
width: double.infinity,
// height: 80.0,

@ -1,4 +1,5 @@
import 'dart:async';
import 'package:diplomaticquarterapp/core/service/privilege_service.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart';
@ -20,6 +21,8 @@ class SplashScreen extends StatefulWidget {
}
class _SplashScreenState extends State<SplashScreen> {
PrivilegeService _privilegeService = locator<PrivilegeService>();
//Provider.of<ProjectViewModel>(context, listen: false).isLogin
@override
void initState() {
@ -27,7 +30,7 @@ class _SplashScreenState extends State<SplashScreen> {
Timer(
Duration(seconds: 1, milliseconds: 500),
() {
getUserData().then((value) {
loadPrivilege().then((value) {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (BuildContext context) => LandingPage(),
@ -38,14 +41,11 @@ class _SplashScreenState extends State<SplashScreen> {
);
}
Future getUserData() async {
var data = await sharedPref.getObject(USER_PROFILE);
if (data != null) {
AuthenticatedUser userData = AuthenticatedUser.fromJson(data);
Provider.of<ProjectViewModel>(context, listen: false).isLogin = true;
authenticatedUserObject.isLogin = true;
authenticatedUserObject.user = userData;
}
/// load the Privilege from service
Future loadPrivilege() async {
await _privilegeService.getPrivilege();
Provider.of<ProjectViewModel>(context, listen: false).setPrivilegeModelList(privilege: _privilegeService.privilegeModelList);
}
@override

@ -2,7 +2,33 @@ import 'dart:convert';
import 'dart:core';
import 'dart:typed_data';
import 'package:badges/badges.dart';
import 'package:connectivity/connectivity.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/Blood/my_balance_page.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/medical/active_medications/ActiveMedicationsPage.dart';
import 'package:diplomaticquarterapp/pages/medical/allergies_page.dart';
import 'package:diplomaticquarterapp/pages/medical/ask_doctor/ask_doctor_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/eye/EyeMeasurementsPage.dart';
import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers.dart';
import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart';
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart';
import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -160,7 +186,340 @@ class Utils {
.hasMatch(email);
}
static List<Widget> myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) {
List<Widget> medical = List();
if (projectViewModel.havePrivilege(5)) {
medical.add(InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: MyAppointments(),
),
);
},
child: isLogin
? Container(
height: 120,
child: Stack(children: [
MedicalProfileItem(
title: TranslationBase.of(context).myAppointments,
imagePath: 'my_appointment_icon.png',
subTitle: TranslationBase.of(context).myAppointmentsList,
hasBadge: true,
),
Positioned(
right: 0.0,
child: Badge(
toAnimate: false,
position: BadgePosition.topEnd(),
shape: BadgeShape.circle,
badgeColor: Color(0xFF40ACC9).withOpacity(1.0),
borderRadius: BorderRadius.circular(8),
badgeContent: Container(
padding: EdgeInsets.all(2.0),
child: Text(count.toString(),
style:
TextStyle(color: Colors.white, fontSize: 16.0)),
),
),
),
]),
)
: MedicalProfileItem(
title: TranslationBase.of(context).myAppointments,
imagePath: 'my_appointment_icon.png',
subTitle: TranslationBase.of(context).myAppointmentsList,
hasBadge: true,
),
));
}
if (projectViewModel.havePrivilege(10)) {
medical.add(InkWell(
onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())),
child: MedicalProfileItem(
title: TranslationBase.of(context).lab,
imagePath: 'lab_result_icon.png',
subTitle: TranslationBase.of(context).labSubtitle,
),
));
}
if (projectViewModel.havePrivilege(7)) {
medical.add(InkWell(
onTap: () =>
Navigator.push(context, FadePage(page: RadiologyHomePage())),
child: MedicalProfileItem(
title: TranslationBase.of(context).radiology,
imagePath: 'radiology_icon.png',
subTitle: TranslationBase.of(context).radiologySubtitle,
),
));
}
if (projectViewModel.havePrivilege(12)) {
medical.add(InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: HomePrescriptionsPage(),
),
);
},
child: MedicalProfileItem(
title: TranslationBase.of(context).medicines,
imagePath: 'prescription_icon.png',
subTitle: TranslationBase.of(context).medicinesSubtitle,
),
));
}
if (projectViewModel.havePrivilege(25)) {
medical.add(InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: VitalSignDetailsScreen(),
),
),
child: MedicalProfileItem(
title: TranslationBase.of(context).vitalSigns,
imagePath: 'vital_signs.png',
subTitle: TranslationBase.of(context).vitalSignsSubtitle,
),
));
}
if (projectViewModel.havePrivilege(48)) {
medical.add(InkWell(
onTap: () =>
Navigator.push(context, FadePage(page: ActiveMedicationsPage())),
child: MedicalProfileItem(
title: TranslationBase.of(context).myMedical,
imagePath: 'active_medications.png',
subTitle: TranslationBase.of(context).myMedicalSubtitle,
),
));
}
if (projectViewModel.havePrivilege(6)) {
medical.add(InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: DoctorHomePage(),
),
);
},
child: MedicalProfileItem(
title: TranslationBase.of(context).myDoctor,
imagePath: 'doctor_icon.png',
subTitle: TranslationBase.of(context).myDoctorSubtitle,
),
));
}
if (projectViewModel.havePrivilege(14)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: EyeMeasurementsPage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).eye,
imagePath: 'eye_measurement_icon.png',
subTitle: TranslationBase.of(context).eyeSubtitle,
),
));
}
if (projectViewModel.havePrivilege(22)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: InsuranceCard()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).insurance,
imagePath: 'insurance_card_icon.png',
subTitle: TranslationBase.of(context).insuranceSubtitle,
),
));
}
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: InsuranceUpdate()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).updateInsurance,
imagePath: 'insurance_update_icon_.png',
subTitle: TranslationBase.of(context).updateInsuranceSubtitle,
),
));
if (projectViewModel.havePrivilege(18)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: InsuranceApproval()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).insuranceApproval,
imagePath: 'insurance_approvals_icon.png',
subTitle: TranslationBase.of(context).insuranceApprovalSubtitle,
),
));
}
if (projectViewModel.havePrivilege(23)) {
medical.add(InkWell(
onTap: () => Navigator.push(context, FadePage(page: AllergiesPage())),
child: MedicalProfileItem(
title: TranslationBase.of(context).allergies,
imagePath: 'my_allergies_icon.png',
subTitle: TranslationBase.of(context).allergiesSubtitle,
),
));
}
if (projectViewModel.havePrivilege(26)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MyVaccines()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).myVaccines,
imagePath: 'my_vaccines_icon.png',
subTitle: TranslationBase.of(context).myVaccinesSubtitle,
),
));
}
if (projectViewModel.havePrivilege(20))
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: HomeReportPage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).medical,
imagePath: 'medical_reports_icon.png',
subTitle: TranslationBase.of(context).medicalSubtitle,
),
));
if (projectViewModel.havePrivilege(19)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MonthlyReportsPage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).monthly,
imagePath: 'monthly_reports_icon.png',
subTitle: TranslationBase.of(context).monthlySubtitle,
),
));
}
if (projectViewModel.havePrivilege(16)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: PatientSickLeavePage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).sick,
imagePath: 'sick_leaves_icons.png',
subTitle: TranslationBase.of(context).sickSubtitle,
),
));
}
if (projectViewModel.havePrivilege(47)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MyBalancePage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).myBalance,
imagePath: 'check-in.png',
subTitle: TranslationBase.of(context).myBalanceSubtitle,
),
));
}
if (projectViewModel.havePrivilege(61)) {
medical.add(MedicalProfileItem(
title: TranslationBase.of(context).patientCall,
imagePath: 'medical_history_icon.png',
subTitle: TranslationBase.of(context).patientCallSubtitle,
));
}
if (projectViewModel.havePrivilege(24)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MyTrackers()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).myTrackers,
imagePath: 'my_tracker_icon.png',
subTitle: TranslationBase.of(context).myTrackersSubtitle,
),
));
}
if (projectViewModel.havePrivilege(30))
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: SmartWatchInstructions()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).smartWatches,
imagePath: 'smartwatch_icon.png',
subTitle: TranslationBase.of(context).smartWatchesSubtitle,
),
));
if (projectViewModel.havePrivilege(28)) {
medical.add(InkWell(
onTap: () {
Navigator.push(context, FadePage(page: AskDoctorHomPage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).askYour,
imagePath: 'ask_doctor_icon.png',
subTitle: TranslationBase.of(context).askYourSubtitle,
),
));
}
if (projectViewModel.havePrivilege(32)) {
medical.add(InkWell(
//TODO
// onTap: () {
// Navigator.push(
// context, FadePage(page: DoctorHomePage()));
// },
child: MedicalProfileItem(
title: TranslationBase.of(context).internet,
imagePath: 'insurance_card_icon.png',
subTitle: TranslationBase.of(context).internetSubtitle,
),
));
}
if (projectViewModel.havePrivilege(40)) {
medical.add(InkWell(
// onTap: () {
// Navigator.push(
// context, FadePage(page: InsuranceApproval()));
// },
child: MedicalProfileItem(
title: TranslationBase.of(context).chatbot,
imagePath: 'insurance_approvals_icon.png',
subTitle: TranslationBase.of(context).chatbotSubtitle,
),
));
}
return medical;
}
}
// extension function that use in iterations(list.. etc) to iterate items and get index and item it self
extension IndexedIterable<E> on Iterable<E> {
Iterable<T> mapIndexed<T>(T Function(E e, int i) f) {

@ -1,18 +1,20 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../d_q_icons_icons.dart';
import 'bottom_navigation_item.dart';
class BottomNavBar extends StatefulWidget {
final ValueChanged<int> changeIndex;
final int index;
BottomNavBar({Key key, this.changeIndex, this.index}) : super(key: key);
final int index ;
BottomNavBar({Key key, this.changeIndex,this.index}) : super(key: key);
@override
_BottomNavBarState createState() => _BottomNavBarState();
@ -27,6 +29,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BottomAppBar(
elevation: 4,
shape: CircularNotchedRectangle(),
@ -53,7 +56,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
currentIndex: 1,
name: TranslationBase.of(context).medicalProfile,
),
if (widget.index == 0)
if (widget.index == 0 && projectViewModel.havePrivilege(34))
Expanded(
child: SizedBox(
height: 50,
@ -66,7 +69,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
),
),
),
if (widget.index != 0)
if (widget.index != 0 && projectViewModel.havePrivilege(34))
BottomNavigationItem(
icon: EvaIcons.calendar,
activeIcon: EvaIcons.calendar,
@ -83,6 +86,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
currentIndex: 3,
name: TranslationBase.of(context).myFamily,
),
if(projectViewModel.havePrivilege(51))
BottomNavigationItem(
icon: EvaIcons.calendar,
activeIcon: EvaIcons.calendar,

@ -135,7 +135,7 @@ class DoctorCard extends StatelessWidget {
),
),
),
if (onEmailTap != null)
if (onEmailTap != null && projectViewModel.havePrivilege(17))
InkWell(
onTap: onEmailTap,
child: Icon(

@ -79,6 +79,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
),
),
),
if(projectViewModel.havePrivilege(11))
InkWell(
onTap: widget.onTap,
child: Container(

@ -40,8 +40,7 @@ class _AppDrawerState extends State<AppDrawer> {
var familyFileProvider = FamilyFilesProvider();
AuthenticatedUser user;
AuthenticatedUser mainUser;
AuthenticatedUserObject authenticatedUserObject = locator<
AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
VitalSignService _vitalSignService = locator<VitalSignService>();
@ -49,10 +48,7 @@ class _AppDrawerState extends State<AppDrawer> {
Widget build(BuildContext context) {
projectProvider = Provider.of(context);
return SizedBox(
width: MediaQuery
.of(context)
.size
.width * 0.75,
width: MediaQuery.of(context).size.width * 0.75,
child: Container(
color: Colors.white,
child: Drawer(
@ -106,8 +102,7 @@ class _AppDrawerState extends State<AppDrawer> {
child: Column(
children: <Widget>[
AppText(
TranslationBase
.of(
TranslationBase.of(
context)
.fileno +
": " +
@ -143,9 +138,7 @@ class _AppDrawerState extends State<AppDrawer> {
children: <Widget>[
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.arabicChange,
TranslationBase.of(context).arabicChange,
Icons.translate),
onTap: () {
// Navigator.of(context).pushNamed(
@ -162,12 +155,10 @@ class _AppDrawerState extends State<AppDrawer> {
? Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
user.isFamily == null || user.isFamily == false
? InkWell(
if(projectProvider.havePrivilege(2))
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.family,
TranslationBase.of(context).family,
Icons.group,
textColor: Color(0xFF40ACC9),
iconColor: Color(0xFF40ACC9),
@ -179,8 +170,8 @@ class _AppDrawerState extends State<AppDrawer> {
MY_FAMILIY,
);
},
)
: SizedBox(),
),
// if(projectProvider.havePrivilege(2))
FutureBuilder(
future: getFamilyFiles(), // async work
builder: (BuildContext context,
@ -235,25 +226,10 @@ class _AppDrawerState extends State<AppDrawer> {
flex: 7,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: <
Widget>[
AppText(
mainUser
.firstName +
' ' +
mainUser
.lastName),
AppText(
TranslationBase
.of(
context)
.fileno +
": " +
mainUser
.patientID
.toString()),
CrossAxisAlignment.start,
children: <Widget>[
AppText(mainUser.firstName + ' ' + mainUser.lastName),
AppText(TranslationBase.of(context).fileno + ": " + mainUser.patientID.toString()),
])),
],
)))
@ -284,63 +260,20 @@ class _AppDrawerState extends State<AppDrawer> {
},
child: Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
CrossAxisAlignment.start,
children: <
Widget>[
Expanded(
child:
Icon(Icons
.person,
color: result
.responseID ==
user
.patientID
? Color(
0xFF40ACC9)
: Colors
.black),
Icon(Icons.person, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black),
),
Expanded(
flex: 7,
child: Padding(
padding: EdgeInsets
.only(
left: 5,
right: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment
.start,
children: <
Widget>[
AppText(
result
.patientName,
color: result
.responseID ==
user
.patientID
? Color(
0xFF40ACC9)
: Colors
.black),
AppText(
TranslationBase
.of(
context)
.fileno +
": " +
result
.iD
.toString(),
color: result
.responseID ==
user
.patientID
? Color(
0xFF40ACC9)
: Colors
.black),
padding:EdgeInsets.only(left:5, right:5),
child:Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black),
AppText(TranslationBase.of(context).fileno + ": " + result.iD.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black),
]))),
],
)))
@ -351,10 +284,11 @@ class _AppDrawerState extends State<AppDrawer> {
}
},
),
if(projectProvider.havePrivilege(1))
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
TranslationBase.of(context)
.notification,
Icons.notifications),
onTap: () {
@ -367,11 +301,10 @@ class _AppDrawerState extends State<AppDrawer> {
NotificationsPage()));
},
),
if(projectProvider.havePrivilege(3))
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.appsetting,
TranslationBase.of(context).appsetting,
Icons.settings_input_composite),
onTap: () {
Navigator.of(context).pushNamed(
@ -381,9 +314,7 @@ class _AppDrawerState extends State<AppDrawer> {
),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.rateApp,
TranslationBase.of(context).rateApp,
Icons.star),
onTap: () {
if (Platform.isIOS) {
@ -397,9 +328,7 @@ class _AppDrawerState extends State<AppDrawer> {
),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.logout,
TranslationBase.of(context).logout,
Icons.lock_open),
onTap: () {
logout();
@ -409,9 +338,7 @@ class _AppDrawerState extends State<AppDrawer> {
)
: InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.loginregister,
TranslationBase.of(context).loginregister,
Icons.lock_open),
onTap: () {
login();
@ -435,9 +362,7 @@ class _AppDrawerState extends State<AppDrawer> {
children: [
Column(
children: <Widget>[
Text(TranslationBase
.of(context)
.poweredBy),
Text(TranslationBase.of(context).poweredBy),
Image.asset(
'assets/images/cs_logo_container.png',
width: SizeConfig.imageSizeMultiplier * 30,
@ -490,8 +415,8 @@ class _AppDrawerState extends State<AppDrawer> {
authenticatedUserObject.logout();
projectProvider.isLogin = false;
await authenticatedUserObject.getUser();
_vitalSignService.heightCm = "";
_vitalSignService.weightKg = "";
_vitalSignService.heightCm ="";
_vitalSignService.weightKg ="";
await sharedPref.clear();
this.user = null;
Navigator.of(context).pushNamed(HOME);
@ -541,6 +466,7 @@ class _AppDrawerState extends State<AppDrawer> {
loginAfter(result, context) async {
Utils.hideProgressDialog();
Provider.of<ProjectViewModel>(context, listen: false).setPrivilege(privilegeList: result,isLoginChild: true);
result = CheckActivationCode.fromJson(result);
var familyFile = await sharedPref.getObject(FAMILY_FILE);
var mainUser = await sharedPref.getObject(MAIN_USER);

Loading…
Cancel
Save