fist commit ftc staff app clone
This commit is contained in:
57
lib/controllers/auth_module/agency_sign_in_controller.dart
Normal file
57
lib/controllers/auth_module/agency_sign_in_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
4
lib/controllers/auth_module/export_auth_module.dart
Normal file
4
lib/controllers/auth_module/export_auth_module.dart
Normal 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';
|
||||
53
lib/controllers/auth_module/otp_screen_controller.dart
Normal file
53
lib/controllers/auth_module/otp_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
116
lib/controllers/auth_module/sing_in_screen_controller.dart
Normal file
116
lib/controllers/auth_module/sing_in_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
119
lib/controllers/auth_module/splash_screen_controller.dart
Normal file
119
lib/controllers/auth_module/splash_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
127
lib/controllers/clients/add_new_document_screen_controller.dart
Normal file
127
lib/controllers/clients/add_new_document_screen_controller.dart
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
121
lib/controllers/clients/all_care_notes_screen_contorller.dart
Normal file
121
lib/controllers/clients/all_care_notes_screen_contorller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
71
lib/controllers/clients/appointment_screen_controller.dart
Normal file
71
lib/controllers/clients/appointment_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -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()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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()!,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
273
lib/controllers/clients/care_notes_screen_controller.dart
Normal file
273
lib/controllers/clients/care_notes_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
127
lib/controllers/clients/clients_list_screen_controller.dart
Normal file
127
lib/controllers/clients/clients_list_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
113
lib/controllers/clients/documents_list_screen_controller.dart
Normal file
113
lib/controllers/clients/documents_list_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
20
lib/controllers/clients/export_clients_controllers.dart
Normal file
20
lib/controllers/clients/export_clients_controllers.dart
Normal 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';
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
34
lib/controllers/clients/new_note_screen_controller.dart
Normal file
34
lib/controllers/clients/new_note_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
32
lib/controllers/clients/notes_screen_controller.dart
Normal file
32
lib/controllers/clients/notes_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
49
lib/controllers/clients/pbs_plan_screen_controller.dart
Normal file
49
lib/controllers/clients/pbs_plan_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
55
lib/controllers/clients/photo_gallery_screen_controller.dart
Normal file
55
lib/controllers/clients/photo_gallery_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
32
lib/controllers/clients/select_note_screen_controller.dart
Normal file
32
lib/controllers/clients/select_note_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
8
lib/controllers/custom_navigation_drawer_controller.dart
Normal file
8
lib/controllers/custom_navigation_drawer_controller.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class CustomNavigationDrawerController extends GetxController{
|
||||
RxInt selectedIndex = 1.obs;
|
||||
|
||||
|
||||
}
|
||||
7
lib/controllers/export_controllers.dart
Normal file
7
lib/controllers/export_controllers.dart
Normal 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';
|
||||
116
lib/controllers/home/dashboard_screen_controller.dart
Normal file
116
lib/controllers/home/dashboard_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
3
lib/controllers/home/export_home_controllers.dart
Normal file
3
lib/controllers/home/export_home_controllers.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
export 'dashboard_screen_controller.dart';
|
||||
export '../../view/screens/chat/controller/chat_screen_controller.dart';
|
||||
export 'inbox_screen_controller.dart';
|
||||
156
lib/controllers/home/inbox_screen_controller.dart
Normal file
156
lib/controllers/home/inbox_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
146
lib/controllers/home/select_user_for_chat_screen_controller.dart
Normal file
146
lib/controllers/home/select_user_for_chat_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export "notifications_list_screen_controller.dart";
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
1
lib/controllers/profile/export_profile_controllers.dart
Normal file
1
lib/controllers/profile/export_profile_controllers.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'view_profile_screen_controller.dart';
|
||||
94
lib/controllers/profile/view_profile_screen_controller.dart
Normal file
94
lib/controllers/profile/view_profile_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
136
lib/controllers/rota/book_holiday_screen_controller.dart
Normal file
136
lib/controllers/rota/book_holiday_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
122
lib/controllers/rota/calendar_view_screen_controller.dart
Normal file
122
lib/controllers/rota/calendar_view_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
5
lib/controllers/rota/export_rota_controller.dart
Normal file
5
lib/controllers/rota/export_rota_controller.dart
Normal 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';
|
||||
61
lib/controllers/rota/pick_up_shifts_screen_controller.dart
Normal file
61
lib/controllers/rota/pick_up_shifts_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
102
lib/controllers/rota/rota_dashboard_screen_controller.dart
Normal file
102
lib/controllers/rota/rota_dashboard_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
46
lib/controllers/rota/your_rota_screen_controller.dart
Normal file
46
lib/controllers/rota/your_rota_screen_controller.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
326
lib/dialogs/app_dialogs.dart
Normal file
326
lib/dialogs/app_dialogs.dart
Normal file
@@ -0,0 +1,326 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
||||
import 'package:ftc_mobile_app/models/appointmentsListResponse/AppointmentsListResponse.dart';
|
||||
import 'package:ftc_mobile_app/models/clients/recent_incidents_model.dart';
|
||||
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'widgets/appointment_details.dart';
|
||||
import 'widgets/recent_incident_detail_dialog.dart';
|
||||
|
||||
class AppDialog {
|
||||
static String areYouSureText = "Are you sure?";
|
||||
static bool alreadyShownUnauthorizedAlert = false;
|
||||
|
||||
static Widget titleText(String title) {
|
||||
return CustomTextWidget(
|
||||
text: title,
|
||||
textAlign: TextAlign.center,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
}
|
||||
|
||||
static Widget messageText(String message) {
|
||||
return CustomTextWidget(
|
||||
text: message,
|
||||
textAlign: TextAlign.center,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
}
|
||||
|
||||
static Widget buttonsBar({
|
||||
String button1Text = "No",
|
||||
String button2Text = "Yes",
|
||||
VoidCallback? onButton1Tap,
|
||||
required VoidCallback onButton2Tap,
|
||||
}) {
|
||||
return SizedBox(
|
||||
width: double.maxFinite,
|
||||
height: 40.h,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomAppButton(
|
||||
onTap: () {
|
||||
if (onButton1Tap == null) {
|
||||
Get.back();
|
||||
} else {
|
||||
onButton1Tap();
|
||||
}
|
||||
},
|
||||
buttonText: button1Text,
|
||||
textColor: Colors.black,
|
||||
borderColor: Colors.grey,
|
||||
buttonColor: Colors.white,
|
||||
),
|
||||
),
|
||||
16.horizontalSpace,
|
||||
Expanded(
|
||||
child: CustomAppButton(
|
||||
onTap: onButton2Tap,
|
||||
buttonText: button2Text,
|
||||
buttonColor: Get.theme.primaryColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Future successDialog({
|
||||
required String title,
|
||||
required String message,
|
||||
required String buttonText,
|
||||
required VoidCallback onDoneButtonClick,
|
||||
bool canDismiss = true,
|
||||
}) {
|
||||
return Get.generalDialog(
|
||||
barrierLabel: "",
|
||||
barrierDismissible: canDismiss,
|
||||
pageBuilder: (_, a1, a2) {
|
||||
return AlertDialog(
|
||||
shape: 15.toRoundedRectRadius(),
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
contentPadding: REdgeInsets.symmetric(horizontal: 24, vertical: 32),
|
||||
content: WillPopScope(
|
||||
onWillPop: () async => canDismiss,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// SvgPicture.asset(
|
||||
// Assets.svgIcCheck,
|
||||
// width: 50.r,
|
||||
// height: 50.r,
|
||||
// ),
|
||||
// 16.verticalSpace,
|
||||
titleText(title),
|
||||
12.verticalSpace,
|
||||
messageText(message),
|
||||
24.verticalSpace,
|
||||
CustomAppButton(
|
||||
onTap: onDoneButtonClick,
|
||||
buttonText: buttonText,
|
||||
buttonColor: Get.theme.primaryColor,
|
||||
).addPaddingHorizontal(24),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static Future showDialogWithSingleActionButton(
|
||||
{required String title,
|
||||
required String message,
|
||||
required VoidCallback onDoneButtonClick}) {
|
||||
return Get.generalDialog(
|
||||
barrierLabel: "",
|
||||
barrierDismissible: true,
|
||||
pageBuilder: (_, a1, a2) {
|
||||
return AlertDialog(
|
||||
shape: 15.toRoundedRectRadius(),
|
||||
contentPadding: REdgeInsets.symmetric(horizontal: 32, vertical: 32),
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
insetPadding: REdgeInsets.all(24),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
12.verticalSpace,
|
||||
titleText(title),
|
||||
16.verticalSpace,
|
||||
messageText(message),
|
||||
32.verticalSpace,
|
||||
CustomAppButton(
|
||||
onTap: onDoneButtonClick,
|
||||
buttonText: "Done",
|
||||
buttonColor: Get.theme.primaryColor,
|
||||
).addPaddingHorizontal(24),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static Future showDialogDeleteAccount(
|
||||
{required VoidCallback onDeleteButtonClick}) {
|
||||
return Get.generalDialog(
|
||||
barrierLabel: "",
|
||||
barrierDismissible: true,
|
||||
pageBuilder: (_, a1, a2) {
|
||||
return Center(
|
||||
child: Card(
|
||||
shape: 15.toRoundedRectRadius(),
|
||||
color: Colors.white,
|
||||
margin: REdgeInsets.symmetric(horizontal: 24),
|
||||
child: Padding(
|
||||
padding: REdgeInsets.symmetric(horizontal: 24.0, vertical: 32),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(width: double.maxFinite, height: 12.h),
|
||||
titleText("Delete Account?"),
|
||||
SizedBox(width: double.maxFinite, height: 16.h),
|
||||
messageText("Are you sure you want to delete your account?"),
|
||||
SizedBox(width: double.maxFinite, height: 32.h),
|
||||
buttonsBar(onButton2Tap: onDeleteButtonClick),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static Future showUnauthorizedAlert() async {
|
||||
if (alreadyShownUnauthorizedAlert) {
|
||||
return;
|
||||
}
|
||||
|
||||
alreadyShownUnauthorizedAlert = true;
|
||||
await Get.dialog(
|
||||
WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: UnconstrainedBox(
|
||||
child: SizedBox(
|
||||
width: 1.0.sw,
|
||||
child: AlertDialog(
|
||||
shape: 15.toRoundedRectRadius(),
|
||||
contentPadding:
|
||||
REdgeInsets.symmetric(horizontal: 32, vertical: 32),
|
||||
insetPadding:
|
||||
REdgeInsets.symmetric(horizontal: 24, vertical: 24),
|
||||
backgroundColor: Colors.white,
|
||||
content: Column(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.warning_amber_rounded,
|
||||
color: Colors.red,
|
||||
size: 65.r,
|
||||
),
|
||||
24.verticalSpace,
|
||||
titleText(
|
||||
"Session Expired",
|
||||
),
|
||||
12.verticalSpace,
|
||||
messageText(
|
||||
"Your session has been expired. Please log-in again to continue using the app.",
|
||||
),
|
||||
48.verticalSpace,
|
||||
CustomAppButton(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
alreadyShownUnauthorizedAlert = false;
|
||||
// FrequentFunctions.logout();
|
||||
},
|
||||
buttonText: "Log In",
|
||||
buttonColor: Get.theme.primaryColor,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
barrierDismissible: false)
|
||||
.then((value) {
|
||||
alreadyShownUnauthorizedAlert = false;
|
||||
});
|
||||
}
|
||||
|
||||
static Future alertAndLogout(VoidCallback onTapYes) {
|
||||
return _showLogoutAlert(onTapYes);
|
||||
}
|
||||
|
||||
static Future _showLogoutAlert(Function() onTapYes) async {
|
||||
// do not handle dialog dismiss, as it's already done
|
||||
return openAlertDialog(
|
||||
title: "Logout!",
|
||||
message: "$areYouSureText Do you really want to logout from the app?",
|
||||
onYesTap: onTapYes);
|
||||
}
|
||||
|
||||
static Future<bool> showAlertAppExit() async {
|
||||
var isOk = false;
|
||||
|
||||
await Get.generalDialog(
|
||||
barrierLabel: "",
|
||||
barrierDismissible: true,
|
||||
pageBuilder: (_, a1, a2) {
|
||||
return Center(
|
||||
child: Card(
|
||||
shape: 15.toRoundedRectRadius(),
|
||||
color: Colors.white,
|
||||
margin: REdgeInsets.symmetric(horizontal: 24),
|
||||
child: Padding(
|
||||
padding: REdgeInsets.symmetric(horizontal: 24.0, vertical: 32),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(width: double.maxFinite, height: 12.h),
|
||||
titleText(areYouSureText),
|
||||
SizedBox(width: double.maxFinite, height: 16.h),
|
||||
titleText("Do you really want to exit from the app?"),
|
||||
SizedBox(width: double.maxFinite, height: 32.h),
|
||||
buttonsBar(onButton2Tap: () async {
|
||||
isOk = true;
|
||||
Get.back();
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return isOk;
|
||||
}
|
||||
|
||||
static Future openAlertDialog(
|
||||
{required String title,
|
||||
required String message,
|
||||
required VoidCallback onYesTap}) {
|
||||
return Get.generalDialog(
|
||||
barrierLabel: "",
|
||||
barrierDismissible: true,
|
||||
pageBuilder: (_, a1, a2) {
|
||||
return Center(
|
||||
child: Card(
|
||||
shape: 15.toRoundedRectRadius(),
|
||||
color: Colors.white,
|
||||
margin: REdgeInsets.symmetric(horizontal: 24),
|
||||
child: Padding(
|
||||
padding: REdgeInsets.symmetric(horizontal: 24.0, vertical: 32),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(width: double.maxFinite, height: 12.h),
|
||||
titleText(title),
|
||||
16.verticalSpace,
|
||||
messageText(message),
|
||||
SizedBox(width: double.maxFinite, height: 32.h),
|
||||
buttonsBar(onButton2Tap: onYesTap),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
static showAppointmentDetailDialog(
|
||||
{required AppointmentsListResponseData data}) {
|
||||
Get.dialog(AppointmentDetailsDialog(data: data));
|
||||
}
|
||||
|
||||
static showRecentIncidentDetailDialog({required RecentIncidentsModel data}) {
|
||||
Get.dialog(RecentIncidentDetailDialog(data: data));
|
||||
}
|
||||
}
|
||||
128
lib/dialogs/widgets/appointment_details.dart
Normal file
128
lib/dialogs/widgets/appointment_details.dart
Normal file
@@ -0,0 +1,128 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
||||
import 'package:ftc_mobile_app/models/appointmentsListResponse/AppointmentsListResponse.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/common_cancel_button.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/my_circle_image.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class AppointmentDetailsDialog extends StatelessWidget {
|
||||
final AppointmentsListResponseData data;
|
||||
|
||||
const AppointmentDetailsDialog({super.key, required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appointmentDate = DateFormat("dd/MM/yyyy")
|
||||
.format(DateTime.fromMillisecondsSinceEpoch(data.appointmentDate!));
|
||||
|
||||
final appointmentTime =
|
||||
"${data.appointmentStartTime ?? "NA"} to ${data.appointmentEndTime ?? "NA"}";
|
||||
|
||||
final d = (data.appointmentMin ?? 0).minutes;
|
||||
final duration =
|
||||
"${d.inHours} hours and ${d.inMinutes - (d.inHours.hours.inMinutes)} minutes";
|
||||
|
||||
return AlertDialog(
|
||||
insetPadding: REdgeInsets.all(18),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2.r)),
|
||||
backgroundColor: Colors.white,
|
||||
surfaceTintColor: Colors.white,
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
data.appointmentTitle ?? "",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
CustomTextWidget(
|
||||
text: "$appointmentDate $appointmentTime",
|
||||
fontSize: 13.sp,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
16.verticalSpace,
|
||||
CustomTextWidget(
|
||||
text: "Appointment duration:",
|
||||
fontSize: 14.sp,
|
||||
fontColor: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
CustomTextWidget(
|
||||
text: duration,
|
||||
fontSize: 13.sp,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
16.verticalSpace,
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
text: "Detail: ",
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: data.appointmentDetails ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 13.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
16.verticalSpace,
|
||||
CustomTextWidget(
|
||||
text: "Staff:",
|
||||
fontSize: 14.sp,
|
||||
fontColor: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
8.verticalSpace,
|
||||
Row(
|
||||
children: [
|
||||
MyCircleImage(
|
||||
imageSize: 32.r,
|
||||
url: "${WebUrls.baseUrl}${data.staff?.profilePictureUrl ?? ""}",
|
||||
errorWidget: CustomImageWidget(
|
||||
imagePath: AssetsManager.kPersonMainIcon,
|
||||
height: 32.r,
|
||||
width: 32.r,
|
||||
),
|
||||
),
|
||||
8.horizontalSpace,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
data.staff?.name ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 13.sp,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Contact No. ${data.staff?.phoneNumber ?? ""}",
|
||||
style: TextStyle(
|
||||
fontSize: 13.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: const [CommonCloseTextButton()],
|
||||
);
|
||||
}
|
||||
}
|
||||
75
lib/dialogs/widgets/holiday_request_sent_dialog.dart
Normal file
75
lib/dialogs/widgets/holiday_request_sent_dialog.dart
Normal file
@@ -0,0 +1,75 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/common_cancel_button.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/label_value_box_widget.dart';
|
||||
|
||||
class HolidayRequestSentDialog extends StatelessWidget {
|
||||
const HolidayRequestSentDialog({
|
||||
super.key,
|
||||
required this.holidayStartDate,
|
||||
required this.holidayEndDate,
|
||||
required this.holidayTotalTime,
|
||||
});
|
||||
|
||||
final String holidayStartDate;
|
||||
final String holidayEndDate;
|
||||
final String holidayTotalTime;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
insetPadding: REdgeInsets.all(18),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2.r)),
|
||||
backgroundColor: Colors.white,
|
||||
surfaceTintColor: Colors.white,
|
||||
title: Center(
|
||||
child: CustomTextWidget(
|
||||
text: 'Your Holiday Request has been sent',
|
||||
fontWeight: FontWeight.bold,
|
||||
isExpanded: false,
|
||||
alignment: Alignment.center,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: LabelValueBoxWidget(
|
||||
label: 'Start Date:',
|
||||
value: holidayStartDate,
|
||||
borderColor:
|
||||
CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
)),
|
||||
5.horizontalSpace,
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: LabelValueBoxWidget(
|
||||
label: 'End Date',
|
||||
value: holidayEndDate,
|
||||
borderColor:
|
||||
CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
)),
|
||||
],
|
||||
),
|
||||
10.verticalSpace,
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: LabelValueBoxWidget(
|
||||
label: 'Your remaining Holidays',
|
||||
value: holidayTotalTime,
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
)),
|
||||
10.verticalSpace,
|
||||
const CustomTextWidget(
|
||||
text: "Kindly wait as we review your holiday request.")
|
||||
],
|
||||
),
|
||||
actions: const [CommonCloseTextButton()],
|
||||
);
|
||||
}
|
||||
}
|
||||
69
lib/dialogs/widgets/holidays_data_dialog.dart
Normal file
69
lib/dialogs/widgets/holidays_data_dialog.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/common_cancel_button.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/label_value_box_widget.dart';
|
||||
|
||||
class HolidaysDataDialog extends StatelessWidget {
|
||||
const HolidaysDataDialog({
|
||||
super.key,
|
||||
required this.holidayModel,
|
||||
});
|
||||
|
||||
final HolidayModel holidayModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
insetPadding: REdgeInsets.all(18),
|
||||
surfaceTintColor: CustomAppColors.kPrimaryColor,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
|
||||
backgroundColor: CustomAppColors.kWhiteColor,
|
||||
title: Center(
|
||||
child: CustomTextWidget(
|
||||
text: 'Your Holidays',
|
||||
fontWeight: FontWeight.w700,
|
||||
isExpanded: false,
|
||||
alignment: Alignment.center,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
LabelValueBoxWidget(
|
||||
label: 'Carried Over:',
|
||||
value: holidayModel.carriedOver,
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
LabelValueBoxWidget(
|
||||
label: 'Holiday Entitlement',
|
||||
value: holidayModel.holidayEntitlement,
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
LabelValueBoxWidget(
|
||||
label: 'Holiday Allowance',
|
||||
value: holidayModel.holidayAllowance,
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
LabelValueBoxWidget(
|
||||
label: 'Your remaining Holidays',
|
||||
value: holidayModel.remainingHolidays,
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
LabelValueBoxWidget(
|
||||
label: 'Time left before Year End:',
|
||||
value: holidayModel.timeLeftBeforeYearEnd,
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
const CommonCloseTextButton()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
88
lib/dialogs/widgets/recent_incident_detail_dialog.dart
Normal file
88
lib/dialogs/widgets/recent_incident_detail_dialog.dart
Normal file
@@ -0,0 +1,88 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
||||
import 'package:ftc_mobile_app/models/clients/recent_incidents_model.dart';
|
||||
import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/common_cancel_button.dart';
|
||||
import 'package:quill_html_editor/quill_html_editor.dart';
|
||||
|
||||
class RecentIncidentDetailDialog extends StatelessWidget {
|
||||
final RecentIncidentsModel data;
|
||||
|
||||
const RecentIncidentDetailDialog({super.key, required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
insetPadding: REdgeInsets.all(18),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2.r)),
|
||||
backgroundColor: Colors.white,
|
||||
surfaceTintColor: Colors.white,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
content: SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
20.verticalSpace,
|
||||
Text("Incident Date - Time",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14.sp,
|
||||
color: Colors.black,
|
||||
)).addPaddingHorizontal(16),
|
||||
Text(
|
||||
DateFormatter.ddMMyyyyhhmmFormat(
|
||||
DateTime.parse(data.createdAt).toLocal()),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12.sp,
|
||||
color: CustomAppColors.kBlackColor,
|
||||
)).addPaddingHorizontal(16),
|
||||
8.verticalSpace,
|
||||
Divider(
|
||||
color: CustomAppColors.kLightGreyColor,
|
||||
),
|
||||
8.verticalSpace,
|
||||
CustomTextWidget(
|
||||
text: data.incidentTitle.isNotEmpty
|
||||
? data.incidentTitle
|
||||
: "Untitled Incident",
|
||||
isExpanded: false,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14.sp,
|
||||
textAlign: TextAlign.left,
|
||||
).addPaddingHorizontal(16),
|
||||
4.verticalSpace,
|
||||
Expanded(
|
||||
child: QuillHtmlEditor(
|
||||
text: data.note,
|
||||
hintText: 'Hint text goes here',
|
||||
controller: data.quillController,
|
||||
isEnabled: false,
|
||||
ensureVisible: false,
|
||||
minHeight: 50.h,
|
||||
autoFocus: false,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
// hintTextStyle: _hintTextStyle,
|
||||
hintTextAlign: TextAlign.start,
|
||||
loadingBuilder: (context) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 1,
|
||||
color: Colors.red,
|
||||
));
|
||||
},
|
||||
).addPaddingHorizontal(16),
|
||||
),
|
||||
const CommonCloseTextButton().addPaddingAll(16),
|
||||
8.verticalSpace,
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
128
lib/dialogs/widgets/shift_dialog.dart
Normal file
128
lib/dialogs/widgets/shift_dialog.dart
Normal file
@@ -0,0 +1,128 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
||||
import 'package:ftc_mobile_app/models/rota/WeekArrayData.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/common_cancel_button.dart';
|
||||
import 'package:ftc_mobile_app/view/custom_widgets/label_value_box_widget.dart';
|
||||
|
||||
class ShowRotaAlertDialog extends StatelessWidget {
|
||||
final DaysArrayData data;
|
||||
final Function? onClaimShiftTap;
|
||||
final Function? onCancelShiftTap;
|
||||
|
||||
const ShowRotaAlertDialog(
|
||||
{super.key,
|
||||
required this.data,
|
||||
this.onClaimShiftTap,
|
||||
this.onCancelShiftTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isAvailableShift = (data.staffUserId == null);
|
||||
return AlertDialog(
|
||||
insetPadding: REdgeInsets.all(18),
|
||||
contentPadding: REdgeInsets.all(15),
|
||||
surfaceTintColor: CustomAppColors.kPrimaryColor,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2.r)),
|
||||
backgroundColor: CustomAppColors.kPrimaryColor,
|
||||
title: Center(
|
||||
child: CustomTextWidget(
|
||||
text: isAvailableShift
|
||||
? 'Available Shift'
|
||||
: data.staffUserId?.staffMemberName ?? "",
|
||||
fontWeight: FontWeight.bold,
|
||||
isExpanded: false,
|
||||
alignment: Alignment.center,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
LabelValueBoxWidget(
|
||||
label: 'Service User (Patient):',
|
||||
value: data.serviceUserId?.displayName ?? 'Unassigned',
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
// LabelValueBoxWidget(
|
||||
// label: 'Worker Type:',
|
||||
// value: data.workerType,
|
||||
// borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
// ),
|
||||
// 10.verticalSpace,
|
||||
LabelValueBoxWidget(
|
||||
label: 'Location:',
|
||||
value: data.locationId?.shiftLocationName ?? '',
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
// 10.verticalSpace,
|
||||
// LabelValueBoxWidget(
|
||||
// label: 'Staff Required:',
|
||||
// value: data.staffRequired,
|
||||
// borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
// ),
|
||||
10.verticalSpace,
|
||||
LabelValueBoxWidget(
|
||||
label: 'Start Time:',
|
||||
value: DateFormatter()
|
||||
.roasterShiftFormattedTime(time: data.shiftStartTime ?? ""),
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
LabelValueBoxWidget(
|
||||
label: 'End Time:',
|
||||
value: DateFormatter()
|
||||
.roasterShiftFormattedTime(time: data.shiftEndTime ?? ""),
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
// LabelValueBoxWidget(
|
||||
// label: 'Break Time:',
|
||||
// value: data.breakTime,
|
||||
// borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
// ),
|
||||
// 10.verticalSpace,
|
||||
LabelValueBoxWidget(
|
||||
label: 'Notes:',
|
||||
value: data.note ?? "NA",
|
||||
borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3),
|
||||
),
|
||||
10.verticalSpace,
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(minHeight: 30.h, maxHeight: 30.h),
|
||||
child: Row(
|
||||
children: [
|
||||
data.isRequested == true
|
||||
? FrequentFunctions.noWidget
|
||||
: Expanded(
|
||||
child: CustomAppButton(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
if (isAvailableShift) {
|
||||
if (onClaimShiftTap != null) {
|
||||
onClaimShiftTap!.call();
|
||||
}
|
||||
} else {
|
||||
if (onCancelShiftTap != null) {
|
||||
onCancelShiftTap!.call();
|
||||
}
|
||||
}
|
||||
},
|
||||
buttonText:
|
||||
isAvailableShift ? "Claim Shift" : "Cancel Shift",
|
||||
textColor: Colors.white,
|
||||
borderColor: Colors.transparent,
|
||||
),
|
||||
),
|
||||
10.horizontalSpace,
|
||||
const Expanded(child: CommonCloseTextButton()),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
68
lib/firebase_options.dart
Normal file
68
lib/firebase_options.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
// File generated by FlutterFire CLI.
|
||||
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
|
||||
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
|
||||
import 'package:flutter/foundation.dart'
|
||||
show defaultTargetPlatform, kIsWeb, TargetPlatform;
|
||||
|
||||
/// Default [FirebaseOptions] for use with your Firebase apps.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// import 'firebase_options.dart';
|
||||
/// // ...
|
||||
/// await Firebase.initializeApp(
|
||||
/// options: DefaultFirebaseOptions.currentPlatform,
|
||||
/// );
|
||||
/// ```
|
||||
class DefaultFirebaseOptions {
|
||||
static FirebaseOptions get currentPlatform {
|
||||
if (kIsWeb) {
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for web - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
}
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
return android;
|
||||
case TargetPlatform.iOS:
|
||||
return ios;
|
||||
case TargetPlatform.macOS:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for macos - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
case TargetPlatform.windows:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for windows - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
case TargetPlatform.linux:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for linux - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
default:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions are not supported for this platform.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static const FirebaseOptions android = FirebaseOptions(
|
||||
apiKey: 'AIzaSyDF2vZbiWQROGvyvLeeCmAjPLnPLYjE6Os',
|
||||
appId: '1:583559514958:android:89af243ca4a3888a32ec1f',
|
||||
messagingSenderId: '583559514958',
|
||||
projectId: 'ftc-services-ea8d6',
|
||||
storageBucket: 'ftc-services-ea8d6.appspot.com',
|
||||
);
|
||||
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyAkJyvTX8oQSY9Ju3L39oupZbdy4Eo-RbA',
|
||||
appId: '1:583559514958:ios:5ec9cd88ca24777932ec1f',
|
||||
messagingSenderId: '583559514958',
|
||||
projectId: 'ftc-services-ea8d6',
|
||||
storageBucket: 'ftc-services-ea8d6.appspot.com',
|
||||
iosBundleId: 'com.ftc.app.ftcMobileApp',
|
||||
);
|
||||
}
|
||||
6
lib/ftc_mobile_app.dart
Normal file
6
lib/ftc_mobile_app.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
export 'models/export_models.dart';
|
||||
export 'view/export_view.dart';
|
||||
export 'controllers/export_controllers.dart';
|
||||
export 'utilities/export_utilities.dart';
|
||||
export 'web_services/export_web_services.dart';
|
||||
export 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
60
lib/main.dart
Normal file
60
lib/main.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_time_ago/get_time_ago.dart';
|
||||
|
||||
import 'utilities/app_session_manager.dart';
|
||||
import 'utilities/custom_timeago_messages.dart';
|
||||
import 'utilities/fcm_notifications.dart';
|
||||
import 'utilities/notification_util.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await CustomUIOverLay.initialize();
|
||||
GetTimeAgo.setCustomLocaleMessages('en', CustomTimeAgoMessages());
|
||||
|
||||
//Notification initialize
|
||||
NotificationUtils.init();
|
||||
try {
|
||||
await FcmNotification.getInstance().init();
|
||||
} catch (e) {
|
||||
debugPrint("FcmNotification init error: $e");
|
||||
}
|
||||
|
||||
await LocalStorageManager.init();
|
||||
Get.lazyPut(() => AppSessionManager(), fenix: true);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ScreenUtilInit(
|
||||
designSize: Size(
|
||||
MediaQuery.sizeOf(context).width,
|
||||
MediaQuery.sizeOf(context).height,
|
||||
),
|
||||
builder: (_, child) {
|
||||
return GetMaterialApp(
|
||||
title: ConstantText.kAppName,
|
||||
debugShowCheckedModeBanner: false,
|
||||
builder: (context, child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaler: const TextScaler.linear(1.0),
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
theme: CustomTheme.defaultTheme(),
|
||||
navigatorKey: CustomRouteGenerator.navigatorKey,
|
||||
initialRoute: CustomRouteNames.kInitialRoute,
|
||||
onGenerateRoute: CustomRouteGenerator.generateRoute,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
|
||||
|
||||
class AppointmentsListResponse {
|
||||
AppointmentsListResponse({
|
||||
this.success,
|
||||
this.status,
|
||||
this.message,
|
||||
this.data,});
|
||||
|
||||
AppointmentsListResponse.fromJson(dynamic json) {
|
||||
status = json['status'];
|
||||
message = json['message'];
|
||||
if (json['data'] != null) {
|
||||
data = [];
|
||||
json['data'].forEach((v) {
|
||||
data?.add(AppointmentsListResponseData.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bool? success;
|
||||
String? status;
|
||||
String? message;
|
||||
List<AppointmentsListResponseData>? data;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['status'] = status;
|
||||
map['message'] = message;
|
||||
if (data != null) {
|
||||
map['data'] = data?.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class AppointmentsListResponseData {
|
||||
AppointmentsListResponseData({
|
||||
this.id,
|
||||
this.user,
|
||||
this.appointmentDate,
|
||||
this.appointmentStartTime,
|
||||
this.appointmentEndTime,
|
||||
this.appointmentMin,
|
||||
this.staff,
|
||||
this.addedby,
|
||||
this.appointmentDetails,
|
||||
this.status,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.appointmentTitle,});
|
||||
|
||||
AppointmentsListResponseData.fromJson(dynamic json) {
|
||||
id = json['_id'];
|
||||
user = json['user'];
|
||||
appointmentDate = json['appointmentDate'];
|
||||
appointmentStartTime = json['appointmentStartTime'];
|
||||
appointmentEndTime = json['appointmentEndTime'];
|
||||
appointmentMin = json['appointmentMin'];
|
||||
staff = json['staff'] != null ? UserData.fromJson(json['staff']) : null;
|
||||
addedby = json['addedby'];
|
||||
appointmentDetails = json['appointmentDetails'];
|
||||
status = json['status'];
|
||||
createdAt = json['createdAt'];
|
||||
updatedAt = json['updatedAt'];
|
||||
appointmentTitle = json['appointmentTitle'];
|
||||
}
|
||||
String? id;
|
||||
String? user;
|
||||
int? appointmentDate;
|
||||
String? appointmentStartTime;
|
||||
String? appointmentEndTime;
|
||||
int? appointmentMin;
|
||||
UserData? staff;
|
||||
String? addedby;
|
||||
String? appointmentDetails;
|
||||
String? status;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
String? appointmentTitle;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['_id'] = id;
|
||||
map['user'] = user;
|
||||
map['appointmentDate'] = appointmentDate;
|
||||
map['appointmentStartTime'] = appointmentStartTime;
|
||||
map['appointmentEndTime'] = appointmentEndTime;
|
||||
map['appointmentMin'] = appointmentMin;
|
||||
if (staff != null) {
|
||||
map['staff'] = staff?.toJson();
|
||||
}
|
||||
map['addedby'] = addedby;
|
||||
map['appointmentDetails'] = appointmentDetails;
|
||||
map['status'] = status;
|
||||
map['createdAt'] = createdAt;
|
||||
map['updatedAt'] = updatedAt;
|
||||
map['appointmentTitle'] = appointmentTitle;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
80
lib/models/chat/ChatModel.dart
Normal file
80
lib/models/chat/ChatModel.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
import '../profileData/user_data.dart';
|
||||
|
||||
class ChatModel {
|
||||
static const stateNone = 0;
|
||||
static const stateError = -1;
|
||||
static const stateLoading = 1;
|
||||
static const stateSuccess = 2;
|
||||
|
||||
static const String fileTypeLocalPath = "localPath";
|
||||
|
||||
ChatModel({
|
||||
this.id,
|
||||
this.from,
|
||||
this.to,
|
||||
this.message,
|
||||
this.messageType,
|
||||
this.filePath,
|
||||
this.date,
|
||||
this.archived,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.localId,
|
||||
this.fileType,
|
||||
this.state = stateNone,
|
||||
});
|
||||
|
||||
ChatModel.fromJson(dynamic json) {
|
||||
from = json['from'] != null ? UserData.fromJson(json['from']) : null;
|
||||
to = json['to'] != null ? UserData.fromJson(json['to']) : null;
|
||||
id = json['_id'];
|
||||
message = json['message'];
|
||||
messageType = json['messageType'];
|
||||
filePath = json['filePath'];
|
||||
date = json['date'];
|
||||
localId = json['localId'];
|
||||
archived = json['archived'];
|
||||
createdAt = json['createdAt'];
|
||||
updatedAt = json['updatedAt'];
|
||||
|
||||
date = DateTime.tryParse(createdAt ?? "")?.millisecondsSinceEpoch ?? 0;
|
||||
}
|
||||
|
||||
String? id;
|
||||
UserData? from;
|
||||
UserData? to;
|
||||
String? message;
|
||||
String? messageType;
|
||||
String? filePath;
|
||||
int? date;
|
||||
bool? archived;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
|
||||
//Local usage variables
|
||||
int state = stateNone;
|
||||
String? fileType;
|
||||
String? localId;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
if (from != null) {
|
||||
map['from'] = from?.toJson();
|
||||
}
|
||||
if (to != null) {
|
||||
map['to'] = to?.toJson();
|
||||
}
|
||||
map['_id'] = id;
|
||||
map['message'] = message;
|
||||
map['messageType'] = messageType;
|
||||
map['filePath'] = filePath;
|
||||
map['date'] = date;
|
||||
map['archived'] = archived;
|
||||
map['createdAt'] = createdAt;
|
||||
map['updatedAt'] = updatedAt;
|
||||
map['localId'] = localId;
|
||||
map['state'] = state;
|
||||
map['isSent'] = state;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
61
lib/models/chat/add_group_message_model.dart
Normal file
61
lib/models/chat/add_group_message_model.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
class AddDeleteUpdateGroupMessageModel {
|
||||
AddDeleteUpdateGroupMessageModel({
|
||||
required this.groupId,
|
||||
required this.userId,
|
||||
required this.message,
|
||||
required this.isDeleted,
|
||||
required this.isHide,
|
||||
required this.isPin,
|
||||
required this.id,
|
||||
required this.seenBy,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.v,
|
||||
});
|
||||
String groupId = "";
|
||||
String userId = "";
|
||||
String message = "";
|
||||
bool isDeleted = false;
|
||||
bool isHide = false;
|
||||
bool isPin = false;
|
||||
String id = "";
|
||||
List<dynamic> seenBy = [];
|
||||
String createdAt = "";
|
||||
String updatedAt = "";
|
||||
int v = -1;
|
||||
|
||||
AddDeleteUpdateGroupMessageModel.fromJson(Map<String, dynamic> json){
|
||||
groupId = json['groupId']??"";
|
||||
userId = json['userId']??"";
|
||||
message = json['message']??"";
|
||||
isDeleted = json['isDeleted']?? false;
|
||||
isHide = json['isHide']?? false;
|
||||
isPin = json['isPin']?? false;
|
||||
id = json['_id']??"";
|
||||
seenBy = List.castFrom<dynamic, dynamic>(json['seenBy']??[]);
|
||||
createdAt = json['createdAt']??"";
|
||||
updatedAt = json['updatedAt']??"";
|
||||
v = json['__v']??-1;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['groupId'] = groupId;
|
||||
data['userId'] = userId;
|
||||
data['message'] = message;
|
||||
data['isDeleted'] = isDeleted;
|
||||
data['isHide'] = isHide;
|
||||
data['isPin'] = isPin;
|
||||
data['_id'] = id;
|
||||
data['seenBy'] = seenBy;
|
||||
data['createdAt'] = createdAt;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['__v'] = v;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AddDeleteUpdateGroupMessageModel{groupId: $groupId, userId: $userId, message: $message, isDeleted: $isDeleted, isHide: $isHide, isPin: $isPin, id: $id, seenBy: $seenBy, createdAt: $createdAt, updatedAt: $updatedAt, v: $v}';
|
||||
}
|
||||
}
|
||||
353
lib/models/chat/all_group_messages_model.dart
Normal file
353
lib/models/chat/all_group_messages_model.dart
Normal file
@@ -0,0 +1,353 @@
|
||||
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
|
||||
|
||||
import '../profileData/FcmTokens.dart';
|
||||
import '../profileData/LocationData.dart';
|
||||
|
||||
class AllGroupMessages {
|
||||
AllGroupMessages({
|
||||
required this.id,
|
||||
required this.groupId,
|
||||
required this.userId,
|
||||
required this.message,
|
||||
required this.messageType,
|
||||
required this.filePath,
|
||||
required this.isDeleted,
|
||||
required this.isHide,
|
||||
required this.isPin,
|
||||
required this.seenBy,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.v,
|
||||
});
|
||||
|
||||
String id = "";
|
||||
GroupId groupId = GroupId.empty();
|
||||
UserData? userId;
|
||||
String message = "";
|
||||
String messageType = "";
|
||||
String filePath = "";
|
||||
bool isDeleted = false;
|
||||
bool isHide = false;
|
||||
bool isPin = false;
|
||||
List<dynamic> seenBy = [];
|
||||
String createdAt = "";
|
||||
String updatedAt = "";
|
||||
int v = -1;
|
||||
|
||||
AllGroupMessages.empty();
|
||||
|
||||
AllGroupMessages.fromJson(Map<String, dynamic> json) {
|
||||
id = json['_id'] ?? "";
|
||||
groupId = GroupId.fromJson(json['groupId'] ?? GroupId.empty());
|
||||
userId = UserData.fromJson(json['userId'] ?? {});
|
||||
message = json['message'] ?? "";
|
||||
messageType = json['messageType'] ?? "";
|
||||
filePath = json['filePath'] ?? "";
|
||||
isDeleted = json['isDeleted'] ?? false;
|
||||
isHide = json['isHide'] ?? false;
|
||||
isPin = json['isPin'] ?? false;
|
||||
seenBy = List.castFrom<dynamic, dynamic>(json['seenBy'] ?? []);
|
||||
createdAt = json['createdAt'] ?? "";
|
||||
updatedAt = json['updatedAt'] ?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['_id'] = id;
|
||||
data['groupId'] = groupId.toJson();
|
||||
data['userId'] = userId?.toJson();
|
||||
data['message'] = message;
|
||||
data['messageType'] = messageType;
|
||||
data['filePath'] = filePath;
|
||||
data['isDeleted'] = isDeleted;
|
||||
data['isHide'] = isHide;
|
||||
data['isPin'] = isPin;
|
||||
data['seenBy'] = seenBy;
|
||||
data['createdAt'] = createdAt;
|
||||
data['updatedAt'] = updatedAt;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AllGroupMessages{id: $id, groupId: $groupId, userId: $userId, message: $message, isDeleted: $isDeleted, isHide: $isHide, isPin: $isPin, seenBy: $seenBy, createdAt: $createdAt, updatedAt: $updatedAt, v: $v}';
|
||||
}
|
||||
}
|
||||
|
||||
class GroupId {
|
||||
GroupId({
|
||||
required this.lastMessages,
|
||||
required this.groupWorkingScheduleTime,
|
||||
required this.id,
|
||||
required this.groupName,
|
||||
required this.groupImage,
|
||||
required this.groupMembers,
|
||||
required this.isGroup,
|
||||
required this.date,
|
||||
required this.isActive,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.v,
|
||||
});
|
||||
|
||||
LastMessages lastMessages = LastMessages.empty();
|
||||
GroupWorkingScheduleTime groupWorkingScheduleTime =
|
||||
GroupWorkingScheduleTime.empty();
|
||||
String id = "";
|
||||
String groupName = "";
|
||||
String groupImage = "";
|
||||
List<String> groupMembers = [];
|
||||
bool isGroup = false;
|
||||
String date = "";
|
||||
bool isActive = false;
|
||||
String createdAt = "";
|
||||
String updatedAt = "";
|
||||
int v = -1;
|
||||
|
||||
GroupId.empty();
|
||||
|
||||
GroupId.id({required this.id});
|
||||
|
||||
GroupId.fromJson(Map<String, dynamic> json) {
|
||||
lastMessages =
|
||||
LastMessages.fromJson(json['lastMessages'] ?? LastMessages.empty());
|
||||
groupWorkingScheduleTime = GroupWorkingScheduleTime.fromJson(
|
||||
json['groupWorkingScheduleTime'] ?? GroupWorkingScheduleTime.empty());
|
||||
id = json['_id'] ?? "";
|
||||
groupName = json['groupName'] ?? "";
|
||||
groupImage = json['groupImage'] ?? "";
|
||||
groupMembers = List.castFrom<dynamic, String>(json['groupMembers'] ?? []);
|
||||
isGroup = json['isGroup'] ?? false;
|
||||
date = json['date'] ?? "";
|
||||
isActive = json['isActive'] ?? false;
|
||||
createdAt = json['createdAt'] ?? "";
|
||||
updatedAt = json['updatedAt'] ?? "";
|
||||
v = json['__v'] ?? -1;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['lastMessages'] = lastMessages.toJson();
|
||||
data['groupWorkingScheduleTime'] = groupWorkingScheduleTime.toJson();
|
||||
data['_id'] = id;
|
||||
data['groupName'] = groupName;
|
||||
data['groupImage'] = groupImage;
|
||||
data['groupMembers'] = groupMembers;
|
||||
data['isGroup'] = isGroup;
|
||||
data['date'] = date;
|
||||
data['isActive'] = isActive;
|
||||
data['createdAt'] = createdAt;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['__v'] = v;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'GroupId{lastMessages: $lastMessages, groupWorkingScheduleTime: $groupWorkingScheduleTime, id: $id, groupName: $groupName, groupImage: $groupImage, groupMembers: $groupMembers, isGroup: $isGroup, date: $date, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt, v: $v}';
|
||||
}
|
||||
}
|
||||
|
||||
class LastMessages {
|
||||
LastMessages({
|
||||
required this.message,
|
||||
required this.messageSentBy,
|
||||
required this.messageTime,
|
||||
});
|
||||
|
||||
String message = "";
|
||||
String messageSentBy = "";
|
||||
int messageTime = -1;
|
||||
|
||||
LastMessages.empty();
|
||||
|
||||
LastMessages.fromJson(Map<String, dynamic> json) {
|
||||
message = json['message'] ?? "";
|
||||
messageSentBy = json['messageSentBy'] ?? "";
|
||||
messageTime = json['messageTime'] ?? -1;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['message'] = message;
|
||||
data['messageSentBy'] = messageSentBy;
|
||||
data['messageTime'] = messageTime;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LastMessages{message: $message, messageSentBy: $messageSentBy, messageTime: $messageTime}';
|
||||
}
|
||||
}
|
||||
|
||||
class GroupWorkingScheduleTime {
|
||||
GroupWorkingScheduleTime({
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
required this.totalWorkHours,
|
||||
});
|
||||
|
||||
int startTime = -1;
|
||||
int endTime = -1;
|
||||
String totalWorkHours = "";
|
||||
|
||||
GroupWorkingScheduleTime.empty();
|
||||
|
||||
GroupWorkingScheduleTime.fromJson(Map<String, dynamic> json) {
|
||||
startTime = json['startTime'] ?? -1;
|
||||
endTime = json['endTime'] ?? -1;
|
||||
totalWorkHours = json['totalWorkHours'] ?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['startTime'] = startTime;
|
||||
data['endTime'] = endTime;
|
||||
data['totalWorkHours'] = totalWorkHours;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'GroupWorkingScheduleTime{startTime: $startTime, endTime: $endTime, totalWorkHours: $totalWorkHours}';
|
||||
}
|
||||
}
|
||||
|
||||
class UserId {
|
||||
UserId({
|
||||
required this.fcmTokens,
|
||||
required this.location,
|
||||
required this.id,
|
||||
required this.userModelName,
|
||||
required this.name,
|
||||
required this.version,
|
||||
required this.email,
|
||||
required this.phoneNumber,
|
||||
required this.active,
|
||||
required this.role,
|
||||
required this.profilePictureUrl,
|
||||
required this.deviceId,
|
||||
required this.verificationCode,
|
||||
required this.isVerified,
|
||||
required this.approved,
|
||||
required this.blocked,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.v,
|
||||
required this.password,
|
||||
required this.userSettings,
|
||||
required this.modelId,
|
||||
});
|
||||
|
||||
FcmTokens fcmTokens = FcmTokens.empty();
|
||||
LocationData location = LocationData.empty();
|
||||
String id = "";
|
||||
String userModelName = "";
|
||||
String name = "";
|
||||
String version = "";
|
||||
String email = "";
|
||||
String phoneNumber = "";
|
||||
bool active = false;
|
||||
String role = "";
|
||||
String profilePictureUrl = "";
|
||||
String deviceId = "";
|
||||
String verificationCode = "";
|
||||
bool isVerified = false;
|
||||
bool approved = false;
|
||||
bool blocked = false;
|
||||
String createdAt = "";
|
||||
String updatedAt = "";
|
||||
int v = -1;
|
||||
String password = "";
|
||||
String userSettings = "";
|
||||
String modelId = "";
|
||||
|
||||
UserId.empty();
|
||||
|
||||
UserId.id({required this.id});
|
||||
|
||||
UserId.fromJson(Map<String, dynamic> json) {
|
||||
fcmTokens = FcmTokens.fromJson(json['fcm_tokens'] ?? FcmTokens.empty());
|
||||
location = LocationData.fromJson(json['location'] ?? LocationData.empty());
|
||||
id = json['_id'] ?? "";
|
||||
userModelName = json['userModelName'] ?? "";
|
||||
name = json['name'] ?? "";
|
||||
version = json['version'] ?? "";
|
||||
email = json['email'] ?? "";
|
||||
phoneNumber = json['phoneNumber'] ?? "";
|
||||
active = json['active'] ?? false;
|
||||
role = json['role'] ?? "";
|
||||
profilePictureUrl = json['profile_picture_url'] ?? "";
|
||||
deviceId = json['deviceId'] ?? "";
|
||||
verificationCode = json['verification_code'] ?? "";
|
||||
isVerified = json['is_verified'] ?? false;
|
||||
approved = json['approved'] ?? false;
|
||||
blocked = json['blocked'] ?? false;
|
||||
createdAt = json['createdAt'] ?? "";
|
||||
updatedAt = json['updatedAt'] ?? "";
|
||||
v = json['__v'] ?? -1;
|
||||
password = json['password'] ?? "";
|
||||
userSettings = json['userSettings'] ?? "";
|
||||
modelId = json['modelId'] ?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['fcm_tokens'] = fcmTokens.toJson();
|
||||
data['location'] = location.toJson();
|
||||
data['_id'] = id;
|
||||
data['userModelName'] = userModelName;
|
||||
data['name'] = name;
|
||||
data['version'] = version;
|
||||
data['email'] = email;
|
||||
data['phoneNumber'] = phoneNumber;
|
||||
data['active'] = active;
|
||||
data['role'] = role;
|
||||
data['profile_picture_url'] = profilePictureUrl;
|
||||
data['deviceId'] = deviceId;
|
||||
data['verification_code'] = verificationCode;
|
||||
data['is_verified'] = isVerified;
|
||||
data['approved'] = approved;
|
||||
data['blocked'] = blocked;
|
||||
data['createdAt'] = createdAt;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['__v'] = v;
|
||||
data['password'] = password;
|
||||
data['userSettings'] = userSettings;
|
||||
data['modelId'] = modelId;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserId{fcmTokens: $fcmTokens, location: $location, id: $id, userModelName: $userModelName, name: $name, version: $version, email: $email, phoneNumber: $phoneNumber, active: $active, role: $role, profilePictureUrl: $profilePictureUrl, deviceId: $deviceId, verificationCode: $verificationCode, isVerified: $isVerified, approved: $approved, blocked: $blocked, createdAt: $createdAt, updatedAt: $updatedAt, v: $v, password: $password, userSettings: $userSettings, modelId: $modelId}';
|
||||
}
|
||||
}
|
||||
|
||||
// class Location {
|
||||
// Location({
|
||||
// required this.type,
|
||||
// required this.coordinates,
|
||||
// });
|
||||
// String type = "";
|
||||
// List<double> coordinates = [];
|
||||
//
|
||||
// Location.empty();
|
||||
// Location.fromJson(Map<String, dynamic> json){
|
||||
// type = json['type']??"";
|
||||
// coordinates = List.castFrom<dynamic, double>(json['coordinates']??[]);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final data = <String, dynamic>{};
|
||||
// data['type'] = type;
|
||||
// data['coordinates'] = coordinates;
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// String toString() {
|
||||
// return 'Location{type: $type, coordinates: $coordinates}';
|
||||
// }
|
||||
// }
|
||||
45
lib/models/chat/all_single_chat_message_model.dart
Normal file
45
lib/models/chat/all_single_chat_message_model.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
class AllSingleChatMessages {
|
||||
AllSingleChatMessages({
|
||||
required this.seen,
|
||||
required this.recieverId,
|
||||
required this.name,
|
||||
required this.message,
|
||||
required this.date,
|
||||
required this.image,
|
||||
required this.senderId,
|
||||
});
|
||||
bool seen = false;
|
||||
String recieverId ="";
|
||||
String name ="";
|
||||
String message ="";
|
||||
String date ="";
|
||||
String image ="";
|
||||
String senderId ="";
|
||||
|
||||
AllSingleChatMessages.fromJson(Map<String, dynamic> json){
|
||||
seen = json['seen'] ?? false;
|
||||
recieverId = json['recieverId'] ?? "";
|
||||
name = json['name'] ?? "";
|
||||
message = json['message'] ?? "";
|
||||
date = json['date'] ?? "";
|
||||
image = json['image'] ?? "";
|
||||
senderId = json['senderId'] ?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['seen'] = seen;
|
||||
data['recieverId'] = recieverId;
|
||||
data['name'] = name;
|
||||
data['message'] = message;
|
||||
data['date'] = date;
|
||||
data['image'] = image;
|
||||
data['senderId'] = senderId;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AllSingleChatMessages{seen: $seen, recieverId: $recieverId, name: $name, message: $message, date: $date, image: $image, senderId: $senderId}';
|
||||
}
|
||||
}
|
||||
57
lib/models/chat/all_single_user_chat_server_side.dart
Normal file
57
lib/models/chat/all_single_user_chat_server_side.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
|
||||
|
||||
class AllSingleUsersChats {
|
||||
AllSingleUsersChats({
|
||||
required this.from,
|
||||
required this.to,
|
||||
required this.message,
|
||||
required this.seen,
|
||||
required this.isDeleted,
|
||||
required this.isHide,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.seenAt,
|
||||
required this.id,
|
||||
});
|
||||
|
||||
UserData? from;
|
||||
UserData? to;
|
||||
String message = "";
|
||||
bool seen = false;
|
||||
bool isDeleted = false;
|
||||
bool isHide = false;
|
||||
String createdAt = "";
|
||||
String updatedAt = "";
|
||||
String seenAt = "";
|
||||
String id = "";
|
||||
|
||||
AllSingleUsersChats.empty();
|
||||
|
||||
AllSingleUsersChats.fromJson(Map<String, dynamic> json) {
|
||||
from = UserData.fromJson(json['from'] ?? {});
|
||||
to = UserData.fromJson(json['to'] ?? {});
|
||||
message = json['message'] ?? "";
|
||||
seen = json['seen'] ?? false;
|
||||
isDeleted = json['isDeleted'] ?? false;
|
||||
isHide = json['isHide'] ?? false;
|
||||
createdAt = json['createdAt'] ?? "";
|
||||
updatedAt = json['updatedAt'] ?? "";
|
||||
seenAt = json['seenAt'] ?? "";
|
||||
id = json['_id'] ?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['from'] = from?.toJson();
|
||||
data['to'] = to?.toJson();
|
||||
data['message'] = message;
|
||||
data['seen'] = seen;
|
||||
data['isDeleted'] = isDeleted;
|
||||
data['isHide'] = isHide;
|
||||
data['createdAt'] = createdAt;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['seenAt'] = seenAt;
|
||||
data['_id'] = id;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
214
lib/models/chat/combined_last_messages_model_class.dart
Normal file
214
lib/models/chat/combined_last_messages_model_class.dart
Normal file
@@ -0,0 +1,214 @@
|
||||
class CombinedMessageModel {
|
||||
CombinedMessageModel({
|
||||
required this.personalMessage,
|
||||
required this.sortedArrayGroup,
|
||||
});
|
||||
List<PersonalMessage> personalMessage = [];
|
||||
List<SortedArrayGroup> sortedArrayGroup = [];
|
||||
|
||||
CombinedMessageModel.empty();
|
||||
CombinedMessageModel.fromJson(Map<String, dynamic> json){
|
||||
personalMessage = List.from(json['personalMessage']).map((e)=>PersonalMessage.fromJson(e)).toList();
|
||||
sortedArrayGroup = List.from(json['sortedArrayGroup']).map((e)=>SortedArrayGroup.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['personalMessage'] = personalMessage.map((e)=>e.toJson()).toList();
|
||||
data['sortedArrayGroup'] = sortedArrayGroup.map((e)=>e.toJson()).toList();
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CombinedMessageModel{personalMessage: $personalMessage, sortedArrayGroup: $sortedArrayGroup}';
|
||||
}
|
||||
}
|
||||
|
||||
class PersonalMessage {
|
||||
PersonalMessage({
|
||||
required this.isGroup,
|
||||
required this.seen,
|
||||
required this.recieverId,
|
||||
required this.name,
|
||||
required this.message,
|
||||
required this.messageType,
|
||||
required this.date,
|
||||
required this.image,
|
||||
required this.senderId,
|
||||
});
|
||||
bool isGroup = false;
|
||||
bool seen = false;
|
||||
String recieverId = "";
|
||||
String name = "";
|
||||
String message = "";
|
||||
String messageType = "";
|
||||
String date = ""; //eg. "2024-06-21T09:38:16.352Z"
|
||||
String image = "";
|
||||
String senderId = "";
|
||||
|
||||
PersonalMessage.empty();
|
||||
PersonalMessage.fromJson(Map<String, dynamic> json){
|
||||
isGroup = json['isGroup']??false;
|
||||
seen = json['seen']??false;
|
||||
recieverId = json['recieverId']??"";
|
||||
name = json['name']??"";
|
||||
message = json['message']??"";
|
||||
messageType = json['messageType']??"";
|
||||
date = json['date']??"";
|
||||
image = json['image']??"";
|
||||
senderId = json['senderId']??"";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['isGroup'] = isGroup;
|
||||
data['seen'] = seen;
|
||||
data['recieverId'] = recieverId;
|
||||
data['name'] = name;
|
||||
data['message'] = message;
|
||||
data['messageType'] = messageType;
|
||||
data['date'] = date;
|
||||
data['image'] = image;
|
||||
data['senderId'] = senderId;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PersonalMessage{isGroup: $isGroup, seen: $seen, recieverId: $recieverId, name: $name, message: $message, date: $date, image: $image, senderId: $senderId}';
|
||||
}
|
||||
}
|
||||
|
||||
class SortedArrayGroup {
|
||||
SortedArrayGroup({
|
||||
required this.lastMessages,
|
||||
required this.groupWorkingScheduleTime,
|
||||
required this.id,
|
||||
required this.groupName,
|
||||
required this.groupImage,
|
||||
required this.groupMembers,
|
||||
required this.isGroup,
|
||||
required this.date,
|
||||
required this.isActive,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.v,
|
||||
});
|
||||
LastMessages lastMessages = LastMessages.empty();
|
||||
GroupWorkingScheduleTime groupWorkingScheduleTime = GroupWorkingScheduleTime.empty();
|
||||
String id = "";
|
||||
String groupName = "";
|
||||
String groupImage = "";
|
||||
List<String> groupMembers = [];
|
||||
bool isGroup = false;
|
||||
String date = "";
|
||||
bool isActive = false;
|
||||
String createdAt = "";
|
||||
String updatedAt = "";
|
||||
int v = -1;
|
||||
|
||||
SortedArrayGroup.empty();
|
||||
SortedArrayGroup.fromJson(Map<String, dynamic> json){
|
||||
lastMessages = LastMessages.fromJson(json['lastMessages'] ?? LastMessages.empty());
|
||||
groupWorkingScheduleTime = GroupWorkingScheduleTime.fromJson(json['groupWorkingScheduleTime'] ?? GroupWorkingScheduleTime.empty());
|
||||
id = json['_id'] ?? "";
|
||||
groupName = json['groupName'] ?? "";
|
||||
groupImage = json['groupImage'] ?? "";
|
||||
groupMembers = List.castFrom<dynamic, String>(json['groupMembers'] ?? []);
|
||||
isGroup = json['isGroup'] ?? false;
|
||||
date = json['date'] ?? "";
|
||||
isActive = json['isActive'] ?? false;
|
||||
createdAt = json['createdAt'] ?? "";
|
||||
updatedAt = json['updatedAt'] ?? "";
|
||||
v = json['__v'] ?? -1;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['lastMessages'] = lastMessages.toJson();
|
||||
data['groupWorkingScheduleTime'] = groupWorkingScheduleTime.toJson();
|
||||
data['_id'] = id;
|
||||
data['groupName'] = groupName;
|
||||
data['groupImage'] = groupImage;
|
||||
data['groupMembers'] = groupMembers;
|
||||
data['isGroup'] = isGroup;
|
||||
data['date'] = date;
|
||||
data['isActive'] = isActive;
|
||||
data['createdAt'] = createdAt;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['__v'] = v;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SortedArrayGroup{lastMessages: $lastMessages, groupWorkingScheduleTime: $groupWorkingScheduleTime, id: $id, groupName: $groupName, groupImage: $groupImage, groupMembers: $groupMembers, isGroup: $isGroup, date: $date, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt, v: $v}';
|
||||
}
|
||||
}
|
||||
|
||||
class LastMessages {
|
||||
LastMessages({
|
||||
required this.message,
|
||||
required this.messageType,
|
||||
required this.messageSentBy,
|
||||
required this.messageTime,
|
||||
});
|
||||
String message = "";
|
||||
String messageType = "";
|
||||
String messageSentBy = "";
|
||||
int messageTime = -1;
|
||||
|
||||
LastMessages.empty();
|
||||
LastMessages.fromJson(Map<String, dynamic> json){
|
||||
message = json['message'] ?? "";
|
||||
messageType = json['messageType'] ?? "";
|
||||
messageSentBy = json['messageSentBy'] ?? "";
|
||||
messageTime = json['messageTime'] ?? -1;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['message'] = message;
|
||||
data['messageType'] = messageType;
|
||||
data['messageSentBy'] = messageSentBy;
|
||||
data['messageTime'] = messageTime;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LastMessages{message: $message, messageSentBy: $messageSentBy, messageTime: $messageTime}';
|
||||
}
|
||||
}
|
||||
|
||||
class GroupWorkingScheduleTime {
|
||||
GroupWorkingScheduleTime({
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
required this.totalWorkHours,
|
||||
});
|
||||
int startTime = -1;
|
||||
int endTime = -1;
|
||||
String totalWorkHours = "";
|
||||
|
||||
GroupWorkingScheduleTime.empty();
|
||||
GroupWorkingScheduleTime.fromJson(Map<String, dynamic> json){
|
||||
startTime = json['startTime']?? -1;
|
||||
endTime = json['endTime']?? -1;
|
||||
totalWorkHours = json['totalWorkHours']?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['startTime'] = startTime;
|
||||
data['endTime'] = endTime;
|
||||
data['totalWorkHours'] = totalWorkHours;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'GroupWorkingScheduleTime{startTime: $startTime, endTime: $endTime, totalWorkHours: $totalWorkHours}';
|
||||
}
|
||||
}
|
||||
53
lib/models/chat/single_chat.dart
Normal file
53
lib/models/chat/single_chat.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
class SingleChatModelClass {
|
||||
SingleChatModelClass({
|
||||
required this.from,
|
||||
required this.to,
|
||||
required this.message,
|
||||
required this.seen,
|
||||
required this.isDeleted,
|
||||
required this.isHide,
|
||||
required this.isPin,
|
||||
required this.id2,
|
||||
required this.id,
|
||||
});
|
||||
String from = "";
|
||||
String to = "";
|
||||
String message = "";
|
||||
bool seen = false;
|
||||
bool isDeleted = false;
|
||||
bool isHide = false;
|
||||
bool isPin = false;
|
||||
String id2 = "";
|
||||
String id = "";
|
||||
|
||||
SingleChatModelClass.fromJson(Map<String, dynamic> json){
|
||||
from = json['from'] ?? "";
|
||||
to = json['to'] ?? "";
|
||||
message = json['message'] ?? "";
|
||||
seen = json['seen'] ?? false;
|
||||
isDeleted = json['isDeleted'] ?? false;
|
||||
isHide = json['isHide'] ?? false;
|
||||
isPin = json['isPin'] ?? false;
|
||||
id2 = json['_id'] ?? "";
|
||||
id = json['id'] ?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['from'] = from;
|
||||
data['to'] = to;
|
||||
data['message'] = message;
|
||||
data['seen'] = seen;
|
||||
data['isDeleted'] = isDeleted;
|
||||
data['isHide'] = isHide;
|
||||
data['isPin'] = isPin;
|
||||
data['_id'] = id2;
|
||||
data['id'] = id;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SingleChatModelClass{from: $from, to: $to, message: $message, seen: $seen, isDeleted: $isDeleted, isHide: $isHide, isPin: $isPin, id2: $id2, id: $id}';
|
||||
}
|
||||
}
|
||||
69
lib/models/chat/update_delete_single_message_model.dart
Normal file
69
lib/models/chat/update_delete_single_message_model.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
class UpdateDeleteSingleMessageModel {
|
||||
UpdateDeleteSingleMessageModel({
|
||||
required this.idOne,
|
||||
required this.from,
|
||||
required this.to,
|
||||
required this.message,
|
||||
required this.seen,
|
||||
required this.isDeleted,
|
||||
required this.isHide,
|
||||
required this.isPin,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.v,
|
||||
required this.seenAt,
|
||||
required this.id,
|
||||
});
|
||||
String idOne = "";
|
||||
String from = "";
|
||||
String to = "";
|
||||
String message = "";
|
||||
bool seen = false;
|
||||
bool isDeleted = false;
|
||||
bool isHide = false;
|
||||
bool isPin = false;
|
||||
String createdAt = "";
|
||||
String updatedAt = "";
|
||||
int v = -1;
|
||||
String seenAt = "";
|
||||
String id = "";
|
||||
|
||||
UpdateDeleteSingleMessageModel.fromJson(Map<String, dynamic> json){
|
||||
idOne = json['_id']?? "";
|
||||
from = json['from']?? "";
|
||||
to = json['to']?? "";
|
||||
message = json['message']?? "";
|
||||
seen = json['seen']?? false;
|
||||
isDeleted = json['isDeleted']?? false;
|
||||
isHide = json['isHide']?? false;
|
||||
isPin = json['isPin']?? false;
|
||||
createdAt = json['createdAt']?? "";
|
||||
updatedAt = json['updatedAt']?? "";
|
||||
v = json['__v']?? -1;
|
||||
seenAt = json['seenAt']?? "";
|
||||
id = json['id']?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['_id'] = idOne;
|
||||
data['from'] = from;
|
||||
data['to'] = to;
|
||||
data['message'] = message;
|
||||
data['seen'] = seen;
|
||||
data['isDeleted'] = isDeleted;
|
||||
data['isHide'] = isHide;
|
||||
data['isPin'] = isPin;
|
||||
data['createdAt'] = createdAt;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['__v'] = v;
|
||||
data['seenAt'] = seenAt;
|
||||
data['id'] = id;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateDeleteSingleMessageModel{idOne: $idOne, from: $from, to: $to, message: $message, seen: $seen, isDeleted: $isDeleted, isHide: $isHide, isPin: $isPin, createdAt: $createdAt, updatedAt: $updatedAt, v: $v, seenAt: $seenAt, id: $id}';
|
||||
}
|
||||
}
|
||||
58
lib/models/clients/HealthIssuesDetailsModel.dart
Normal file
58
lib/models/clients/HealthIssuesDetailsModel.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'package:ftc_mobile_app/models/clients/body_points_category.dart';
|
||||
|
||||
class HealthIssueDetailsModel {
|
||||
String sId = "";
|
||||
BodyPointsCategory? bodyPointsCategory;
|
||||
bool status = false;
|
||||
String healthNote = "";
|
||||
String complaint = "";
|
||||
String userId = "";
|
||||
String createdAt = "";
|
||||
String updatedAt = "";
|
||||
int iV = -1;
|
||||
String id = "";
|
||||
|
||||
HealthIssueDetailsModel(
|
||||
{required this.sId,
|
||||
required this.bodyPointsCategory,
|
||||
required this.status,
|
||||
required this.healthNote,
|
||||
required this.complaint,
|
||||
required this.userId,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.iV,
|
||||
required this.id});
|
||||
|
||||
HealthIssueDetailsModel.empty();
|
||||
|
||||
HealthIssueDetailsModel.fromJson(Map<String, dynamic> json) {
|
||||
sId = json['_id'] ?? "";
|
||||
bodyPointsCategory = json['category'] != null && json['category'] is Map
|
||||
? BodyPointsCategory.fromJson(json['category'] ?? <String, dynamic>{} )
|
||||
: null;
|
||||
status = json['status']??''=="1";
|
||||
healthNote = json['healthNote'] ?? "";
|
||||
complaint = json['complaint'] ?? "";
|
||||
userId = json['userId'] ?? "";
|
||||
createdAt = json['createdAt'] ?? "";
|
||||
updatedAt = json['updatedAt'] ?? "";
|
||||
iV = json['__v'] ?? "";
|
||||
id = json['id'] ?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['_id'] = sId;
|
||||
data['category'] = bodyPointsCategory?.toJson();
|
||||
data['status'] = status;
|
||||
data['healthNote'] = healthNote;
|
||||
data['complaint'] = complaint;
|
||||
data['userId'] = userId;
|
||||
data['createdAt'] = createdAt;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['__v'] = iV;
|
||||
data['id'] = id;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
381
lib/models/clients/PBSPlanModel.dart
Normal file
381
lib/models/clients/PBSPlanModel.dart
Normal file
@@ -0,0 +1,381 @@
|
||||
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
|
||||
import 'package:quill_html_editor/quill_html_editor.dart';
|
||||
|
||||
class PBSListDataJson {
|
||||
PBSListDataJson({
|
||||
required this.pbsList,
|
||||
required this.count,
|
||||
});
|
||||
|
||||
List<PbsList> pbsList = [];
|
||||
int count = -1;
|
||||
|
||||
PBSListDataJson.empty();
|
||||
|
||||
PBSListDataJson.fromJson(Map<String, dynamic> json) {
|
||||
for (var item in json['pbsList']) {
|
||||
pbsList.add(PbsList.fromJson(item));
|
||||
}
|
||||
// pbsList = List.from(json['pbsList']).map((e)=>PbsList.fromJson(e)).toList();
|
||||
count = json['count'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['pbsList'] = pbsList.map((e) => e.toJson()).toList();
|
||||
data['count'] = count;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PBSListDataJson{pbsList: $pbsList, count: $count}';
|
||||
}
|
||||
}
|
||||
|
||||
class PbsList {
|
||||
PbsList({
|
||||
required this.id,
|
||||
required this.userIdModelInPbs,
|
||||
required this.staffId,
|
||||
required this.aboutPlan,
|
||||
required this.managementOfBehaviorPlan,
|
||||
required this.secondaryPrevention,
|
||||
required this.reactiveStrategies,
|
||||
required this.postIncidentSupport,
|
||||
required this.updatedAt,
|
||||
required this.createdAt,
|
||||
});
|
||||
|
||||
String id = "";
|
||||
UserData? userIdModelInPbs;
|
||||
UserData? staffId;
|
||||
String aboutPlan = "";
|
||||
String managementOfBehaviorPlan = "";
|
||||
String secondaryPrevention = "";
|
||||
String reactiveStrategies = "";
|
||||
String postIncidentSupport = "";
|
||||
String updatedAt = "";
|
||||
String createdAt = "";
|
||||
|
||||
QuillEditorController aboutPlanQuillController = QuillEditorController();
|
||||
QuillEditorController managementOfBehaviouralPresentationQuillController = QuillEditorController();
|
||||
QuillEditorController secondaryPreventionQuillController = QuillEditorController();
|
||||
QuillEditorController reactiveStrategiesQuillController = QuillEditorController();
|
||||
QuillEditorController postIncidentSupportRecoveryQuillController = QuillEditorController();
|
||||
|
||||
PbsList.empty();
|
||||
|
||||
PbsList.addData({
|
||||
required this.id,
|
||||
required this.aboutPlan,
|
||||
required this.managementOfBehaviorPlan,
|
||||
required this.secondaryPrevention,
|
||||
required this.reactiveStrategies,
|
||||
required this.postIncidentSupport,
|
||||
});
|
||||
|
||||
PbsList.fromJson(Map<String, dynamic> json) {
|
||||
id = json['_id'] ?? "";
|
||||
userIdModelInPbs = UserData.fromJson(json['userId'] ?? {});
|
||||
staffId = UserData.fromJson(json['staffId'] ?? {});
|
||||
aboutPlan = json['aboutPlan'] ?? "";
|
||||
managementOfBehaviorPlan = json['managementOfBehaviorPlan'] ?? "";
|
||||
secondaryPrevention = json['secondaryPrevention'] ?? "";
|
||||
reactiveStrategies = json['reactiveStartegies'] ?? "";
|
||||
postIncidentSupport = json['postIncidentSupport'] ?? "";
|
||||
updatedAt = json['updatedAt'] ?? "";
|
||||
createdAt = json['createdAt'] ?? "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['_id'] = id;
|
||||
data['userId'] = userIdModelInPbs?.toJson();
|
||||
data['staffId'] = staffId?.toJson();
|
||||
data['aboutPlan'] = aboutPlan;
|
||||
data['managementOfBehaviorPlan'] = managementOfBehaviorPlan;
|
||||
data['secondaryPrevention'] = secondaryPrevention;
|
||||
data['reactiveStartegies'] = reactiveStrategies;
|
||||
data['postIncidentSupport'] = postIncidentSupport;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['createdAt'] = createdAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// class UserIdModelInPbs {
|
||||
// UserIdModelInPbs({
|
||||
// required this.fcmTokens,
|
||||
// required this.location,
|
||||
// required this.id,
|
||||
// required this.userModelName,
|
||||
// required this.name,
|
||||
// required this.version,
|
||||
// required this.email,
|
||||
// required this.phoneNumber,
|
||||
// required this.active,
|
||||
// required this.role,
|
||||
// required this.profilePictureUrl,
|
||||
// required this.deviceId,
|
||||
// required this.verificationCode,
|
||||
// required this.isVerified,
|
||||
// required this.approved,
|
||||
// required this.blocked,
|
||||
// required this.createdAt,
|
||||
// required this.updatedAt,
|
||||
// required this.v,
|
||||
// required this.password,
|
||||
// required this.userSettings,
|
||||
// required this.modelId,
|
||||
// });
|
||||
//
|
||||
// FcmTokens fcmTokens = FcmTokens.empty();
|
||||
// Location location = Location.empty();
|
||||
// String id = "";
|
||||
// String userModelName = "";
|
||||
// String name = "";
|
||||
// String version = "";
|
||||
// String email = "";
|
||||
// String phoneNumber = "";
|
||||
// bool active = false;
|
||||
// String role = "";
|
||||
// String profilePictureUrl = "";
|
||||
// String deviceId = "";
|
||||
// String verificationCode = "";
|
||||
// bool isVerified = false;
|
||||
// bool approved = false;
|
||||
// bool blocked = false;
|
||||
// String createdAt = "";
|
||||
// String updatedAt = "";
|
||||
// int v = -1;
|
||||
// String password = "";
|
||||
// String userSettings = "";
|
||||
// String modelId = "";
|
||||
//
|
||||
// UserIdModelInPbs.empty();
|
||||
//
|
||||
// UserIdModelInPbs.fromJson(Map<String, dynamic> json) {
|
||||
// fcmTokens = FcmTokens.fromJson(json['fcm_tokens'] ?? "");
|
||||
// location = Location.fromJson(json['location'] ?? "");
|
||||
// id = json['_id'] ?? "";
|
||||
// userModelName = json['userModelName'] ?? "";
|
||||
// name = json['name'] ?? "";
|
||||
// version = json['version'] ?? "";
|
||||
// email = json['email'] ?? "";
|
||||
// phoneNumber = json['phoneNumber'] ?? "";
|
||||
// active = json['active'] ?? "";
|
||||
// role = json['role'] ?? "";
|
||||
// profilePictureUrl = json['profile_picture_url'] ?? "";
|
||||
// deviceId = json['deviceId'] ?? "";
|
||||
// verificationCode = json['verification_code'] ?? "";
|
||||
// isVerified = json['is_verified'] ?? "";
|
||||
// approved = json['approved'] ?? "";
|
||||
// blocked = json['blocked'] ?? "";
|
||||
// createdAt = json['createdAt'] ?? "";
|
||||
// updatedAt = json['updatedAt'] ?? "";
|
||||
// v = json['__v'] ?? "";
|
||||
// password = json['password'] ?? "";
|
||||
// userSettings = json['userSettings'] ?? "";
|
||||
// modelId = json['modelId'] ?? "";
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final data = <String, dynamic>{};
|
||||
// data['fcm_tokens'] = fcmTokens.toJson();
|
||||
// data['location'] = location.toJson();
|
||||
// data['_id'] = id;
|
||||
// data['userModelName'] = userModelName;
|
||||
// data['name'] = name;
|
||||
// data['version'] = version;
|
||||
// data['email'] = email;
|
||||
// data['phoneNumber'] = phoneNumber;
|
||||
// data['active'] = active;
|
||||
// data['role'] = role;
|
||||
// data['profile_picture_url'] = profilePictureUrl;
|
||||
// data['deviceId'] = deviceId;
|
||||
// data['verification_code'] = verificationCode;
|
||||
// data['is_verified'] = isVerified;
|
||||
// data['approved'] = approved;
|
||||
// data['blocked'] = blocked;
|
||||
// data['createdAt'] = createdAt;
|
||||
// data['updatedAt'] = updatedAt;
|
||||
// data['__v'] = v;
|
||||
// data['password'] = password;
|
||||
// data['userSettings'] = userSettings;
|
||||
// data['modelId'] = modelId;
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// String toString() {
|
||||
// return 'UserId{fcmTokens: $fcmTokens, location: $location, id: $id, userModelName: $userModelName, name: $name, version: $version, email: $email, phoneNumber: $phoneNumber, active: $active, role: $role, profilePictureUrl: $profilePictureUrl, deviceId: $deviceId, verificationCode: $verificationCode, isVerified: $isVerified, approved: $approved, blocked: $blocked, createdAt: $createdAt, updatedAt: $updatedAt, v: $v, password: $password, userSettings: $userSettings, modelId: $modelId}';
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class FcmTokens {
|
||||
// FcmTokens({
|
||||
// required this.token,
|
||||
// required this.deviceType,
|
||||
// });
|
||||
//
|
||||
// String token = "";
|
||||
// String deviceType = "";
|
||||
//
|
||||
// FcmTokens.empty();
|
||||
//
|
||||
// FcmTokens.fromJson(Map<String, dynamic> json) {
|
||||
// token = json['token'] ?? "";
|
||||
// deviceType = json['deviceType'] ?? "";
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final data = <String, dynamic>{};
|
||||
// data['token'] = token;
|
||||
// data['deviceType'] = deviceType;
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// String toString() {
|
||||
// return 'FcmTokens{token: $token, deviceType: $deviceType}';
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class Location {
|
||||
// Location({
|
||||
// required this.type,
|
||||
// required this.coordinates,
|
||||
// });
|
||||
//
|
||||
// String type = "";
|
||||
// List<double> coordinates = [0, 0];
|
||||
//
|
||||
// Location.empty();
|
||||
//
|
||||
// Location.fromJson(Map<String, dynamic> json) {
|
||||
// type = json['type'];
|
||||
// coordinates = List.castFrom<dynamic, double>(json['coordinates']);
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final data = <String, dynamic>{};
|
||||
// data['type'] = type;
|
||||
// data['coordinates'] = coordinates;
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// String toString() {
|
||||
// return 'Location{type: $type, coordinates: $coordinates}';
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class StaffId {
|
||||
// StaffId({
|
||||
// required this.fcmTokens,
|
||||
// required this.location,
|
||||
// required this.id,
|
||||
// required this.userModelName,
|
||||
// required this.name,
|
||||
// required this.version,
|
||||
// required this.email,
|
||||
// required this.phoneNumber,
|
||||
// required this.active,
|
||||
// required this.role,
|
||||
// required this.profilePictureUrl,
|
||||
// required this.deviceId,
|
||||
// required this.verificationCode,
|
||||
// required this.isVerified,
|
||||
// required this.approved,
|
||||
// required this.blocked,
|
||||
// required this.createdAt,
|
||||
// required this.updatedAt,
|
||||
// required this.v,
|
||||
// required this.password,
|
||||
// required this.userSettings,
|
||||
// required this.modelId,
|
||||
// });
|
||||
//
|
||||
// FcmTokens fcmTokens = FcmTokens.empty();
|
||||
// Location location = Location.empty();
|
||||
// String id = "";
|
||||
// String userModelName = "";
|
||||
// String name = "";
|
||||
// String version = "";
|
||||
// String email = "";
|
||||
// String phoneNumber = "";
|
||||
// bool active = false;
|
||||
// String role = "";
|
||||
// String profilePictureUrl = "";
|
||||
// String deviceId = "";
|
||||
// String verificationCode = "";
|
||||
// bool isVerified = false;
|
||||
// bool approved = false;
|
||||
// bool blocked = false;
|
||||
// String createdAt = "";
|
||||
// String updatedAt = "";
|
||||
// int v = -1;
|
||||
// String password = "";
|
||||
// String userSettings = "";
|
||||
// String modelId = "";
|
||||
//
|
||||
// StaffId.empty();
|
||||
//
|
||||
// StaffId.fromJson(Map<String, dynamic> json) {
|
||||
// fcmTokens = FcmTokens.fromJson(json['fcm_tokens'] ?? "");
|
||||
// location = Location.fromJson(json['location'] ?? "");
|
||||
// id = json['_id'] ?? "";
|
||||
// userModelName = json['userModelName'] ?? "";
|
||||
// name = json['name'] ?? "";
|
||||
// version = json['version'] ?? "";
|
||||
// email = json['email'] ?? "";
|
||||
// phoneNumber = json['phoneNumber'] ?? "";
|
||||
// active = json['active'] ?? "";
|
||||
// role = json['role'] ?? "";
|
||||
// profilePictureUrl = json['profile_picture_url'] ?? "";
|
||||
// deviceId = json['deviceId'] ?? "";
|
||||
// verificationCode = json['verification_code'] ?? "";
|
||||
// isVerified = json['is_verified'] ?? "";
|
||||
// approved = json['approved'] ?? "";
|
||||
// blocked = json['blocked'] ?? "";
|
||||
// createdAt = json['createdAt'] ?? "";
|
||||
// updatedAt = json['updatedAt'] ?? "";
|
||||
// v = json['__v'] ?? "";
|
||||
// password = json['password'] ?? "";
|
||||
// userSettings = json['userSettings'] ?? "";
|
||||
// modelId = json['modelId'] ?? "";
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final data = <String, dynamic>{};
|
||||
// data['fcm_tokens'] = fcmTokens.toJson();
|
||||
// data['location'] = location.toJson();
|
||||
// data['_id'] = id;
|
||||
// data['userModelName'] = userModelName;
|
||||
// data['name'] = name;
|
||||
// data['version'] = version;
|
||||
// data['email'] = email;
|
||||
// data['phoneNumber'] = phoneNumber;
|
||||
// data['active'] = active;
|
||||
// data['role'] = role;
|
||||
// data['profile_picture_url'] = profilePictureUrl;
|
||||
// data['deviceId'] = deviceId;
|
||||
// data['verification_code'] = verificationCode;
|
||||
// data['is_verified'] = isVerified;
|
||||
// data['approved'] = approved;
|
||||
// data['blocked'] = blocked;
|
||||
// data['createdAt'] = createdAt;
|
||||
// data['updatedAt'] = updatedAt;
|
||||
// data['__v'] = v;
|
||||
// data['password'] = password;
|
||||
// data['userSettings'] = userSettings;
|
||||
// data['modelId'] = modelId;
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// String toString() {
|
||||
// return 'StaffId{fcmTokens: $fcmTokens, location: $location, id: $id, userModelName: $userModelName, name: $name, version: $version, email: $email, phoneNumber: $phoneNumber, active: $active, role: $role, profilePictureUrl: $profilePictureUrl, deviceId: $deviceId, verificationCode: $verificationCode, isVerified: $isVerified, approved: $approved, blocked: $blocked, createdAt: $createdAt, updatedAt: $updatedAt, v: $v, password: $password, userSettings: $userSettings, modelId: $modelId}';
|
||||
// }
|
||||
// }
|
||||
74
lib/models/clients/add_pbs_plan_model.dart
Normal file
74
lib/models/clients/add_pbs_plan_model.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
import 'package:quill_html_editor/quill_html_editor.dart';
|
||||
|
||||
class AddPBSPlanModel{
|
||||
// String incidentTitle = "";
|
||||
// String incidentId = "";
|
||||
// String userId = "";
|
||||
// int incidentDate = 0;
|
||||
// bool active = false;
|
||||
// String createdAt = "";
|
||||
// String updatedAt = "";
|
||||
// int v = 0;
|
||||
String userId = "";
|
||||
String staffId = "";
|
||||
String planId = "";
|
||||
String aboutPlanNote = "";
|
||||
QuillEditorController aboutPlanQuillController = QuillEditorController();
|
||||
String managementOfBehaviouralPresentationNote = "";
|
||||
QuillEditorController managementOfBehaviouralPresentationQuillController = QuillEditorController();
|
||||
String secondaryPreventionNote = "";
|
||||
QuillEditorController secondaryPreventionQuillController = QuillEditorController();
|
||||
String reactiveStrategiesNote = "";
|
||||
QuillEditorController reactiveStrategiesQuillController = QuillEditorController();
|
||||
String postIncidentSupportRecoveryNote = "";
|
||||
QuillEditorController postIncidentSupportRecoveryQuillController = QuillEditorController();
|
||||
|
||||
Future<bool> get areAllFieldsEdited async {
|
||||
String aboutPlanText = await aboutPlanQuillController.getText();
|
||||
String managementOfBehaviouralPresentationText =
|
||||
await managementOfBehaviouralPresentationQuillController.getText();
|
||||
String secondaryPreventionText =
|
||||
await secondaryPreventionQuillController.getText();
|
||||
String reactiveStrategiesText =
|
||||
await reactiveStrategiesQuillController.getText();
|
||||
String postIncidentSupportRecoveryText =
|
||||
await postIncidentSupportRecoveryQuillController.getText();
|
||||
return aboutPlanText.isNotEmpty &&
|
||||
managementOfBehaviouralPresentationText.isNotEmpty &&
|
||||
secondaryPreventionText.isNotEmpty &&
|
||||
reactiveStrategiesText.isNotEmpty &&
|
||||
postIncidentSupportRecoveryText.isNotEmpty;
|
||||
}
|
||||
|
||||
AddPBSPlanModel.empty();
|
||||
|
||||
AddPBSPlanModel.fromJson(Map<String, dynamic> json){
|
||||
userId = json['userId'];
|
||||
staffId = json['staffId'];
|
||||
aboutPlanNote = json['aboutPlan'];
|
||||
managementOfBehaviouralPresentationNote = json['managementOfBehaviorPlan'];
|
||||
secondaryPreventionNote = json['secondaryPrevention'];
|
||||
reactiveStrategiesNote = json['reactiveStartegies'];
|
||||
postIncidentSupportRecoveryNote = json['postIncidentSupport'];
|
||||
planId = json['_id'];
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AddPBSPlanModel{userId: $userId, staffId: $staffId, planId: $planId, aboutPlanNote: $aboutPlanNote, aboutPlanQuillController: $aboutPlanQuillController, managementOfBehaviouralPresentationNote: $managementOfBehaviouralPresentationNote, managementOfBehaviouralPresentationQuillController: $managementOfBehaviouralPresentationQuillController, secondaryPreventionNote: $secondaryPreventionNote, secondaryPreventionQuillController: $secondaryPreventionQuillController, reactiveStrategiesNote: $reactiveStrategiesNote, reactiveStrategiesQuillController: $reactiveStrategiesQuillController, postIncidentSupportRecoveryNote: $postIncidentSupportRecoveryNote, postIncidentSupportRecoveryQuillController: $postIncidentSupportRecoveryQuillController}';
|
||||
}
|
||||
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final _data = <String, dynamic>{};
|
||||
// _data['userId'] = userId;
|
||||
// _data['staffId'] = staffId;
|
||||
// _data['aboutPlan'] = aboutPlan;
|
||||
// _data['managementOfBehaviorPlan'] = managementOfBehaviorPlan;
|
||||
// _data['secondaryPrevention'] = secondaryPrevention;
|
||||
// _data['reactiveStartegies'] = reactiveStartegies;
|
||||
// _data['postIncidentSupport'] = postIncidentSupport;
|
||||
// _data['_id'] = _id;
|
||||
// return _data;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'CareNoteData.dart';
|
||||
|
||||
class AllCareNotesListResponse {
|
||||
AllCareNotesListResponse({
|
||||
this.status,
|
||||
this.message,
|
||||
this.data,
|
||||
});
|
||||
|
||||
AllCareNotesListResponse.success() {
|
||||
status = "Success";
|
||||
}
|
||||
|
||||
AllCareNotesListResponse.fromJson(dynamic json) {
|
||||
status = json['status'];
|
||||
message = json['message'];
|
||||
data = json['data'] != null ? CareNoteData.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
String? status;
|
||||
String? message;
|
||||
CareNoteData? data;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['status'] = status;
|
||||
map['message'] = message;
|
||||
if (data != null) {
|
||||
map['data'] = data?.toJson();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
42
lib/models/clients/allCareNotes/CareNoteData.dart
Normal file
42
lib/models/clients/allCareNotes/CareNoteData.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'CarePlans.dart';
|
||||
|
||||
class CareNoteData {
|
||||
CareNoteData({
|
||||
this.carePlans,
|
||||
this.count,
|
||||
this.carePlanCount,
|
||||
this.offset,
|
||||
this.limit,
|
||||
});
|
||||
|
||||
CareNoteData.fromJson(dynamic json) {
|
||||
if (json['carePlans'] != null) {
|
||||
carePlans = [];
|
||||
json['carePlans'].forEach((v) {
|
||||
carePlans?.add(CarePlan.fromJson(v));
|
||||
});
|
||||
}
|
||||
count = json['count'];
|
||||
carePlanCount = json['carePlanCount'];
|
||||
offset = json['offset'];
|
||||
limit = json['limit'];
|
||||
}
|
||||
|
||||
List<CarePlan>? carePlans;
|
||||
int? count;
|
||||
int? carePlanCount;
|
||||
int? offset;
|
||||
int? limit;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
if (carePlans != null) {
|
||||
map['carePlans'] = carePlans?.map((v) => v.toJson()).toList();
|
||||
}
|
||||
map['count'] = count;
|
||||
map['carePlanCount'] = carePlanCount;
|
||||
map['offset'] = offset;
|
||||
map['limit'] = limit;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
200
lib/models/clients/allCareNotes/CarePlans.dart
Normal file
200
lib/models/clients/allCareNotes/CarePlans.dart
Normal file
@@ -0,0 +1,200 @@
|
||||
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
|
||||
import '../body_points_category.dart';
|
||||
|
||||
class CarePlan {
|
||||
CarePlan({
|
||||
this.id,
|
||||
this.eventDateTime,
|
||||
this.userId,
|
||||
this.addedby,
|
||||
this.noteDetails,
|
||||
this.active,
|
||||
this.noteType,
|
||||
this.title,
|
||||
this.flag,
|
||||
this.isHTML,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.healthIssueId,
|
||||
this.keycontacts,
|
||||
this.riskAssesments,
|
||||
});
|
||||
|
||||
CarePlan.fromJson(dynamic json) {
|
||||
id = json['_id'];
|
||||
eventDateTime = json['eventDateTime'];
|
||||
userId = json['userId'] is Map ? UserData.fromJson(json['userId']) : null;
|
||||
addedby = json['addedby'] is Map ? UserData.fromJson(json['addedby']) : null;
|
||||
noteDetails = json['noteDetails'];
|
||||
active = json['active'];
|
||||
noteType = json['noteType'];
|
||||
title = json['title'];
|
||||
flag = json['flag'];
|
||||
isHTML = json['isHTML'];
|
||||
createdAt = json['createdAt'];
|
||||
updatedAt = json['updatedAt'];
|
||||
|
||||
healthIssueId = json['healthIssueId'] != null
|
||||
? HealthIssueId.fromJson(json['healthIssueId'])
|
||||
: null;
|
||||
keycontacts = json['keycontacts'] != null
|
||||
? List<dynamic>.from(json['keycontacts'])
|
||||
: null;
|
||||
riskAssesments = json['riskAssesments'] != null
|
||||
? List<dynamic>.from(json['riskAssesments'])
|
||||
: null;
|
||||
}
|
||||
|
||||
String? id;
|
||||
int? eventDateTime;
|
||||
UserData? userId;
|
||||
UserData? addedby;
|
||||
String? noteDetails;
|
||||
bool? active;
|
||||
String? noteType;
|
||||
String? title;
|
||||
bool? flag;
|
||||
bool? isHTML;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
HealthIssueId? healthIssueId;
|
||||
List<dynamic>? keycontacts;
|
||||
List<dynamic>? riskAssesments;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['_id'] = id;
|
||||
map['eventDateTime'] = eventDateTime;
|
||||
if (userId != null) {
|
||||
map['userId'] = userId?.toJson();
|
||||
}
|
||||
if (addedby != null) {
|
||||
map['addedby'] = addedby?.toJson();
|
||||
}
|
||||
map['noteDetails'] = noteDetails;
|
||||
map['active'] = active;
|
||||
map['noteType'] = noteType;
|
||||
map['title'] = title;
|
||||
map['flag'] = flag;
|
||||
map['isHTML'] = isHTML;
|
||||
map['createdAt'] = createdAt;
|
||||
map['updatedAt'] = updatedAt;
|
||||
if (healthIssueId != null) {
|
||||
map['healthIssueId'] = healthIssueId?.toJson();
|
||||
}
|
||||
if (keycontacts != null) {
|
||||
map['keycontacts'] = keycontacts;
|
||||
}
|
||||
if (riskAssesments != null) {
|
||||
map['riskAssesments'] = riskAssesments;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
class HealthIssueId {
|
||||
HealthIssueId.fromJson(dynamic json) {
|
||||
id = json['_id'];
|
||||
category =
|
||||
json['category'] != null ? SubCat.fromJson(json['category']) : null;
|
||||
status = json['status'];
|
||||
healthNote = json['healthNote'];
|
||||
complaint = json['complaint'];
|
||||
userId = json['userId'];
|
||||
isCarePlanData = json['isCarePlanData'];
|
||||
isPhysicalIntervention = json['isPhysicalIntervention'];
|
||||
createdAt = json['createdAt'];
|
||||
updatedAt = json['updatedAt'];
|
||||
}
|
||||
|
||||
String? id;
|
||||
SubCat? category;
|
||||
bool? status;
|
||||
String? healthNote;
|
||||
String? complaint;
|
||||
String? userId;
|
||||
bool? isCarePlanData;
|
||||
bool? isPhysicalIntervention;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['_id'] = id;
|
||||
if (category != null) {
|
||||
map['category'] = category?.toJson();
|
||||
}
|
||||
map['status'] = status;
|
||||
map['healthNote'] = healthNote;
|
||||
map['complaint'] = complaint;
|
||||
map['userId'] = userId;
|
||||
map['isCarePlanData'] = isCarePlanData;
|
||||
map['isPhysicalIntervention'] = isPhysicalIntervention;
|
||||
map['createdAt'] = createdAt;
|
||||
map['updatedAt'] = updatedAt;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
// class Category {
|
||||
// Category.fromJson(dynamic json) {
|
||||
// id = json['_id'];
|
||||
// name = json['name'];
|
||||
// enumValue = json['enum'];
|
||||
// parentCategory = json['parentCategory'] != null ? ParentCategory.fromJson(json['parentCategory']) : null;
|
||||
// createdAt = json['createdAt'];
|
||||
// updatedAt = json['updatedAt'];
|
||||
// v = json['__v'];
|
||||
// }
|
||||
//
|
||||
// String? id;
|
||||
// String? name;
|
||||
// String? enumValue;
|
||||
// ParentCategory? parentCategory;
|
||||
// String? createdAt;
|
||||
// String? updatedAt;
|
||||
// int? v;
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final map = <String, dynamic>{};
|
||||
// map['_id'] = id;
|
||||
// map['name'] = name;
|
||||
// map['enum'] = enumValue;
|
||||
// if (parentCategory != null) {
|
||||
// map['parentCategory'] = parentCategory?.toJson();
|
||||
// }
|
||||
// map['createdAt'] = createdAt;
|
||||
// map['updatedAt'] = updatedAt;
|
||||
// map['__v'] = v;
|
||||
// return map;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class ParentCategory {
|
||||
// ParentCategory.fromJson(dynamic json) {
|
||||
// id = json['_id'];
|
||||
// name = json['name'];
|
||||
// enumValue = json['enum'];
|
||||
// createdAt = json['createdAt'];
|
||||
// updatedAt = json['updatedAt'];
|
||||
// v = json['__v'];
|
||||
// }
|
||||
//
|
||||
// String? id;
|
||||
// String? name;
|
||||
// String? enumValue;
|
||||
// String? createdAt;
|
||||
// String? updatedAt;
|
||||
// int? v;
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final map = <String, dynamic>{};
|
||||
// map['_id'] = id;
|
||||
// map['name'] = name;
|
||||
// map['enum'] = enumValue;
|
||||
// map['createdAt'] = createdAt;
|
||||
// map['updatedAt'] = updatedAt;
|
||||
// map['__v'] = v;
|
||||
// return map;
|
||||
// }
|
||||
// }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user