2023-05-11 00:04:53 +00:00
|
|
|
import 'package:app_popup_menu/app_popup_menu.dart';
|
2023-02-08 08:06:27 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-03-06 08:29:55 +00:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2023-05-11 00:04:53 +00:00
|
|
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
2023-03-06 08:29:55 +00:00
|
|
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
|
|
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
2023-05-11 00:04:53 +00:00
|
|
|
import 'package:fluttericon/entypo_icons.dart';
|
2023-03-06 08:29:55 +00:00
|
|
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
|
|
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
2023-02-08 08:06:27 +00:00
|
|
|
import 'package:unit2/model/profile/family_backround.dart';
|
2023-05-11 00:04:53 +00:00
|
|
|
import 'package:unit2/screens/profile/components/basic_information/family/add_mobile_modal.dart';
|
|
|
|
import 'package:unit2/screens/profile/components/basic_information/family/child_add_modal.dart';
|
|
|
|
import 'package:unit2/screens/profile/components/basic_information/family/child_edit_modal.dart';
|
|
|
|
import 'package:unit2/screens/profile/components/basic_information/family/father_edit_modal.dart';
|
|
|
|
import 'package:unit2/screens/profile/components/basic_information/family/mother_add_modal.dart';
|
|
|
|
import 'package:unit2/screens/profile/components/basic_information/family/mother_edit_modal.dart';
|
|
|
|
import 'package:unit2/screens/profile/components/basic_information/family/related_add_modal.dart';
|
2023-02-09 08:48:19 +00:00
|
|
|
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
2023-02-08 08:06:27 +00:00
|
|
|
import 'package:unit2/theme-data.dart/colors.dart';
|
|
|
|
import 'package:unit2/utils/global.dart';
|
2023-05-11 00:04:53 +00:00
|
|
|
import 'package:unit2/utils/global_context.dart';
|
2023-02-09 08:48:19 +00:00
|
|
|
import 'package:unit2/utils/text_container.dart';
|
2023-06-06 06:54:51 +00:00
|
|
|
import 'package:unit2/widgets/error_state.dart';
|
2023-03-07 02:31:28 +00:00
|
|
|
import '../../../bloc/profile/family/family_bloc.dart';
|
2023-05-11 00:04:53 +00:00
|
|
|
import '../../../model/utils/agency.dart';
|
|
|
|
import '../../../model/utils/category.dart';
|
|
|
|
import '../../../model/utils/position.dart';
|
|
|
|
import '../../../utils/alerts.dart';
|
|
|
|
import '../../../utils/profile_utilities.dart';
|
|
|
|
import 'basic_information/family/father_add_modal.dart';
|
|
|
|
import 'basic_information/family/related_edit_modal.dart';
|
|
|
|
import 'basic_information/family/spouse_add_modal.dart';
|
|
|
|
import 'basic_information/family/spouse_edit_modal.dart';
|
2023-03-07 02:31:28 +00:00
|
|
|
|
2023-02-08 08:06:27 +00:00
|
|
|
class FamilyBackgroundScreen extends StatefulWidget {
|
2023-03-06 08:29:55 +00:00
|
|
|
const FamilyBackgroundScreen({
|
|
|
|
super.key,
|
|
|
|
});
|
2023-02-08 08:06:27 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<FamilyBackgroundScreen> createState() => _FamilyBackgroundScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
|
|
|
|
FamilyBackground? father;
|
|
|
|
FamilyBackground? mother;
|
|
|
|
FamilyBackground? spouse;
|
|
|
|
List<FamilyBackground> children = [];
|
|
|
|
List<FamilyBackground> otherRelated = [];
|
2023-05-11 00:04:53 +00:00
|
|
|
List<String> bloodType = [
|
|
|
|
"NONE",
|
|
|
|
"A+",
|
|
|
|
"B+",
|
|
|
|
"A-",
|
|
|
|
"B-",
|
|
|
|
"AB+",
|
|
|
|
"AB-",
|
|
|
|
"0+",
|
|
|
|
"0-"
|
|
|
|
];
|
|
|
|
List<String> nameExtensions = [
|
|
|
|
"NONE",
|
|
|
|
"N/A",
|
|
|
|
"SR.",
|
|
|
|
"JR.",
|
|
|
|
"I",
|
|
|
|
"II",
|
|
|
|
"III",
|
|
|
|
"IV",
|
|
|
|
"V",
|
|
|
|
"VI",
|
|
|
|
"VII",
|
|
|
|
"VIII",
|
|
|
|
"IX",
|
|
|
|
"X"
|
|
|
|
];
|
|
|
|
List<String> sexes = ["MALE", "FEMALE"];
|
|
|
|
List<String> civilStatus = [
|
|
|
|
"NONE",
|
|
|
|
"SINGLE",
|
|
|
|
"MARRIED",
|
|
|
|
"SEPARATED",
|
|
|
|
"WIDOWED"
|
|
|
|
];
|
|
|
|
List<String> gender = [
|
|
|
|
"NONE",
|
|
|
|
"AGENDER",
|
|
|
|
"ANATOMAL SEX",
|
|
|
|
"CISGENDER",
|
|
|
|
"CISHET",
|
|
|
|
"GENDER NON-CONFORMING",
|
|
|
|
"GENDER-EXPANSIVE",
|
|
|
|
"GENDER-FLUID",
|
|
|
|
"GENDERQUEER",
|
|
|
|
"GENDERVOID",
|
|
|
|
"INTERSEX",
|
|
|
|
"NON-BINARY",
|
|
|
|
"TRANSGENDER",
|
|
|
|
"OTHERS"
|
|
|
|
];
|
2023-08-15 06:32:21 +00:00
|
|
|
List<PositionTitle> positions = [];
|
2023-05-11 00:04:53 +00:00
|
|
|
List<Agency> agencices = [];
|
|
|
|
List<Category> categories = [];
|
|
|
|
bool fatherIncaseOfEmergency = false;
|
|
|
|
List<Relationship>? relationshipTypes;
|
|
|
|
final formKey = GlobalKey<FormBuilderState>();
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
2023-02-08 08:06:27 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-05-11 00:04:53 +00:00
|
|
|
final familyBloc = BlocProvider.of<FamilyBloc>(context);
|
|
|
|
int? profileId;
|
|
|
|
String? token;
|
|
|
|
|
2023-02-08 08:06:27 +00:00
|
|
|
return Scaffold(
|
2023-05-11 00:04:53 +00:00
|
|
|
key: _scaffoldKey,
|
|
|
|
backgroundColor: Colors.white,
|
2023-02-09 08:48:19 +00:00
|
|
|
appBar: AppBar(
|
|
|
|
title: const Text(familyBackgroundScreenTitle),
|
|
|
|
centerTitle: true,
|
|
|
|
backgroundColor: primary,
|
|
|
|
),
|
2023-03-06 08:29:55 +00:00
|
|
|
body: ProgressHUD(
|
2023-05-11 00:04:53 +00:00
|
|
|
padding: const EdgeInsets.all(24),
|
|
|
|
backgroundColor: Colors.black87,
|
|
|
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
2023-03-06 08:29:55 +00:00
|
|
|
child: BlocBuilder<UserBloc, UserState>(
|
2023-05-11 00:04:53 +00:00
|
|
|
buildWhen: (previous, current) {
|
|
|
|
return false;
|
|
|
|
},
|
2023-03-06 08:29:55 +00:00
|
|
|
builder: (context, state) {
|
2023-05-11 00:04:53 +00:00
|
|
|
if (state is UserLoggedIn) {
|
|
|
|
token = state.userData!.user!.login!.token;
|
|
|
|
profileId = state.userData!.user!.login!.user!.profileId;
|
|
|
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
|
|
|
builder: (context, state) {
|
|
|
|
if (state is ProfileLoaded) {
|
|
|
|
return BlocConsumer<FamilyBloc, FamilyState>(
|
|
|
|
listener: (context, state) {
|
|
|
|
if (state is FamilyLoadingState) {
|
|
|
|
final progress = ProgressHUD.of(context);
|
|
|
|
progress!.showWithText("Please wait...");
|
|
|
|
}
|
|
|
|
if (state is FamilyLoaded ||
|
|
|
|
state is FamilyErrorState ||
|
|
|
|
state is FamilyAddedState ||
|
|
|
|
state is DeletedState) {
|
|
|
|
final progress = ProgressHUD.of(context);
|
|
|
|
progress!.dismiss();
|
|
|
|
}
|
|
|
|
////AddedState
|
|
|
|
if (state is FamilyAddedState) {
|
|
|
|
if (state.response['success']) {
|
|
|
|
successAlert(context, "Adding Successfull!",
|
|
|
|
state.response['message'], () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
context.read<FamilyBloc>().add(LoadFamily());
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
errorAlert(context, "Adding Failed",
|
|
|
|
"Something went wrong. Please try again.", () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
context.read<FamilyBloc>().add(LoadFamily());
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (state is EmergencyContactEditedState) {
|
|
|
|
if (state.response['success']) {
|
|
|
|
successAlert(context, state.response['message'],
|
|
|
|
state.response[''], () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
context.read<FamilyBloc>().add(LoadFamily());
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
errorAlert(context, state.response['message'],
|
|
|
|
"Something went wrong. Please try again.", () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
context.read<FamilyBloc>().add(LoadFamily());
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
////Edited State
|
|
|
|
if (state is FamilyEditedState) {
|
|
|
|
if (state.response['success']) {
|
|
|
|
successAlert(context, "Update Successfull!",
|
|
|
|
state.response['message'], () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
context.read<FamilyBloc>().add(LoadFamily());
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
errorAlert(context, "Update Failed",
|
|
|
|
"Something went wrong. Please try again.", () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
context.read<FamilyBloc>().add(LoadFamily());
|
|
|
|
});
|
2023-03-06 08:29:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-11 00:04:53 +00:00
|
|
|
if (state is DeletedState) {
|
|
|
|
if (state.success) {
|
|
|
|
successAlert(context, "Deletion Successfull",
|
|
|
|
"Family Background has been deleted successfully",
|
|
|
|
() {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
context.read<FamilyBloc>().add(LoadFamily());
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
errorAlert(context, "Deletion Failed",
|
|
|
|
"Error deleting Family", () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
context.read<FamilyBloc>().add(LoadFamily());
|
|
|
|
});
|
2023-03-06 08:29:55 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-11 00:04:53 +00:00
|
|
|
},
|
|
|
|
builder: (context, state) {
|
|
|
|
if (state is FamilyLoaded) {
|
|
|
|
if (state.families != null) {
|
|
|
|
children.clear();
|
|
|
|
otherRelated.clear();
|
|
|
|
father = null;
|
|
|
|
mother = null;
|
|
|
|
spouse = null;
|
|
|
|
for (var family in state.families!) {
|
|
|
|
if (family.relationship!.id == 1) {
|
|
|
|
father = family;
|
|
|
|
}
|
|
|
|
if (family.relationship!.id == 2) {
|
|
|
|
mother = family;
|
|
|
|
}
|
|
|
|
if (family.relationship!.id == 3) {
|
|
|
|
spouse = family;
|
|
|
|
}
|
|
|
|
if (family.relationship!.id == 4) {
|
|
|
|
children.add(family);
|
|
|
|
}
|
|
|
|
if (family.relationship!.id! > 4) {
|
|
|
|
otherRelated.add(family);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ListView(children: [
|
|
|
|
////Father----------------------------------------------
|
|
|
|
Container(
|
|
|
|
decoration: box1(),
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 12, vertical: 8),
|
|
|
|
width: screenWidth,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
fatherText.toUpperCase(),
|
|
|
|
style: Theme.of(context)
|
|
|
|
.textTheme
|
2023-06-06 06:54:51 +00:00
|
|
|
.titleSmall!
|
2023-05-11 00:04:53 +00:00
|
|
|
.copyWith(color: primary),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: father == null
|
|
|
|
? IconButton(
|
|
|
|
onPressed: () {
|
|
|
|
////Show Add Alert Dialog
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder:
|
|
|
|
(BuildContext
|
|
|
|
context) {
|
|
|
|
return FatherAlert(
|
|
|
|
familyBloc:
|
|
|
|
familyBloc,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
token:
|
|
|
|
token!,
|
|
|
|
bloodType:
|
|
|
|
bloodType,
|
|
|
|
civilStatus:
|
|
|
|
civilStatus,
|
|
|
|
gender:
|
|
|
|
gender,
|
|
|
|
nameExtensions:
|
|
|
|
nameExtensions,
|
|
|
|
sexes:
|
|
|
|
sexes);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus,
|
|
|
|
color: second,
|
|
|
|
))
|
|
|
|
: const SizedBox(),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: father != null
|
|
|
|
? Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Flexible(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize
|
|
|
|
.min,
|
|
|
|
children: [
|
|
|
|
ListTile(
|
|
|
|
dense: true,
|
|
|
|
visualDensity: const VisualDensity(
|
|
|
|
horizontal:
|
|
|
|
-4,
|
|
|
|
vertical:
|
|
|
|
-4),
|
|
|
|
title: Text(
|
2023-06-21 00:22:43 +00:00
|
|
|
"${father?.relatedPerson?.firstName} ${father?.relatedPerson?.middleName ?? ''} ${father?.relatedPerson!.lastName} ${father?.relatedPerson?.nameExtension ?? ''}",
|
2023-05-11 00:04:53 +00:00
|
|
|
style: Theme.of(
|
|
|
|
context)
|
|
|
|
.textTheme
|
|
|
|
.titleMedium!
|
|
|
|
.copyWith(
|
|
|
|
fontWeight: FontWeight.w500),
|
|
|
|
),
|
|
|
|
subtitle:
|
|
|
|
const Text(
|
|
|
|
"fullname"),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize
|
|
|
|
.min,
|
|
|
|
children: [
|
|
|
|
Checkbox(
|
|
|
|
visualDensity: const VisualDensity(
|
|
|
|
horizontal:
|
|
|
|
0,
|
|
|
|
vertical:
|
|
|
|
-4),
|
|
|
|
value: father!
|
|
|
|
.incaseOfEmergency!,
|
|
|
|
onChanged:
|
|
|
|
(value) {
|
|
|
|
confirmAlertWithCancel(context,
|
|
|
|
() {
|
|
|
|
final progress = ProgressHUD.of(context);
|
|
|
|
progress!.showWithText("Loading...");
|
|
|
|
|
|
|
|
context.read<FamilyBloc>().add(AddEmergencyEvent(requestType: "CHECKBOX", contactInfoId: father!.emergencyContact!.isNotEmpty ? father!.emergencyContact!.first.contactinfoid : null, numberMail: father!.emergencyContact!.isNotEmpty ? father!.emergencyContact!.first.numbermail : null, profileId: profileId!, relatedPersonId: father!.relatedPerson!.id!, token: token!));
|
|
|
|
}, () {}, "Emergency Contact Information?",
|
|
|
|
father!.incaseOfEmergency == true ? "Remove as emergency contact information?" : "Add as emergency contact information?");
|
|
|
|
}),
|
|
|
|
const Text(
|
|
|
|
incaseOfEmergency),
|
|
|
|
////Add mobile icon
|
|
|
|
Container(
|
|
|
|
child: father!.incaseOfEmergency! && father!.emergencyContact!.isEmpty
|
|
|
|
? IconButton(
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
|
|
|
|
onPressed: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: father!.emergencyContact!.isNotEmpty ? father!.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: father!.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
},
|
|
|
|
formKey: formKey);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus_circled,
|
|
|
|
color: third,
|
|
|
|
size: 18,
|
|
|
|
))
|
|
|
|
: Container())
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
visible:
|
|
|
|
father!
|
|
|
|
.incaseOfEmergency!,
|
|
|
|
child: Container(
|
|
|
|
child: father!.emergencyContact!.isNotEmpty
|
|
|
|
? Row(
|
|
|
|
children: [
|
|
|
|
//// edit mobile
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
formKey: formKey,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: father!.emergencyContact!.isNotEmpty ? father!.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: father!.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
width: 16,
|
|
|
|
),
|
|
|
|
Badge(
|
|
|
|
backgroundColor: third,
|
|
|
|
textColor: Colors.white,
|
|
|
|
label: Text(father!.emergencyContact!.first.numbermail!),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Container())),
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppPopupMenu<int>(
|
|
|
|
offset: const Offset(
|
|
|
|
-10, -10),
|
|
|
|
elevation: 3,
|
|
|
|
onSelected: (value) {
|
|
|
|
////delete -= = = = = = = = =>>
|
|
|
|
if (value == 2) {
|
|
|
|
confirmAlert(
|
|
|
|
context, () {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(
|
|
|
|
context);
|
|
|
|
progress!
|
|
|
|
.showWithText(
|
|
|
|
"Loading...");
|
|
|
|
context.read<FamilyBloc>().add(DeleteFamily(
|
|
|
|
id: father!
|
|
|
|
.relatedPerson!
|
|
|
|
.id!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
token:
|
|
|
|
token!));
|
|
|
|
}, "Delete?",
|
|
|
|
"Confirm Delete?");
|
|
|
|
}
|
|
|
|
if (value == 1) {
|
|
|
|
////edit eligibilty-= = = = = = = = =>>
|
|
|
|
showDialog(
|
|
|
|
context:
|
|
|
|
context,
|
|
|
|
builder:
|
|
|
|
(BuildContext
|
|
|
|
context) {
|
|
|
|
return FatherEditAlert(
|
|
|
|
familyBackground:
|
|
|
|
father!,
|
|
|
|
familyBloc:
|
|
|
|
familyBloc,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
token:
|
|
|
|
token!,
|
|
|
|
bloodType:
|
|
|
|
bloodType,
|
|
|
|
civilStatus:
|
|
|
|
civilStatus,
|
|
|
|
gender:
|
|
|
|
gender,
|
|
|
|
nameExtensions:
|
|
|
|
nameExtensions,
|
|
|
|
sexes:
|
|
|
|
sexes);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
menuItems: [
|
|
|
|
popMenuItem(
|
|
|
|
text: "Update",
|
|
|
|
value: 1,
|
|
|
|
icon:
|
|
|
|
Icons.edit),
|
|
|
|
popMenuItem(
|
2023-06-06 06:54:51 +00:00
|
|
|
text: "Remove",
|
2023-05-11 00:04:53 +00:00
|
|
|
value: 2,
|
|
|
|
icon: Icons
|
|
|
|
.delete),
|
|
|
|
],
|
|
|
|
icon: const Icon(
|
|
|
|
Icons.more_vert,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
|
|
|
tooltip: "Options",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(
|
|
|
|
width: screenWidth,
|
2023-08-30 01:55:03 +00:00
|
|
|
child: Text(
|
|
|
|
"Provide your father's primary information.",style:Theme.of(context).textTheme.bodySmall,
|
2023-05-11 00:04:53 +00:00
|
|
|
textAlign:
|
|
|
|
TextAlign.center,
|
|
|
|
),
|
|
|
|
))
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
|
|
|
|
////Mother-----------------------------------------------------
|
|
|
|
Container(
|
|
|
|
decoration: box1(),
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 12, vertical: 8),
|
|
|
|
width: screenWidth,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
2023-03-06 08:29:55 +00:00
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
2023-05-11 00:04:53 +00:00
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
motherText.toUpperCase(),
|
|
|
|
style: Theme.of(context)
|
|
|
|
.textTheme
|
2023-06-06 06:54:51 +00:00
|
|
|
.titleSmall!
|
2023-05-11 00:04:53 +00:00
|
|
|
.copyWith(color: primary),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: mother == null
|
|
|
|
? IconButton(
|
|
|
|
onPressed: () {
|
|
|
|
////Show Alert Dialog
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder:
|
|
|
|
(BuildContext
|
|
|
|
context) {
|
|
|
|
return MotherAlert(
|
|
|
|
familyBloc:
|
|
|
|
familyBloc,
|
|
|
|
token: token!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
bloodType:
|
|
|
|
bloodType,
|
|
|
|
civilStatus:
|
|
|
|
civilStatus,
|
|
|
|
gender:
|
|
|
|
gender,
|
|
|
|
nameExtensions:
|
|
|
|
nameExtensions,
|
|
|
|
sexes: sexes);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus,
|
|
|
|
color: second,
|
|
|
|
))
|
|
|
|
: const SizedBox(),
|
|
|
|
)
|
2023-03-06 08:29:55 +00:00
|
|
|
],
|
2023-05-11 00:04:53 +00:00
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: mother != null
|
|
|
|
? Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize
|
|
|
|
.min,
|
|
|
|
children: [
|
|
|
|
ListTile(
|
|
|
|
dense: true,
|
|
|
|
visualDensity:
|
|
|
|
const VisualDensity(
|
|
|
|
horizontal:
|
|
|
|
-4,
|
|
|
|
vertical:
|
|
|
|
-4),
|
|
|
|
title: Text(
|
2023-06-21 00:22:43 +00:00
|
|
|
"${mother?.relatedPerson?.firstName} ${mother?.relatedPerson?.middleName ?? ''} ${mother?.relatedPerson?.lastName} ${mother?.relatedPerson?.nameExtension ?? ''}",
|
2023-05-11 00:04:53 +00:00
|
|
|
style: Theme.of(
|
|
|
|
context)
|
|
|
|
.textTheme
|
|
|
|
.titleMedium!
|
|
|
|
.copyWith(
|
|
|
|
fontWeight:
|
|
|
|
FontWeight.w500),
|
|
|
|
),
|
|
|
|
subtitle:
|
|
|
|
const Text(
|
|
|
|
"fullname"),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize
|
|
|
|
.min,
|
|
|
|
children: [
|
|
|
|
Checkbox(
|
|
|
|
visualDensity: const VisualDensity(
|
|
|
|
horizontal:
|
|
|
|
0,
|
|
|
|
vertical:
|
|
|
|
-4),
|
|
|
|
value: mother!
|
|
|
|
.incaseOfEmergency!,
|
|
|
|
onChanged:
|
|
|
|
(value) {
|
|
|
|
confirmAlertWithCancel(
|
|
|
|
context,
|
|
|
|
() {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(context);
|
|
|
|
progress!
|
|
|
|
.showWithText("Loading...");
|
2023-02-08 08:06:27 +00:00
|
|
|
|
2023-05-11 00:04:53 +00:00
|
|
|
context.read<FamilyBloc>().add(AddEmergencyEvent(
|
|
|
|
requestType: 'CHECKBOX',
|
|
|
|
contactInfoId: mother!.emergencyContact!.isNotEmpty ? mother!.emergencyContact!.first.contactinfoid : null,
|
|
|
|
numberMail: mother!.emergencyContact!.isNotEmpty ? mother!.emergencyContact!.first.numbermail : null,
|
|
|
|
profileId: profileId!,
|
|
|
|
relatedPersonId: mother!.relatedPerson!.id!,
|
|
|
|
token: token!));
|
|
|
|
},
|
|
|
|
() {},
|
|
|
|
"Emergency Contact Information?",
|
|
|
|
mother!.incaseOfEmergency == true
|
|
|
|
? "Remove as emergency contact information?"
|
|
|
|
: "Add as emergency contact information?");
|
|
|
|
}),
|
|
|
|
const Text(
|
|
|
|
incaseOfEmergency),
|
|
|
|
Container(
|
|
|
|
child: mother!.incaseOfEmergency! &&
|
|
|
|
mother!.emergencyContact!.isEmpty
|
|
|
|
? IconButton(
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
|
|
|
|
onPressed: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: mother!.emergencyContact!.isNotEmpty ? mother!.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: mother!.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
},
|
|
|
|
formKey: formKey);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus_circled,
|
|
|
|
color: third,
|
|
|
|
size: 18,
|
|
|
|
))
|
|
|
|
: Container())
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
visible: mother!
|
|
|
|
.incaseOfEmergency!,
|
|
|
|
child: Container(
|
|
|
|
child: mother!.emergencyContact!.isNotEmpty
|
|
|
|
? Row(
|
|
|
|
children: [
|
|
|
|
//// edit mobile
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
formKey: formKey,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: mother!.emergencyContact!.isNotEmpty ? mother!.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: mother!.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
width: 16,
|
|
|
|
),
|
|
|
|
Badge(
|
|
|
|
backgroundColor: third,
|
|
|
|
textColor: Colors.white,
|
|
|
|
label: Text(mother!.emergencyContact!.first.numbermail!),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Container())),
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
AppPopupMenu<int>(
|
|
|
|
offset: const Offset(
|
|
|
|
-10, -10),
|
|
|
|
elevation: 3,
|
|
|
|
onSelected: (value) {
|
|
|
|
////delete -= = = = = = = = =>>
|
|
|
|
if (value == 2) {
|
|
|
|
confirmAlert(
|
|
|
|
context, () {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(
|
|
|
|
context);
|
|
|
|
progress!
|
|
|
|
.showWithText(
|
|
|
|
"Loading...");
|
|
|
|
context
|
|
|
|
.read<
|
|
|
|
FamilyBloc>()
|
|
|
|
.add(DeleteFamily(
|
|
|
|
id: mother!
|
|
|
|
.relatedPerson!
|
|
|
|
.id!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
token:
|
|
|
|
token!));
|
|
|
|
}, "Delete?",
|
|
|
|
"Confirm Delete?");
|
|
|
|
}
|
|
|
|
if (value == 1) {
|
|
|
|
////edit eligibilty-= = = = = = = = =>>
|
|
|
|
showDialog(
|
|
|
|
context:
|
|
|
|
context,
|
|
|
|
builder:
|
|
|
|
(BuildContext
|
|
|
|
context) {
|
|
|
|
return MotherEditAlert(
|
|
|
|
familyBackground:
|
|
|
|
mother!,
|
|
|
|
familyBloc:
|
|
|
|
familyBloc,
|
|
|
|
token:
|
|
|
|
token!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
bloodType:
|
|
|
|
bloodType,
|
|
|
|
civilStatus:
|
|
|
|
civilStatus,
|
|
|
|
gender:
|
|
|
|
gender,
|
|
|
|
nameExtensions:
|
|
|
|
nameExtensions,
|
|
|
|
sexes:
|
|
|
|
sexes);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
menuItems: [
|
|
|
|
popMenuItem(
|
|
|
|
text: "Update",
|
|
|
|
value: 1,
|
|
|
|
icon: Icons.edit),
|
|
|
|
popMenuItem(
|
2023-06-06 06:54:51 +00:00
|
|
|
text: "Remove",
|
2023-05-11 00:04:53 +00:00
|
|
|
value: 2,
|
|
|
|
icon:
|
|
|
|
Icons.delete),
|
|
|
|
],
|
|
|
|
icon: const Icon(
|
|
|
|
Icons.more_vert,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
|
|
|
tooltip: "Options",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(
|
|
|
|
width: screenWidth,
|
2023-08-30 01:55:03 +00:00
|
|
|
child: Text(
|
|
|
|
"Provide your mother's primary information",style: Theme.of(context).textTheme.bodySmall,
|
2023-05-11 00:04:53 +00:00
|
|
|
textAlign:
|
|
|
|
TextAlign.center,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
////Spouse ---------------------------------------------------------
|
|
|
|
Container(
|
|
|
|
decoration: box1(),
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 12, vertical: 8),
|
|
|
|
width: screenWidth,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
2023-03-06 08:29:55 +00:00
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
2023-05-11 00:04:53 +00:00
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
spouseText.toUpperCase(),
|
|
|
|
style: Theme.of(context)
|
|
|
|
.textTheme
|
2023-06-06 06:54:51 +00:00
|
|
|
.titleSmall!
|
2023-05-11 00:04:53 +00:00
|
|
|
.copyWith(color: primary),
|
2023-03-06 08:29:55 +00:00
|
|
|
),
|
2023-05-11 00:04:53 +00:00
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: spouse == null
|
|
|
|
? IconButton(
|
|
|
|
////spouse
|
|
|
|
//// Show Dialog
|
|
|
|
onPressed: () async {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(
|
|
|
|
context);
|
|
|
|
progress!.showWithText(
|
|
|
|
"Loading...");
|
2023-06-21 00:22:43 +00:00
|
|
|
try {
|
|
|
|
if (positions
|
|
|
|
.isEmpty) {
|
|
|
|
positions =
|
|
|
|
await ProfileUtilities
|
|
|
|
.instance
|
|
|
|
.getAgencyPosition();
|
|
|
|
}
|
2023-03-06 08:29:55 +00:00
|
|
|
|
2023-06-21 00:22:43 +00:00
|
|
|
if (agencices
|
|
|
|
.isEmpty) {
|
|
|
|
agencices =
|
|
|
|
await ProfileUtilities
|
|
|
|
.instance
|
|
|
|
.getAgecies();
|
|
|
|
}
|
|
|
|
if (categories
|
|
|
|
.isEmpty) {
|
|
|
|
categories =
|
|
|
|
await ProfileUtilities
|
|
|
|
.instance
|
|
|
|
.agencyCategory();
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
NavigationService
|
|
|
|
.navigatorKey
|
|
|
|
.currentContext
|
|
|
|
?.read<
|
|
|
|
FamilyBloc>()
|
|
|
|
.add(CallErrorState(
|
|
|
|
message: e
|
|
|
|
.toString()));
|
2023-05-11 00:04:53 +00:00
|
|
|
}
|
|
|
|
progress.dismiss();
|
|
|
|
showDialog(
|
|
|
|
context: NavigationService
|
|
|
|
.navigatorKey
|
|
|
|
.currentContext!,
|
|
|
|
builder:
|
|
|
|
(BuildContext
|
|
|
|
context) {
|
|
|
|
return SpouseAlert(
|
|
|
|
familyBloc:
|
|
|
|
familyBloc,
|
|
|
|
token: token!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
positions:
|
|
|
|
positions,
|
|
|
|
agencies:
|
|
|
|
agencices,
|
|
|
|
category:
|
|
|
|
categories,
|
|
|
|
bloodType:
|
|
|
|
bloodType,
|
|
|
|
civilStatus:
|
|
|
|
civilStatus,
|
|
|
|
gender:
|
|
|
|
gender,
|
|
|
|
nameExtensions:
|
|
|
|
nameExtensions,
|
|
|
|
sexes: sexes);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus,
|
|
|
|
color: second,
|
|
|
|
))
|
2023-03-06 08:29:55 +00:00
|
|
|
: const SizedBox(),
|
2023-05-11 00:04:53 +00:00
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: spouse != null
|
|
|
|
? Row(
|
2023-05-22 02:23:56 +00:00
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
2023-03-06 08:29:55 +00:00
|
|
|
children: [
|
2023-05-22 02:23:56 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 5,
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
dense: true,
|
|
|
|
visualDensity:
|
|
|
|
const VisualDensity(
|
|
|
|
horizontal:
|
|
|
|
-4,
|
|
|
|
vertical:
|
|
|
|
-4),
|
|
|
|
title: Text(
|
2023-06-21 00:22:43 +00:00
|
|
|
"${spouse?.relatedPerson?.firstName} ${spouse?.relatedPerson?.middleName ?? ''} ${spouse?.relatedPerson!.lastName} ${spouse?.relatedPerson?.nameExtension ?? ''}",
|
2023-05-22 02:23:56 +00:00
|
|
|
style: Theme.of(
|
|
|
|
context)
|
|
|
|
.textTheme
|
|
|
|
.titleMedium!
|
|
|
|
.copyWith(
|
|
|
|
fontWeight:
|
|
|
|
FontWeight.w500),
|
|
|
|
),
|
|
|
|
subtitle:
|
|
|
|
const Text(
|
|
|
|
"fullname"),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Checkbox(
|
|
|
|
visualDensity: const VisualDensity(
|
2023-05-11 00:04:53 +00:00
|
|
|
horizontal:
|
|
|
|
0,
|
|
|
|
vertical:
|
|
|
|
-4),
|
2023-05-22 02:23:56 +00:00
|
|
|
value: spouse!
|
|
|
|
.incaseOfEmergency!,
|
|
|
|
onChanged:
|
|
|
|
(value) {
|
|
|
|
confirmAlertWithCancel(
|
|
|
|
context,
|
|
|
|
() {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(context);
|
|
|
|
progress!
|
|
|
|
.showWithText("Loading...");
|
|
|
|
|
|
|
|
context.read<FamilyBloc>().add(AddEmergencyEvent(
|
|
|
|
contactInfoId: spouse!.emergencyContact!.isNotEmpty ? spouse!.emergencyContact!.first.contactinfoid : null,
|
|
|
|
numberMail: spouse!.emergencyContact!.isNotEmpty ? spouse!.emergencyContact!.first.numbermail : null,
|
|
|
|
profileId: profileId!,
|
|
|
|
relatedPersonId: spouse!.relatedPerson!.id!,
|
|
|
|
token: token!,
|
|
|
|
requestType: "CHECKBOX"));
|
|
|
|
},
|
|
|
|
() {},
|
|
|
|
"Emergency Contact Information?",
|
|
|
|
spouse!.incaseOfEmergency == true
|
|
|
|
? "Remove as emergency contact information?"
|
|
|
|
: "Add as emergency contact information?");
|
|
|
|
}),
|
|
|
|
const Text(
|
|
|
|
incaseOfEmergency),
|
|
|
|
////Add mobile icon
|
|
|
|
Container(
|
|
|
|
child: spouse!.incaseOfEmergency! &&
|
|
|
|
spouse!.emergencyContact!.isEmpty
|
|
|
|
? IconButton(
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
|
|
|
|
onPressed: () {
|
2023-05-11 00:04:53 +00:00
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: spouse!.emergencyContact!.isNotEmpty ? spouse!.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: spouse!.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
2023-05-22 02:23:56 +00:00
|
|
|
},
|
|
|
|
formKey: formKey);
|
2023-05-11 00:04:53 +00:00
|
|
|
});
|
|
|
|
},
|
2023-05-22 02:23:56 +00:00
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus_circled,
|
|
|
|
color: third,
|
|
|
|
size: 18,
|
|
|
|
))
|
|
|
|
: Container()),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
visible: spouse!
|
|
|
|
.incaseOfEmergency!,
|
|
|
|
child: Container(
|
|
|
|
child: spouse!.emergencyContact!.isNotEmpty
|
|
|
|
? Row(
|
|
|
|
children: [
|
|
|
|
//// edit mobile
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
formKey: formKey,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: spouse!.emergencyContact!.isNotEmpty ? spouse!.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: spouse!.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
width: 16,
|
|
|
|
),
|
|
|
|
Badge(
|
|
|
|
backgroundColor: third,
|
|
|
|
textColor: Colors.white,
|
|
|
|
label: Text(spouse!.emergencyContact!.first.numbermail!),
|
|
|
|
),
|
|
|
|
],
|
2023-05-11 00:04:53 +00:00
|
|
|
),
|
2023-05-22 02:23:56 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Container())),
|
|
|
|
Container(
|
|
|
|
padding:
|
|
|
|
const EdgeInsets
|
|
|
|
.only(
|
|
|
|
left:
|
|
|
|
12),
|
|
|
|
alignment:
|
|
|
|
Alignment
|
|
|
|
.topLeft,
|
|
|
|
child: spouse
|
|
|
|
?.position !=
|
|
|
|
null
|
|
|
|
? Column(
|
2023-05-11 00:04:53 +00:00
|
|
|
crossAxisAlignment:
|
2023-05-22 02:23:56 +00:00
|
|
|
CrossAxisAlignment.start,
|
2023-05-11 00:04:53 +00:00
|
|
|
children: [
|
|
|
|
const SizedBox(
|
2023-05-22 02:23:56 +00:00
|
|
|
height:
|
|
|
|
12,
|
2023-05-11 00:04:53 +00:00
|
|
|
),
|
|
|
|
Text(
|
2023-05-22 02:23:56 +00:00
|
|
|
"OCCUPATION",
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500, color: primary)),
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
height: 3,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
spouse!.position!.title!,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
spouse!.company!.name!,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
spouse!.companyAddress!,
|
|
|
|
style: Theme.of(context).textTheme.labelMedium,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
spouse!.companyContactNumber!,
|
|
|
|
style: Theme.of(context).textTheme.labelMedium,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
2023-05-11 00:04:53 +00:00
|
|
|
],
|
|
|
|
)
|
2023-05-22 02:23:56 +00:00
|
|
|
: const SizedBox(),
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
AppPopupMenu<int>(
|
|
|
|
offset: const Offset(
|
|
|
|
-10, -10),
|
|
|
|
elevation: 3,
|
|
|
|
onSelected:
|
|
|
|
(value) async {
|
|
|
|
////delete -= = = = = = = = =>>
|
|
|
|
if (value == 2) {
|
|
|
|
confirmAlert(
|
|
|
|
context, () {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(
|
|
|
|
context);
|
|
|
|
progress!
|
|
|
|
.showWithText(
|
|
|
|
"Loading...");
|
|
|
|
context
|
|
|
|
.read<
|
|
|
|
FamilyBloc>()
|
|
|
|
.add(DeleteFamily(
|
2023-06-06 06:54:51 +00:00
|
|
|
id: spouse!
|
2023-05-22 02:23:56 +00:00
|
|
|
.relatedPerson!
|
|
|
|
.id!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
token:
|
|
|
|
token!));
|
|
|
|
}, "Delete?",
|
|
|
|
"Confirm Delete?");
|
|
|
|
}
|
|
|
|
if (value == 1) {
|
|
|
|
////edit eligibilty-= = = = = = = = =>>
|
2023-05-11 00:04:53 +00:00
|
|
|
|
2023-05-22 02:23:56 +00:00
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(
|
|
|
|
context);
|
|
|
|
progress!
|
|
|
|
.showWithText(
|
|
|
|
"Loading...");
|
|
|
|
if (positions
|
|
|
|
.isEmpty) {
|
|
|
|
positions =
|
|
|
|
await ProfileUtilities
|
|
|
|
.instance
|
|
|
|
.getAgencyPosition();
|
|
|
|
}
|
2023-05-11 00:04:53 +00:00
|
|
|
|
2023-05-22 02:23:56 +00:00
|
|
|
if (agencices
|
|
|
|
.isEmpty) {
|
|
|
|
agencices =
|
|
|
|
await ProfileUtilities
|
|
|
|
.instance
|
|
|
|
.getAgecies();
|
|
|
|
}
|
|
|
|
if (categories
|
|
|
|
.isEmpty) {
|
|
|
|
categories =
|
|
|
|
await ProfileUtilities
|
|
|
|
.instance
|
|
|
|
.agencyCategory();
|
|
|
|
}
|
|
|
|
progress.dismiss();
|
|
|
|
showDialog(
|
|
|
|
context: NavigationService
|
|
|
|
.navigatorKey
|
|
|
|
.currentContext!,
|
|
|
|
builder:
|
|
|
|
(BuildContext
|
|
|
|
context) {
|
|
|
|
return SpouseEditAlert(
|
|
|
|
familyBackground:
|
|
|
|
spouse!,
|
|
|
|
familyBloc:
|
|
|
|
familyBloc,
|
|
|
|
token:
|
|
|
|
token!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
positions:
|
|
|
|
positions,
|
|
|
|
agencies:
|
|
|
|
agencices,
|
|
|
|
category:
|
|
|
|
categories,
|
|
|
|
bloodType:
|
|
|
|
bloodType,
|
|
|
|
civilStatus:
|
|
|
|
civilStatus,
|
|
|
|
gender:
|
|
|
|
gender,
|
|
|
|
nameExtensions:
|
|
|
|
nameExtensions,
|
|
|
|
sexes:
|
|
|
|
sexes);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
menuItems: [
|
|
|
|
popMenuItem(
|
|
|
|
text: "Update",
|
|
|
|
value: 1,
|
|
|
|
icon: Icons.edit),
|
|
|
|
popMenuItem(
|
2023-06-06 06:54:51 +00:00
|
|
|
text: "Remove",
|
2023-05-22 02:23:56 +00:00
|
|
|
value: 2,
|
|
|
|
icon:
|
|
|
|
Icons.delete),
|
|
|
|
],
|
|
|
|
icon: const Icon(
|
|
|
|
Icons.more_vert,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
|
|
|
tooltip: "Options",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
2023-05-11 00:04:53 +00:00
|
|
|
: SizedBox(
|
|
|
|
width: screenWidth,
|
2023-08-30 01:55:03 +00:00
|
|
|
child: Padding(
|
2023-05-11 00:04:53 +00:00
|
|
|
padding:
|
2023-08-30 01:55:03 +00:00
|
|
|
const EdgeInsets.symmetric(
|
2023-05-11 00:04:53 +00:00
|
|
|
vertical: 8,
|
|
|
|
horizontal: 0),
|
|
|
|
child: Text(
|
2023-08-30 01:55:03 +00:00
|
|
|
"Provide your spouse's primary and employment information. Leave empty if not applicable.",style: Theme.of(context).textTheme.bodySmall,
|
2023-05-11 00:04:53 +00:00
|
|
|
textAlign:
|
|
|
|
TextAlign.center,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
//// Childrens ----------------------------------
|
|
|
|
Container(
|
|
|
|
decoration: box1(),
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 12, vertical: 8),
|
|
|
|
width: screenWidth,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
2023-03-06 08:29:55 +00:00
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
2023-05-11 00:04:53 +00:00
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
childrenText.toUpperCase(),
|
|
|
|
style: Theme.of(context)
|
|
|
|
.textTheme
|
2023-06-06 06:54:51 +00:00
|
|
|
.titleSmall!
|
2023-05-11 00:04:53 +00:00
|
|
|
.copyWith(color: primary),
|
|
|
|
),
|
|
|
|
const Expanded(child: SizedBox()),
|
|
|
|
IconButton(
|
|
|
|
////childrens
|
|
|
|
////Show add dialog
|
|
|
|
onPressed: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext
|
|
|
|
context) {
|
|
|
|
return ChildAlert(
|
|
|
|
familyBloc:
|
|
|
|
familyBloc,
|
|
|
|
token: token!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
bloodType:
|
|
|
|
bloodType,
|
|
|
|
civilStatus:
|
|
|
|
civilStatus,
|
|
|
|
gender: gender,
|
|
|
|
nameExtensions:
|
|
|
|
nameExtensions,
|
|
|
|
sexes: sexes);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus,
|
|
|
|
color: second,
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
2023-08-20 09:36:16 +00:00
|
|
|
|
2023-05-11 00:04:53 +00:00
|
|
|
child: children.isNotEmpty
|
|
|
|
? Column(
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize.min,
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
children:
|
|
|
|
children.map((child) {
|
|
|
|
return Container(
|
|
|
|
padding:
|
|
|
|
const EdgeInsets
|
|
|
|
.symmetric(
|
|
|
|
horizontal: 12,
|
2023-08-20 09:36:16 +00:00
|
|
|
vertical: 0),
|
2023-05-11 00:04:53 +00:00
|
|
|
width: screenWidth,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
height: 5,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize
|
|
|
|
.min,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize
|
|
|
|
.min,
|
|
|
|
children: [
|
|
|
|
ListTile(
|
|
|
|
dense:
|
|
|
|
true,
|
|
|
|
visualDensity: const VisualDensity(
|
|
|
|
horizontal: -4,
|
|
|
|
vertical: -4),
|
|
|
|
title: Text(
|
2023-06-21 00:22:43 +00:00
|
|
|
"${child.relatedPerson?.firstName} ${child.relatedPerson?.middleName ?? ''} ${child.relatedPerson?.lastName} ${child.relatedPerson?.nameExtension ?? ''}",
|
2023-05-11 00:04:53 +00:00
|
|
|
style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500)),
|
|
|
|
subtitle:
|
|
|
|
const Text("fullname"),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Checkbox(
|
|
|
|
visualDensity: const VisualDensity(horizontal: 0, vertical: -4),
|
|
|
|
value: child.incaseOfEmergency!,
|
|
|
|
onChanged: (value) {
|
|
|
|
confirmAlertWithCancel(context, () {
|
|
|
|
final progress = ProgressHUD.of(context);
|
|
|
|
progress!.showWithText("Loading...");
|
|
|
|
|
|
|
|
context.read<FamilyBloc>().add(AddEmergencyEvent(contactInfoId: child.emergencyContact!.isNotEmpty ? child.emergencyContact!.first.contactinfoid : null, numberMail: child.emergencyContact!.isNotEmpty ? child.emergencyContact!.first.numbermail : null, profileId: profileId!, relatedPersonId: child.relatedPerson!.id!, token: token!, requestType: "CHECKBOX"));
|
|
|
|
}, () {}, "Emergency Contact Information?", child.incaseOfEmergency == true ? "Remove as emergency contact information?" : "Add as emergency contact information?");
|
|
|
|
}),
|
|
|
|
const Text(incaseOfEmergency),
|
|
|
|
////Add mobile icon
|
|
|
|
Container(
|
|
|
|
child: child.incaseOfEmergency! && child.emergencyContact!.isEmpty
|
|
|
|
? IconButton(
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
|
|
|
|
onPressed: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: child.emergencyContact!.isNotEmpty ? child.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: child.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
},
|
|
|
|
formKey: formKey);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus_circled,
|
|
|
|
color: third,
|
|
|
|
size: 18,
|
|
|
|
))
|
|
|
|
: Container())
|
|
|
|
],
|
|
|
|
),
|
|
|
|
//// child person add mobile number
|
|
|
|
Visibility(
|
|
|
|
visible:
|
|
|
|
child.incaseOfEmergency!,
|
|
|
|
child: Container(
|
|
|
|
child: child.emergencyContact!.isNotEmpty
|
|
|
|
? Row(
|
|
|
|
children: [
|
|
|
|
//// edit mobile
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
formKey: formKey,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: child.emergencyContact!.isNotEmpty ? child.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: child.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
width: 16,
|
|
|
|
),
|
|
|
|
Badge(
|
|
|
|
backgroundColor: third,
|
|
|
|
textColor: Colors.white,
|
|
|
|
label: Text(child.emergencyContact!.first.numbermail!),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Container())),
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
AppPopupMenu<
|
|
|
|
int>(
|
|
|
|
offset:
|
|
|
|
const Offset(
|
|
|
|
-10,
|
|
|
|
-10),
|
|
|
|
elevation: 3,
|
|
|
|
onSelected:
|
|
|
|
(value) {
|
|
|
|
////delete -= = = = = = = = =>>
|
|
|
|
if (value ==
|
|
|
|
2) {
|
|
|
|
confirmAlert(
|
|
|
|
context,
|
|
|
|
() {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(context);
|
|
|
|
progress!
|
|
|
|
.showWithText("Loading...");
|
|
|
|
context.read<FamilyBloc>().add(DeleteFamily(
|
|
|
|
id: child
|
|
|
|
.relatedPerson!.id!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
token:
|
|
|
|
token!));
|
|
|
|
}, "Delete?",
|
|
|
|
"Confirm Delete?");
|
|
|
|
}
|
|
|
|
if (value ==
|
|
|
|
1) {
|
|
|
|
//// edit
|
|
|
|
showDialog(
|
|
|
|
context:
|
|
|
|
context,
|
|
|
|
builder:
|
|
|
|
(BuildContext context) {
|
|
|
|
return ChildEditAlert(
|
|
|
|
familyBackground: child,
|
|
|
|
familyBloc: familyBloc,
|
|
|
|
profileId: profileId!,
|
|
|
|
token: token!,
|
|
|
|
bloodType: bloodType,
|
|
|
|
civilStatus: civilStatus,
|
|
|
|
gender: gender,
|
|
|
|
nameExtensions: nameExtensions,
|
|
|
|
sexes: sexes);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
menuItems: [
|
|
|
|
popMenuItem(
|
|
|
|
text:
|
|
|
|
"Update",
|
|
|
|
value:
|
|
|
|
1,
|
|
|
|
icon: Icons
|
|
|
|
.edit),
|
|
|
|
popMenuItem(
|
|
|
|
text:
|
2023-06-06 06:54:51 +00:00
|
|
|
"Remove",
|
2023-05-11 00:04:53 +00:00
|
|
|
value:
|
|
|
|
2,
|
|
|
|
icon: Icons
|
|
|
|
.delete),
|
|
|
|
],
|
|
|
|
icon:
|
|
|
|
const Icon(
|
|
|
|
Icons
|
|
|
|
.more_vert,
|
|
|
|
color: Colors
|
|
|
|
.grey,
|
|
|
|
),
|
|
|
|
tooltip:
|
|
|
|
"Options",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}).toList())
|
|
|
|
: SizedBox(
|
|
|
|
width: screenWidth,
|
2023-08-30 01:55:03 +00:00
|
|
|
child: Padding(
|
2023-05-11 00:04:53 +00:00
|
|
|
padding:
|
2023-08-30 01:55:03 +00:00
|
|
|
const EdgeInsets.symmetric(
|
2023-05-11 00:04:53 +00:00
|
|
|
vertical: 8,
|
|
|
|
horizontal: 0),
|
|
|
|
child: Text(
|
2023-08-30 01:55:03 +00:00
|
|
|
"Provide your child/children's primary information. Leave empty if not applicable.",style: Theme.of(context).textTheme.bodySmall,
|
2023-05-11 00:04:53 +00:00
|
|
|
textAlign:
|
|
|
|
TextAlign.center,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
////Other related person
|
|
|
|
Container(
|
|
|
|
decoration: box1(),
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 12, vertical: 8),
|
|
|
|
width: screenWidth,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
otherRelatedText.toUpperCase(),
|
|
|
|
style: Theme.of(context)
|
|
|
|
.textTheme
|
2023-06-06 06:54:51 +00:00
|
|
|
.titleSmall!
|
2023-05-11 00:04:53 +00:00
|
|
|
.copyWith(color: primary),
|
2023-03-06 08:29:55 +00:00
|
|
|
),
|
2023-05-11 00:04:53 +00:00
|
|
|
),
|
|
|
|
IconButton(
|
|
|
|
////other related
|
|
|
|
//// Show Alert Dialog
|
|
|
|
onPressed: () async {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(context);
|
|
|
|
progress!.showWithText(
|
|
|
|
"Loading...");
|
|
|
|
List<Relationship>
|
|
|
|
relationshipTypes =
|
|
|
|
await ProfileUtilities
|
|
|
|
.instance
|
|
|
|
.getRelationshipType();
|
|
|
|
progress.dismiss();
|
|
|
|
showDialog(
|
|
|
|
context: NavigationService
|
|
|
|
.navigatorKey
|
|
|
|
.currentContext!,
|
|
|
|
builder: (BuildContext
|
|
|
|
context) {
|
|
|
|
return RelatedAlert(
|
|
|
|
token: token!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
familyBloc:
|
|
|
|
familyBloc,
|
|
|
|
relationships:
|
|
|
|
relationshipTypes,
|
|
|
|
bloodType:
|
|
|
|
bloodType,
|
|
|
|
civilStatus:
|
|
|
|
civilStatus,
|
|
|
|
gender: gender,
|
|
|
|
nameExtensions:
|
|
|
|
nameExtensions,
|
|
|
|
sexes: sexes);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus,
|
|
|
|
color: second,
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: otherRelated.isNotEmpty
|
|
|
|
? Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
children: otherRelated
|
|
|
|
.map((relative) {
|
|
|
|
return Container(
|
|
|
|
padding:
|
|
|
|
const EdgeInsets
|
|
|
|
.symmetric(
|
|
|
|
horizontal: 12,
|
2023-08-20 09:36:16 +00:00
|
|
|
vertical: 0),
|
2023-05-11 00:04:53 +00:00
|
|
|
width: screenWidth,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
height: 5,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize
|
|
|
|
.min,
|
|
|
|
children: [
|
|
|
|
ListTile(
|
|
|
|
dense:
|
|
|
|
true,
|
|
|
|
visualDensity: const VisualDensity(
|
|
|
|
horizontal: -4,
|
|
|
|
vertical: -4),
|
|
|
|
title: Text(
|
|
|
|
"${relative.relatedPerson?.firstName} ${relative.relatedPerson?.middleName ?? ""} ${relative.relatedPerson?.lastName} ${relative.relatedPerson?.nameExtension ?? ''}",
|
|
|
|
style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500)),
|
|
|
|
subtitle:
|
|
|
|
const Text("fullname"),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Checkbox(
|
|
|
|
visualDensity: const VisualDensity(horizontal: 0, vertical: -4),
|
|
|
|
value: relative.incaseOfEmergency!,
|
|
|
|
onChanged: (value) {
|
|
|
|
confirmAlertWithCancel(context, () {
|
|
|
|
final progress = ProgressHUD.of(context);
|
|
|
|
progress!.showWithText("Loading...");
|
|
|
|
|
|
|
|
context.read<FamilyBloc>().add(AddEmergencyEvent(contactInfoId: relative.emergencyContact!.isNotEmpty ? relative.emergencyContact!.first.contactinfoid : null, numberMail: relative.emergencyContact!.isNotEmpty ? relative.emergencyContact!.first.numbermail : null, profileId: profileId!, relatedPersonId: relative.relatedPerson!.id!, token: token!, requestType: "CHECKBOX"));
|
|
|
|
}, () {}, "Emergency Contact Information?", relative.incaseOfEmergency == true ? "Remove as emergency contact information?" : "Add as emergency contact information?");
|
|
|
|
}),
|
|
|
|
const Text(incaseOfEmergency),
|
|
|
|
Container(
|
|
|
|
child: relative.incaseOfEmergency! && relative.emergencyContact!.isEmpty
|
|
|
|
? IconButton(
|
|
|
|
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
|
|
|
|
onPressed: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: relative.emergencyContact!.isNotEmpty ? relative.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: relative.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
},
|
|
|
|
formKey: formKey);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(
|
|
|
|
Entypo.plus_circled,
|
|
|
|
color: third,
|
|
|
|
size: 18,
|
|
|
|
))
|
|
|
|
: Container())
|
|
|
|
],
|
|
|
|
),
|
|
|
|
//// other related person add mobile number
|
|
|
|
Visibility(
|
|
|
|
visible:
|
|
|
|
relative.incaseOfEmergency!,
|
|
|
|
child: Container(
|
|
|
|
child: relative.emergencyContact!.isNotEmpty
|
|
|
|
? Row(
|
|
|
|
children: [
|
|
|
|
//// edit mobile
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AddMobileNumber(
|
|
|
|
formKey: formKey,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(_scaffoldKey.currentContext!).pop();
|
|
|
|
familyBloc.add(AddEmergencyEvent(contactInfoId: relative.emergencyContact!.isNotEmpty ? relative.emergencyContact!.first.contactinfoid : null, numberMail: formKey.currentState!.value['number_mail'], profileId: profileId!, relatedPersonId: relative.relatedPerson!.id!, token: token!, requestType: "CONTACT"));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
const SizedBox(
|
|
|
|
width: 16,
|
|
|
|
),
|
|
|
|
Badge(
|
|
|
|
backgroundColor: third,
|
|
|
|
textColor: Colors.white,
|
|
|
|
label: Text(relative.emergencyContact!.first.numbermail!),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Container()),
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
AppPopupMenu<
|
|
|
|
int>(
|
|
|
|
offset:
|
|
|
|
const Offset(
|
|
|
|
-10,
|
|
|
|
-10),
|
|
|
|
elevation: 3,
|
|
|
|
onSelected:
|
|
|
|
(value) async {
|
|
|
|
////delete -= = = = = = = = =>>
|
|
|
|
if (value ==
|
|
|
|
2) {
|
|
|
|
confirmAlert(
|
|
|
|
context,
|
|
|
|
() {
|
|
|
|
final progress =
|
|
|
|
ProgressHUD.of(context);
|
|
|
|
progress!
|
|
|
|
.showWithText("Loading...");
|
|
|
|
context.read<FamilyBloc>().add(DeleteFamily(
|
|
|
|
id: relative
|
|
|
|
.relatedPerson!.id!,
|
|
|
|
profileId:
|
|
|
|
profileId!,
|
|
|
|
token:
|
|
|
|
token!));
|
|
|
|
}, "Delete?",
|
|
|
|
"Confirm Delete?");
|
|
|
|
}
|
|
|
|
if (value ==
|
|
|
|
1) {
|
|
|
|
////edit eligibilty-= = = = = = = = =>>
|
|
|
|
await getRelationshiptypes(
|
|
|
|
context);
|
|
|
|
showDialog(
|
|
|
|
context: NavigationService
|
|
|
|
.navigatorKey
|
|
|
|
.currentContext!,
|
|
|
|
builder:
|
|
|
|
(BuildContext context) {
|
|
|
|
return RelatedEditAlert(
|
|
|
|
familyBackground: relative,
|
|
|
|
token: token!,
|
|
|
|
profileId: profileId!,
|
|
|
|
familyBloc: familyBloc,
|
|
|
|
relationships: relationshipTypes!,
|
|
|
|
bloodType: bloodType,
|
|
|
|
civilStatus: civilStatus,
|
|
|
|
gender: gender,
|
|
|
|
nameExtensions: nameExtensions,
|
|
|
|
sexes: sexes);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
menuItems: [
|
|
|
|
popMenuItem(
|
|
|
|
text:
|
|
|
|
"Update",
|
|
|
|
value:
|
|
|
|
1,
|
|
|
|
icon: Icons
|
|
|
|
.edit),
|
|
|
|
popMenuItem(
|
|
|
|
text:
|
2023-06-06 06:54:51 +00:00
|
|
|
"Remove",
|
2023-05-11 00:04:53 +00:00
|
|
|
value:
|
|
|
|
2,
|
|
|
|
icon: Icons
|
|
|
|
.delete),
|
|
|
|
],
|
|
|
|
icon:
|
|
|
|
const Icon(
|
|
|
|
Icons
|
|
|
|
.more_vert,
|
|
|
|
color: Colors
|
|
|
|
.grey,
|
|
|
|
),
|
|
|
|
tooltip:
|
|
|
|
"Options",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}).toList())
|
|
|
|
: SizedBox(
|
|
|
|
width: screenWidth,
|
2023-08-30 01:55:03 +00:00
|
|
|
child: Padding(
|
2023-05-11 00:04:53 +00:00
|
|
|
padding:
|
2023-08-30 01:55:03 +00:00
|
|
|
const EdgeInsets.symmetric(
|
2023-05-11 00:04:53 +00:00
|
|
|
vertical: 8,
|
|
|
|
horizontal: 0),
|
|
|
|
child: Text(
|
2023-08-30 01:55:03 +00:00
|
|
|
"Provide the other related person's primary information. Leave empty if not applicable.",style: Theme.of(context).textTheme.bodySmall,
|
2023-05-11 00:04:53 +00:00
|
|
|
textAlign:
|
|
|
|
TextAlign.center,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]);
|
2023-06-21 00:22:43 +00:00
|
|
|
}
|
|
|
|
if (state is FamilyErrorState) {
|
|
|
|
return SomethingWentWrong(
|
|
|
|
message: state.message,
|
|
|
|
onpressed: () {
|
|
|
|
context.read<FamilyBloc>().add(GetFamilies(
|
|
|
|
profileId: profileId!, token: token!));
|
|
|
|
});
|
|
|
|
}
|
2023-05-11 00:04:53 +00:00
|
|
|
return Container();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return Container();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return Container();
|
2023-03-06 08:29:55 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
2023-02-08 08:06:27 +00:00
|
|
|
);
|
|
|
|
}
|
2023-05-11 00:04:53 +00:00
|
|
|
|
|
|
|
getRelationshiptypes(BuildContext parentContext) async {
|
|
|
|
final progress = ProgressHUD.of(parentContext);
|
|
|
|
progress!.showWithText("Loading...");
|
|
|
|
|
|
|
|
relationshipTypes = await ProfileUtilities.instance.getRelationshipType();
|
|
|
|
progress.dismiss();
|
|
|
|
}
|
|
|
|
|
|
|
|
PopupMenuItem<int> popMenuItem({String? text, int? value, IconData? icon}) {
|
|
|
|
return PopupMenuItem(
|
|
|
|
value: value,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Icon(
|
|
|
|
icon,
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
width: 10,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
text!,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2023-02-09 08:48:19 +00:00
|
|
|
}
|