dashboard replaced with client profile page
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ftc_mobile_app/models/profile_screen_model.dart';
|
||||
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
|
||||
import 'package:ftc_mobile_app/models/rota/LiveRoasterResponseData.dart';
|
||||
import 'package:ftc_mobile_app/models/rota/WeekArrayData.dart';
|
||||
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../../ftc_mobile_app.dart';
|
||||
|
||||
class DashboardScreenController extends GetxController {
|
||||
@@ -16,7 +15,7 @@ class DashboardScreenController extends GetxController {
|
||||
final selectedIndex = 1.obs;
|
||||
final myShiftsList = RxList<DaysArrayData>();
|
||||
final ongoingShift = Rx<DaysArrayData?>(null);
|
||||
final myProfileData = Rx<StaffMembers?>(null);
|
||||
final myProfileData = Rx<UserData?>(null);
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -49,10 +48,14 @@ class DashboardScreenController extends GetxController {
|
||||
}
|
||||
|
||||
getProfileDetail() async {
|
||||
final resp = await ClientService().getUserDetails();
|
||||
final resp = await ClientService().getUserDetails().showLoader();
|
||||
|
||||
if (resp is ProfileDataModel) {
|
||||
myProfileData.value = resp.data?.staffMembers?.firstOrNull;
|
||||
if (resp.success == true) {
|
||||
myProfileData.value = resp.data?.users?.firstOrNull;
|
||||
} else {
|
||||
if (resp.message.isNotNullOrEmpty()) {
|
||||
FrequentFunctions.showToast(message: resp.message!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class ViewProfileScreenController extends GetxController {
|
||||
addressTEC.text = d?.user?.modelId?.homeAddress ?? "";
|
||||
});
|
||||
|
||||
detail.value = dashboardController.myProfileData();
|
||||
// detail.value = dashboardController.myProfileData();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@ void main() async {
|
||||
GetTimeAgo.setCustomLocaleMessages('en', CustomTimeAgoMessages());
|
||||
|
||||
//Notification initialize
|
||||
NotificationUtils.init();
|
||||
try {
|
||||
await FcmNotification.getInstance().init();
|
||||
} catch (e) {
|
||||
debugPrint("FcmNotification init error: $e");
|
||||
}
|
||||
// NotificationUtils.init();
|
||||
// try {
|
||||
// await FcmNotification.getInstance().init();
|
||||
// } catch (e) {
|
||||
// debugPrint("FcmNotification init error: $e");
|
||||
// }
|
||||
|
||||
await LocalStorageManager.init();
|
||||
Get.lazyPut(() => AppSessionManager(), fenix: true);
|
||||
|
||||
@@ -45,7 +45,7 @@ class _CustomDrawerState extends State<CustomDrawer> {
|
||||
return MyCircleImage(
|
||||
imageSize: 80.r,
|
||||
url:
|
||||
"${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.user?.profilePictureUrl ?? ""}",
|
||||
"${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.profilePictureUrl ?? ""}",
|
||||
errorWidget: CustomImageWidget(
|
||||
imagePath: AssetsManager.kPersonMainIcon,
|
||||
imageColor: CustomAppColors.kDarkBlueTextColor,
|
||||
@@ -61,7 +61,7 @@ class _CustomDrawerState extends State<CustomDrawer> {
|
||||
() => CustomTextWidget(
|
||||
text: DashboardScreenController.instance
|
||||
.myProfileData()
|
||||
?.staffMemberName ??
|
||||
?.displayName ??
|
||||
"",
|
||||
textAlign: TextAlign.center,
|
||||
fontColor: CustomAppColors.kBlackColor,
|
||||
@@ -69,16 +69,6 @@ class _CustomDrawerState extends State<CustomDrawer> {
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => CustomTextWidget(
|
||||
text: DashboardScreenController.instance
|
||||
.myProfileData()
|
||||
?.staffDesignation ??
|
||||
"",
|
||||
fontColor: CustomAppColors.kLightGreyColor,
|
||||
fontSize: 10.sp,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -99,55 +89,6 @@ class _CustomDrawerState extends State<CustomDrawer> {
|
||||
Navigator.pop(context);
|
||||
dashboardController.selectedIndex.value = 1;
|
||||
drawerController.selectedIndex.value = 1;
|
||||
// Navigator.pushNamed(
|
||||
// context,
|
||||
// CustomRouteNames.kDashboardScreenRoute,
|
||||
// );
|
||||
}),
|
||||
6.verticalSpace,
|
||||
_getDrawerNavItem(
|
||||
title: "Rota",
|
||||
iconPath: AssetsManager.kPersonMainIcon,
|
||||
color: CustomAppColors.kLightGreyColor,
|
||||
selected: drawerController.selectedIndex.value == 0,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
// dashboardController.selectedIndex.value = 0;
|
||||
// drawerController.selectedIndex.value = 0;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
CustomRouteNames.kRotaDashboardScreenRoute,
|
||||
);
|
||||
}),
|
||||
6.verticalSpace,
|
||||
_getDrawerNavItem(
|
||||
title: "Clients",
|
||||
iconPath: AssetsManager.kPeopleIcon,
|
||||
color: CustomAppColors.kLightGreyColor,
|
||||
selected: drawerController.selectedIndex.value == 3,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
dashboardController.selectedIndex.value = 3;
|
||||
drawerController.selectedIndex.value = 3;
|
||||
// Navigator.pushNamed(
|
||||
// context,
|
||||
// CustomRouteNames.kClientsListScreenRoute,
|
||||
// );
|
||||
}),
|
||||
6.verticalSpace,
|
||||
_getDrawerNavItem(
|
||||
title: "Inbox",
|
||||
iconPath: AssetsManager.kMessageIcon,
|
||||
color: CustomAppColors.kLightGreyColor,
|
||||
selected: drawerController.selectedIndex.value == 2,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
dashboardController.selectedIndex.value = 2;
|
||||
drawerController.selectedIndex.value = 2;
|
||||
// Navigator.pushNamed(
|
||||
// context,
|
||||
// CustomRouteNames.kInboxScreenRoute,
|
||||
// );
|
||||
}),
|
||||
6.verticalSpace,
|
||||
_getDrawerNavItem(
|
||||
@@ -191,26 +132,7 @@ class _CustomDrawerState extends State<CustomDrawer> {
|
||||
// CustomRouteNames.kNotificationListScreenRoute,
|
||||
// );
|
||||
}),
|
||||
const Expanded(child: FrequentFunctions.noWidget),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CustomTextWidget(
|
||||
text: "Shift end at ",
|
||||
fontColor: CustomAppColors.kLightGreyColor,
|
||||
isExpanded: false,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
CustomTextWidget(
|
||||
text: "07Hrs 50Sec",
|
||||
fontColor: CustomAppColors.kSecondaryColor,
|
||||
isExpanded: false,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -32,7 +32,7 @@ class _ClientProfileScreenState extends State<ClientProfileScreen> {
|
||||
backgroundColor: CustomAppColors.kPrimaryColor,
|
||||
screenKey: controller.screenKey,
|
||||
onScreenTap: controller.removeFocus,
|
||||
showAppBar: true,
|
||||
showAppBar: false,
|
||||
appBar: CustomAppBar(
|
||||
leadingButton: Container(),
|
||||
showBoxShadow: false,
|
||||
|
||||
@@ -15,6 +15,24 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomScaffold(
|
||||
appBar: appBar,
|
||||
backgroundColor: CustomAppColors.kPrimaryColor,
|
||||
screenKey: controller.screenKey,
|
||||
onScreenTap: controller.removeFocus,
|
||||
showAppBar: true,
|
||||
sideDrawer: const CustomDrawer(),
|
||||
body: SafeArea(
|
||||
child: Obx(() {
|
||||
if (controller.myProfileData() == null) {
|
||||
return FrequentFunctions.centerText(text: "No data found");
|
||||
}
|
||||
|
||||
return ClientProfileScreen(userData: controller.myProfileData()!);
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
return CustomScaffold(
|
||||
appBar: appBar,
|
||||
sideDrawer: const CustomDrawer(),
|
||||
|
||||
@@ -48,7 +48,7 @@ class HomeScreen extends StatelessWidget {
|
||||
return MyCircleImage(
|
||||
imageSize: 80.r,
|
||||
url:
|
||||
"${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.user?.profilePictureUrl ?? ""}",
|
||||
"${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.profilePictureUrl ?? ""}",
|
||||
errorWidget: CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
child: CustomImageWidget(
|
||||
@@ -67,7 +67,7 @@ class HomeScreen extends StatelessWidget {
|
||||
() => CustomTextWidget(
|
||||
text: DashboardScreenController.instance
|
||||
.myProfileData()
|
||||
?.staffMemberName ??
|
||||
?.displayName ??
|
||||
"",
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -76,17 +76,17 @@ class HomeScreen extends StatelessWidget {
|
||||
),
|
||||
|
||||
//designation
|
||||
Obx(
|
||||
() => CustomTextWidget(
|
||||
text: DashboardScreenController.instance
|
||||
.myProfileData()
|
||||
?.staffDesignation ??
|
||||
"",
|
||||
fontSize: 14.sp,
|
||||
fontColor: CustomAppColors.kPrimaryColor,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
// Obx(
|
||||
// () => CustomTextWidget(
|
||||
// text: DashboardScreenController.instance
|
||||
// .myProfileData()
|
||||
// ?.staffDesignation ??
|
||||
// "",
|
||||
// fontSize: 14.sp,
|
||||
// fontColor: CustomAppColors.kPrimaryColor,
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// ),
|
||||
16.verticalSpace,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:ftc_mobile_app/models/clients/recent_incidents_model.dart';
|
||||
import 'package:ftc_mobile_app/models/clients/add_pbs_plan_model.dart';
|
||||
import 'package:ftc_mobile_app/models/clients/riskAssessmentResponse/GetRiskAssessmentResponse.dart';
|
||||
import 'package:ftc_mobile_app/models/clients/riskAssessmentResponse/RiskAssessmentData.dart';
|
||||
import 'package:ftc_mobile_app/utilities/enums/api_method.dart';
|
||||
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
|
||||
import '../models/appointmentsListResponse/AppointmentsListResponse.dart';
|
||||
import '../models/clients/HealthIssuesDetailsModel.dart';
|
||||
@@ -30,49 +31,29 @@ class ClientService {
|
||||
|
||||
final HttpRequestClient _httpClient = HttpRequestClient();
|
||||
|
||||
Future<dynamic> getUserDetails() async {
|
||||
// String userJson = LocalStorageManager.getSessionToken(
|
||||
// tokenKey: LocalStorageKeys.kUserModelKey,
|
||||
// );
|
||||
// UserModel userModel = UserModel.fromJson(json.decode(userJson));
|
||||
Future<AllClientsResponse> getUserDetails() async {
|
||||
Map<String, dynamic> requestBody = {
|
||||
"sortproperty": "createdAt",
|
||||
"sortorder": -1,
|
||||
"offset": 0,
|
||||
"limit": 1,
|
||||
"query": {
|
||||
"critarion": {
|
||||
"active": true,
|
||||
"_id": LocalStorageManager.userId,
|
||||
// "_id": LocalStorageManager.userId,
|
||||
"_id": "659535b08d2973ab265f1091"
|
||||
},
|
||||
"addedby": "_id email name",
|
||||
"lastModifiedBy": "_id email name"
|
||||
},
|
||||
};
|
||||
|
||||
ResponseModel responseModel = await _httpClient.customRequest(
|
||||
"POST",
|
||||
url: WebUrls.userProfileUrl,
|
||||
requestBody: requestBody,
|
||||
requestHeader: {'Content-Type': 'application/json'},
|
||||
isBearerHeaderRequired: true,
|
||||
isBearer: true,
|
||||
ResponseModel responseModel = await _httpClient.safeApiCall(
|
||||
method: ApiMethod.post,
|
||||
url: WebUrls.getServiceUsersListUrl,
|
||||
body: requestBody,
|
||||
);
|
||||
if (responseModel.statusCode >= 200 &&
|
||||
responseModel.statusCode <= 230 &&
|
||||
responseModel.statusDescription.toLowerCase().contains("success")) {
|
||||
final profileDataModel = ProfileDataModel.fromJson({
|
||||
'status': "${responseModel.statusCode}",
|
||||
"data": responseModel.data,
|
||||
'message': responseModel.statusDescription,
|
||||
});
|
||||
// await LocalStorageManager.saveSession(
|
||||
// tokenKey: LocalStorageKeys.kProfileModelKey,
|
||||
// tokenValue: json.encode(profileDataModel.toJson()),
|
||||
// );
|
||||
return profileDataModel;
|
||||
if ((responseModel.statusCode ~/ 100) == 2) {
|
||||
final resp = AllClientsResponseData.fromJson(responseModel.data);
|
||||
return AllClientsResponse(success: true, data: resp);
|
||||
} else {
|
||||
return responseModel.statusDescription;
|
||||
return AllClientsResponse(success: false, message: responseModel.statusDescription);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,11 +204,6 @@ class ClientService {
|
||||
responseModel.statusCode <= 230 &&
|
||||
responseModel.statusDescription.toLowerCase().contains("success")) {
|
||||
final resp = AllClientsResponseData.fromJson(responseModel.data);
|
||||
|
||||
// List<ServiceUserModel> serviceUsers = [];
|
||||
// for (var singleUser in responseModel.data['serviceUsers']) {
|
||||
// serviceUsers.add(ServiceUserModel.fromJson(singleUser));
|
||||
// }
|
||||
return AllClientsResponse(success: true, data: resp);
|
||||
} else {
|
||||
return AllClientsResponse(
|
||||
@@ -914,10 +890,7 @@ class ClientService {
|
||||
url: WebUrls.getCarePlansListURL,
|
||||
requestBody: {
|
||||
"query": {
|
||||
"critarion": {
|
||||
"userId": serviceUserId,
|
||||
"active": true
|
||||
}
|
||||
"critarion": {"userId": serviceUserId, "active": true}
|
||||
},
|
||||
"sortproperty": "eventDateTime",
|
||||
"sortorder": -1,
|
||||
|
||||
Reference in New Issue
Block a user