fist commit ftc staff app clone

This commit is contained in:
2024-08-01 13:46:46 +05:30
commit bf9064a9c9
515 changed files with 42796 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:get/get.dart';
class AgencySignInController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final TextEditingController emailPhoneController = TextEditingController();
RxString emailPhoneErrorMsg = "".obs;
RxBool isLoading = false.obs;
bool validateEmailPhone() {
if(emailPhoneController.text.isEmpty) {
emailPhoneErrorMsg.value = ConstantText.kEmailPhoneIsRequired;
} else {
emailPhoneErrorMsg.value = "";
}
return emailPhoneErrorMsg.isEmpty;
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
void onSendCodeButton() async {
if(validateEmailPhone()){
isLoading.value = true;
var response = await AuthService().passwordLessLogin(
email: emailPhoneController.text,
);
if (response is bool) {
await LocalStorageManager.saveSession(
tokenKey: LocalStorageKeys.kSaveEmailKey,
tokenValue: emailPhoneController.text,
);
isLoading.value = false;
await Navigator.pushNamed(
screenKey.currentContext!,
CustomRouteNames.kOTPScreenRoute,
arguments: emailPhoneController.text,
);
} else {
isLoading.value = false;
FrequentFunctions.showToast(
message: response["message"],
);
}
}
}
@override
void dispose() {
emailPhoneController.dispose();
Get.delete<AgencySignInController>();
super.dispose();
}
}

View File

@@ -0,0 +1,4 @@
export 'splash_screen_controller.dart';
export 'sing_in_screen_controller.dart';
export 'agency_sign_in_controller.dart';
export 'otp_screen_controller.dart';

View File

@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
class OTPScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
// final TextEditingController otpController = TextEditingController(text: "");
final TextEditingController otpController = TextEditingController(text: "123456");
RxString otpErrorMsg = "".obs;
RxBool isLoading = false.obs;
bool validateOTP() {
if(otpController.text.isEmpty) {
otpErrorMsg.value = ConstantText.kPleaseInputOTP;
} else if(otpController.text.length<6) {
otpErrorMsg.value = ConstantText.kInvalidOTP;
} else {
otpErrorMsg.value = "";
}
return otpErrorMsg.isEmpty;
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
void onSubmitButton() async {
if (validateOTP()) {
var response = await AuthService().verifyOtp(
verificationCode: otpController.text,
).showLoader();
if (response is bool && response == true) {
Navigator.pushNamedAndRemoveUntil(
screenKey.currentContext!,
CustomRouteNames.kDashboardScreenRoute,
(route) => false,
);
} else if (response is String) {
FrequentFunctions.showToast(message: response);
} else {
FrequentFunctions.showToast(message: response.toString());
}
}
}
@override
void dispose() {
otpController.dispose();
Get.delete<OTPScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,116 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:get/get.dart';
class SignInScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
// final emailController = TextEditingController(text: "");
// final passwordController = TextEditingController(text: "");
final emailController = TextEditingController(text: "ashu@gmail.com");
final passwordController = TextEditingController(text: "Abc@1234");
final emailErrorMsg = "".obs, passwordErrorMsg = "".obs;
// final isRememberMe = false.obs;
final isLoading = false.obs;
@override
void onInit() {
emailController.text =
LocalStorageManager.getSessionToken(tokenKey: LocalStorageKeys.kSaveEmailKey);
// isRememberMe.value = _sessionManagement
// .getSessionToken(tokenKey: SessionKeys.kRememberMeKey)
// .toLowerCase() ==
// "true";
emailController.text = 'ashu@gmail.com';
super.onInit();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
bool validateEmail() {
if (emailController.text.isEmpty) {
emailErrorMsg.value = ConstantText.kEmailIsRequired;
} else if (!GetUtils.isEmail(emailController.text)) {
emailErrorMsg.value = ConstantText.kInvalidEmail;
} else {
emailErrorMsg.value = "";
}
return emailErrorMsg.isEmpty;
}
bool validatePassword() {
if (passwordController.text.isEmpty) {
passwordErrorMsg.value = ConstantText.kPasswordIsRequired;
} else {
passwordErrorMsg.value = "";
}
return passwordErrorMsg.isEmpty;
}
void onLogInButton() async {
if (validateEmail() & validatePassword()) {
isLoading.value = true;
var response = await AuthService().loginUser(
email: emailController.text,
password: passwordController.text,
);
if (response is bool) {
// if (isRememberMe.isTrue) {
// await _sessionManagement.saveSession(
// tokenKey: SessionKeys.kRememberMeKey,
// tokenValue: "${isRememberMe.isTrue}",
// );
// }
await LocalStorageManager.saveSession(
tokenKey: LocalStorageKeys.kSaveEmailKey,
tokenValue: emailController.text,
);
isLoading.value = false;
await Navigator.pushNamed(
screenKey.currentContext!,
CustomRouteNames.kOTPScreenRoute,
);
} else {
isLoading.value = false;
FrequentFunctions.showToast(
message: response["message"],
);
}
}
}
void onForgotButton() {
showDialog(
context: screenKey.currentState!.context,
builder: (BuildContext context) {
return CustomForgetPasswordDialog(
dialogButtonCloseText: "Cancel",
dialogButtonAcceptText: "Email Link",
dialogMessageText:
"A password reset link will be sent to your registered email.",
dialogMessageTextBold: "",
headingText: "Send Reset Password Link",
// acceptFunction: (String email) async {
// // await AuthService().forgetPassword(email: email);
// },
);
},
);
}
void onAgencyLogInButton() async {
await Navigator.pushNamed(
screenKey.currentContext!,
CustomRouteNames.kAgencySignInScreenRoute,
);
}
@override
void dispose() {
emailController.dispose();
passwordController.dispose();
Get.delete<SignInScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,119 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/utilities/app_session_manager.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
class SplashScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
@override
void onInit() {
5.seconds.delay(() {
// _gotoLoginScreen();
if (_loginTokenNotFound) {
_gotoLoginScreen();
} else {
_checkOngoingShift();
}
});
super.onInit();
}
//true if login token found in local storage
bool get _loginTokenNotFound {
return LocalStorageManager.getLoginToken().isEmpty;
}
DateTime _getDateTimeObjFor({required int hour, required int minute}) {
return DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day, hour, minute);
}
//Todo: If Shift present then logout half an hour before start time
// Else logout 7am uk time
_checkOngoingShift() {
final shift = LocalStorageManager.getOngoingShift();
//if shift present
if (shift != null) {
///boolean value [isShiftExpired] to check
///if there is an expired shift in local storage.
final isShiftExpired = shift.endTime!.isBefore(TimeOfDay.now());
if (isShiftExpired) {
LocalStorageManager.removeOngoingShift();
} else {
final shiftNotStartedYet = shift.startTime!.isAfter(TimeOfDay.now());
if (shiftNotStartedYet) {
///checking if shift is going to start in 30 minutes or less
if ((shift.startTime!.minute - TimeOfDay.now().minute) <= 30) {
_gotoLoginScreen();
return;
}
///checking if shift is going to start in 60 minutes or less, then
///start session timer which will alert session expire to user
///if 30minutes left in shift start and logout the user.
if ((shift.startTime!.minute - TimeOfDay.now().minute) <= 60) {
//starting session timer
final sessionExpireDateTime = _getDateTimeObjFor(
hour: shift.startTime!.hour,
minute: shift.startTime!.minute,
).subtract(30.minutes);
final millisLeft = sessionExpireDateTime.millisecondsSinceEpoch -
DateTime.now().millisecondsSinceEpoch;
AppSessionManager.instance.startSessionTimer(millisLeft);
}
}
}
} else {
final currentTime = TimeOfDay.now();
const time7am = TimeOfDay(hour: 7, minute: 0);
///checking if current time is before [7:00 AM]
if (currentTime.isBefore(time7am)) {
///checking if remaining 30 minutes or less time
if ((time7am.minute - currentTime.minute) <= 30) {
//starting session timer
final dateTime7am =
_getDateTimeObjFor(hour: time7am.hour, minute: time7am.minute);
final millisLeft = dateTime7am.millisecondsSinceEpoch -
DateTime.now().millisecondsSinceEpoch;
AppSessionManager.instance.startSessionTimer(millisLeft);
}
}
}
_gotoDashboardScreen();
}
_gotoLoginScreen() {
Navigator.pushNamedAndRemoveUntil(
screenKey.currentContext!,
CustomRouteNames.kLoginScreenRoute,
(route) => false,
);
}
_gotoDashboardScreen() {
Navigator.pushNamedAndRemoveUntil(
screenKey.currentContext!,
CustomRouteNames.kDashboardScreenRoute,
(route) => false,
);
}
@override
void dispose() {
Get.delete<SplashScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,100 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/models/clients/HealthIssuesDetailsModel.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import 'careNoteFormControllers/category_subcategory_widget_controller.dart';
class AddDetailsToNewBodyPointScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final healthNoteController = TextEditingController();
final complaintController = TextEditingController();
final catSubCatController = Get.put(CategorySubcategoryWidgetController());
///[isEditing] will be true if using [AddDetailsToNewBodyPointScreen] screen to edit issue details,
/// or say issueData is not null
final isEditing = false.obs;
String serviceUserId = "";
HealthIssueDetailsModel? issueData;
@override
void onReady() {
if (issueData != null) {
isEditing.value = true;
healthNoteController.text = issueData!.healthNote;
complaintController.text = issueData!.complaint;
}
catSubCatController.getBodyParts();
super.onReady();
}
@override
void dispose() {
healthNoteController.dispose();
complaintController.dispose();
catSubCatController.dispose();
super.dispose();
}
Future<void> submitButtonPressed(BuildContext context) async {
if (isEditing.isFalse) {
if (catSubCatController.selectedBodyPart() == null) {
FrequentFunctions.showToast(
message: "Please select category first",
);
return;
}
if (catSubCatController.selectedBodyPart()!.subCategory.isNotEmpty &&
catSubCatController.selectedSubcategory() == null) {
FrequentFunctions.showToast(
message: "Please select subcategory",
);
return;
}
}
if (healthNoteController.text.trim().isEmpty) {
FrequentFunctions.showToast(message: "Health Note is required");
return;
}
if (complaintController.text.trim().isEmpty) {
FrequentFunctions.showToast(message: "Complaint is required");
return;
}
var result = (isEditing.isFalse)
? await ClientService()
.addHealthIssue(
userId: serviceUserId,
category: catSubCatController.selectedSubcategory()?.id ??
catSubCatController.selectedBodyPart()!.id,
healthNote: healthNoteController.text.trim(),
complaint: complaintController.text.trim())
.showLoader()
: await ClientService()
.updateHealthIssueData(
issueId: issueData!.id,
categoryId: issueData!.bodyPointsCategory!.id,
healthNote: healthNoteController.text.trim(),
complaint: complaintController.text.trim())
.showLoader();
if (result is! String) {
Navigator.of(context).pop(true);
} else {
if (result.isNotEmpty) {
FrequentFunctions.showToast(message: result);
}
}
return;
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
}

View File

@@ -0,0 +1,127 @@
import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import '../../models/clients/documents_list_model.dart';
class AddNewDocumentScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
TextEditingController documentTitleController = TextEditingController();
TextEditingController documentDetailsController = TextEditingController();
dynamic arguments;
final docIdReceived = false.obs;
final viewOnly = false.obs;
final serviceUser = Rx<UserData?>(null);
DocumentModel documentModel = DocumentModel.empty();
final docFile = Rx<File?>(null);
RxString docFilePath = "".obs;
@override
void onInit() {
arguments = CustomRouteGenerator.argument;
if (arguments is List &&
arguments[0] is DocumentModel &&
arguments[1] is UserData) {
//Open for Editing
documentModel = arguments[0];
docIdReceived.value = true;
docFilePath.value = documentModel.docPath;
documentTitleController.text = documentModel.title;
documentDetailsController.text = documentModel.details;
serviceUser.value = arguments[1];
} else if (arguments is List && arguments[1] is bool) {
documentModel = arguments[0];
docFilePath.value = documentModel.docPath;
viewOnly.value = true;
documentTitleController.text = documentModel.title;
documentDetailsController.text = documentModel.details;
} else if (arguments is UserData) {
//Open to add new document
serviceUser.value = arguments;
}
super.onInit();
}
onFileChooseButtonTap() async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ["pdf", "doc", "docx", "xlsx", "xls"]);
if (result != null) {
docFile.value = File(result.files.single.path!);
docFilePath.value = result.files.single.path!;
}
}
Future<void> submitButtonPressed() async {
if (validateFields()) {
if (docIdReceived.isTrue) {
//update doc code here
String documentPath = docFilePath.value;
//If doc file is picked than uploading file to server and will be used to update document
if (docFile() != null) {
final resp = await ClientService()
.uploadDocumentService(docPath: docFile()!.path)
.showLoader();
if (resp is String) {
documentPath = resp;
}
}
final response = await ClientService()
.updateDocumentService(
userId: serviceUser()!.id!,
docId: documentModel.id,
docPath: documentPath,
docDetails: documentDetailsController.text,
title: documentTitleController.text,
addedBy: LocalStorageManager.userId)
.showLoader();
if (response is DocumentModel) {
backButtonPressed(argument: response);
} else {
FrequentFunctions.showToast(message: response);
}
} else if (viewOnly.isTrue) {
//view doc code here
} else {
// add doc code here
var response = await ClientService()
.addDocumentService(
userId: serviceUser()!.id!,
docPath: docFile.value!.path ?? "",
docDetails: documentDetailsController.text,
title: documentTitleController.text,
addedBy: LocalStorageManager.userId)
.showLoader();
backButtonPressed(argument: response);
}
} else if (viewOnly.isTrue) {
backButtonPressed();
} else {
FrequentFunctions.showToast(
message: "Please fill all fields and add Required Document");
}
}
void backButtonPressed({dynamic argument}) {
// Get.delete<AddNewDocumentScreenController>();
Navigator.of(screenKey.currentContext!).pop(argument);
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
bool validateFields() {
return documentTitleController.text.isNotEmpty &&
documentDetailsController.text.isNotEmpty &&
(docFile.value != null || docIdReceived.isTrue);
}
}

View File

@@ -0,0 +1,166 @@
import 'package:adoptive_calendar/adoptive_calendar.dart';
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/view/screens/clients/add_new_recent_incident_screen.dart';
import 'package:get/get.dart';
import 'package:quill_html_editor/quill_html_editor.dart';
class AddNewRecentIncidentScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final incidentDateTEC = TextEditingController();
final incidentTitleTEC = TextEditingController();
// TextEditingController incidentDetails = TextEditingController();
QuillEditorController incidentDetailsQuillFieldController =
QuillEditorController();
final selectedDate = DateTime.now().obs;
final isButtonEnabled = false.obs;
// DateTime? fromDateTime, toDateTime;
// RecentIncidentsModel recentIncidentsModel = RecentIncidentsModel.empty();
// String userId = "";
late final AddNewRecentIncidentsScreenArgs arguments;
AddNewRecentIncidentScreenController(AddNewRecentIncidentsScreenArgs args) {
arguments = args;
}
@override
void onInit() {
incidentTitleTEC.addListener(_onIncidentTitleChanged);
selectedDate.listen(_setDateTimeInField);
_setDateTimeInField(selectedDate());
fetchDataFromServiceAndSetToVariables();
super.onInit();
}
_onIncidentTitleChanged() {
isButtonEnabled.value = incidentTitleTEC.text.isNotEmpty;
}
_setDateTimeInField(DateTime d) {
incidentDateTEC.text = FrequentFunctions.careNoteDateFormatter.format(d);
}
void fetchDataFromServiceAndSetToVariables() async {
if (arguments.incidentsModel != null) {
selectedDate.value = DateTime.fromMillisecondsSinceEpoch(
arguments.incidentsModel!.incidentDate);
incidentTitleTEC.text = arguments.incidentsModel!.incidentTitle;
await incidentDetailsQuillFieldController
.setText(arguments.incidentsModel!.note);
// isButtonEnabled.value = incidentTitleTEC.text.isNotEmpty;
}
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
selectDate(context) async {
Get.focusScope?.unfocus();
final DateTime? d = await showDialog(
context: context,
builder: (BuildContext context) {
return AdoptiveCalendar(
initialDate: DateTime.now(),
action: true,
);
},
);
if (d != null) {
selectedDate.value = d;
// incidentDateTEC.text = FrequentFunctions.careNoteDateFormatter.format(d);
}
}
// Future<void> selectDateFromPicker(
// {required BuildContext context,
// required DateTime minDate,
// required DateTime maxDate}) async {
// try {
// final selected = await showDatePicker(
// context: context,
// initialDate: selectedDate.value,
// firstDate: minDate,
// lastDate: maxDate,
// // initialDate: minDate,
// // firstDate: DateTime.now(),
// // lastDate: DateTime(DateTime.now().year+1),
// // selectableDayPredicate: _showDatesToEnable,
// builder: (BuildContext context, Widget? child) {
// return Theme(
// data: ThemeData.light().copyWith(
// primaryColor: CustomAppColors.kSecondaryColor,
// colorScheme: const ColorScheme.light(
// primary: CustomAppColors.kSecondaryColor),
// buttonTheme: const ButtonThemeData(
// buttonColor: CustomAppColors.kSecondaryColor),
// ),
// child: child!,
// );
// });
// if (selected != null) {
// // updating selected date range based on selected week
// // setState(() {
// selectedDate.value = selected;
// // });
// // widget.onDayPressed?.call(
// // selected, widget.markedDatesMap?.getEvents(selected) ?? const []);
// }
// } catch (e) {
// FrequentFunctions.showDialog(
// context: context,
// title: 'Alert',
// description:
// 'Something went wrong!! Please check your Date and Time Settings',
// type: DialogType.error,
// btnOkColor: CustomAppColors.kRedColor);
// }
// }
Future<void> submitButtonPressed(BuildContext context) async {
dynamic response;
if (arguments.userId.isNotNullOrEmpty()) {
response = await ClientService()
.addRecentIncidentService(
userId: arguments.userId!,
incidentTitle: incidentTitleTEC.text,
note: await incidentDetailsQuillFieldController.getText(),
incidentDate: selectedDate.value.millisecondsSinceEpoch,
)
.showLoader();
} else if (arguments.incidentsModel != null) {
response = await ClientService()
.updateRecentIncidentService(
incidentId: arguments.incidentsModel!.incidentId,
incidentNote: await incidentDetailsQuillFieldController.getText(),
incidentTitle: incidentTitleTEC.text,
incidentDate: selectedDate.value.millisecondsSinceEpoch,
)
.showLoader();
}
onBackPress(context, response: response);
}
void onBackPress(BuildContext context, {dynamic response}) {
// Get.delete<AddNewRecentIncidentScreenController>();
Navigator.pop(context, response);
}
@override
void dispose() {
incidentDateTEC.dispose();
incidentTitleTEC.dispose();
incidentTitleTEC.removeListener(_onIncidentTitleChanged);
Get.delete<AddNewRecentIncidentScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,121 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/allCareNotes/AllCareNotesListResponse.dart';
import 'package:ftc_mobile_app/models/clients/allCareNotes/CarePlans.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import '../../utilities/frequent_functions.dart';
import '../../web_services/client_services.dart';
class AllCareNotesScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final notesList = RxList<CarePlan>();
final canLoadMore = RxBool(false);
int _total = 0;
final int _limit = 20;
int _skip = 0;
bool loadingMore = false;
final _listRC = RefreshController(initialRefresh: false);
RefreshController get listRC => _listRC;
final _listSC = ScrollController();
ScrollController get listSC => _listSC;
String serviceUserId = "";
@override
void onInit() {
super.onInit();
notesList.listen((list) {
canLoadMore.value = list.length < _total;
});
}
void onRefresh() async {
await getCareNotesList();
_listRC.refreshCompleted();
}
void onLoading() async {
if (!loadingMore) {
await _loadMore();
}
_listRC.loadComplete();
}
Future<void> getCareNotesList() async {
_skip = 0;
var response = await ClientService()
.getCarePlansList(
serviceUserId: serviceUserId,
limit: _limit,
offset: _skip,
)
.showLoader();
if (response is AllCareNotesListResponse) {
if (response.data?.carePlans?.isNotEmpty == true) {
_total = response.data?.carePlanCount ?? 0;
_skip += _limit;
notesList.value = (response.data?.carePlans ?? [])
..sort((a, b) {
if (b.flag == true) {
return 1;
}
return -1;
});
} else {
notesList.clear();
}
} else if (response is String && response.isNotEmpty) {
notesList.clear();
FrequentFunctions.showToast(message: response);
} else {
notesList.clear();
}
}
Future<void> _loadMore() async {
if (canLoadMore.isTrue) {
loadingMore = true;
var response = await ClientService().getCarePlansList(
serviceUserId: serviceUserId,
limit: _limit,
offset: _skip,
);
loadingMore = false;
if (response is AllCareNotesListResponse) {
if (response.data?.carePlans?.isNotEmpty == true) {
_skip += _limit;
notesList.addAll(response.data?.carePlans ?? []);
}
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
}
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<AllCareNotesScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<AllCareNotesScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,71 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import '../../ftc_mobile_app.dart';
import '../../models/appointmentsListResponse/AppointmentsListResponse.dart';
class AppointmentScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final appointments = <AppointmentsListResponseData>[].obs;
final _listRC = RefreshController(initialRefresh: false);
RefreshController get listRC => _listRC;
final _listSC = ScrollController();
ScrollController get listSC => _listSC;
String serviceUserId = "";
@override
void onReady() {
super.onReady();
getAppointmentsList();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
void onRefresh() async {
await getAppointmentsList();
_listRC.refreshCompleted();
}
Future<void> getAppointmentsList() async {
try {
if (serviceUserId.isEmpty) {
throw Exception("serviceUserId is not assigned");
}
final response = await ClientService()
.getAppointmentsList(
serviceId: serviceUserId,
startDate: DateTime.now().subtract(28.days).millisecondsSinceEpoch,
endDate: DateTime.now().add(28.days).millisecondsSinceEpoch,
)
.showLoader();
if (response.success == true) {
appointments.value = response.data ?? [];
} else {
if (response.message.isNotNullOrEmpty()) {
FrequentFunctions.showToast(message: response.message!);
}
}
} catch (e) {
debugPrint("getAppointmentsList error");
debugPrint(e.toString());
}
}
@override
void dispose() {
_listSC.dispose();
Get.delete<AppointmentScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/ABC_form_html_request.dart';
import 'package:get/get.dart';
import 'common_care_note_forms_controller.dart';
class ABCFormScreenController extends CommonCareNoteFormsController {
final antecedentEventsController = TextEditingController();
final behaviourController = TextEditingController();
final consequenceEventsController = TextEditingController();
ABCFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void dispose() {
antecedentEventsController.dispose();
behaviourController.dispose();
consequenceEventsController.dispose();
Get.delete<ABCFormScreenController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (antecedentEventsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Antecedent Events field is required",
);
return;
}
if (behaviourController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Behaviour field is required",
);
return;
}
if (consequenceEventsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Consequence Events field is required",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
noteDetails: ABCFormHtmlRequest(
antecedentEvents: antecedentEventsController.text.trim(),
behaviour: behaviourController.text.trim(),
consequenceEvents: consequenceEventsController.text.trim(),
).toHtml()),
);
}
}

View File

@@ -0,0 +1,46 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/physical_intervention_form_html_request.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/safeguarding_form_html_request.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/web_services/client_services.dart';
import 'package:get/get.dart';
import '../../../models/clients/body_points_category.dart';
import 'common_care_note_forms_controller.dart';
class CategorySubcategoryWidgetController extends GetxController {
final bodyPointsCategoryList = RxList<BodyPointsCategory>();
final selectedBodyPart = Rx<BodyPointsCategory?>(null);
final selectedSubcategory = Rx<SubCat?>(null);
@override
void dispose() {
Get.delete<CategorySubcategoryWidgetController>();
super.dispose();
}
getBodyParts() async {
var result = await ClientService().getBodyPointsCategoryList().showLoader();
if (result is List && result is List<BodyPointsCategory>) {
log('---------------bodyPointsCategoryList length before set -----------${bodyPointsCategoryList.length}');
List<BodyPointsCategory> uniqueList = removeDuplicates(result);
bodyPointsCategoryList.value = uniqueList;
// selectedBodyPart.value = bodyPointsCategoryList.first;
}
}
List<BodyPointsCategory> removeDuplicates(List<BodyPointsCategory> list) {
List<BodyPointsCategory> uniqueList = [];
Set<String> enumedSet = {};
for (var category in list) {
if (!enumedSet.contains(category.idOne)) {
uniqueList.add(category);
enumedSet.add(category.idOne);
}
}
return uniqueList;
}
}

View File

@@ -0,0 +1,89 @@
import 'dart:convert';
import 'package:adoptive_calendar/adoptive_calendar.dart';
import 'package:ftc_mobile_app/models/response_model.dart';
import 'package:ftc_mobile_app/models/user_model.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/web_services/client_services.dart';
import 'package:get/get.dart';
import '../../../models/create_care_plan_request.dart';
import 'package:flutter/material.dart';
import '../../../utilities/export_utilities.dart';
export '../../../utilities/export_utilities.dart';
export '../../../models/create_care_plan_request.dart';
class CommonCareNoteFormArgs {
final String serviceUserId;
final String noteType;
CommonCareNoteFormArgs({required this.serviceUserId, required this.noteType});
}
abstract class CommonCareNoteFormsController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final dateController = TextEditingController();
DateTime? date;
final CommonCareNoteFormArgs args;
CommonCareNoteFormsController({required this.args});
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
selectDate(context) async {
Get.focusScope?.unfocus();
final DateTime? d = await showDialog(
context: context,
builder: (BuildContext context) {
return AdoptiveCalendar(
initialDate: DateTime.now(),
action: true,
);
},
);
if (d != null) {
date = d;
dateController.text = FrequentFunctions.careNoteDateFormatter.format(d);
}
}
Future<dynamic> onFormSubmit({required CreateCarePlanRequest request}) async {
// final userJson = LocalStorageManager.getSessionToken(
// tokenKey: LocalStorageKeys.kUserModelKey,
// );
// print("userJson: $userJson");
// final userModel = UserModel.fromJson(jsonDecode(userJson));
request.addedby = LocalStorageManager.userId;
request.userId = args.serviceUserId;
request.noteType = args.noteType;
if (date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
request.eventDateTime = date!.toUtc().millisecondsSinceEpoch;
final response =
await ClientService().createCarePlan(request: request).showLoader();
if (response is ResponseModel) {
Navigator.pop(screenKey.currentContext!);
Navigator.pop(screenKey.currentContext!);
FrequentFunctions.showToast(message: response.statusDescription);
} else {
FrequentFunctions.showToast(message: response['message']);
}
}
@override
void dispose() {
dateController.dispose();
super.dispose();
}
}

View File

@@ -0,0 +1,285 @@
import 'package:adoptive_calendar/adoptive_calendar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../../../models/clients/careNoteFormsRequests/HtmlTableOption.dart';
import '../../../models/clients/careNoteFormsRequests/consent_capacity_html_request.dart';
import 'common_care_note_forms_controller.dart';
import 'package:flutter/services.dart' show rootBundle;
class ConsentCapacityFormScreenController
extends CommonCareNoteFormsController {
final commentsController = TextEditingController();
final mentalCapacityAssessmentDetailController = TextEditingController();
final specificDecisionDetailController = TextEditingController();
final roleController = TextEditingController();
final organisationController = TextEditingController();
final addressController = TextEditingController();
final telController = TextEditingController();
final emailController = TextEditingController();
final lackCapacityToMakeParticularDecisionDetailController =
TextEditingController();
final recordYourEvidenceDescribeController = TextEditingController();
final viableOptionsConsideredController = TextEditingController();
final explainWhyTickedBoxController = TextEditingController();
final impairmentDescribeController = TextEditingController();
final describeCanPersonDecisionInfoController = TextEditingController();
final describeCanTheyRetainController = TextEditingController();
final describeCanTheyUseController = TextEditingController();
final describeCanTheyCommunicateController = TextEditingController();
final evidenceController = TextEditingController();
final whatIsYourEvidenceController = TextEditingController();
final seekingManagementDescribeController = TextEditingController();
final recordInterviewDescribeController = TextEditingController();
final requireIMCAController = TextEditingController();
final designationController = TextEditingController();
final baseAddressController = TextEditingController();
final contactDetailsController = TextEditingController();
final name1Controller = TextEditingController();
final dontHaveDecisionNameController = TextEditingController();
final haveDecisionNameController = TextEditingController();
final assessorsName4Controller = TextEditingController();
final assessmentDateTimeController = TextEditingController();
final dontHaveDecisionDateController = TextEditingController();
final haveDecisionDateController = TextEditingController();
final whyIMCARequiredDateController = TextEditingController();
//Yes/No radio selected options
final selectedMCARequiredOption = Rx<String?>(null);
final selectedImpairmentOption = Rx<String?>(null);
final selectedCanPersonDecisionInfoOption = Rx<String?>(null);
final selectedCanTheyRetainOption = Rx<String?>(null);
final selectedCanTheyUseOption = Rx<String?>(null);
final selectedCanTheyCommunicateOption = Rx<String?>(null);
final selectedDoYouHaveConcernOption = Rx<String?>(null);
final selectedDoesRequireIMCAOption = Rx<String>("No");
List<HtmlTableOption> canDecisionBeDelayedOptions = [
HtmlTableOption(id: '1', requirements: 'The decision can be delayed'),
HtmlTableOption(
id: '2', requirements: 'Not appropriate to delay the decision'),
HtmlTableOption(
id: '3',
requirements: 'Person not likely to gain or develop capacity '),
];
List<HtmlTableOption> causativeNexusOptions = [
HtmlTableOption(id: '1', requirements: 'Yes, there is a causative link '),
HtmlTableOption(
id: '2',
requirements:
'No, there is not a causative link, so the person has capacity to make the relevant decision. The decision may therefore be an unwise decision. '),
];
DateTime? assessmentDateTime;
DateTime? dontHaveDecisionDateTime;
DateTime? haveDecisionDateTime;
DateTime? whyIMCARequiredDateTime;
String consentCapacityHtml = "";
ConsentCapacityFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void onInit() {
loadConsentCapacityHtmlFile();
super.onInit();
}
@override
void dispose() {
commentsController.dispose();
mentalCapacityAssessmentDetailController.dispose();
specificDecisionDetailController.dispose();
roleController.dispose();
organisationController.dispose();
addressController.dispose();
telController.dispose();
emailController.dispose();
assessmentDateTimeController.dispose();
lackCapacityToMakeParticularDecisionDetailController.dispose();
recordYourEvidenceDescribeController.dispose();
viableOptionsConsideredController.dispose();
explainWhyTickedBoxController.dispose();
impairmentDescribeController.dispose();
describeCanPersonDecisionInfoController.dispose();
describeCanTheyRetainController.dispose();
describeCanTheyUseController.dispose();
describeCanTheyCommunicateController.dispose();
evidenceController.dispose();
whatIsYourEvidenceController.dispose();
seekingManagementDescribeController.dispose();
recordInterviewDescribeController.dispose();
requireIMCAController.dispose();
designationController.dispose();
baseAddressController.dispose();
contactDetailsController.dispose();
name1Controller.dispose();
dontHaveDecisionNameController.dispose();
haveDecisionNameController.dispose();
assessorsName4Controller.dispose();
dontHaveDecisionDateController.dispose();
haveDecisionDateController.dispose();
whyIMCARequiredDateController.dispose();
Get.delete<ConsentCapacityFormScreenController>();
super.dispose();
}
Future loadConsentCapacityHtmlFile() async {
final htmlString =
await rootBundle.loadString(AssetsManager.kConsentCapacityFormHtml);
consentCapacityHtml = htmlString;
}
Future<DateTime?> _unFocusAndPickDate(BuildContext context) async {
Get.focusScope?.unfocus();
return await showDialog(
context: context,
builder: (BuildContext context) {
return AdoptiveCalendar(
initialDate: DateTime.now(),
action: true,
);
},
);
}
selectAssessmentDateTime(BuildContext context) async {
final d = await _unFocusAndPickDate(context);
if (d != null) {
assessmentDateTime = d;
assessmentDateTimeController.text =
FrequentFunctions.careNoteDateFormatter.format(d);
}
}
selectDontHaveDecisionDateTime(BuildContext context) async {
final d = await _unFocusAndPickDate(context);
if (d != null) {
dontHaveDecisionDateTime = d;
dontHaveDecisionDateController.text =
FrequentFunctions.careNoteDateFormatter.format(d);
}
}
selectHaveDecisionDateTime(BuildContext context) async {
final d = await _unFocusAndPickDate(context);
if (d != null) {
haveDecisionDateTime = d;
haveDecisionDateController.text =
FrequentFunctions.careNoteDateFormatter.format(d);
}
}
selectDateTimeOfWhyIMCARequired(BuildContext context) async {
final d = await _unFocusAndPickDate(context);
if (d != null) {
whyIMCARequiredDateTime = d;
whyIMCARequiredDateController.text =
FrequentFunctions.careNoteDateFormatter.format(d);
}
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (commentsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Comments field is required",
);
return;
}
super.removeFocus();
final formatter = DateFormat("dd/MM/yyyy / hh:mm aa");
final consentCapacityHtmlString = ConsentCapacityHtmlRequest(
isMCARequired: selectedMCARequiredOption()!,
comments: commentsController.text.trim(),
mentalCapacityAssessmentDetail:
mentalCapacityAssessmentDetailController.text.trim(),
specificDecisionDetail: specificDecisionDetailController.text.trim(),
personUndertakingName: name1Controller.text.trim(),
personUndertakingRole: roleController.text.trim(),
organisation: organisationController.text.trim(),
address: addressController.text.trim(),
tel: telController.text.trim(),
email: emailController.text.trim(),
dateAndTimeOfAssessment: (assessmentDateTime != null)
? formatter.format(assessmentDateTime!)
: "",
lackCapacityToMakeParticularDecisionDetail:
lackCapacityToMakeParticularDecisionDetailController.text.trim(),
recordYourEvidenceDescribe:
recordYourEvidenceDescribeController.text.trim(),
viableOptionsConsidered: viableOptionsConsideredController.text.trim(),
explainWhyTickedBox: explainWhyTickedBoxController.text.trim(),
canDecisionBeDelayedOptions: canDecisionBeDelayedOptions,
selectedImpairmentOption: selectedImpairmentOption() ?? "",
impairmentDescribe: impairmentDescribeController.text.trim(),
selectedCanPersonDecisionInfoOption:
selectedCanPersonDecisionInfoOption() ?? "",
describeCanPersonDecisionInfo:
describeCanPersonDecisionInfoController.text.trim(),
selectedCanTheyRetainOption: selectedCanTheyRetainOption() ?? "",
describeCanTheyRetain: describeCanTheyRetainController.text.trim(),
selectedCanTheyUseOption: selectedCanTheyUseOption() ?? "",
describeCanTheyUse: describeCanTheyUseController.text.trim(),
selectedCanTheyCommunicateOption:
selectedCanTheyCommunicateOption() ?? "",
describeCanTheyCommunicate:
describeCanTheyCommunicateController.text.trim(),
causativeNexusOptions: causativeNexusOptions,
evidence: evidenceController.text.trim(),
selectedDoYouHaveConcernOption: selectedDoYouHaveConcernOption() ?? "",
whatIsYourEvidence: whatIsYourEvidenceController.text.trim(),
seekingManagementDescribe:
seekingManagementDescribeController.text.trim(),
recordInterviewDescribe: recordInterviewDescribeController.text.trim(),
section9DontHaveDecisionNameData:
dontHaveDecisionNameController.text.trim(),
section9DontHaveDecisionDateData: (dontHaveDecisionDateTime != null)
? formatter.format(dontHaveDecisionDateTime!)
: "",
section9HaveDecisionNameData: haveDecisionNameController.text.trim(),
section9HaveDecisionDateData: (haveDecisionDateTime != null)
? formatter.format(haveDecisionDateTime!)
: "",
isIMCARequired: selectedDoesRequireIMCAOption(),
giveWhyIMCARequiredReason: requireIMCAController.text.trim(),
whyIMCARequiredDateTime: (whyIMCARequiredDateTime != null)
? formatter.format(whyIMCARequiredDateTime!)
: "",
section9AssessorsName: assessorsName4Controller.text.trim(),
assessorsDesignation: designationController.text.trim(),
assessorsBaseAddress: baseAddressController.text.trim(),
assessorsContactDetailsData: contactDetailsController.text.trim(),
).toHtml(consentCapacityHtml);
// log("consentCapacityHtmlString: $consentCapacityHtmlString");
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
noteDetails: consentCapacityHtmlString,
),
);
}
}

View File

@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'common_care_note_forms_controller.dart';
class FreeTextEntriesFormScreenController
extends CommonCareNoteFormsController {
final titleController = TextEditingController();
final noteDetailsController = TextEditingController();
final flagForHandover = false.obs;
FreeTextEntriesFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void dispose() {
titleController.dispose();
noteDetailsController.dispose();
Get.delete<FreeTextEntriesFormScreenController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (titleController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Title field is required",
);
return;
}
if (noteDetailsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Note Details field is required",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
title: titleController.text.trim(),
noteDetails: noteDetailsController.text.trim(),
flag: flagForHandover(),
),
);
}
}

View File

@@ -0,0 +1,76 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/health_appointments_form_html_request.dart';
import 'package:get/get.dart';
import 'common_care_note_forms_controller.dart';
class HealthAppointmentsFormScreenController
extends CommonCareNoteFormsController {
final reasonController = TextEditingController();
final commentsController = TextEditingController();
final appointmentWith = [
"GP",
"CAMHS",
"Psychologist",
"A&E",
"Sexual Health",
"Social Worker",
"Other"
];
String? selectedAppointmentWith;
HealthAppointmentsFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void dispose() {
reasonController.dispose();
commentsController.dispose();
Get.delete<HealthAppointmentsFormScreenController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (selectedAppointmentWith == null) {
FrequentFunctions.showToast(
message: "Please select appointment with",
);
return;
}
if (reasonController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Reason for appointment field is required",
);
return;
}
if (commentsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Comments field is required",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
noteDetails: HealthAppointmentsFormHtmlRequest(
appointmentWith: selectedAppointmentWith!,
reason: reasonController.text.trim(),
comments: commentsController.text.trim(),
).toHtml(),
),
);
}
}

View File

@@ -0,0 +1,152 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'category_subcategory_widget_controller.dart';
import 'common_care_note_forms_controller.dart';
class InjuryHealthIssueFormScreenController
extends CommonCareNoteFormsController {
final nameOfWitnesses = TextEditingController();
final placeOfAccident = TextEditingController();
final accidentDescription = TextEditingController();
final recordOfInjury = TextEditingController();
final conditionOfPatient = TextEditingController();
final nameOfParentContacted = TextEditingController();
final parentContactedTime = TextEditingController();
final isParentContacted = RxString("No");
final howParentContacted = Rx<String?>(null);
final catSubCatController = Get.put(CategorySubcategoryWidgetController());
InjuryHealthIssueFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void onReady() {
catSubCatController.getBodyParts();
super.onReady();
}
@override
void dispose() {
nameOfWitnesses.dispose();
placeOfAccident.dispose();
accidentDescription.dispose();
recordOfInjury.dispose();
conditionOfPatient.dispose();
nameOfParentContacted.dispose();
parentContactedTime.dispose();
catSubCatController.dispose();
Get.delete<InjuryHealthIssueFormScreenController>();
super.dispose();
}
selectParentContactTime(context) async {
Get.focusScope?.unfocus();
TimeOfDay? timeOfDay = await FrequentFunctions.selectTime(context,
selectedTime: TimeOfDay.now(),
themeColor: Get.theme.colorScheme.primary);
if (timeOfDay != null) {
parentContactedTime.text = timeOfDay.format(context);
}
}
Future<void> onSaveButtonTap() async {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (nameOfWitnesses.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Name of witnesses/adults present field is required",
);
return;
}
if (placeOfAccident.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Place accident occured field is required",
);
return;
}
if (accidentDescription.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Description how the accident occured field is required",
);
return;
}
if (catSubCatController.selectedBodyPart() == null) {
FrequentFunctions.showToast(
message: "Please select category first",
);
return;
}
if (catSubCatController.selectedBodyPart()!.subCategory.isNotEmpty &&
catSubCatController.selectedSubcategory() == null) {
FrequentFunctions.showToast(
message: "Please select subcategory",
);
return;
}
if (isParentContacted() == "Yes" &&
nameOfParentContacted.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Name of parent contacted field is required",
);
return;
}
if (isParentContacted() == "Yes" &&
parentContactedTime.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Please select parent contacted time",
);
return;
}
if (isParentContacted() == "Yes" && howParentContacted() == null) {
FrequentFunctions.showToast(
message: "Please select how parent was contacted",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
category: catSubCatController.selectedSubcategory()?.id ??
catSubCatController.selectedBodyPart()!.id,
noteDetails: CreateCarePlanRequest.injuryHealthIssueHtmlReq(
nameOfWitnesses: nameOfWitnesses.text.trim(),
placeOfAccident: placeOfAccident.text.trim(),
accidentDescription: accidentDescription.text.trim(),
recordOfInjury: recordOfInjury.text.trim(),
conditionOfPatient: conditionOfPatient.text.trim(),
isParentContacted: isParentContacted(),
nameOfParentContacted: isParentContacted() != "Yes"
? null
: nameOfParentContacted.text.trim(),
parentContactedTime: isParentContacted() != "Yes"
? null
: parentContactedTime.text.trim(),
howParentContacted:
isParentContacted() != "Yes" ? null : howParentContacted()!,
),
),
);
}
}

View File

@@ -0,0 +1,60 @@
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../../../models/mood_rating_data.dart';
import 'common_care_note_forms_controller.dart';
class MoodRatingFormController extends CommonCareNoteFormsController {
MoodRatingFormController({required super.args});
final ratings = <MoodRatingData>[
MoodRatingData(icon: AssetsManager.ratingsIcAngry, name: 'Angry'),
MoodRatingData(icon: AssetsManager.ratingsIcBored, name: 'Bored'),
MoodRatingData(icon: AssetsManager.ratingsIcCalm, name: 'Calm'),
MoodRatingData(icon: AssetsManager.ratingsIcConfident, name: 'Confident'),
MoodRatingData(icon: AssetsManager.ratingsIcExcited, name: 'Excited'),
MoodRatingData(icon: AssetsManager.ratingsIcHappy, name: 'Happy'),
MoodRatingData(icon: AssetsManager.ratingsIcHopeful, name: 'Hopeful'),
MoodRatingData(icon: AssetsManager.ratingsIcNervous, name: 'Nervous'),
MoodRatingData(icon: AssetsManager.ratingsIcProud, name: 'Proud'),
MoodRatingData(icon: AssetsManager.ratingsIcRelaxed, name: 'Relaxed'),
MoodRatingData(icon: AssetsManager.ratingsIcSad, name: 'Sad'),
MoodRatingData(icon: AssetsManager.ratingsIcScared, name: 'Scared'),
MoodRatingData(icon: AssetsManager.ratingsIcTired, name: 'Tired'),
MoodRatingData(icon: AssetsManager.ratingsIcWorried, name: 'Worried'),
];
final Rx<MoodRatingData?> selectedRating = Rx<MoodRatingData?>(null);
@override
void dispose() {
Get.delete<MoodRatingFormController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (selectedRating() == null) {
FrequentFunctions.showToast(
message: "Please select your mood rating",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
title: "Mood Rating is ${selectedRating()!.name}",
noteDetails:
"Mood Rating is ${selectedRating()!.name} at ${DateFormat("hh:mm aa on dd/MM/yyyy").format(date!)}",
moodRating: selectedRating()!.name,
),
);
}
}

View File

@@ -0,0 +1,67 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/nutrition_hydration_form_html_request.dart';
import 'package:get/get.dart';
import 'common_care_note_forms_controller.dart';
abstract class NutritionHydrationType {
static const String food = "Food";
static const String fluid = "Fluid";
}
class NutritionHydrationFormScreenController
extends CommonCareNoteFormsController {
final mealDrinkTypeController = TextEditingController();
final amountController = TextEditingController();
final commentsController = TextEditingController();
final selectedType = RxString(NutritionHydrationType.food);
final typeOptions = [
NutritionHydrationType.food,
NutritionHydrationType.fluid
];
NutritionHydrationFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void dispose() {
mealDrinkTypeController.dispose();
amountController.dispose();
commentsController.dispose();
Get.delete<NutritionHydrationFormScreenController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (commentsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Comments field is required",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
noteDetails: NutritionHydrationFormHtmlRequest(
nutritionHydrationType: selectedType(),
foodFluidType: mealDrinkTypeController.text.trim(),
foodFluidAmount: amountController.text.trim(),
comments: commentsController.text.trim(),
).toHtml(),
),
);
}
}

View File

@@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/observations_form_html_request.dart';
import 'package:get/get.dart';
import 'common_care_note_forms_controller.dart';
class ObservationsFormScreenController extends CommonCareNoteFormsController {
final heartRateController = TextEditingController();
final bloodPressureController = TextEditingController();
final respiratoryRateController = TextEditingController();
final oxygenController = TextEditingController();
final temperatureController = TextEditingController();
final bloodSugarController = TextEditingController();
ObservationsFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void dispose() {
heartRateController.dispose();
bloodPressureController.dispose();
respiratoryRateController.dispose();
oxygenController.dispose();
temperatureController.dispose();
bloodSugarController.dispose();
Get.delete<ObservationsFormScreenController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (heartRateController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Heart Rate field is required",
);
return;
}
if (bloodPressureController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Blood Pressure field is required",
);
return;
}
if (respiratoryRateController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Respiratory Rate field is required",
);
return;
}
if (oxygenController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Oxygen field is required",
);
return;
}
if (temperatureController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Temperature field is required",
);
return;
}
if (bloodSugarController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Blood Sugar field is required",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
noteDetails: ObservationsFormHtmlReq(
heartRate: heartRateController.text.trim(),
bloodPressure: bloodPressureController.text.trim(),
respiratoryRate: respiratoryRateController.text.trim(),
oxygen: oxygenController.text.trim(),
temperature: temperatureController.text.trim(),
bloodSugar: bloodSugarController.text.trim(),
).toHtml(),
),
);
}
}

View File

@@ -0,0 +1,209 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/physical_intervention_form_html_request.dart';
import 'package:get/get.dart';
import '../../../models/clients/careNoteFormsRequests/HtmlTableOption.dart';
import 'category_subcategory_widget_controller.dart';
import 'common_care_note_forms_controller.dart';
class PhysicalInterventionFormScreenController
extends CommonCareNoteFormsController {
final durationOfIncidentController = TextEditingController();
final staffDebriefFormNumberController = TextEditingController();
final nameOfWitnessController = TextEditingController();
final incidentPlaceController = TextEditingController();
final whatWasUsedController = TextEditingController();
final wasThePbsFollowedController = TextEditingController();
final reasonForPhysicalInterventionController = TextEditingController();
final staffInvolvedController = TextEditingController();
final conditionOfServiceUserController = TextEditingController();
final userClamedController = TextEditingController();
final explainController = TextEditingController();
final commentsController = TextEditingController();
final nameOfParentContacted = TextEditingController();
final parentContactedTime = TextEditingController();
final isParentContacted = RxString("No");
final howParentContacted = Rx<String?>(null);
final howFormSharedRx = Rx<String?>(null);
final catSubCatController = Get.put(CategorySubcategoryWidgetController());
List<HtmlTableOption> whyForceNecessaryOptions = [
HtmlTableOption(
id: '1', requirements: 'Service User was placing themselves at risk'),
HtmlTableOption(
id: '2', requirements: 'Service User was placing others at risk'),
HtmlTableOption(
id: '3', requirements: 'Significant Damage to property'),
HtmlTableOption(
id: '4', requirements: 'Illegal offence was being carried out'),
HtmlTableOption(id: '5', requirements: 'Other'),
];
final isParentContactedOptions = ['Yes', 'No'];
final howParentContactedOptions = [
'Call',
'Email',
'Other',
'Upon collection/drop off'
];
final howFormSharedOptions = ['Paper', 'Email', 'Other'];
PhysicalInterventionFormScreenController(
{required CommonCareNoteFormArgs args})
: super(args: args);
@override
void onReady() {
catSubCatController.getBodyParts();
super.onReady();
}
@override
void dispose() {
durationOfIncidentController.dispose();
staffDebriefFormNumberController.dispose();
nameOfWitnessController.dispose();
incidentPlaceController.dispose();
whatWasUsedController.dispose();
wasThePbsFollowedController.dispose();
reasonForPhysicalInterventionController.dispose();
staffInvolvedController.dispose();
conditionOfServiceUserController.dispose();
userClamedController.dispose();
explainController.dispose();
commentsController.dispose();
nameOfParentContacted.dispose();
parentContactedTime.dispose();
catSubCatController.dispose();
Get.delete<PhysicalInterventionFormScreenController>();
super.dispose();
}
selectParentContactTime(context) async {
Get.focusScope?.unfocus();
TimeOfDay? timeOfDay = await FrequentFunctions.selectTime(context,
selectedTime: TimeOfDay.now(),
themeColor: Get.theme.colorScheme.primary);
if (timeOfDay != null) {
parentContactedTime.text = timeOfDay.format(context);
}
}
Future<void> onSaveButtonTap() async {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (durationOfIncidentController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Concerns about the service user field is required",
);
return;
}
if (staffDebriefFormNumberController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Voice of the service user field is required",
);
return;
}
if (nameOfWitnessController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Are there any immediate risks field is required",
);
return;
}
if (catSubCatController.selectedBodyPart() == null) {
FrequentFunctions.showToast(
message: "Please select category first",
);
return;
}
if (catSubCatController.selectedBodyPart()!.subCategory.isNotEmpty &&
catSubCatController.selectedSubcategory() == null) {
FrequentFunctions.showToast(
message: "Please select subcategory",
);
return;
}
if (isParentContacted() == "Yes" &&
nameOfParentContacted.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Name of parent contacted field is required",
);
return;
}
if (isParentContacted() == "Yes" &&
parentContactedTime.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Please select parent contacted time",
);
return;
}
if (isParentContacted() == "Yes" && howParentContacted() == null) {
FrequentFunctions.showToast(
message: "Please select how parent was contacted",
);
return;
}
if (howFormSharedRx() == null) {
FrequentFunctions.showToast(
message: "Please select How was this form shared with parents/carers?",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
category: catSubCatController.selectedSubcategory()?.id ??
catSubCatController.selectedBodyPart()!.id,
noteDetails: PhysicalInterventionFormHtmlRequest(
durationOfIncidents: durationOfIncidentController.text.trim(),
staffDebriefFormNumber:
staffDebriefFormNumberController.text.trim(),
nameOfWitnesses: nameOfWitnessController.text.trim(),
placeOfIncident: incidentPlaceController.text.trim(),
priorToIntervention: whatWasUsedController.text.trim(),
pbsFollowed: wasThePbsFollowedController.text.trim(),
reasonForPhysicalIntervention:
reasonForPhysicalInterventionController.text.trim(),
staffInvolvedInPI: staffInvolvedController.text.trim(),
conditionOfSU: conditionOfServiceUserController.text.trim(),
howSuCalmed: userClamedController.text.trim(),
useOfForceNecessary: whyForceNecessaryOptions,
pleaseExplain: explainController.text.trim(),
isParentContacted: isParentContacted(),
nameOfParentContacted: isParentContacted() != "Yes"
? ""
: nameOfParentContacted.text.trim(),
parentContactedTime: isParentContacted() != "Yes"
? ""
: parentContactedTime.text.trim(),
howParentContacted:
isParentContacted() != "Yes" ? "" : howParentContacted()!,
parentCarersComments: commentsController.text.trim(),
howFormWasShared: howFormSharedRx()!)
.toHtml(),
),
);
}
}

View File

@@ -0,0 +1,138 @@
import 'package:adoptive_calendar/adoptive_calendar.dart';
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/safeguarding_form_html_request.dart';
import 'package:get/get.dart';
import 'category_subcategory_widget_controller.dart';
import 'common_care_note_forms_controller.dart';
class SafeguardingFormScreenController extends CommonCareNoteFormsController {
final concernAboutServiceUserController = TextEditingController();
final voiceOfServiceUserController = TextEditingController();
final anyImmediateRisksController = TextEditingController();
final qActionTakenController = TextEditingController();
final commentsController = TextEditingController();
final nameController1 = TextEditingController();
final nameController2 = TextEditingController();
final anyWitnessesController = TextEditingController();
final reportingDateTimeController = TextEditingController();
final actionTakenController = TextEditingController();
final catSubCatController = Get.put(CategorySubcategoryWidgetController());
SafeguardingFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void onReady() {
catSubCatController.getBodyParts();
super.onReady();
}
@override
void dispose() {
concernAboutServiceUserController.dispose();
voiceOfServiceUserController.dispose();
anyImmediateRisksController.dispose();
qActionTakenController.dispose();
commentsController.dispose();
nameController1.dispose();
nameController2.dispose();
anyWitnessesController.dispose();
reportingDateTimeController.dispose();
actionTakenController.dispose();
catSubCatController.dispose();
Get.delete<SafeguardingFormScreenController>();
super.dispose();
}
selectDateAndTimeOfReporting(context) async {
Get.focusScope?.unfocus();
final DateTime? d = await showDialog(
context: context,
builder: (BuildContext context) {
return AdoptiveCalendar(
initialDate: DateTime.now(),
action: true,
);
},
);
// final d = await CommonCode.datePicker(context);
if (d != null) {
reportingDateTimeController.text =
FrequentFunctions.careNoteDateFormatter.format(d).toLowerCase();
}
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (concernAboutServiceUserController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Concerns about the service user field is required",
);
return;
}
if (voiceOfServiceUserController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Voice of the service user field is required",
);
return;
}
if (anyImmediateRisksController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Are there any immediate risks field is required",
);
return;
}
if (catSubCatController.selectedBodyPart() == null) {
FrequentFunctions.showToast(
message: "Please select category first",
);
return;
}
if (catSubCatController.selectedBodyPart()!.subCategory.isNotEmpty &&
catSubCatController.selectedSubcategory() == null) {
FrequentFunctions.showToast(
message: "Please select subcategory",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
category: catSubCatController.selectedSubcategory()?.id ??
catSubCatController.selectedBodyPart()!.id,
noteDetails: SafeguardingFormHtmlRequest(
concernsAboutServiceUser:
concernAboutServiceUserController.text.trim(),
voiceOfTheServiceUser: voiceOfServiceUserController.text.trim(),
areThereAnyImmediateRisks: anyImmediateRisksController.text.trim(),
whatActionDoYouFeel: qActionTakenController.text.trim(),
comments: commentsController.text.trim(),
yourName: nameController1.text.trim(),
anyWitnesses: anyWitnessesController.text.trim(),
dateTimeReporting: reportingDateTimeController.text.trim(),
yourNameDslDdsl: nameController2.text.trim(),
actionTaken: actionTakenController.text.trim(),
).toHtml(),
),
);
}
}

View File

@@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/showering_and_bath_form_html_request.dart';
import 'package:get/get.dart';
import 'common_care_note_forms_controller.dart';
class ShoweringBathFormScreenController extends CommonCareNoteFormsController {
final commentsController = TextEditingController();
final selectedOption = Rx<String>('Bath');
ShoweringBathFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void dispose() {
commentsController.dispose();
Get.delete<ShoweringBathFormScreenController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (commentsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Comments field is required",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
noteDetails: ShoweringAndBathFormHtmlRequest(
showeringBathType: selectedOption(),
comments: commentsController.text.trim(),
).toHtml(),
),
);
}
}

View File

@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/careNoteFormsRequests/toileting_form_html_request.dart';
import 'package:get/get.dart';
import 'common_care_note_forms_controller.dart';
class ToiletingNoteFormScreenController extends CommonCareNoteFormsController {
final commentsController = TextEditingController();
final selectedOption = Rx<String?>(null);
final assistanceRequired = false.obs;
ToiletingNoteFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void dispose() {
commentsController.dispose();
Get.delete<ToiletingNoteFormScreenController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (assistanceRequired() && commentsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Comments field is required",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
noteDetails: ToiletingFormHtmlRequest(
assistanceRequired: assistanceRequired(),
assistanceType: !assistanceRequired() ? "" : (selectedOption() ?? ""),
comments: !assistanceRequired() ? "" : commentsController.text.trim(),
).toHtml(),
),
);
}
}

View File

@@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'common_care_note_forms_controller.dart';
class WeightHeightFormScreenController extends CommonCareNoteFormsController {
final heightController = TextEditingController();
final weightController = TextEditingController();
final commentsController = TextEditingController();
final appointmentWith = [
"GP",
"CAMHS",
"Psychologist",
"A&E",
"Sexual Health",
"Social Worker",
"Other"
];
WeightHeightFormScreenController({required CommonCareNoteFormArgs args})
: super(args: args);
@override
void dispose() {
heightController.dispose();
weightController.dispose();
commentsController.dispose();
Get.delete<WeightHeightFormScreenController>();
super.dispose();
}
Future<void> onSaveButtonTap() async {
// if (super.date == null || super.time == null) {
if (super.date == null) {
FrequentFunctions.showToast(
message: "Please select date and time first",
);
return;
}
if (heightController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Height field is required",
);
return;
}
if (weightController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Weight field is required",
);
return;
}
if (commentsController.text.trim().isEmpty) {
FrequentFunctions.showToast(
message: "Comments field is required",
);
return;
}
super.removeFocus();
await onFormSubmit(
request: CreateCarePlanRequest(
isHTML: true,
flag: false,
title: "",
noteDetails: CreateCarePlanRequest.heightWeightHtmlReq(
heightController.text.trim(),
weightController.text.trim(),
commentsController.text.trim(),
),
),
);
}
}

View File

@@ -0,0 +1,75 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:webview_flutter/webview_flutter.dart';
import '../../models/clients/allCareNotes/CarePlans.dart';
import '../../view/screens/clients/care_note_detail_screen.dart';
class CareNoteDetailScreenController extends GetxController {
final isLoadingWebPage = false.obs;
final webViewHeight = (300.0).obs;
late final WebViewController webViewController;
String headerHtml = """<div></div>""";
final CarePlan data;
CareNoteDetailScreenController(this.data) {
headerHtml = """<p>
<strong>${data.addedby?.name ?? ""}</strong>
<small>${(data.eventDateTime == null) ? "" : DateFormat("dd/MM/yyyy hh:mm aa").format(DateTime.fromMillisecondsSinceEpoch(data.eventDateTime!).toLocal())}</small>
</p>
""";
if (data.isHTML == true) {
final bodyPartHtml = (data.healthIssueId?.category == null)
? ""
: """<p>
<strong>Effected Body Part</strong>
<small>${data.healthIssueId!.category!.name}</small>
</p>""";
webViewController = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {},
onPageStarted: (String url) {
isLoadingWebPage.value = true;
},
onPageFinished: (String url) {
updateWebViewHeight();
},
onHttpError: (HttpResponseError error) {},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('https://www.youtube.com/')) {
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
),
)
..loadHtmlString(CareNoteDetailScreen.meta +
CareNoteDetailScreen.css +
headerHtml +
data.noteDetails! +
bodyPartHtml);
}
}
void updateWebViewHeight() async {
final height = await webViewController
.runJavaScriptReturningResult('document.body.scrollHeight;');
if (height is String) {
double h = double.parse(height);
webViewHeight.value = h;
} else if (height is double) {
webViewHeight.value = height;
}
isLoadingWebPage.value = false;
}
}

View File

@@ -0,0 +1,273 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/utilities/enums/care_note_form_type.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
import '../../models/clients/care_note_category.dart';
class CareNotesScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final List<CareNoteCategory> categories = [];
final categoriesMapList = [
{
"iconPath": AssetsManager.kIcHealth,
"category": "Health",
"subcategories": [
{
"iconPath": AssetsManager.kIcInjury,
"name": "Injury / Health Issue",
"formType": CareNotesFormType.injuryHealthIssueForm.text,
"apiValue": CareNotesFormType.injuryHealthIssueForm.apiValue,
},
{
"iconPath": AssetsManager.kIcWeightHeight,
"name": "Weight / Height",
"formType": CareNotesFormType.weightHeightForm.text,
"apiValue": CareNotesFormType.weightHeightForm.apiValue,
},
{
"iconPath": AssetsManager.kIcAppointment,
"name": "Health appointments",
"formType": CareNotesFormType.healthAppointmentForm.text,
"apiValue": CareNotesFormType.healthAppointmentForm.apiValue,
},
{
"iconPath": AssetsManager.kIcSearch,
"name": "Observations",
"formType": CareNotesFormType.observationsForm.text,
"apiValue": CareNotesFormType.observationsForm.apiValue,
},
{
"iconPath": AssetsManager.kIcOthers,
"name": "Others",
"formType": CareNotesFormType.healthOtherForm.text,
"apiValue": CareNotesFormType.healthOtherForm.apiValue,
}
]
},
{
"iconPath": AssetsManager.kIcGeneral,
"category": "General",
"subcategories": [
{
"iconPath": AssetsManager.kIcNote,
"name": "General Note",
"formType": CareNotesFormType.generalNoteForm.text,
"apiValue": CareNotesFormType.generalNoteForm.apiValue,
},
{
"iconPath": AssetsManager.kIcActivity,
"name": "Activities",
"formType": CareNotesFormType.activitiesForm.text,
"apiValue": CareNotesFormType.activitiesForm.apiValue,
},
{
"iconPath": AssetsManager.kIcSleep,
"name": "Sleep",
"formType": CareNotesFormType.sleepForm.text,
"apiValue": CareNotesFormType.sleepForm.apiValue,
},
{
"iconPath": AssetsManager.kIcSafeguarding,
"name": "Safeguarding",
"formType": CareNotesFormType.safeguardingForm.text,
"apiValue": CareNotesFormType.safeguardingForm.apiValue,
},
{
"iconPath": AssetsManager.kIcOthers,
"name": "Others",
"formType": CareNotesFormType.generalOtherForm.text,
"apiValue": CareNotesFormType.generalOtherForm.apiValue,
}
]
},
{
"iconPath": AssetsManager.kIcPersonalCare,
"category": "Personal Care",
"subcategories": [
{
"iconPath": AssetsManager.kIcToileting,
"name": "Toileting",
"formType": CareNotesFormType.toiletingNoteForm.text,
"apiValue": CareNotesFormType.toiletingNoteForm.apiValue,
},
{
"iconPath": AssetsManager.kIcShower,
"name": "Showering / Bath",
"formType": CareNotesFormType.showeringBathForm.text,
"apiValue": CareNotesFormType.showeringBathForm.apiValue,
},
{
"iconPath": AssetsManager.kIcMouthHygiene,
"name": "Mouth Hygiene",
"formType": CareNotesFormType.mouthHygieneForm.text,
"apiValue": CareNotesFormType.mouthHygieneForm.apiValue,
},
{
"iconPath": AssetsManager.kIcOthers,
"name": "Others",
"formType": CareNotesFormType.personalCareOtherForm.text,
"apiValue": CareNotesFormType.personalCareOtherForm.apiValue,
}
]
},
{
"iconPath": AssetsManager.kIcMentalWellbeing,
"category": "Mental Wellbeing",
"subcategories": [
{
"iconPath": AssetsManager.kIcMood,
"name": "Mood Rating",
"formType": CareNotesFormType.moodRatingForm.text,
"apiValue": CareNotesFormType.moodRatingForm.apiValue,
},
{
"iconPath": AssetsManager.kIcAbc,
"name": "ABC",
"formType": CareNotesFormType.ABCForm.text,
"apiValue": CareNotesFormType.ABCForm.apiValue,
},
{
"iconPath": AssetsManager.kIcPhysicalIntervention,
"name": "Physical Intervention",
"formType": CareNotesFormType.physicalInterventionForm.text,
"apiValue": CareNotesFormType.physicalInterventionForm.apiValue,
},
{
"iconPath": AssetsManager.kIcConsent,
"name": "Consent, Capacity, MCA & DOLS",
"formType": CareNotesFormType.consentCapacityForm.text,
"apiValue": CareNotesFormType.consentCapacityForm.apiValue,
},
{
"iconPath": AssetsManager.kIcOthers,
"name": "Others",
"formType": CareNotesFormType.mentalWellbeingOtherForm.text,
"apiValue": CareNotesFormType.mentalWellbeingOtherForm.apiValue,
}
]
},
{
"iconPath": AssetsManager.kIcIntractions,
"category": "Professional/family Interactions",
"subcategories": [
{
"iconPath": AssetsManager.kIcMeeting,
"name": "Meetings",
"formType": CareNotesFormType.meetingsForm.text,
"apiValue": CareNotesFormType.meetingsForm.apiValue,
},
{
"iconPath": AssetsManager.kIcTelephone,
"name": "Telephone Calls",
"formType": CareNotesFormType.telephoneCallsForm.text,
"apiValue": CareNotesFormType.telephoneCallsForm.apiValue,
},
{
"iconPath": AssetsManager.kIcReviews,
"name": "Reviews",
"formType": CareNotesFormType.reviewsForm.text,
"apiValue": CareNotesFormType.reviewsForm.apiValue,
},
{
"iconPath": AssetsManager.kIcEmail,
"name": "Emails",
"formType": CareNotesFormType.emailsForm.text,
"apiValue": CareNotesFormType.emailsForm.apiValue,
},
{
"iconPath": AssetsManager.kIcOtherInteractions,
"name": "All other interactions",
"formType": CareNotesFormType.allOtherInteractionsForm.text,
"apiValue": CareNotesFormType.allOtherInteractionsForm.apiValue,
},
{
"iconPath": AssetsManager.kIcOthers,
"name": "Others",
"formType":
CareNotesFormType.professionalFamilyInteractionsOtherForm.text,
"apiValue":
CareNotesFormType.professionalFamilyInteractionsOtherForm.apiValue,
}
]
},
{
"iconPath": AssetsManager.kIcIndependentLiving,
"category": "Independent Living",
"subcategories": [
{
"iconPath": AssetsManager.kIcLaundry,
"name": "Laundry",
"formType": CareNotesFormType.laundryForm.text,
"apiValue": CareNotesFormType.laundryForm.apiValue,
},
{
"iconPath": AssetsManager.kIcCooking,
"name": "Cooking",
"formType": CareNotesFormType.cookingForm.text,
"apiValue": CareNotesFormType.cookingForm.apiValue,
},
{
"iconPath": AssetsManager.kIcHydration,
"name": "Nutrition / Hydration",
"formType": CareNotesFormType.nutritionHydrationForm.text,
"apiValue": CareNotesFormType.nutritionHydrationForm.apiValue,
},
{
"iconPath": AssetsManager.kIcCleaning,
"name": "Cleaning",
"formType": CareNotesFormType.cleaningForm.text,
"apiValue": CareNotesFormType.cleaningForm.apiValue,
},
{
"iconPath": AssetsManager.kIcFinance,
"name": "Finance",
"formType": CareNotesFormType.financeForm.text,
"apiValue": CareNotesFormType.financeForm.apiValue,
},
{
"iconPath": AssetsManager.kIcPublicInteraction,
"name": "Public interaction (including transport)",
"formType": CareNotesFormType.publicInteractionForm.text,
"apiValue": CareNotesFormType.publicInteractionForm.apiValue,
},
{
"iconPath": AssetsManager.kIcEducation,
"name": "Education",
"formType": CareNotesFormType.educationForm.text,
"apiValue": CareNotesFormType.educationForm.apiValue,
},
{
"iconPath": AssetsManager.kIcOthers,
"name": "Others",
"formType": CareNotesFormType.independentLivingOtherForm.text,
"apiValue": CareNotesFormType.independentLivingOtherForm.apiValue,
}
]
}
];
@override
void onInit() {
for (var e in categoriesMapList) {
categories.add(CareNoteCategory.fromJson(e));
}
super.onInit();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<CareNotesScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<CareNotesScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/service_users_model.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
import '../../models/clients/care_note_category.dart';
class CareNotesSubcategoriesScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<CareNotesSubcategoriesScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<CareNotesSubcategoriesScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
import '../../models/clients/service_users_model.dart';
class CarePlanMenuScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
var argument;
final serviceUser = Rx<UserData?>(null);
CarePlanMenuScreenController({required UserData data}) {
serviceUser.value = data;
}
@override
void onInit() {
if (CustomRouteGenerator.argument != null) {
argument = CustomRouteGenerator.argument;
if (argument is ServiceUserModel) {
serviceUser.value = argument;
}
}
super.onInit();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<CarePlanMenuScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<CarePlanMenuScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/service_users_model.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
class ClientProfileScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final serviceUser = Rx<UserData?>(null);
ClientProfileScreenController({required UserData data}) {
serviceUser.value = data;
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<ClientProfileScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<ClientProfileScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,127 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import '../../utilities/frequent_functions.dart';
import '../../web_services/client_services.dart';
class ClientsListScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final searchController = TextEditingController();
final serviceUsersList = RxList<UserData>();
final canLoadMore = RxBool(false);
final searchText = "".obs;
final int _limit = 20;
int _skip = 0;
bool loadingMore = false;
final _listRC = RefreshController(initialRefresh: false);
RefreshController get listRC => _listRC;
final _listSC = ScrollController();
ScrollController get listSC => _listSC;
@override
void onInit() {
debounce(searchText, onSearch, time: 800.milliseconds);
super.onInit();
}
@override
void onReady() {
getClients();
super.onReady();
}
void onRefresh() async {
await getClients();
_listRC.refreshCompleted();
}
void onLoading() async {
if (!loadingMore) {
await _loadMore();
}
_listRC.loadComplete();
}
onSearch(String text) {
getClients();
}
Future<void> getClients() async {
serviceUsersList.clear();
_skip = 0;
var response = await ClientService()
.getServiceUsersList(
searchText: searchText(),
limit: _limit,
offset: _skip,
)
.showLoader();
if (response.success == true) {
if (response.data?.users?.isNotEmpty == true) {
_skip += _limit;
serviceUsersList.value = response.data?.users ?? <UserData>[];
canLoadMore.value = true;
} else {
canLoadMore.value = searchText.isEmpty;
}
} else {
if (response.message.isNullOrEmptyNot()) {
FrequentFunctions.showToast(message: response.message!);
}
}
}
Future<void> _loadMore() async {
if (canLoadMore.isTrue) {
loadingMore = true;
var response = await ClientService().getServiceUsersList(
searchText: searchText(),
limit: _limit,
offset: _skip,
);
loadingMore = false;
if (response.success == true) {
if (response.data?.users?.isNotEmpty == true) {
_skip += _limit;
serviceUsersList.addAll(response.data?.users ?? []);
canLoadMore.value = true;
} else {
canLoadMore.value = false;
}
} else {
if (response.message.isNullOrEmptyNot()) {
FrequentFunctions.showToast(message: response.message!);
}
}
}
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
searchController.dispose();
_listSC.dispose();
Get.delete<ClientsListScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<ClientsListScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,85 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import '../../models/clients/consent_details_model.dart';
class ConsentAndCapacityAddNewFormScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final firstNameController = TextEditingController();
final lastNameController = TextEditingController();
final phoneController = TextEditingController();
final emailController = TextEditingController();
final genderController = TextEditingController();
final dobController = TextEditingController();
final ageController = TextEditingController();
final descriptionController = TextEditingController();
// List<String> dropDownList = ["A","b","C"];
// RxString selectedDropdownValue = "A".obs;
final isForUpdate = false.obs;
// String updateConsentId = "";
// final serviceUser = Rx<UserData?>(null);
ConsentDetailsModel saveResult = ConsentDetailsModel.empty();
Future<dynamic> saveButtonPressed(String serviceUserId) async {
var result = await ClientService()
.addConsentDetails(
description: descriptionController.value.text,
staffId: serviceUserId)
.showLoader();
if (result is ConsentDetailsModel && result.id != "") {
saveResult.description = descriptionController.value.text;
result.description = descriptionController.value.text;
saveResult = result;
FrequentFunctions.showToast(message: "Consent Template added successfully");
return result;
// return true;
} else {
if (result is String) {
FrequentFunctions.showToast(message: result);
}
return false;
}
}
Future<bool> updateButtonPressed(String consentId) async {
var result = await ClientService()
.updateConsentDetails(
description: descriptionController.value.text, consentId: consentId)
.showLoader();
if (result is bool && result == true) {
FrequentFunctions.showToast(message: "Consent Template Updated successfully");
return true;
} else {
if (result is String) {
FrequentFunctions.showToast(message: result);
}
return false;
}
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
firstNameController.dispose();
lastNameController.dispose();
phoneController.dispose();
emailController.dispose();
genderController.dispose();
dobController.dispose();
ageController.dispose();
descriptionController.dispose();
Get.delete<ConsentAndCapacityAddNewFormScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<ConsentAndCapacityAddNewFormScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import '../../models/clients/consent_details_model.dart';
import '../../models/clients/service_users_model.dart';
class ConsentAndCapacityQuestionnaireScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
List<String> dropDownList = ["A", "b", "C"];
RxString selectedDropdownValue = "A".obs;
RxList<ConsentDetailsModel> consentDetailsList = RxList();
dynamic argument;
final serviceUser = Rx<UserData?>(null);
ConsentAndCapacityQuestionnaireScreenController({required UserData data}) {
serviceUser.value = data;
}
@override
void onReady() {
print("serviceUser() != null ---- ${serviceUser() != null}");
if (serviceUser() != null) {
fetchList();
}
super.onReady();
}
void fetchList() async {
if (CustomRouteGenerator.argument != null) {
argument = CustomRouteGenerator.argument;
if (argument is ServiceUserModel) {
serviceUser.value = argument;
}
}
var result = await ClientService()
.getConsentDetails(staffId: serviceUser()!.id!)
.showLoader();
if (result is List<ConsentDetailsModel>) {
consentDetailsList.value = result;
}
}
void deleteConsentPressed(
{required String consentId, required int index}) async {
var result =
await ClientService().deleteConsent(consentId: consentId).showLoader();
if (result is bool && result == true) {
FrequentFunctions.showToast(message: "Consent Deleted Successfully");
consentDetailsList.removeAt(index);
} else {
if (result is String) {
FrequentFunctions.showToast(message: result);
} else {
FrequentFunctions.showToast(message: "Consent Deleted Successfully");
}
}
}
Future<bool> updateButtonPressed(
String description, String id, int index) async {
var result = await ClientService()
.updateConsentDetails(description: description, consentId: id);
if (result is bool && result == true) {
FrequentFunctions.showToast(message: "Consent Template Updated successfully");
consentDetailsList[index].description = description;
consentDetailsList.refresh();
return true;
} else {
if (result is String) {
FrequentFunctions.showToast(message: result);
}
return false;
}
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<ConsentAndCapacityQuestionnaireScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<ConsentAndCapacityQuestionnaireScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,138 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/models/clients/HealthIssuesDetailsModel.dart';
import 'package:ftc_mobile_app/models/clients/body_points_category.dart';
import 'package:ftc_mobile_app/utilities/enums/body_parts.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
class BodyPointIssueStyleWrapper {
final HealthIssueDetailsModel data;
Color? color;
BodyPointIssueStyleWrapper({
required this.data,
this.color,
});
}
class CurrentHealthIssuesScreenController extends GetxController {
static const tabAllIssues = "All Issues";
static const tabActiveIssues = "Active Issues";
static const tabResolvedIssues = "Resolved Issues";
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
RxString selectedDropdownValue = "Active".obs;
final List<String> tabs = [tabAllIssues, tabActiveIssues, tabResolvedIssues];
Map<BodyPart, BodyPointIssueStyleWrapper> oIssueBodyParts = {};
final issueBodyParts = RxMap<BodyPart, BodyPointIssueStyleWrapper>();
String serviceUserId = '';
String currentTab = tabAllIssues;
@override
void onInit() {
super.onInit();
}
@override
void onReady() {
getPointsDataFromService();
super.onReady();
}
onTabChange(String tabText) {
switch (tabText) {
case tabAllIssues:
issueBodyParts.value = Map.from(oIssueBodyParts);
break;
case tabActiveIssues:
final f = <BodyPart, BodyPointIssueStyleWrapper>{};
f.addEntries(oIssueBodyParts.entries.where((e) => e.value.data.status));
issueBodyParts.value = f;
break;
case tabResolvedIssues:
final f = <BodyPart, BodyPointIssueStyleWrapper>{};
f.addEntries(
oIssueBodyParts.entries.where((e) => e.value.data.status == false));
issueBodyParts.value = f;
break;
}
currentTab = tabText;
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
static Color getStatusColor(bool status) {
return status == true ? Colors.red : Colors.green;
}
/// This method fetches health issues and map their body points to related data and color to show for the point,
void getPointsDataFromService() async {
var result = await ClientService()
.getHealthIssues(userId: serviceUserId)
.showLoader();
if (result is List<HealthIssueDetailsModel>) {
final bodyPartsMap = <BodyPart, BodyPointIssueStyleWrapper>{};
const bodyParts = BodyPart.values;
for (final data in result) {
final bodyPartEnum = bodyParts.firstWhereOrNull(
(e1) => e1.apiValue == data.bodyPointsCategory?.enumed);
if (bodyPartEnum != null) {
bodyPartsMap[bodyPartEnum] = BodyPointIssueStyleWrapper(
data: data,
color: getStatusColor(data.status),
);
}
}
oIssueBodyParts = bodyPartsMap;
onTabChange(currentTab);
}
}
Future<void> updateHealthIssueStatus(
{required BodyPart bodyPoint,
required HealthIssueDetailsModel data,
required bool status}) async {
final response = await ClientService()
.updateHealthIssueData(
issueId: data.id,
categoryId: data.bodyPointsCategory!.id,
status: status,
)
.showLoader();
if (response is BodyPointsCategory) {
oIssueBodyParts[bodyPoint]!
..data.status = status
..color = getStatusColor(status);
issueBodyParts[bodyPoint]!
..data.status = status
..color = getStatusColor(status);
Get.back();
onTabChange(currentTab);
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
}
void onBackPress(BuildContext context) {
Get.delete<CurrentHealthIssuesScreenController>();
Navigator.pop(context);
}
@override
void dispose() {
Get.delete<CurrentHealthIssuesScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class DocumentDetailsScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus(){
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<DocumentDetailsScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,113 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/models/clients/documents_list_model.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart';
class DocumentsListScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final searchTEC = TextEditingController();
List<DocumentModel> oDocumentsList = [];
final documentsList = RxList<DocumentModel>();
final serviceUser = Rx<UserData?>(null);
DocumentsListScreenController(UserData data) {
serviceUser.value = data;
}
@override
void onReady() {
getDocuments();
super.onReady();
}
void getDocuments() async {
final response = await ClientService()
.getDocumentListService(serviceUserId: serviceUser()!.id!)
.showLoader();
if (response is DocumentsListModel) {
if (response.documentList.isNotEmpty) {
response.documentList
.removeWhere((e) => e.title.isEmpty || e.details.isEmpty);
oDocumentsList = response.documentList;
documentsList.value = response.documentList;
}
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
}
onSearch(String text) {
if (text.isEmpty) {
documentsList.value = oDocumentsList;
} else {
documentsList.value = oDocumentsList
.where((e) => e.title.toLowerCase().contains(text.toLowerCase()))
.toList();
}
}
downloadDoc({required String path}) async {
if (path.isNotEmpty) {
final f = await _downloadGooglePlacePhoto(path: path).showLoader();
if (f != null) {
FrequentFunctions.showToast(
message: "Document downloaded successfully");
}
}
}
Future<File?> _downloadGooglePlacePhoto({required String path}) async {
try {
// final hasInternet = await FrequentFunctions.hasInternetConnection;
// debugPrint("hasInternet: $hasInternet");
//
// if (!hasInternet) {
// return null;
// }
final tempDir = await getApplicationDocumentsDirectory();
String fullPath = "${tempDir.path}/${basename(path)}";
File file = File(fullPath);
if (file.existsSync()) {
return null;
}
var dio = Dio();
final response = await dio.get(
"${WebUrls.baseUrl}$path",
options: Options(responseType: ResponseType.bytes),
);
if (response.statusCode == 200) {
file.writeAsBytesSync(response.data);
return file;
}
return null;
} on DioException catch (_) {
return null;
} catch (e) {
debugPrint("Web Error: $e");
return null;
}
}
@override
void dispose() {
Get.delete<DocumentsListScreenController>();
searchTEC.dispose();
super.dispose();
}
}

View File

@@ -0,0 +1,20 @@
export 'clients_list_screen_controller.dart';
export 'client_profile_screen_controller.dart';
export 'appointment_screen_controller.dart';
export 'notes_screen_controller.dart';
export 'select_note_screen_controller.dart';
export 'new_note_screen_controller.dart';
export 'care_plan_menu_screen_controller.dart';
export 'documents_list_screen_controller.dart';
export 'document_details_screen_controller.dart';
export 'recent_incidents_screen_controller.dart';
export 'current_health_issues_screen_controller.dart';
export 'consent_and_capacity_add_new_form_screen_controller.dart';
export 'consent_and_capacity_questionnaire_screen_controller.dart';
export 'life_history_and_goals_screen_controller.dart';
export 'pbs_plan_screen_controller.dart';
export 'photo_gallery_screen_controller.dart';
export 'risk_assessments_screen_controller.dart';
export 'risk_assessments_template_screen_controller.dart';
export 'new_client_module_controllers/export_new_client_module.dart';
export 'care_notes_screen_controller.dart';

View File

@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class LifeHistoryAndGoalsScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
TextEditingController lastNameController = TextEditingController();
List<String> dropDownList = ["A","b","C"];
RxString selectedDropdownValue = "A".obs;
void removeFocus(){
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<LifeHistoryAndGoalsScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,199 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/models/clients/PBSPlanModel.dart';
import 'package:ftc_mobile_app/models/clients/add_pbs_plan_model.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/view/screens/clients/clients_new_view_module/add_new_pbs_plan_screen.dart';
import 'package:get/get.dart';
class AddNewPbsPlanScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
// dynamic argument;
// final serviceUser = Rx<UserData?>(null);
// String userId = "";
final addPbsPlanModel = PbsList.empty().obs;
final enableSubmitButton = true.obs;
late final AddNewPBSPlanScreenArgs args;
AddNewPbsPlanScreenController(AddNewPBSPlanScreenArgs data) {
args = data;
if (data.pbsData != null) {
addPbsPlanModel.value = data.pbsData!;
}
}
@override
void onInit() {
// if (CustomRouteGenerator.argument != null) {
// argument = CustomRouteGenerator.argument;
// if (argument is ServiceUserModel) {
// serviceUser.value = argument;
// } else if (argument is List) {
// if (argument[1] is ServiceUserModel) {
// ServiceUserModel user = argument[1];
// userId = user.id;
// }
// if (argument[0] is PbsList) {
// PbsList listItem = argument[0];
// addPbsPlanModel.value.userId = listItem.userIdModelInPbs?.id ?? "";
// addPbsPlanModel.value.staffId = listItem.staffId?.id ?? "";
// addPbsPlanModel.value.planId = listItem.id;
// addPbsPlanModel.value.aboutPlanNote = listItem.aboutPlan;
// addPbsPlanModel.value.managementOfBehaviouralPresentationNote =
// listItem.managementOfBehaviorPlan;
// addPbsPlanModel.value.secondaryPreventionNote =
// listItem.secondaryPrevention;
// addPbsPlanModel.value.reactiveStrategiesNote =
// listItem.reactiveStrategies;
// addPbsPlanModel.value.postIncidentSupportRecoveryNote =
// listItem.postIncidentSupport;
// }
// }
// }
super.onInit();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
// void enableDisableSubmitButton() async {
// enableSubmitButton.value = await addPbsPlanModel.value.areAllFieldsEdited;
// }
@override
void dispose() {
Get.delete<AddNewPbsPlanScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context, dynamic argument) {
addPbsPlanModel.value.postIncidentSupportRecoveryQuillController.dispose();
addPbsPlanModel.value.reactiveStrategiesQuillController.dispose();
addPbsPlanModel.value.secondaryPreventionQuillController.dispose();
addPbsPlanModel.value.managementOfBehaviouralPresentationQuillController
.dispose();
addPbsPlanModel.value.aboutPlanQuillController.dispose();
Get.delete<AddNewPbsPlanScreenController>();
Navigator.of(context).pop(argument);
}
void submitButtonPressed() async {
//post Incident Support
final postIncidentSupportText = await addPbsPlanModel
.value.postIncidentSupportRecoveryQuillController
.getText();
if (postIncidentSupportText.isEmpty) {
FrequentFunctions.showToast(message: "All fields are mandatory.");
return;
}
//reactive Strategies
final reactiveStrategiesText =
await addPbsPlanModel.value.reactiveStrategiesQuillController.getText();
if (reactiveStrategiesText.isEmpty) {
FrequentFunctions.showToast(message: "All fields are mandatory.");
return;
}
//secondaryPrevention
final secondaryPreventionText = await addPbsPlanModel
.value.secondaryPreventionQuillController
.getText();
if (secondaryPreventionText.isEmpty) {
FrequentFunctions.showToast(message: "All fields are mandatory.");
return;
}
//management Of Behavior Plan
final managementOfBehaviorPlanText = await addPbsPlanModel
.value.managementOfBehaviouralPresentationQuillController
.getText();
if (managementOfBehaviorPlanText.isEmpty) {
FrequentFunctions.showToast(message: "All fields are mandatory.");
return;
}
//about Plan
final aboutPlanText =
await addPbsPlanModel.value.aboutPlanQuillController.getText();
if (aboutPlanText.isEmpty) {
FrequentFunctions.showToast(message: "All fields are mandatory.");
return;
}
dynamic response;
if (args.pbsData == null) {
response = await ClientService()
.addPbsPlanService(
userId: args.userData.id!,
staffId: LocalStorageManager.userId,
postIncidentSupport: postIncidentSupportText,
reactiveStartegies: reactiveStrategiesText,
secondaryPrevention: secondaryPreventionText,
managementOfBehaviorPlan: managementOfBehaviorPlanText,
aboutPlan: aboutPlanText)
.showLoader();
} else {
response = await ClientService()
.updatePbsPlanService(
id: addPbsPlanModel().id,
userId: args.userData.id!,
staffId: LocalStorageManager.userId,
postIncidentSupport: postIncidentSupportText,
reactiveStartegies: reactiveStrategiesText,
secondaryPrevention: secondaryPreventionText,
managementOfBehaviorPlan: managementOfBehaviorPlanText,
aboutPlan: aboutPlanText,
)
.showLoader();
}
if (response is AddPBSPlanModel) {
print("-------------response is AddPBSPlanModel-----------");
print({response.toString()});
print("------------------------");
backButtonPressed(screenKey.currentContext!, true);
} else {
FrequentFunctions.showToast(message: response.toString());
}
}
// void updateButtonPressed() async {
// dynamic response = await ClientService()
// .updatePbsPlanService(
// id: addPbsPlanModel().id,
// userId: args.userData.id!,
// staffId: FrequentFunctions.userModel.value.id,
// postIncidentSupport: await addPbsPlanModel
// .value.postIncidentSupportRecoveryQuillController
// .getText(),
// reactiveStartegies: await addPbsPlanModel
// .value.reactiveStrategiesQuillController
// .getText(),
// secondaryPrevention: await addPbsPlanModel
// .value.secondaryPreventionQuillController
// .getText(),
// managementOfBehaviorPlan: await addPbsPlanModel
// .value.managementOfBehaviouralPresentationQuillController
// .getText(),
// aboutPlan:
// await addPbsPlanModel.value.aboutPlanQuillController.getText())
// .showLoader();
// if (response is AddPBSPlanModel) {
// backButtonPressed(screenKey.currentContext!, true);
// } else {
// FrequentFunctions.showToast(message: response.toString());
// }
// }
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class CrisisManagementScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<CrisisManagementScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,12 @@
export 'crisis_management_screen_controller.dart';
export 'future_plans_screen_controller.dart';
export 'health_full_body_map_screen_controller.dart';
export 'health_screen_controller.dart';
export 'medication_screen_controller.dart';
export 'introduction_screen_controller.dart';
export 'mental_health_screen_controller.dart';
export 'my_current_plan_screen_controller.dart';
export 'my_interests_screen_controller.dart';
export 'overview_screen_controller.dart';
export 'things_i_want_you_to_help_me_screen_controller.dart';
export 'support_plan_screen_controller.dart';

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class FuturePlansScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<FuturePlansScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class HealthFullBodyMapScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
List<String> activeList = ["Active","Expired"];
RxString selectedDropdownValue = "Active".obs;
RxBool firstPointVisible = false.obs;
RxString firstPointSelectedDropdownValue = "Active".obs;
RxBool secondPointVisible = false.obs;
RxString secondPointSelectedDropdownValue = "Expired".obs;
RxBool thirdPointVisible = false.obs;
RxString thirdPointSelectedDropdownValue = "Active".obs;
RxBool fourthPointVisible = false.obs;
RxString fourthPointSelectedDropdownValue = "Expired".obs;
RxBool fifthPointVisible = false.obs;
RxString fifthPointSelectedDropdownValue = "Active".obs;
RxBool sixthPointVisible = false.obs;
RxString sixthPointSelectedDropdownValue = "Expired".obs;
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<HealthFullBodyMapScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<HealthFullBodyMapScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class HealthScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<HealthScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ClientsIntroductionScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<ClientsIntroductionScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class MedicationScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<MedicationScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<MedicationScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class MentalHealthScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<MentalHealthScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class MyCurrentPlanScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<MyCurrentPlanScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class MyInterestsScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<MyInterestsScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class OverViewScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<OverViewScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class SupportPlanScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<SupportPlanScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ThingsIWantYouToHelpMeWithScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<ThingsIWantYouToHelpMeWithScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
class NewNoteScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final TextEditingController titleController = TextEditingController();
final UserModel user = UserModel(
name: 'John Doe',
profilePicture: 'assets/profile_picture.jpg', // Replace with the actual path or URL
phoneNumber: '123-456-7890',
homeAddress: '123 Main St, City ville',
nextOfKin: 'Jane Doe',
diagnosisDate: "Dec. 19",
diagnosisHistory: "A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here.",
aboutPatient: 'A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here.',
);
List<String> users = ["Hailey Johnson","Ryan Porter","Alan Cruz","Jiwon Nguyen","Patrick Lewis","Isabella Garcia","Yin Chiew","Rebecca Nicholson"];
TextEditingController searchController = TextEditingController();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
titleController.dispose();
Get.delete<NewNoteScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
class NotesScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final UserModel user = UserModel(
name: 'John Doe',
profilePicture: 'assets/profile_picture.jpg', // Replace with the actual path or URL
phoneNumber: '123-456-7890',
homeAddress: '123 Main St, City ville',
nextOfKin: 'Jane Doe',
diagnosisDate: "Dec. 19",
diagnosisHistory: "A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here.",
aboutPatient: 'A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here.',
);
List<String> users = ["Hailey Johnson","Ryan Porter","Alan Cruz","Jiwon Nguyen","Patrick Lewis","Isabella Garcia","Yin Chiew","Rebecca Nicholson"];
TextEditingController searchController = TextEditingController();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<NotesScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/models/clients/PBSPlanModel.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
class PBSPlanScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final searchTEC = TextEditingController();
// dynamic argument;
final serviceUser = Rx<UserData?>(null);
final pbsList = RxList<PbsList>();
@override
void onReady() {
fetchPBSPlanList();
super.onReady();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
Future<void> fetchPBSPlanList() async {
dynamic result = await ClientService()
.getPbsPlanListService(userId: serviceUser.value!.id!)
.showLoader();
if (result is PBSListDataJson) {
if (result.pbsList.isNotEmpty) {
pbsList.value = result.pbsList.take(1).toList();
}
}
}
void onBackPress(BuildContext context) {
Get.delete<PBSPlanScreenController>();
Navigator.pop(context);
}
@override
void dispose() {
searchTEC.dispose();
Get.delete<PBSPlanScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/memoryListResponse/MemoryListData.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/utilities/frequent_functions.dart';
import 'package:ftc_mobile_app/web_services/client_services.dart';
import 'package:get/get.dart';
class PhotoGalleryScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
late final String serviceUserId;
final memoryList = RxList<MemoryListData>();
@override
void onReady() {
getMemoryList();
super.onReady();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
Future<void> getMemoryList() async {
// serviceUsersList.clear();
// _skip = 0;
var response = await ClientService()
.getMemoryList(serviceUserId: serviceUserId
// limit: _limit,
// offset: _skip,
)
.showLoader();
if (response.success == true) {
if (response.data?.list?.isNotEmpty == true) {
// _skip += _limit;
memoryList.value = response.data?.list ?? <MemoryListData>[];
// canLoadMore.value = true;
} else {
// canLoadMore.value = searchText.isEmpty;
}
} else {
if (response.message.isNullOrEmptyNot()) {
FrequentFunctions.showToast(message: response.message!);
}
}
}
@override
void dispose() {
Get.delete<PhotoGalleryScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import '../../models/clients/recent_incidents_model.dart';
class RecentIncidentsScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final searchTEC = TextEditingController();
List<RecentIncidentsModel> oRecentIncidentsList = [];
RxList<RecentIncidentsModel> recentIncidentsList = RxList();
final serviceUser = Rx<UserData?>(null);
RecentIncidentsScreenController(UserData data) {
serviceUser(data);
}
@override
void onReady() {
fetchRecentIncidentList();
super.onReady();
}
void fetchRecentIncidentList() async {
if (serviceUser() == null) {
return;
}
var result = await ClientService()
.getRecentIncidentsListService(userId: serviceUser()!.id!)
.showLoader();
if (result is List<RecentIncidentsModel>) {
oRecentIncidentsList = List.from(result);
recentIncidentsList.value = result;
} else {
FrequentFunctions.showToast(message: result.toString());
}
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
onSearch(String text) {
if (text.isEmpty) {
recentIncidentsList.value = oRecentIncidentsList;
} else {
recentIncidentsList.value = oRecentIncidentsList
.where(
(e) => e.incidentTitle.toLowerCase().contains(text.toLowerCase()))
.toList();
}
}
@override
void dispose() {
searchTEC.dispose();
Get.delete<RecentIncidentsScreenController>();
super.dispose();
}
void onBackPress(BuildContext context) {
Get.delete<RecentIncidentsScreenController>();
Navigator.pop(context);
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class RiskAssessmentsScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
void removeFocus(){
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<RiskAssessmentsScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,47 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/riskAssessmentResponse/RiskAssessmentData.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/utilities/frequent_functions.dart';
import 'package:ftc_mobile_app/web_services/client_services.dart';
import 'package:get/get.dart';
class RiskAssessmentsTemplateScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
late final String serviceUserId;
final list = RxList<RiskAssessmentData>();
RiskAssessmentsTemplateScreenController(String userId) {
serviceUserId = userId;
}
@override
void onReady() {
getRiskAssessments();
super.onReady();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
void getRiskAssessments() async {
var response = await ClientService()
.getRiskAssessments(serviceUserId: serviceUserId)
.showLoader();
if (response.success == true) {
list.value = response.data ?? [];
} else {
if (response.message.isNotNullOrEmpty()) {
FrequentFunctions.showToast(message: response.message!);
}
}
}
@override
void dispose() {
Get.delete<RiskAssessmentsTemplateScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
class SelectNoteScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final UserModel user = UserModel(
name: 'John Doe',
profilePicture: 'assets/profile_picture.jpg', // Replace with the actual path or URL
phoneNumber: '123-456-7890',
homeAddress: '123 Main St, City ville',
nextOfKin: 'Jane Doe',
diagnosisDate: "Dec. 19",
diagnosisHistory: "A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here.",
aboutPatient: 'A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here. A quick preview of the diagnosis will be shown here.',
);
List<String> users = ["Hailey Johnson","Ryan Porter","Alan Cruz","Jiwon Nguyen","Patrick Lewis","Isabella Garcia","Yin Chiew","Rebecca Nicholson"];
TextEditingController searchController = TextEditingController();
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
Get.delete<SelectNoteScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,8 @@
import 'package:get/get.dart';
class CustomNavigationDrawerController extends GetxController{
RxInt selectedIndex = 1.obs;
}

View File

@@ -0,0 +1,7 @@
export 'auth_module/export_auth_module.dart';
export 'rota/export_rota_controller.dart';
export 'clients/export_clients_controllers.dart';
export 'home/export_home_controllers.dart';
export 'notifications/export_notifications_controllers.dart';
export 'profile/export_profile_controllers.dart';
export 'custom_navigation_drawer_controller.dart';

View File

@@ -0,0 +1,116 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/profile_screen_model.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 {
static DashboardScreenController get instance =>
Get.find<DashboardScreenController>();
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final selectedIndex = 1.obs;
final myShiftsList = RxList<DaysArrayData>();
final ongoingShift = Rx<DaysArrayData?>(null);
final myProfileData = Rx<StaffMembers?>(null);
@override
void onInit() {
_initOngoingShift();
super.onInit();
}
@override
void onReady() {
getProfileDetail();
getMyShifts();
super.onReady();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
_initOngoingShift() {
final shift = LocalStorageManager.getOngoingShift();
if (shift != null) {
//meaning shift expired already
if (shift.endTime != null && shift.endTime!.isBefore(TimeOfDay.now())) {
LocalStorageManager.removeOngoingShift();
} else {
ongoingShift.value = shift;
}
}
}
getProfileDetail() async {
final resp = await ClientService().getUserDetails();
if (resp is ProfileDataModel) {
myProfileData.value = resp.data?.staffMembers?.firstOrNull;
}
}
Future<void> getMyShifts() async {
var response = await RotaService().getMyShifts(
startDateMills: DateTime.now().subtract(30.days).millisecondsSinceEpoch,
endDateMills: DateTime.now().add(30.days).millisecondsSinceEpoch);
if (response is LiveRoasterResponseData) {
response.daysArray = (response.daysArray.isNullOrEmpty())
? []
: (response.daysArray!
..sort((a, b) => a.shiftDate!.compareTo(b.shiftDate!)));
List<DaysArrayData> todayAndFutureShifts = [];
//Extracting today's and future shifts
for (final shift in response.daysArray!) {
if (shift.shiftDateTime == null ||
shift.startTime == null ||
shift.endTime == null) {
debugPrint(
"shiftId: ${shift.id} has missing shiftDateTime or startTime or endTime. Please check");
return;
}
//Note: matching only date, month, year
final isTodayShift =
DateFormatter.dateFormatter.format(shift.shiftDateTime!) ==
DateFormatter.dateFormatter.format(DateTime.now());
final isFutureShift = shift.shiftDateTime!.isAfter(DateTime.now());
if (isTodayShift) {
//checking and adding today's not expired shift
// shift not expired yet
if (shift.endTime!.isAfter(TimeOfDay.now())) {
todayAndFutureShifts.add(shift);
if (ongoingShift() == null) {
LocalStorageManager.saveShiftData(data: shift);
ongoingShift.value = shift;
}
}
} else if (isFutureShift) {
todayAndFutureShifts.add(shift);
}
}
myShiftsList.value = todayAndFutureShifts.take(2).toList();
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
}
@override
void dispose() {
Get.delete<DashboardScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,3 @@
export 'dashboard_screen_controller.dart';
export '../../view/screens/chat/controller/chat_screen_controller.dart';
export 'inbox_screen_controller.dart';

View File

@@ -0,0 +1,156 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/chat/combined_last_messages_model_class.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/view/screens/chat/arguments/group_data_args.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import '../../ftc_mobile_app.dart';
import '../../web_services/chat_services.dart';
class InboxScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
// CombinedMessageModel combinedMessageModel = CombinedMessageModel.empty();
final String privacyPolicy =
"A quick preview of the text will be shown here. A quick preview of the text will be shown here. shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here.\n shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here.\n shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here.";
final checkBoxValue = false.obs;
final chatsAndGroups = RxList<MessagesListModel>();
// final sortedChatsAndGroups = RxList<MessagesListModel>();
final canLoadMore = RxBool(false);
final onFirstMessageSend = false.obs;
// late IO.Socket socket;
// final int _limit = 20;
// int _skip = 0;
bool loadingMore = false;
final _listRC = RefreshController(initialRefresh: false);
RefreshController get listRC => _listRC;
final _listSC = ScrollController();
ScrollController get listSC => _listSC;
String myId = "";
@override
void onInit() {
//Getting my ID
// String userJson = LocalStorageManager.getSessionToken(
// tokenKey: LocalStorageKeys.kUserModelKey,
// );
// UserModel userModel = UserModel.fromJson(json.decode(userJson));
myId = LocalStorageManager.userId;
onFirstMessageSend.listen((isTrue) {
if (isTrue) {
onFirstMessageSend(false);
getChatsAndGroupsList();
}
});
super.onInit();
}
@override
void onReady() {
// connect();
getChatsAndGroupsList();
super.onReady();
}
void onBackButtonPressed() {
Get.delete<InboxScreenController>();
Navigator.pop(screenKey.currentState!.context);
}
// void showPrivacyDialog() {
// showDialog(
// context: screenKey.currentState!.context,
// builder: (BuildContext context) {
// return PrivacyPolicyDialog(
// privacyPolicy: privacyPolicy,
// checkBoxOnChange: (value) {
// checkBoxValue.value = value;
// },
// );
// },
// );
// }
void onRefresh() async {
await getChatsAndGroupsList();
_listRC.refreshCompleted();
}
void onLoading() async {
// if (!loadingMore) {
// await _loadMore();
// }
_listRC.loadComplete();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
Future getChatsAndGroupsList() async {
final resp =
await ChatService().combinedLastMessage(userId: myId).showLoader();
if (resp is CombinedMessageModel) {
List<MessagesListModel> messages = [];
//Private Messages transform
for (final e in resp.personalMessage) {
messages.add(
MessagesListModel(
otherUserId: (e.senderId == myId) ? e.recieverId : e.senderId,
image: e.image,
title: e.name,
previewOfLastMessage: e.message,
messageType: e.messageType,
date: DateTime.tryParse(e.date)?.millisecondsSinceEpoch ??
DateTime.now().millisecondsSinceEpoch,
// messageDateTime: FrequentFunctions.toTimesAgo(e.date),
// personalMessageIndex: index,
),
);
}
//Group Messages transform
for (final e in resp.sortedArrayGroup) {
messages.add(
MessagesListModel(
image: e.groupImage,
title: e.groupName,
previewOfLastMessage: e.lastMessages.message,
messageType: MessageType.message.name,
// messageType: e.lastMessages.messageType ?? MessageType.message.name,
date: DateTime.tryParse(e.date)?.millisecondsSinceEpoch ??
DateTime.now().millisecondsSinceEpoch,
// messageDateTime: FrequentFunctions.toTimesAgo(e.date),
isGroup: true,
groupData: GroupDataArgs(
groupId: e.id,
groupMembersIds: e.groupMembers,
scheduleTime: e.groupWorkingScheduleTime,
),
),
);
}
chatsAndGroups.value = messages;
} else {
FrequentFunctions.showToast(message: resp["message"]);
}
}
@override
void dispose() {
Get.delete<InboxScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,146 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/utilities/local_storage_manager/local_storage_manager.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import '../../utilities/frequent_functions.dart';
import '../../web_services/client_services.dart';
class SelectUserForChatScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final searchController = TextEditingController();
List<UserData> oStaffUsersList = [];
final staffUsersList = RxList<UserData>();
final canLoadMore = RxBool(false);
final searchText = "".obs;
final int _limit = 20;
int _skip = 0;
bool loadingMore = false;
final _listRC = RefreshController(initialRefresh: false);
RefreshController get listRC => _listRC;
final _listSC = ScrollController();
ScrollController get listSC => _listSC;
@override
void onInit() {
// debounce(searchText, onSearch, time: 800.milliseconds);
super.onInit();
}
@override
void onReady() {
getStaffMembers();
super.onReady();
}
void onRefresh() async {
await getStaffMembers();
_listRC.refreshCompleted();
}
void onLoading() async {
if (!loadingMore) {
await _loadMore();
}
_listRC.loadComplete();
}
onSearch(String text) {
// getStaffMembers();
if (text.isEmpty) {
staffUsersList.value = List.from(oStaffUsersList);
} else {
staffUsersList.value = oStaffUsersList
.where(
(e) => e.displayName.toLowerCase().contains(text.toLowerCase()))
.toList();
// Future.forEach(oStaffUsersList, (e) => null);
}
}
Future<void> getStaffMembers() async {
staffUsersList.clear();
_skip = 0;
var response = await (ClientService()
.getAllUsersList(
searchText: searchText(),
limit: _limit,
offset: _skip,
)
.showLoader());
if (response.success == true) {
if (response.data?.users?.isNotEmpty == true) {
_skip += _limit;
final list = response.data!.users!
..removeWhere((e) => e.id == LocalStorageManager.userId);
oStaffUsersList = List.from(list);
staffUsersList.value = list;
// canLoadMore.value = false;
} else {
// canLoadMore.value = searchText.isEmpty;
}
} else {
if (response.message.isNullOrEmptyNot()) {
FrequentFunctions.showToast(message: response.message!);
}
}
}
Future<void> _loadMore() async {
if (canLoadMore.isTrue) {
loadingMore = true;
var response = await ClientService().getServiceUsersList(
searchText: searchText(),
limit: _limit,
offset: _skip,
);
loadingMore = false;
if (response.success == true) {
if (response.data?.users?.isNotEmpty == true) {
_skip += _limit;
staffUsersList.addAll(response.data?.users ?? []);
canLoadMore.value = true;
} else {
canLoadMore.value = false;
}
} else {
if (response.message.isNullOrEmptyNot()) {
FrequentFunctions.showToast(message: response.message!);
}
}
}
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void dispose() {
searchController.dispose();
_listSC.dispose();
Get.delete<SelectUserForChatScreenController>();
super.dispose();
}
void backButtonPressed(BuildContext context) {
Get.delete<SelectUserForChatScreenController>();
Navigator.of(context).pop();
}
}

View File

@@ -0,0 +1 @@
export "notifications_list_screen_controller.dart";

View File

@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:ftc_mobile_app/utilities/frequent_functions.dart';
import 'package:ftc_mobile_app/web_services/notification_services.dart';
import 'package:get/get.dart';
class NotificationListScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
RxBool privacyPolicyAccepted = false.obs;
final String privacyPolicy =
"A quick preview of the text will be shown here. A quick preview of the text will be shown here. shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here.\n shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here.\n shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here. A quick preview of the text will be shown here.";
// RxInt selectedIndex = 4.obs;
@override
void onReady() {
getNotifications();
super.onReady();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
Future<void> getNotifications() async {
// serviceUsersList.clear();
// _skip = 0;
var response = await NotificationService().getNotifications().showLoader();
if (response.success == true) {
// if (response.data?.users?.isNotEmpty == true) {
// _skip += _limit;
// serviceUsersList.value = response.data?.users ?? <UserData>[];
// canLoadMore.value = true;
// } else {
// canLoadMore.value = searchText.isEmpty;
// }
} else {
if (response.message.isNullOrEmptyNot()) {
FrequentFunctions.showToast(message: response.message!);
}
}
}
@override
void dispose() {
Get.delete<NotificationListScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1 @@
export 'view_profile_screen_controller.dart';

View File

@@ -0,0 +1,94 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/dialogs/app_dialogs.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:get/get.dart';
import '../../models/profile_screen_model.dart';
class ViewProfileScreenController extends GetxController {
final nameTEC = TextEditingController();
final emailTEC = TextEditingController();
final phoneTEC = TextEditingController();
final addressTEC = TextEditingController();
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final dashboardController = DashboardScreenController.instance;
final viewProfileClient = false.obs;
final covidCheck = false.obs;
final isEditable = false.obs;
final detail = Rx<StaffMembers?>(null);
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void onInit() {
// FrequentFunctions.profileDataModelNew = ProfileDataModel.fromJson(
// json.decode(LocalStorageManager.getSessionToken(
// tokenKey: LocalStorageKeys.kProfileModelKey)));
detail.listen((d) {
nameTEC.text = d?.user?.displayName ?? "";
emailTEC.text = d?.user!.email ?? "";
phoneTEC.text = d?.user?.phoneNumber ?? "";
addressTEC.text = d?.user?.modelId?.homeAddress ?? "";
});
detail.value = dashboardController.myProfileData();
super.onInit();
}
@override
onReady() {
// getProfileDetail();
super.onReady();
}
// getProfileDetail() async {
// final resp = await ClientService().getUserDetails().showLoader();
//
// if (resp is ProfileDataModel) {
// detail.value = resp.data?.staffMembers?.firstOrNull;
// covidCheck.value =
// resp.data?.staffMembers?.firstOrNull?.covidCheck ?? false;
// } else {
// if (resp.isNotNullOrEmpty()) {
// FrequentFunctions.showToast(message: resp);
// }
// }
// }
void logoutPressed() {
AppDialog.alertAndLogout(() {
FrequentFunctions().logoutButtonPressed(screenKey.currentState!.context);
});
// showDialog(
// context: screenKey.currentState!.context,
// builder: (BuildContext context) {
// return CustomForgetPasswordDialog(
// dialogButtonCloseText: "Cancel",
// dialogButtonAcceptText: "YES",
// dialogMessageText: "",
// dialogMessageTextBold: "Are you Sure You want to logout?",
// headingText: "Confirmation",
// showTextField: false,
// acceptFunction: () async{
// FrequentFunctions().logoutButtonPressed(screenKey.currentState!.context);
// },
// );
// },
// );
}
@override
void dispose() {
nameTEC.dispose();
emailTEC.dispose();
phoneTEC.dispose();
addressTEC.dispose();
Get.delete<ViewProfileScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,136 @@
import 'package:flutter/material.dart';
import 'package:flutter_calendar_carousel/classes/event.dart';
import 'package:flutter_calendar_carousel/classes/event_list.dart';
import 'package:ftc_mobile_app/models/requests/HolidayRequestData.dart';
import 'package:ftc_mobile_app/models/staffWorkload/StaffWorkloadResponse.dart';
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
class BookHolidayScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final targetDateTime = DateTime.now().obs;
final agreeToRules = false.obs;
final holidayStartDate = DateTime.now().obs;
final holidayEndDate = Rx<DateTime>(DateTime.now());
final holidayDays = 0.obs;
final holidayHours = 0.obs;
final myWorkLoads = Rx<StaffWorkLoads?>(null);
final _controller = Get.put(RotaDashboardScreenController());
Rx<EventList<Event>> get markedDatesMap => _controller.markedDatesMap;
@override
void onInit() {
_calculateDaysAndHours();
super.onInit();
}
@override
void onReady() {
fetchRecords();
super.onReady();
}
onRangeSelect(
DateTime rangeStart, DateTime? rangeEnd, List<String> selectedDates) {
print(
"rangeStart: ${rangeStart.toString()}\nrangeEnd: ${rangeEnd.toString()}");
holidayStartDate.value = rangeStart;
holidayEndDate.value = rangeEnd ?? (rangeStart);
_calculateDaysAndHours();
}
_calculateDaysAndHours() {
holidayDays.value = holidayEndDate().difference(holidayStartDate()).inDays;
if (DateFormatter.dateFormatter.format(holidayStartDate()) !=
DateFormatter.dateFormatter.format(holidayEndDate())) {
holidayDays.value += 1;
} else {
holidayDays.value = 1;
}
//Filtering out shifts that fall between the holiday ranges
final shifts = _controller.myShiftsList.where((shift) {
final dateNotNull = shift.shiftDateTime != null;
final isWithinHolidayRange =
shift.shiftDateTime!.isAfter(holidayStartDate()) &&
shift.shiftDateTime!.isBefore(holidayEndDate());
final onHolidayStartDate =
DateFormatter.dateFormatter.format(shift.shiftDateTime!) ==
DateFormatter.dateFormatter.format(holidayStartDate());
final onHolidayEndDate =
DateFormatter.dateFormatter.format(shift.shiftDateTime!) ==
DateFormatter.dateFormatter.format(holidayEndDate());
return (dateNotNull &&
(onHolidayStartDate || isWithinHolidayRange || onHolidayEndDate));
}).toList();
holidayHours.value = shifts.fold(
0, (previousValue, shift) => (shift.workHrs ?? 0) + previousValue);
// holidayHours.value =
// holidayEndDate().difference(holidayStartDate()).inHours;
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
Future<void> fetchRecords() async {
var response = await RotaService().getStaffWorkload().showLoader();
if (response is StaffWorkloadResponse) {
final workLoads = response.data?.staffWorkLoads ?? [];
if (workLoads.isNotEmpty) {
myWorkLoads.value = workLoads.first;
}
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
}
Future<bool> requestHoliday() async {
if (agreeToRules.isFalse) {
FrequentFunctions.showToast(
message: "Please select agree to booking rules first");
return false;
}
var response = await RotaService()
.requestHoliday(
request: HolidayRequestData(
hldRqStartDate: holidayStartDate().toUtc().millisecondsSinceEpoch,
hldRqEndDate: holidayEndDate().toUtc().millisecondsSinceEpoch,
hldRqTotalDays: holidayDays(),
hldRqTotalHours: holidayHours(),
hldRqStatus: "pending",
hldRequestType: "holiday",
),
)
.showLoader();
if (response is ResponseModel) {
return true;
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
return false;
}
@override
void dispose() {
Get.delete<BookHolidayScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,122 @@
import 'package:flutter/material.dart';
import 'package:flutter_calendar_carousel/classes/event.dart';
import 'package:flutter_calendar_carousel/classes/event_list.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../../ftc_mobile_app.dart';
class CalendarViewScreenController extends GetxController {
GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
RxBool isLoading = false.obs;
// Rx<EventList<Event>> markedDatesMap = EventList<Event>(events: {},).obs;
Rx<DateTime> targetDateTime = DateTime(2024, 1, 1).obs;
RxString currentMonthName =
DateFormat.yMMM().format(DateTime(2024, 1, 1)).obs;
Rx<EventList<Event>> events = EventList<Event>(
events: {},
).obs;
// RxList<MarkDatesModel> markedDatesList = RxList();
RxList<RotaShift> datesToShowList = RxList();
Rx<MarkDatesModel> selectedDate = MarkDatesModel.empty().obs;
// RxList<MonthWiseRecord> monthWiseRecord = RxList();
RxList<RotaShift> rotaShiftList = RxList();
@override
void onInit() {
fetchRecords();
super.onInit();
}
void markDatesOnCalendar() {
// markedDatesList.removeAt(0); //for removing late initialization error
// for (var rotaShift in rotaShiftList) {
// markedDatesList.add(
// MarkDatesModel.addDate(date: rotaShift.shiftTime, title: "Possible"));
// datesToShowList.add(rotaShift);
// }
// for (var markedDate in markedDatesList) {
// markedDatesMap.value.add(
// DateTime(
// markedDate.date.year, markedDate.date.month, markedDate.date.day),
// Event(
// date: DateTime(
// markedDate.date.year, markedDate.date.month, markedDate.date.day),
// // date: markedDate.date,
// title: markedDate.title,
// icon: markedDate.title == "Possible"
// ? _underlineIcon(
// markedDate.date.day.toString(),
// )
// : _shiftIcon(
// markedDate.date.day.toString(),
// ),
// ),
// );
// }
// datesToShowList = datesToShowList; // to ask from panday G
}
Widget _shiftIcon(String day) => CircleAvatar(
backgroundColor: CustomAppColors.kSecondaryColor,
child: Text(
day,
style:
const TextStyle(color: CustomAppColors.kWhiteColor, fontSize: 13),
),
);
Widget _underlineIcon(String day) => Container(
alignment: Alignment.center,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: CustomAppColors.kSecondaryColor,
width: 3.0,
),
),
),
);
void onNextMonthTap() {
targetDateTime.value = DateTime(targetDateTime.value.year,
targetDateTime.value.month + 1, targetDateTime.value.day);
currentMonthName.value = DateFormat.yMMM().format(targetDateTime.value);
}
void onPreviousMonthTap() {
targetDateTime.value = DateTime(targetDateTime.value.year,
targetDateTime.value.month - 1, targetDateTime.value.day);
currentMonthName.value = DateFormat.yMMM().format(targetDateTime.value);
}
void removeFocus() {
FocusScope.of(scaffoldKey.currentContext!).unfocus();
}
Future<void> fetchRecords() async {
isLoading.value = true;
// markedDatesList.add(MarkDatesModel.addDate(
// date: DateTime(2022, 6, 1),
// title: "Possible")); //for removing late initialization error
for (var index = 1; index <= 12; index++) {
var result = await RotaService().serviceUserShifts(
serviceUserId: "65682ad0a01b6c9e6dcde088", month: index, year: 2024);
if (result is MonthWiseRecord) {
// monthWiseRecord.add(result);
rotaShiftList.addAll(FrequentFunctions().findDaysWithData(result));
} else {
}
}
targetDateTime = rotaShiftList.first.shiftTime.obs;
currentMonthName =
DateFormat.yMMM().format(rotaShiftList.first.shiftTime).obs;
isLoading.value = false;
markDatesOnCalendar();
}
}

View File

@@ -0,0 +1,5 @@
export 'calendar_view_screen_controller.dart';
export 'rota_dashboard_screen_controller.dart';
export 'book_holiday_screen_controller.dart';
export 'pick_up_shifts_screen_controller.dart';
export 'your_rota_screen_controller.dart';

View File

@@ -0,0 +1,61 @@
import 'package:flutter/material.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 '../../ftc_mobile_app.dart';
class PickUpShiftsScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final loadingShifts = false.obs;
final myShiftsList = RxList<DaysArrayData>();
@override
void onReady() {
getAvailableShifts();
super.onReady();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
Future<void> getAvailableShifts() async {
loadingShifts.value = true;
var response = await RotaService().getAvailableShifts();
if (response is LiveRoasterResponseData) {
myShiftsList.value = response.daysArray ?? [];
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
loadingShifts.value = false;
}
Future<void> claimShifts(int index, DaysArrayData data) async {
if (data.rosterId!.isNullOrEmpty() ||
data.id.isNullOrEmpty() ||
(data.locationId?.id).isNullOrEmpty()) return;
var response = await RotaService()
.claimShift(
rosterId: data.rosterId!,
locationId: data.locationId!.id!,
dayId: data.id!)
.showLoader();
if (response is LiveRoasterResponseData) {
myShiftsList[index].isRequested = true;
myShiftsList.refresh();
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
}
@override
void dispose() {
Get.delete<PickUpShiftsScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,102 @@
import 'package:flutter/material.dart';
import 'package:flutter_calendar_carousel/classes/event.dart';
import 'package:flutter_calendar_carousel/classes/event_list.dart';
import 'package:ftc_mobile_app/models/rota/WeekArrayData.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../../ftc_mobile_app.dart';
import '../../models/rota/LiveRoasterResponseData.dart';
class RotaDashboardScreenController extends GetxController
with GetSingleTickerProviderStateMixin {
late TabController tabController = TabController(length: 2, vsync: this);
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final loadingShifts = false.obs;
final myShiftsList = RxList<DaysArrayData>();
//it holds shifts list for the selected date
final dateFilteredShiftsList = RxList<DaysArrayData>();
final targetDateTime = DateTime.now().obs;
final markedDatesMap = EventList<Event>(events: {}).obs;
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void onInit() {
getMyShifts();
super.onInit();
}
Future<void> getMyShifts() async {
loadingShifts.value = true;
var response = await RotaService().getMyShifts(
startDateMills: DateTime.now().subtract(30.days).millisecondsSinceEpoch,
endDateMills: DateTime.now().add(30.days).millisecondsSinceEpoch);
if (response is LiveRoasterResponseData) {
myShiftsList.value = response.daysArray ?? [];
createCalendarEvents(myShiftsList());
_filterShifts(targetDateTime());
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
loadingShifts.value = false;
}
createCalendarEvents(List<DaysArrayData> list) {
final Map<DateTime, List<Event>> map = {};
for (final data in list) {
// final date = DateTime.fromMillisecondsSinceEpoch(data.shiftDate!);
if (data.shiftDateTime == null) return;
map.addAll({
DateTime(data.shiftDateTime!.year, data.shiftDateTime!.month,
data.shiftDateTime!.day): [
Event(
date: DateTime(data.shiftDateTime!.year, data.shiftDateTime!.month,
data.shiftDateTime!.day),
title: data.serviceUserId?.displayName ?? "",
icon: CalendarWidget.underlineIcon(),
)
],
});
}
markedDatesMap.value.events
..clear()
..addAll(map);
markedDatesMap.refresh();
}
onDateSelect(DateTime date, List<Event> events) {
targetDateTime.value = date;
if (events.isNotEmpty) {
_filterShifts(date);
}
}
_filterShifts(DateTime date) {
dateFilteredShiftsList.value = myShiftsList.where((e) {
return DateFormatter.dateFormatter
.format(DateTime.fromMillisecondsSinceEpoch(e.shiftDate!)) ==
DateFormatter.dateFormatter.format(date);
}).toList();
}
@override
void dispose() {
tabController.dispose();
Get.delete<RotaDashboardScreenController>();
super.dispose();
}
}

View File

@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/rota/LiveRoasterResponseData.dart';
import 'package:ftc_mobile_app/models/rota/WeekArrayData.dart';
import 'package:get/get.dart';
import '../../ftc_mobile_app.dart';
class YourRotaScreenController extends GetxController{
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final loadingShifts = false.obs;
final myShiftsList = RxList<DaysArrayData>();
@override
void onInit() {
getAvailableShifts();
super.onInit();
}
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
Future<void> getAvailableShifts() async {
loadingShifts.value = true;
var response = await RotaService().getMyShifts(
startDateMills:
DateTime.now().toUtc().subtract(30.days).millisecondsSinceEpoch,
endDateMills:
DateTime.now().toUtc().add(30.days).millisecondsSinceEpoch);
if (response is LiveRoasterResponseData) {
myShiftsList.value = response.daysArray ?? [];
} else if (response is String && response.isNotEmpty) {
FrequentFunctions.showToast(message: response);
}
loadingShifts.value = false;
}
@override
void dispose() {
Get.delete<YourRotaScreenController>();
super.dispose();
}
}