family switch parent child and child 2

dev_aamir
aamir-csol 1 day ago
parent aa17688de6
commit e9ec23f506

@ -4,7 +4,7 @@ import 'package:hmg_patient_app_new/core/enums.dart';
class ApiConsts {
static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT

@ -300,15 +300,31 @@ class AuthenticationRepoImp implements AuthenticationRepo {
if (!isSwitchUser) {
print("Initial Super User Payload");
appState.addUserSwitchPayload(requestBody, isSuperUser: true);
print(requestBody);
} else if (isSwitchUser) {
print("Switch Into First Family File");
appState.addUserSwitchPayload(requestBody, isSuperUser: false);
} else if (appState.getSuperUserID == responseID) {
print("Switching Back to Super User");
// appState.addUserSwitchPayload(requestBody, isSuperUser: true);
} else if (isSwitchUser && appState.getSuperUserID == responseID) {
print("Switching Into Child User 1");
// appState.addUserSwitchPayload(requestBody);
// User is switching profiles
if (appState.getSuperUserID == responseID) {
// Switching back to the super user account
print("Switching Back to Super User");
appState.addUserSwitchPayload(requestBody, isSuperUser: true);
print(requestBody);
} else {
var superUserPaylod = appState.getUserSwitchPayloadByIndex(isSuperUser: true);
if (appState.getSuperUserID == null && superUserPaylod != null) {
if (superUserPaylod != null) {
// requestBody['LoginType'] = loginType;
// requestBody['PatientIdentificationID'] = "";
// requestBody['DeviceToken'] = newRequest.deviceToken;
// requestBody.removeWhere((key, value) => ['NationalID', 'isDentalAllowedBackend', 'ProjectOutSA', 'ForRegisteration', 'PatientID'].contains(key));
}
print("Switch to Family Where Super User Is ${appState.getSuperUserID}");
appState.addUserSwitchPayload(requestBody, isSuperUser: false);
print(requestBody);
} else {
print("Switching Into Family File Member");
}
}
}
await apiClient.post(

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@ -79,8 +80,7 @@ class _FamilyCardsState extends State<FamilyCards> {
children: [
Utils.buildSvgWithAssets(icon: AppAssets.alertSquare),
SizedBox(width: 8.h),
LocaleKeys.whoCanViewMyMedicalFile.tr(context: context).toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500)
.onPress(() {
LocaleKeys.whoCanViewMyMedicalFile.tr(context: context).toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500).onPress(() {
dialogService.showFamilyBottomSheetWithoutHWithChild(
label: LocaleKeys.manageFiles.tr(context: context),
message: "",
@ -136,18 +136,11 @@ class _FamilyCardsState extends State<FamilyCards> {
? AppColors.textGreenColor
: AppColors.alertColor),
SizedBox(height: 8.h),
Wrap(
alignment: WrapAlignment.start,
crossAxisAlignment: WrapCrossAlignment.start,
runAlignment: WrapAlignment.start,
spacing: 0.h,
children: [
(profile.patientName ?? "").toText14(isBold: false, isCenter: false, maxlines: 1, weight: FontWeight.w600),
(getStatusTextByRequest(
FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false))
.toText12(
isBold: false, isCenter: false, maxLine: 1, fontWeight: FontWeight.w500, color: AppColors.greyTextColor),
]),
Wrap(alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.start, runAlignment: WrapAlignment.start, spacing: 0.h, children: [
(profile.patientName ?? "").toText14(isBold: false, isCenter: false, maxlines: 1, weight: FontWeight.w600),
(getStatusTextByRequest(FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false))
.toText12(isBold: false, isCenter: false, maxLine: 1, fontWeight: FontWeight.w500, color: AppColors.greyTextColor),
]),
SizedBox(height: 8.h),
CustomChipWidget(
height: 30.h,
@ -318,7 +311,11 @@ class _FamilyCardsState extends State<FamilyCards> {
final profile = widget.profileViewList![index];
final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId);
final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false;
final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID);
print(jsonEncode(appState.getUserSwitchPayloads));
final isSuperUser = appState.getUserSwitchPayloads;
// TODO: canSwitch functionality is currently disabled - set to true to allow all switches
// Original logic: final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID);
final canSwitch = true; // Disabled - allows all users to switch
return Container(
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r),
@ -469,10 +466,10 @@ class _FamilyCardsState extends State<FamilyCards> {
alignment: WrapAlignment.start,
children: [
(profile.patientName ?? "").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600),
SizedBox(width: 2.w,),
(getStatusTextByRequest(
FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false))
.toText14(
SizedBox(
width: 2.w,
),
(getStatusTextByRequest(FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false)).toText14(
isBold: false,
isCenter: true,
maxlines: 1,

Loading…
Cancel
Save