Successfully implmented Profile API
parent
d8efeffd8c
commit
60c5a295f4
|
@ -364,10 +364,15 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = "1.0.0 ";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "uniT-App";
|
PRODUCT_BUNDLE_IDENTIFIER = "uniT-App";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
|
SUPPORTS_MACCATALYST = NO;
|
||||||
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = 1;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
};
|
};
|
||||||
name = Profile;
|
name = Profile;
|
||||||
|
@ -493,11 +498,16 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = "1.0.0 ";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "uniT-App";
|
PRODUCT_BUNDLE_IDENTIFIER = "uniT-App";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
|
SUPPORTS_MACCATALYST = NO;
|
||||||
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = 1;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
|
@ -516,10 +526,15 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = "1.0.0 ";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "uniT-App";
|
PRODUCT_BUNDLE_IDENTIFIER = "uniT-App";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
|
SUPPORTS_MACCATALYST = NO;
|
||||||
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = 1;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|
|
@ -1,8 +1,22 @@
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:unit2/model/location/country.dart';
|
||||||
|
import 'package:unit2/model/location/region.dart';
|
||||||
|
import 'package:unit2/screens/profile/components/other_information/org_membership/add_modal.dart';
|
||||||
|
import 'package:unit2/screens/unit2/login/components/update_required.dart';
|
||||||
import 'package:unit2/sevices/profile/learningDevelopment_service.dart';
|
import 'package:unit2/sevices/profile/learningDevelopment_service.dart';
|
||||||
|
import 'package:unit2/test_data.dart';
|
||||||
|
import 'package:unit2/utils/text_container.dart';
|
||||||
|
|
||||||
|
import '../../../model/location/barangay.dart';
|
||||||
|
import '../../../model/location/city.dart';
|
||||||
|
import '../../../model/location/provinces.dart';
|
||||||
import '../../../model/profile/learning_development.dart';
|
import '../../../model/profile/learning_development.dart';
|
||||||
|
import '../../../model/utils/agency.dart';
|
||||||
|
import '../../../model/utils/category.dart';
|
||||||
|
import '../../../utils/location_utilities.dart';
|
||||||
|
import '../../../utils/profile_utilities.dart';
|
||||||
|
|
||||||
part 'learning_development_event.dart';
|
part 'learning_development_event.dart';
|
||||||
part 'learning_development_state.dart';
|
part 'learning_development_state.dart';
|
||||||
|
@ -10,19 +24,251 @@ part 'learning_development_state.dart';
|
||||||
class LearningDevelopmentBloc
|
class LearningDevelopmentBloc
|
||||||
extends Bloc<LearningDevelopmentEvent, LearningDevelopmentState> {
|
extends Bloc<LearningDevelopmentEvent, LearningDevelopmentState> {
|
||||||
LearningDevelopmentBloc() : super(LearningDevelopmentInitial()) {
|
LearningDevelopmentBloc() : super(LearningDevelopmentInitial()) {
|
||||||
List<LearningDevelopement> learningsAndDevelopments;
|
List<LearningDevelopement> learningsAndDevelopments = [];
|
||||||
|
List<LearningDevelopmentType> types = [];
|
||||||
|
List<LearningDevelopmentType> topics = [];
|
||||||
|
List<Country> globalCountries = [];
|
||||||
|
List<Region> globalRegions = [];
|
||||||
|
List<Province> globalProvinces = [];
|
||||||
|
List<CityMunicipality> globalCities = [];
|
||||||
|
List<Barangay> globalBarangay = [];
|
||||||
|
List<Agency> agencies = [];
|
||||||
|
List<Category> agencyCategory = [];
|
||||||
|
|
||||||
|
Region? currentRegion;
|
||||||
|
Country? currentCountry;
|
||||||
|
Province? currentProvince;
|
||||||
|
CityMunicipality? currentCity;
|
||||||
|
Barangay? currentBarangay;
|
||||||
on<GetLearningDevelopments>((event, emit) async {
|
on<GetLearningDevelopments>((event, emit) async {
|
||||||
// try {
|
try {
|
||||||
|
emit(LearningDevelopmentLoadingState());
|
||||||
|
List<LearningDevelopement> learnings = await LearningDevelopmentServices
|
||||||
|
.instance
|
||||||
|
.getLearningDevelopments(event.profileId, event.token);
|
||||||
|
learningsAndDevelopments = learnings;
|
||||||
|
emit(LearningDevelopmentLoadedState(
|
||||||
|
learningsAndDevelopment: learningsAndDevelopments));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LeaningDevelopmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
////load
|
||||||
|
on<LoadLearniningDevelopment>((event, emit) {
|
||||||
|
emit(LearningDevelopmentLoadedState(
|
||||||
|
learningsAndDevelopment: learningsAndDevelopments));
|
||||||
|
});
|
||||||
|
//// show add form
|
||||||
|
on<ShowAddLearningDevelopmentForm>((event, emit) async {
|
||||||
|
try {
|
||||||
emit(LearningDevelopmentLoadingState());
|
emit(LearningDevelopmentLoadingState());
|
||||||
List<LearningDevelopement> learnings = await LearningDevelopmentServices
|
if (types.isEmpty) {
|
||||||
.instance
|
List<LearningDevelopmentType> newTypes =
|
||||||
.getLearningDevelopments(event.profileId, event.token);
|
await LearningDevelopmentServices.instance
|
||||||
learningsAndDevelopments = learnings;
|
.getLearningDevelopmentType();
|
||||||
emit(LearningDevelopmentLoadedState(
|
types = newTypes;
|
||||||
learningsAndDevelopment: learningsAndDevelopments));
|
}
|
||||||
// } catch (e) {
|
if (topics.isEmpty) {
|
||||||
// emit(LeaningDevelopmentErrorState(message: e.toString()));
|
List<LearningDevelopmentType> newTopics =
|
||||||
// }
|
await LearningDevelopmentServices.instance.getTrainingTopics();
|
||||||
|
topics = newTopics;
|
||||||
|
}
|
||||||
|
if (globalRegions.isEmpty) {
|
||||||
|
List<Region> regions = await LocationUtils.instance.getRegions();
|
||||||
|
globalRegions = regions;
|
||||||
|
}
|
||||||
|
if (globalCountries.isEmpty) {
|
||||||
|
List<Country> countries = await LocationUtils.instance.getCountries();
|
||||||
|
globalCountries = countries;
|
||||||
|
}
|
||||||
|
if (agencies.isEmpty) {
|
||||||
|
List<Agency> newAgencies =
|
||||||
|
await ProfileUtilities.instance.getAgecies();
|
||||||
|
agencies = newAgencies;
|
||||||
|
}
|
||||||
|
if (agencyCategory.isEmpty) {
|
||||||
|
List<Category> categoryAgencies =
|
||||||
|
await ProfileUtilities.instance.agencyCategory();
|
||||||
|
agencyCategory = categoryAgencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit(LearningDevelopmentAddingState(
|
||||||
|
types: types,
|
||||||
|
topics: topics,
|
||||||
|
countries: globalCountries,
|
||||||
|
regions: globalRegions,
|
||||||
|
conductedBy: agencies,
|
||||||
|
sponsorAgencies: agencies,
|
||||||
|
agencyCategory: agencyCategory));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LeaningDevelopmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
////Show edit form
|
||||||
|
on<ShowEditLearningDevelopmentForm>((event, emit) async {
|
||||||
|
try{
|
||||||
|
if (globalRegions.isEmpty) {
|
||||||
|
List<Region> regions = await LocationUtils.instance.getRegions();
|
||||||
|
globalRegions = regions;
|
||||||
|
}
|
||||||
|
if (globalCountries.isEmpty) {
|
||||||
|
List<Country> countries = await LocationUtils.instance.getCountries();
|
||||||
|
globalCountries = countries;
|
||||||
|
}
|
||||||
|
currentCountry = globalCountries.firstWhere((Country country) =>
|
||||||
|
event.learningDevelopment.conductedTraining!.venue!.country!.code ==
|
||||||
|
country.code);
|
||||||
|
if (!event.isOverseas) {
|
||||||
|
//// if not overseas
|
||||||
|
currentRegion = globalRegions.firstWhere((Region region) =>
|
||||||
|
event.learningDevelopment.conductedTraining!.venue!
|
||||||
|
.cityMunicipality!.province!.region!.code ==
|
||||||
|
region.code);
|
||||||
|
|
||||||
|
globalProvinces = await LocationUtils.instance
|
||||||
|
.getProvinces(regionCode: currentRegion!.code.toString());
|
||||||
|
currentProvince = globalProvinces.firstWhere((Province province) =>
|
||||||
|
event.learningDevelopment.conductedTraining!.venue!
|
||||||
|
.cityMunicipality!.province!.code ==
|
||||||
|
province.code);
|
||||||
|
|
||||||
|
globalCities = await LocationUtils.instance
|
||||||
|
.getCities(code: currentProvince!.code.toString());
|
||||||
|
|
||||||
|
currentCity = globalCities.firstWhere(
|
||||||
|
(CityMunicipality cityMunicipality) =>
|
||||||
|
event.learningDevelopment.conductedTraining!.venue!
|
||||||
|
.cityMunicipality!.code ==
|
||||||
|
cityMunicipality.code);
|
||||||
|
globalBarangay = await LocationUtils.instance
|
||||||
|
.getBarangay(code: currentCity!.code.toString());
|
||||||
|
|
||||||
|
if (event.learningDevelopment.conductedTraining?.venue?.barangay?.cityMunicipality !=
|
||||||
|
null) {
|
||||||
|
currentBarangay = globalBarangay.firstWhere((Barangay barangay) =>
|
||||||
|
event.learningDevelopment.conductedTraining!.venue!.barangay!
|
||||||
|
.code ==
|
||||||
|
barangay.code);
|
||||||
|
} else {
|
||||||
|
currentBarangay = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (topics.isEmpty) {
|
||||||
|
List<LearningDevelopmentType> newTopics =
|
||||||
|
await LearningDevelopmentServices.instance.getTrainingTopics();
|
||||||
|
topics = newTopics;
|
||||||
|
}
|
||||||
|
if (types.isEmpty) {
|
||||||
|
List<LearningDevelopmentType> newTypes =
|
||||||
|
await LearningDevelopmentServices.instance
|
||||||
|
.getLearningDevelopmentType();
|
||||||
|
types = newTypes;
|
||||||
|
}
|
||||||
|
if (agencies.isEmpty) {
|
||||||
|
List<Agency> newAgencies = await ProfileUtilities.instance.getAgecies();
|
||||||
|
agencies = newAgencies;
|
||||||
|
}
|
||||||
|
if (agencyCategory.isEmpty) {
|
||||||
|
List<Category> categoryAgencies =
|
||||||
|
await ProfileUtilities.instance.agencyCategory();
|
||||||
|
agencyCategory = categoryAgencies;
|
||||||
|
}
|
||||||
|
emit(LearningDevelopmentUpdatingState(
|
||||||
|
cities: globalCities,
|
||||||
|
currentBarangay: currentBarangay,
|
||||||
|
barangay: globalBarangay,
|
||||||
|
|
||||||
|
provinces: globalProvinces,
|
||||||
|
types: types,
|
||||||
|
topics: topics,
|
||||||
|
training: event.learningDevelopment.conductedTraining!.title!,
|
||||||
|
learningDevelopement: event.learningDevelopment,
|
||||||
|
currentConductedBy:
|
||||||
|
event.learningDevelopment.conductedTraining!.conductedBy!,
|
||||||
|
currentSponsor: event.learningDevelopment.sponsoredBy,
|
||||||
|
conductedBy: agencies,
|
||||||
|
sponsorAgencies: agencies,
|
||||||
|
agencyCategory: agencyCategory,
|
||||||
|
countries: globalCountries,
|
||||||
|
regions: globalRegions,
|
||||||
|
currentRegion: currentRegion,
|
||||||
|
currentCountry: currentCountry!,
|
||||||
|
currentProvince: currentProvince,
|
||||||
|
currentCity: currentCity,
|
||||||
|
overseas: event.isOverseas));
|
||||||
|
}catch(e){
|
||||||
|
emit(LearningDevelopmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
////Add
|
||||||
|
on<AddLearningAndDevelopment>((event, emit) async {
|
||||||
|
try {
|
||||||
|
Map<dynamic, dynamic> status =
|
||||||
|
await LearningDevelopmentServices.instance.add(
|
||||||
|
learningDevelopement: event.learningDevelopement,
|
||||||
|
token: event.token,
|
||||||
|
profileId: event.profileId);
|
||||||
|
if (status['success']) {
|
||||||
|
LearningDevelopement learningDevelopement =
|
||||||
|
LearningDevelopement.fromJson(status['data']);
|
||||||
|
learningsAndDevelopments.add(learningDevelopement);
|
||||||
|
emit(LearningDevelopmentAddedState(response: status));
|
||||||
|
} else {
|
||||||
|
emit(LearningDevelopmentAddedState(response: status));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(LearningDevelopmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
////Update
|
||||||
|
on<UpdateLearningDevelopment>((event, emit) async {
|
||||||
|
try {
|
||||||
|
Map<dynamic, dynamic> status =
|
||||||
|
await LearningDevelopmentServices.instance.update(
|
||||||
|
learningDevelopement: event.learningDevelopement,
|
||||||
|
token: event.token,
|
||||||
|
profileId: event.profileId);
|
||||||
|
if (status['success']) {
|
||||||
|
learningsAndDevelopments.removeWhere((LearningDevelopement element) =>
|
||||||
|
element.conductedTraining!.id == event.learningDevelopement.conductedTraining!.id &&
|
||||||
|
element.conductedTraining!.totalHours == event.learningDevelopement.conductedTraining!.totalHours);
|
||||||
|
LearningDevelopement learningDevelopement =
|
||||||
|
LearningDevelopement.fromJson(status['data']);
|
||||||
|
learningsAndDevelopments.add(learningDevelopement);
|
||||||
|
emit(LearningDevelopmentUpdatedState(response: status));
|
||||||
|
} else {
|
||||||
|
emit(LearningDevelopmentUpdatedState(response: status));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(LearningDevelopmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
////delete
|
||||||
|
on<DeleteLearningDevelopment>((event, emit) async {
|
||||||
|
try {
|
||||||
|
final bool success = await LearningDevelopmentServices.instance.delete(
|
||||||
|
profileId: event.profileId,
|
||||||
|
token: event.token,
|
||||||
|
sponsorId: event.sponsorId,
|
||||||
|
totalHours: event.hours,
|
||||||
|
trainingId: event.trainingId);
|
||||||
|
if (success) {
|
||||||
|
learningsAndDevelopments.removeWhere((LearningDevelopement element) =>
|
||||||
|
element.conductedTraining!.id == event.trainingId &&
|
||||||
|
element.conductedTraining!.totalHours == event.hours);
|
||||||
|
emit(DeleteLearningDevelopmentState(success: success));
|
||||||
|
} else {
|
||||||
|
emit(DeleteLearningDevelopmentState(success: success));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(LearningDevelopmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//// call errror
|
||||||
|
on<CallErrorState>((event, emit) {
|
||||||
|
emit(LeaningDevelopmentErrorState(message: event.message));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,3 +15,54 @@ class GetLearningDevelopments extends LearningDevelopmentEvent {
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [profileId, token];
|
List<Object> get props => [profileId, token];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ShowAddLearningDevelopmentForm extends LearningDevelopmentEvent{
|
||||||
|
|
||||||
|
}
|
||||||
|
class ShowEditLearningDevelopmentForm extends LearningDevelopmentEvent{
|
||||||
|
final LearningDevelopement learningDevelopment;
|
||||||
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
final bool isOverseas;
|
||||||
|
const ShowEditLearningDevelopmentForm({required this.isOverseas, required this.learningDevelopment, required this.profileId, required this.token});
|
||||||
|
}
|
||||||
|
class LoadLearniningDevelopment extends LearningDevelopmentEvent{
|
||||||
|
|
||||||
|
}
|
||||||
|
////delete
|
||||||
|
class DeleteLearningDevelopment extends LearningDevelopmentEvent {
|
||||||
|
final String token;
|
||||||
|
final int profileId;
|
||||||
|
final int? sponsorId;
|
||||||
|
final int trainingId;
|
||||||
|
final double hours;
|
||||||
|
const DeleteLearningDevelopment(
|
||||||
|
{required this.profileId, required this.token, required this.hours,required this.sponsorId, required this.trainingId});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [profileId, token, hours,trainingId];
|
||||||
|
}
|
||||||
|
|
||||||
|
////add
|
||||||
|
class AddLearningAndDevelopment extends LearningDevelopmentEvent{
|
||||||
|
final LearningDevelopement learningDevelopement;
|
||||||
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
const AddLearningAndDevelopment({required this.learningDevelopement, required this.profileId, required this.token});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [profileId, token,learningDevelopement];
|
||||||
|
}
|
||||||
|
|
||||||
|
////update
|
||||||
|
class UpdateLearningDevelopment extends LearningDevelopmentEvent{
|
||||||
|
final LearningDevelopement learningDevelopement;
|
||||||
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
const UpdateLearningDevelopment({required this.learningDevelopement, required this.profileId, required this.token});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [profileId, token,learningDevelopement];
|
||||||
|
}
|
||||||
|
|
||||||
|
class CallErrorState extends LearningDevelopmentEvent{
|
||||||
|
final String message;
|
||||||
|
const CallErrorState({required this.message});
|
||||||
|
}
|
||||||
|
|
|
@ -9,20 +9,113 @@ abstract class LearningDevelopmentState extends Equatable {
|
||||||
|
|
||||||
class LearningDevelopmentInitial extends LearningDevelopmentState {}
|
class LearningDevelopmentInitial extends LearningDevelopmentState {}
|
||||||
|
|
||||||
class LearningDevelopmentLoadedState extends LearningDevelopmentState{
|
class LearningDevelopmentLoadedState extends LearningDevelopmentState {
|
||||||
final List<LearningDevelopement> learningsAndDevelopment;
|
final List<LearningDevelopement> learningsAndDevelopment;
|
||||||
const LearningDevelopmentLoadedState({required this.learningsAndDevelopment});
|
const LearningDevelopmentLoadedState({required this.learningsAndDevelopment});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [learningsAndDevelopment];
|
List<Object> get props => [learningsAndDevelopment];
|
||||||
}
|
}
|
||||||
|
|
||||||
class LeaningDevelopmentErrorState extends LearningDevelopmentState{
|
class LeaningDevelopmentErrorState extends LearningDevelopmentState {
|
||||||
final String message;
|
final String message;
|
||||||
const LeaningDevelopmentErrorState({required this.message});
|
const LeaningDevelopmentErrorState({required this.message});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [message];
|
List<Object> get props => [message];
|
||||||
}
|
}
|
||||||
|
|
||||||
class LearningDevelopmentLoadingState extends LearningDevelopmentState{
|
class LearningDevelopmentLoadingState extends LearningDevelopmentState {}
|
||||||
|
|
||||||
|
////added State
|
||||||
|
class LearningDevelopmentAddedState extends LearningDevelopmentState {
|
||||||
|
final Map<dynamic, dynamic> response;
|
||||||
|
const LearningDevelopmentAddedState({required this.response});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [response];
|
||||||
|
}
|
||||||
|
|
||||||
|
////Updated State
|
||||||
|
class LearningDevelopmentUpdatedState extends LearningDevelopmentState {
|
||||||
|
final Map<dynamic, dynamic> response;
|
||||||
|
const LearningDevelopmentUpdatedState({required this.response});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [response];
|
||||||
|
}
|
||||||
|
|
||||||
|
//// Deleted State
|
||||||
|
class DeleteLearningDevelopmentState extends LearningDevelopmentState {
|
||||||
|
final bool success;
|
||||||
|
const DeleteLearningDevelopmentState({required this.success});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [success];
|
||||||
|
}
|
||||||
|
|
||||||
|
////Update State
|
||||||
|
class LearningDevelopmentUpdatingState extends LearningDevelopmentState {
|
||||||
|
final List<LearningDevelopmentType> types;
|
||||||
|
final List<LearningDevelopmentType> topics;
|
||||||
|
final LearningDevelopmentType training;
|
||||||
|
final LearningDevelopement learningDevelopement;
|
||||||
|
final Agency currentConductedBy;
|
||||||
|
final Agency? currentSponsor;
|
||||||
|
final List<Agency> conductedBy;
|
||||||
|
final List<Agency> sponsorAgencies;
|
||||||
|
final List<Category> agencyCategory;
|
||||||
|
final List<Country> countries;
|
||||||
|
final List<Region> regions;
|
||||||
|
final List<Province> provinces;
|
||||||
|
final List<Barangay> barangay;
|
||||||
|
final List<CityMunicipality> cities;
|
||||||
|
final Region? currentRegion;
|
||||||
|
final Country currentCountry;
|
||||||
|
final Province? currentProvince;
|
||||||
|
final CityMunicipality? currentCity;
|
||||||
|
final Barangay? currentBarangay;
|
||||||
|
final bool overseas;
|
||||||
|
|
||||||
|
const LearningDevelopmentUpdatingState(
|
||||||
|
{required this.currentBarangay,
|
||||||
|
required this.cities,
|
||||||
|
required this.barangay,
|
||||||
|
required this.provinces,
|
||||||
|
required this.types,
|
||||||
|
required this.topics,
|
||||||
|
required this.training,
|
||||||
|
required this.learningDevelopement,
|
||||||
|
required this.currentConductedBy,
|
||||||
|
required this.currentSponsor,
|
||||||
|
required this.conductedBy,
|
||||||
|
required this.sponsorAgencies,
|
||||||
|
required this.agencyCategory,
|
||||||
|
required this.countries,
|
||||||
|
required this.regions,
|
||||||
|
required this.currentRegion,
|
||||||
|
required this.currentCountry,
|
||||||
|
required this.currentProvince,
|
||||||
|
required this.currentCity,
|
||||||
|
required this.overseas});
|
||||||
|
}
|
||||||
|
|
||||||
|
////Adding State
|
||||||
|
class LearningDevelopmentAddingState extends LearningDevelopmentState {
|
||||||
|
final List<LearningDevelopmentType> types;
|
||||||
|
final List<LearningDevelopmentType> topics;
|
||||||
|
final List<Agency> conductedBy;
|
||||||
|
final List<Agency> sponsorAgencies;
|
||||||
|
final List<Country> countries;
|
||||||
|
final List<Region> regions;
|
||||||
|
final List<Category> agencyCategory;
|
||||||
|
|
||||||
|
const LearningDevelopmentAddingState(
|
||||||
|
{required this.types,
|
||||||
|
required this.topics,
|
||||||
|
required this.countries,
|
||||||
|
required this.regions,
|
||||||
|
required this.conductedBy,
|
||||||
|
required this.sponsorAgencies,
|
||||||
|
required this.agencyCategory});
|
||||||
|
}
|
||||||
|
|
||||||
|
class LearningDevelopmentErrorState extends LearningDevelopmentState {
|
||||||
|
final String message;
|
||||||
|
const LearningDevelopmentErrorState({required this.message});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,62 @@
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:unit2/model/profile/profileInfomation.dart';
|
import 'package:unit2/model/profile/profileInfomation.dart';
|
||||||
|
import 'package:unit2/sevices/profile/profile_other_info.dart';
|
||||||
import 'package:unit2/sevices/profile/profile_service.dart';
|
import 'package:unit2/sevices/profile/profile_service.dart';
|
||||||
|
|
||||||
|
import '../../model/profile/basic_information/primary-information.dart';
|
||||||
|
import '../../screens/profile/components/basic_information/profile_other_info.dart';
|
||||||
part 'profile_event.dart';
|
part 'profile_event.dart';
|
||||||
part 'profile_state.dart';
|
part 'profile_state.dart';
|
||||||
|
|
||||||
class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
||||||
ProfileBloc() : super(ProfileInitial()) {
|
ProfileBloc() : super(ProfileInitial()) {
|
||||||
|
Profile? currentProfileInformation;
|
||||||
|
List<ProfileOtherInfo> religions = [];
|
||||||
|
List<ProfileOtherInfo> ethnicities = [];
|
||||||
|
List<ProfileOtherInfo> indigencies = [];
|
||||||
|
List<ProfileOtherInfo> disabilities = [];
|
||||||
|
List<ProfileOtherInfo> genders = [];
|
||||||
|
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"
|
||||||
|
];
|
||||||
|
|
||||||
ProfileInformation? globalProfileInformation;
|
ProfileInformation? globalProfileInformation;
|
||||||
on<LoadProfile>((event, emit) async {
|
on<LoadProfile>((event, emit) async {
|
||||||
emit(ProfileLoading());
|
emit(ProfileLoading());
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ProfileInformation? profileInformation =
|
ProfileInformation? profileInformation =
|
||||||
await ProfileService.instance.getProfile(event.token, event.userID);
|
await ProfileService.instance.getProfile(event.token, event.userID);
|
||||||
globalProfileInformation = profileInformation;
|
globalProfileInformation = profileInformation;
|
||||||
|
@ -20,7 +65,74 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
||||||
emit(ProfileErrorState(mesage: e.toString()));
|
emit(ProfileErrorState(mesage: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
on<GetPrimaryBasicInfo>((event, emit) {
|
||||||
|
currentProfileInformation = event.primaryBasicInformation;
|
||||||
|
emit(BasicInformationProfileLoaded(
|
||||||
|
primaryBasicInformation: event.primaryBasicInformation));
|
||||||
|
});
|
||||||
|
on<LoadBasicPrimaryInfo>((event,emit){
|
||||||
|
emit(BasicInformationProfileLoaded(
|
||||||
|
primaryBasicInformation: currentProfileInformation!));
|
||||||
|
});
|
||||||
|
on<ShowPrimaryInfoEditForm>((event, emit) async {
|
||||||
|
try {
|
||||||
|
emit(BasicPrimaryInformationLoadingState());
|
||||||
|
if (religions.isEmpty) {
|
||||||
|
religions = await ProfileOtherInfoServices.instace
|
||||||
|
.getReligions(token: event.token);
|
||||||
|
}
|
||||||
|
if (genders.isEmpty) {
|
||||||
|
genders = await ProfileOtherInfoServices.instace
|
||||||
|
.getGenders(token: event.token);
|
||||||
|
}
|
||||||
|
if (ethnicities.isEmpty) {
|
||||||
|
ethnicities = await ProfileOtherInfoServices.instace
|
||||||
|
.getEthnicity(token: event.token);
|
||||||
|
}
|
||||||
|
if (disabilities.isEmpty) {
|
||||||
|
disabilities = await ProfileOtherInfoServices.instace
|
||||||
|
.getDisability(token: event.token);
|
||||||
|
}
|
||||||
|
if (indigencies.isEmpty) {
|
||||||
|
indigencies = await ProfileOtherInfoServices.instace
|
||||||
|
.getIndigency(token: event.token);
|
||||||
|
}
|
||||||
|
emit(BasicInformationEditingState(
|
||||||
|
primaryInformation: currentProfileInformation!,
|
||||||
|
extensions: nameExtensions,
|
||||||
|
sexes: sexes,
|
||||||
|
bloodTypes: bloodType,
|
||||||
|
genders: genders,
|
||||||
|
civilStatus: civilStatus,
|
||||||
|
disability: disabilities,
|
||||||
|
ethnicity: ethnicities,
|
||||||
|
indigenous: indigencies,
|
||||||
|
religion: religions));
|
||||||
|
} catch (e) {
|
||||||
|
emit(BasicPrimaryInformationErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<EditBasicProfileInformation>((event, emit) async {
|
||||||
|
try {
|
||||||
|
Map<dynamic, dynamic> status = await ProfileService.instance
|
||||||
|
.updateBasicProfileInfo(
|
||||||
|
token: event.token,
|
||||||
|
profileId: event.profileId,
|
||||||
|
profileInfo: event.profileInformation,
|
||||||
|
genderId: event.genderId,
|
||||||
|
indigencyId: event.indigencyId,
|
||||||
|
disabilityId: event.disabilityId,
|
||||||
|
ethnicityId: event.ethnicityId,
|
||||||
|
reqligionId: event.religionId);
|
||||||
|
if (status['success']) {
|
||||||
|
Profile profile = Profile.fromJson(status['data']);
|
||||||
|
currentProfileInformation = profile;
|
||||||
|
emit(BasicProfileInfoEditedState(response: status));
|
||||||
|
}
|
||||||
|
emit(BasicProfileInfoEditedState(response: status));
|
||||||
|
} catch (e) {
|
||||||
|
emit(BasicPrimaryInformationErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,29 @@ class LoadProfileInformation extends ProfileEvent {
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
class GetPrimaryBasicInfo extends ProfileEvent{
|
||||||
|
final Profile primaryBasicInformation;
|
||||||
|
const GetPrimaryBasicInfo({required this.primaryBasicInformation});
|
||||||
|
}
|
||||||
|
class LoadBasicPrimaryInfo extends ProfileEvent{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowPrimaryInfoEditForm extends ProfileEvent{
|
||||||
|
final String token;
|
||||||
|
const ShowPrimaryInfoEditForm({required this.token});
|
||||||
|
}
|
||||||
|
class EditBasicProfileInformation extends ProfileEvent{
|
||||||
|
final Profile profileInformation;
|
||||||
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
final int? genderId;
|
||||||
|
final int? indigencyId;
|
||||||
|
final int? disabilityId;
|
||||||
|
final int? religionId;
|
||||||
|
final int? ethnicityId;
|
||||||
|
const EditBasicProfileInformation({required this.disabilityId,required this.ethnicityId, required this.genderId, required this.indigencyId, required this.profileId,required this.profileInformation,required this.religionId,required this.token});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,39 @@ class ProfileErrorState extends ProfileState {
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [mesage];
|
List<Object> get props => [mesage];
|
||||||
}
|
}
|
||||||
|
class BasicInformationEditingState extends ProfileState{
|
||||||
|
final Profile primaryInformation;
|
||||||
|
final List<ProfileOtherInfo> religion;
|
||||||
|
final List<ProfileOtherInfo> ethnicity;
|
||||||
|
final List<ProfileOtherInfo> disability;
|
||||||
|
final List<ProfileOtherInfo> indigenous;
|
||||||
|
final List<ProfileOtherInfo> genders;
|
||||||
|
final List<String>sexes;
|
||||||
|
final List<String> bloodTypes;
|
||||||
|
final List<String> civilStatus;
|
||||||
|
final List<String> extensions;
|
||||||
|
const BasicInformationEditingState( {required this.genders, required this.extensions, required this.primaryInformation, required this.sexes, required this.bloodTypes, required this.civilStatus, required this.disability,required this.ethnicity,required this.indigenous,required this.religion});
|
||||||
|
}
|
||||||
|
////Edited State
|
||||||
|
class BasicProfileInfoEditedState extends ProfileState{
|
||||||
|
final Map<dynamic,dynamic> response;
|
||||||
|
const BasicProfileInfoEditedState({required this.response});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [response];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BasicInformationProfileLoaded extends ProfileState{
|
||||||
|
final Profile primaryBasicInformation;
|
||||||
|
const BasicInformationProfileLoaded({required this.primaryBasicInformation});
|
||||||
|
|
||||||
|
}
|
||||||
|
class BasicPrimaryInformationLoadingState extends ProfileState{
|
||||||
|
|
||||||
|
}
|
||||||
|
class BasicPrimaryInformationErrorState extends ProfileState{
|
||||||
|
final String message;
|
||||||
|
const BasicPrimaryInformationErrorState({required this.message});
|
||||||
|
}
|
||||||
|
|
||||||
class ProfileLoading extends ProfileState {}
|
class ProfileLoading extends ProfileState {}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class VoluntaryWorkAddedState extends VoluntaryWorkState{
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [response];
|
List<Object> get props => [response];
|
||||||
}
|
}
|
||||||
////Added State
|
////Edited State
|
||||||
class VoluntaryWorkEditedState extends VoluntaryWorkState{
|
class VoluntaryWorkEditedState extends VoluntaryWorkState{
|
||||||
final Map<dynamic,dynamic> response;
|
final Map<dynamic,dynamic> response;
|
||||||
const VoluntaryWorkEditedState({required this.response});
|
const VoluntaryWorkEditedState({required this.response});
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import 'package:unit2/model/login_data/employee_info/office.dart';
|
import 'package:unit2/model/login_data/employee_info/office.dart';
|
||||||
|
import 'package:unit2/model/profile/profileInfomation.dart';
|
||||||
|
|
||||||
|
import '../../profile/basic_information/primary-information.dart';
|
||||||
|
|
||||||
class EmployeeInfo {
|
class EmployeeInfo {
|
||||||
EmployeeInfo({
|
EmployeeInfo({
|
||||||
|
@ -35,103 +38,4 @@ class EmployeeInfo {
|
||||||
"profile": profile!.toJson(),
|
"profile": profile!.toJson(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
class Profile {
|
|
||||||
Profile({
|
|
||||||
this.id,
|
|
||||||
this.sex,
|
|
||||||
this.gender,
|
|
||||||
this.deceased,
|
|
||||||
this.heightM,
|
|
||||||
this.birthdate,
|
|
||||||
this.esigPath,
|
|
||||||
this.fullName,
|
|
||||||
this.lastName,
|
|
||||||
this.weightKg,
|
|
||||||
this.bloodType,
|
|
||||||
this.firstName,
|
|
||||||
this.photoPath,
|
|
||||||
this.maidenName,
|
|
||||||
this.middleName,
|
|
||||||
this.uuidQrcode,
|
|
||||||
this.civilStatus,
|
|
||||||
this.titlePrefix,
|
|
||||||
this.titleSuffix,
|
|
||||||
this.showTitleId,
|
|
||||||
this.lastFullName,
|
|
||||||
this.nameExtension,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? id;
|
|
||||||
String? sex;
|
|
||||||
String? gender;
|
|
||||||
bool? deceased;
|
|
||||||
double? heightM;
|
|
||||||
DateTime? birthdate;
|
|
||||||
String? esigPath;
|
|
||||||
String? fullName;
|
|
||||||
String? lastName;
|
|
||||||
int? weightKg;
|
|
||||||
String? bloodType;
|
|
||||||
String? firstName;
|
|
||||||
String? photoPath;
|
|
||||||
String? maidenName;
|
|
||||||
String? middleName;
|
|
||||||
String? uuidQrcode;
|
|
||||||
String? civilStatus;
|
|
||||||
String? titlePrefix;
|
|
||||||
String? titleSuffix;
|
|
||||||
bool? showTitleId;
|
|
||||||
String? lastFullName;
|
|
||||||
String? nameExtension;
|
|
||||||
|
|
||||||
factory Profile.fromJson(Map<String, dynamic> json) => Profile(
|
|
||||||
id: json["id"],
|
|
||||||
sex: json["sex"],
|
|
||||||
gender: json["gender"],
|
|
||||||
deceased: json["deceased"],
|
|
||||||
heightM: json["height_m"].toDouble(),
|
|
||||||
birthdate: DateTime.parse(json["birthdate"]),
|
|
||||||
esigPath: json["esig_path"],
|
|
||||||
fullName: json["full_name"],
|
|
||||||
lastName: json["last_name"],
|
|
||||||
weightKg: json["weight_kg"],
|
|
||||||
bloodType: json["blood_type"],
|
|
||||||
firstName: json["first_name"],
|
|
||||||
photoPath: json["photo_path"],
|
|
||||||
maidenName: json["maiden_name"],
|
|
||||||
middleName: json["middle_name"],
|
|
||||||
uuidQrcode: json["uuid_qrcode"],
|
|
||||||
civilStatus: json["civil_status"],
|
|
||||||
titlePrefix: json["title_prefix"],
|
|
||||||
titleSuffix: json["title_suffix"],
|
|
||||||
showTitleId: json["show_title_id"],
|
|
||||||
lastFullName: json["last_full_name"],
|
|
||||||
nameExtension: json["name_extension"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"id": id,
|
|
||||||
"sex": sex,
|
|
||||||
"gender": gender,
|
|
||||||
"deceased": deceased,
|
|
||||||
"height_m": heightM,
|
|
||||||
"birthdate":
|
|
||||||
"${birthdate!.year.toString().padLeft(4, '0')}-${birthdate!.month.toString().padLeft(2, '0')}-${birthdate!.day.toString().padLeft(2, '0')}",
|
|
||||||
"esig_path": esigPath,
|
|
||||||
"full_name": fullName,
|
|
||||||
"last_name": lastName,
|
|
||||||
"weight_kg": weightKg,
|
|
||||||
"blood_type": bloodType,
|
|
||||||
"first_name": firstName,
|
|
||||||
"photo_path": photoPath,
|
|
||||||
"maiden_name": maidenName,
|
|
||||||
"middle_name": middleName,
|
|
||||||
"uuid_qrcode": uuidQrcode,
|
|
||||||
"civil_status": civilStatus,
|
|
||||||
"title_prefix": titlePrefix,
|
|
||||||
"title_suffix": titleSuffix,
|
|
||||||
"show_title_id": showTitleId,
|
|
||||||
"last_full_name": lastFullName,
|
|
||||||
"name_extension": nameExtension,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,11 +5,10 @@ import 'package:unit2/model/profile/basic_information/identification_information
|
||||||
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
||||||
|
|
||||||
class BasicInfo{
|
class BasicInfo{
|
||||||
PrimaryInformation? primaryInformation;
|
|
||||||
List<ContactInfo> contactInformation;
|
List<ContactInfo> contactInformation;
|
||||||
List<Identification> identifications;
|
List<Identification> identifications;
|
||||||
List<Citizenship> citizenships;
|
List<Citizenship> citizenships;
|
||||||
List<MainAdress> addresses;
|
List<MainAdress> addresses;
|
||||||
BasicInfo({required this.addresses, required this.contactInformation, required this.primaryInformation,required this.identifications,required this.citizenships});
|
BasicInfo({required this.addresses, required this.contactInformation,required this.identifications,required this.citizenships});
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,83 +1,106 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final primaryInformation = primaryInformationFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'package:meta/meta.dart';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
class PrimaryInformation {
|
import 'package:unit2/model/profile/family_backround.dart';
|
||||||
PrimaryInformation({
|
|
||||||
required this.id,
|
|
||||||
required this.lastName,
|
|
||||||
required this.firstName,
|
|
||||||
required this.middleName,
|
|
||||||
required this.nameExtension,
|
|
||||||
required this.sex,
|
|
||||||
required this.birthdate,
|
|
||||||
required this.civilStatus,
|
|
||||||
required this.bloodType,
|
|
||||||
required this.heightM,
|
|
||||||
required this.weightKg,
|
|
||||||
required this.photoPath,
|
|
||||||
required this.esigPath,
|
|
||||||
required this.maidenName,
|
|
||||||
required this.deceased,
|
|
||||||
required this.gender,
|
|
||||||
required this.uuidQrcode,
|
|
||||||
required this.titlePrefix,
|
|
||||||
required this.titleSuffix,
|
|
||||||
required this.showTitleId,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? id;
|
import '../../../screens/profile/components/basic_information/profile_other_info.dart';
|
||||||
String? lastName;
|
|
||||||
String? firstName;
|
|
||||||
String? middleName;
|
|
||||||
String? nameExtension;
|
|
||||||
String? sex;
|
|
||||||
DateTime? birthdate;
|
|
||||||
String? civilStatus;
|
|
||||||
String? bloodType;
|
|
||||||
double? heightM;
|
|
||||||
double? weightKg;
|
|
||||||
String? photoPath;
|
|
||||||
String? esigPath;
|
|
||||||
String? maidenName;
|
|
||||||
bool? deceased;
|
|
||||||
String? gender;
|
|
||||||
String? uuidQrcode;
|
|
||||||
String? titlePrefix;
|
|
||||||
String? titleSuffix;
|
|
||||||
bool? showTitleId;
|
|
||||||
|
|
||||||
factory PrimaryInformation.fromJson(Map<String, dynamic> json) =>
|
Profile primaryInformationFromJson(String str) => Profile.fromJson(json.decode(str));
|
||||||
PrimaryInformation(
|
|
||||||
|
String primaryInformationToJson(Profile data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class Profile {
|
||||||
|
int? id;
|
||||||
|
String? lastName;
|
||||||
|
String? firstName;
|
||||||
|
String? middleName;
|
||||||
|
String? nameExtension;
|
||||||
|
String? sex;
|
||||||
|
DateTime? birthdate;
|
||||||
|
String? civilStatus;
|
||||||
|
String? bloodType;
|
||||||
|
double? heightM;
|
||||||
|
double? weightKg;
|
||||||
|
String? photoPath;
|
||||||
|
String? esigPath;
|
||||||
|
MaidenName? maidenName;
|
||||||
|
bool? deceased;
|
||||||
|
String? uuidQrcode;
|
||||||
|
String? titlePrefix;
|
||||||
|
String? titleSuffix;
|
||||||
|
bool? showTitleId;
|
||||||
|
String? ethnicity;
|
||||||
|
String? disability;
|
||||||
|
String? gender;
|
||||||
|
String? religion;
|
||||||
|
String? ip;
|
||||||
|
|
||||||
|
Profile({
|
||||||
|
required this.id,
|
||||||
|
required this.lastName,
|
||||||
|
required this.firstName,
|
||||||
|
required this.middleName,
|
||||||
|
required this.nameExtension,
|
||||||
|
required this.sex,
|
||||||
|
required this.birthdate,
|
||||||
|
required this.civilStatus,
|
||||||
|
required this.bloodType,
|
||||||
|
required this.heightM,
|
||||||
|
required this.weightKg,
|
||||||
|
required this.photoPath,
|
||||||
|
required this.esigPath,
|
||||||
|
required this.maidenName,
|
||||||
|
required this.deceased,
|
||||||
|
required this.uuidQrcode,
|
||||||
|
required this.titlePrefix,
|
||||||
|
required this.titleSuffix,
|
||||||
|
required this.showTitleId,
|
||||||
|
required this.ethnicity,
|
||||||
|
required this.disability,
|
||||||
|
required this.gender,
|
||||||
|
required this.religion,
|
||||||
|
required this.ip,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Profile.fromJson(Map<String, dynamic> json) => Profile(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
lastName: json["last_name"],
|
lastName: json["last_name"],
|
||||||
firstName: json["first_name"],
|
firstName: json["first_name"],
|
||||||
middleName: json["middle_name"],
|
middleName: json["middle_name"],
|
||||||
nameExtension: json["name_extension"],
|
nameExtension: json["name_extension"],
|
||||||
sex: json["sex"],
|
sex: json["sex"],
|
||||||
birthdate: json['birthdate']==null?null:DateTime.parse(json["birthdate"]),
|
birthdate: DateTime.parse(json["birthdate"]),
|
||||||
civilStatus: json["civil_status"],
|
civilStatus: json["civil_status"],
|
||||||
bloodType: json["blood_type"],
|
bloodType: json["blood_type"],
|
||||||
heightM: json["height_m"]?.toDouble(),
|
heightM: json["height_m"]?.toDouble(),
|
||||||
weightKg: json["weight_kg"],
|
weightKg: json["weight_kg"]?.toDouble(),
|
||||||
photoPath: json["photo_path"],
|
photoPath: json["photo_path"],
|
||||||
esigPath: json["esig_path"],
|
esigPath: json["esig_path"],
|
||||||
maidenName: json["maiden_name"],
|
maidenName: json["maiden_name"]==null?null:MaidenName.fromJson(json["maiden_name"]),
|
||||||
deceased: json["deceased"],
|
deceased: json["deceased"],
|
||||||
gender: json["gender"],
|
|
||||||
uuidQrcode: json["uuid_qrcode"],
|
uuidQrcode: json["uuid_qrcode"],
|
||||||
titlePrefix: json["title_prefix"],
|
titlePrefix: json["title_prefix"],
|
||||||
titleSuffix: json["title_suffix"],
|
titleSuffix: json["title_suffix"],
|
||||||
showTitleId: json["show_title_id"],
|
showTitleId: json["show_title_id"],
|
||||||
);
|
ethnicity: json["ethnicity"]== null?null:json["ethnicity"]['name'],
|
||||||
|
disability: json["disability"] == null?null:json['disability']['name'],
|
||||||
|
gender: json["gender"] == null?null:json['gender']['name'],
|
||||||
|
religion: json["religion"] == null?null:json['religion']['name'],
|
||||||
|
ip: json["ip"]==null?null:json['ip']['name'],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
"last_name": lastName,
|
"last_name": lastName,
|
||||||
"first_name": firstName,
|
"first_name": firstName,
|
||||||
"middle_name": middleName,
|
"middle_name": middleName,
|
||||||
"name_extension": nameExtension,
|
"name_extension": nameExtension,
|
||||||
"sex": sex,
|
"sex": sex,
|
||||||
"birthdate":
|
"birthdate": "${birthdate?.year.toString().padLeft(4, '0')}-${birthdate?.month.toString().padLeft(2, '0')}-${birthdate?.day.toString().padLeft(2, '0')}",
|
||||||
"${birthdate!.year.toString().padLeft(4, '0')}-${birthdate!.month.toString().padLeft(2, '0')}-${birthdate!.day.toString().padLeft(2, '0')}",
|
|
||||||
"civil_status": civilStatus,
|
"civil_status": civilStatus,
|
||||||
"blood_type": bloodType,
|
"blood_type": bloodType,
|
||||||
"height_m": heightM,
|
"height_m": heightM,
|
||||||
|
@ -86,10 +109,14 @@ class PrimaryInformation {
|
||||||
"esig_path": esigPath,
|
"esig_path": esigPath,
|
||||||
"maiden_name": maidenName,
|
"maiden_name": maidenName,
|
||||||
"deceased": deceased,
|
"deceased": deceased,
|
||||||
"gender": gender,
|
|
||||||
"uuid_qrcode": uuidQrcode,
|
"uuid_qrcode": uuidQrcode,
|
||||||
"title_prefix": titlePrefix,
|
"title_prefix": titlePrefix,
|
||||||
"title_suffix": titleSuffix,
|
"title_suffix": titleSuffix,
|
||||||
"show_title_id": showTitleId,
|
"show_title_id": showTitleId,
|
||||||
};
|
"ethnicity": ethnicity,
|
||||||
|
"disability": disability,
|
||||||
|
"gender": gender,
|
||||||
|
"religion": religion,
|
||||||
|
"ip": ip,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,11 @@
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:unit2/model/location/barangay.dart';
|
||||||
|
|
||||||
import '../location/city.dart';
|
import '../location/city.dart';
|
||||||
import '../location/country.dart';
|
import '../location/country.dart';
|
||||||
|
import '../utils/agency.dart';
|
||||||
import '../utils/industry_class.dart';
|
import '../utils/industry_class.dart';
|
||||||
|
|
||||||
LearningDevelopement learningDevelopementFromJson(String str) => LearningDevelopement.fromJson(json.decode(str));
|
LearningDevelopement learningDevelopementFromJson(String str) => LearningDevelopement.fromJson(json.decode(str));
|
||||||
|
@ -21,13 +24,13 @@ class LearningDevelopement {
|
||||||
});
|
});
|
||||||
|
|
||||||
final dynamic attachments;
|
final dynamic attachments;
|
||||||
final EdBy? sponsoredBy;
|
final Agency? sponsoredBy;
|
||||||
final ConductedTraining? conductedTraining;
|
final ConductedTraining? conductedTraining;
|
||||||
final double? totalHoursAttended;
|
final double? totalHoursAttended;
|
||||||
|
|
||||||
factory LearningDevelopement.fromJson(Map<String, dynamic> json) => LearningDevelopement(
|
factory LearningDevelopement.fromJson(Map<String, dynamic> json) => LearningDevelopement(
|
||||||
attachments: json["attachments"],
|
attachments: json["attachments"],
|
||||||
sponsoredBy: json["sponsored_by"] == null ? null : EdBy.fromJson(json["sponsored_by"]),
|
sponsoredBy: json["sponsored_by"] == null ? null : Agency.fromJson(json["sponsored_by"]),
|
||||||
conductedTraining: json["conducted_training"] == null ? null : ConductedTraining.fromJson(json["conducted_training"]),
|
conductedTraining: json["conducted_training"] == null ? null : ConductedTraining.fromJson(json["conducted_training"]),
|
||||||
totalHoursAttended: json["total_hours_attended"],
|
totalHoursAttended: json["total_hours_attended"],
|
||||||
);
|
);
|
||||||
|
@ -62,8 +65,8 @@ class ConductedTraining {
|
||||||
final bool? locked;
|
final bool? locked;
|
||||||
final DateTime? toDate;
|
final DateTime? toDate;
|
||||||
final DateTime? fromDate;
|
final DateTime? fromDate;
|
||||||
final int? totalHours;
|
final double? totalHours;
|
||||||
final EdBy? conductedBy;
|
final Agency? conductedBy;
|
||||||
final List<dynamic>? sessionsAttended;
|
final List<dynamic>? sessionsAttended;
|
||||||
final LearningDevelopmentType? learningDevelopmentType;
|
final LearningDevelopmentType? learningDevelopmentType;
|
||||||
|
|
||||||
|
@ -75,8 +78,8 @@ class ConductedTraining {
|
||||||
locked: json["locked"],
|
locked: json["locked"],
|
||||||
toDate: json["to_date"] == null ? null : DateTime.parse(json["to_date"]),
|
toDate: json["to_date"] == null ? null : DateTime.parse(json["to_date"]),
|
||||||
fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]),
|
fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]),
|
||||||
totalHours: json["total_hours"],
|
totalHours: double.parse(json["total_hours"].toString()),
|
||||||
conductedBy: json["conducted_by"] == null ? null : EdBy.fromJson(json["conducted_by"]),
|
conductedBy: json["conducted_by"] == null ? null : Agency.fromJson(json["conducted_by"]),
|
||||||
sessionsAttended: json["sessions_attended"] == null ? [] : List<dynamic>.from(json["sessions_attended"]!.map((x) => x)),
|
sessionsAttended: json["sessions_attended"] == null ? [] : List<dynamic>.from(json["sessions_attended"]!.map((x) => x)),
|
||||||
learningDevelopmentType: json["learning_development_type"] == null ? null : LearningDevelopmentType.fromJson(json["learning_development_type"]),
|
learningDevelopmentType: json["learning_development_type"] == null ? null : LearningDevelopmentType.fromJson(json["learning_development_type"]),
|
||||||
);
|
);
|
||||||
|
@ -96,58 +99,6 @@ class ConductedTraining {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class EdBy {
|
|
||||||
EdBy({
|
|
||||||
this.id,
|
|
||||||
this.name,
|
|
||||||
this.category,
|
|
||||||
this.privateEntity,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int? id;
|
|
||||||
final String? name;
|
|
||||||
final SponsoredByCategory? category;
|
|
||||||
final bool? privateEntity;
|
|
||||||
|
|
||||||
factory EdBy.fromJson(Map<String, dynamic> json) => EdBy(
|
|
||||||
id: json["id"],
|
|
||||||
name: json["name"],
|
|
||||||
category: json["category"] == null ? null : SponsoredByCategory.fromJson(json["category"]),
|
|
||||||
privateEntity: json["private_entity"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"id": id,
|
|
||||||
"name": name,
|
|
||||||
"category": category?.toJson(),
|
|
||||||
"private_entity": privateEntity,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class SponsoredByCategory {
|
|
||||||
SponsoredByCategory({
|
|
||||||
this.id,
|
|
||||||
this.name,
|
|
||||||
this.industryClass,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int? id;
|
|
||||||
final String? name;
|
|
||||||
final IndustryClass? industryClass;
|
|
||||||
|
|
||||||
factory SponsoredByCategory.fromJson(Map<String, dynamic> json) => SponsoredByCategory(
|
|
||||||
id: json["id"],
|
|
||||||
name: json["name"],
|
|
||||||
industryClass: json["industry_class"] == null ? null : IndustryClass.fromJson(json["industry_class"]),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"id": id,
|
|
||||||
"name": name,
|
|
||||||
"industry_class": industryClass?.toJson(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class LearningDevelopmentType {
|
class LearningDevelopmentType {
|
||||||
LearningDevelopmentType({
|
LearningDevelopmentType({
|
||||||
|
@ -181,7 +132,7 @@ class Venue {
|
||||||
|
|
||||||
final int? id;
|
final int? id;
|
||||||
final Country? country;
|
final Country? country;
|
||||||
final dynamic barangay;
|
final Barangay? barangay;
|
||||||
final VenueCategory? category;
|
final VenueCategory? category;
|
||||||
final dynamic areaClass;
|
final dynamic areaClass;
|
||||||
final CityMunicipality? cityMunicipality;
|
final CityMunicipality? cityMunicipality;
|
||||||
|
@ -189,7 +140,7 @@ class Venue {
|
||||||
factory Venue.fromJson(Map<String, dynamic> json) => Venue(
|
factory Venue.fromJson(Map<String, dynamic> json) => Venue(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
country: json["country"] == null ? null : Country.fromJson(json["country"]),
|
country: json["country"] == null ? null : Country.fromJson(json["country"]),
|
||||||
barangay: json["barangay"],
|
barangay:json["barangay"] == null ? null : Barangay.fromJson(json["country"]),
|
||||||
category: json["category"] == null ? null : VenueCategory.fromJson(json["category"]),
|
category: json["category"] == null ? null : VenueCategory.fromJson(json["category"]),
|
||||||
areaClass: json["area_class"],
|
areaClass: json["area_class"],
|
||||||
cityMunicipality: json["city_municipality"] == null ? null : CityMunicipality.fromJson(json["city_municipality"]),
|
cityMunicipality: json["city_municipality"] == null ? null : CityMunicipality.fromJson(json["city_municipality"]),
|
||||||
|
|
|
@ -0,0 +1,523 @@
|
||||||
|
import 'package:date_time_picker/date_time_picker.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
import 'package:flutter/src/widgets/placeholder.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
|
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
||||||
|
import 'package:unit2/screens/profile/components/basic_information/profile_other_info.dart';
|
||||||
|
import 'package:unit2/screens/unit2/roles/qr_code_scanner.dart/components/save_settings.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/btn-style.dart';
|
||||||
|
|
||||||
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
|
import '../../../../theme-data.dart/form-style.dart';
|
||||||
|
import '../../../../utils/global.dart';
|
||||||
|
|
||||||
|
class EditBasicProfileInfoScreen extends StatefulWidget {
|
||||||
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
const EditBasicProfileInfoScreen(
|
||||||
|
{super.key, required this.profileId, required this.token});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<EditBasicProfileInfoScreen> createState() =>
|
||||||
|
_EditBasicProfileInfoScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
final bdayController = TextEditingController();
|
||||||
|
ProfileOtherInfo? selectedIndigency;
|
||||||
|
ProfileOtherInfo? selectedEthnicity;
|
||||||
|
ProfileOtherInfo? selectedReligion;
|
||||||
|
ProfileOtherInfo? selectedDisability;
|
||||||
|
ProfileOtherInfo? selectedGender;
|
||||||
|
String? selectedSex;
|
||||||
|
String? selectedBloodType;
|
||||||
|
String? selectedStatus;
|
||||||
|
String? selectedExtension;
|
||||||
|
final _formKey = GlobalKey<FormBuilderState>();
|
||||||
|
|
||||||
|
class _EditBasicProfileInfoScreenState
|
||||||
|
extends State<EditBasicProfileInfoScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is BasicInformationEditingState) {
|
||||||
|
bdayController.text = state.primaryInformation.birthdate.toString();
|
||||||
|
selectedSex = state.sexes.firstWhere((element) =>
|
||||||
|
element.toLowerCase() ==
|
||||||
|
state.primaryInformation.sex!.toLowerCase());
|
||||||
|
if (state.primaryInformation.bloodType != null) {
|
||||||
|
selectedBloodType = state.bloodTypes.firstWhere((element) =>
|
||||||
|
element.toLowerCase() ==
|
||||||
|
state.primaryInformation.bloodType?.toLowerCase());
|
||||||
|
}
|
||||||
|
if (state.primaryInformation.nameExtension != null &&
|
||||||
|
state.primaryInformation.nameExtension != "N/A") {
|
||||||
|
selectedExtension = state.extensions.firstWhere((element) =>
|
||||||
|
element.toLowerCase() ==
|
||||||
|
state.primaryInformation.nameExtension?.toLowerCase());
|
||||||
|
}
|
||||||
|
if (state.primaryInformation.civilStatus != null) {
|
||||||
|
selectedStatus = state.civilStatus.firstWhere((element) =>
|
||||||
|
element.toLowerCase() ==
|
||||||
|
state.primaryInformation.civilStatus?.toLowerCase());
|
||||||
|
}
|
||||||
|
if (state.primaryInformation.gender != null &&
|
||||||
|
state.primaryInformation.gender != "N/A") {
|
||||||
|
selectedGender = state.genders.firstWhere((element) =>
|
||||||
|
element.name!.toLowerCase() ==
|
||||||
|
state.primaryInformation.gender?.toLowerCase());
|
||||||
|
}
|
||||||
|
if (state.primaryInformation.ip != null &&
|
||||||
|
state.primaryInformation.ip != "N/A") {
|
||||||
|
selectedIndigency = state.indigenous.firstWhere((element) =>
|
||||||
|
element.name!.toLowerCase() ==
|
||||||
|
state.primaryInformation.ip!.toLowerCase());
|
||||||
|
}
|
||||||
|
if (state.primaryInformation.ethnicity != null &&
|
||||||
|
state.primaryInformation.ethnicity != "N/A") {
|
||||||
|
selectedEthnicity = state.ethnicity.firstWhere((element) =>
|
||||||
|
element.name!.toLowerCase() ==
|
||||||
|
state.primaryInformation.ethnicity!.toLowerCase());
|
||||||
|
}
|
||||||
|
if (state.primaryInformation.religion != null &&
|
||||||
|
state.primaryInformation.religion != "N/A") {
|
||||||
|
selectedReligion = state.religion.firstWhere((element) =>
|
||||||
|
element.name!.toLowerCase() ==
|
||||||
|
state.primaryInformation.religion!.toLowerCase());
|
||||||
|
}
|
||||||
|
if (state.primaryInformation.disability != null &&
|
||||||
|
state.primaryInformation.disability != "N/A") {
|
||||||
|
selectedDisability = state.disability.firstWhere((element) =>
|
||||||
|
element.name!.toLowerCase() ==
|
||||||
|
state.primaryInformation.disability!.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
state.genders.insert(
|
||||||
|
0, ProfileOtherInfo(id: null, name: "NONE", description: null));
|
||||||
|
state.indigenous.insert(
|
||||||
|
0, ProfileOtherInfo(id: null, name: "NONE", description: null));
|
||||||
|
state.disability.insert(
|
||||||
|
0, ProfileOtherInfo(id: null, name: "NONE", description: null));
|
||||||
|
state.ethnicity.insert(
|
||||||
|
0, ProfileOtherInfo(id: null, name: "NONE", description: null));
|
||||||
|
state.religion.insert(
|
||||||
|
0, ProfileOtherInfo(id: null, name: "NONE", description: null));
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32),
|
||||||
|
child: FormBuilder(
|
||||||
|
key: _formKey,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 28,
|
||||||
|
),
|
||||||
|
FormBuilderTextField(
|
||||||
|
name: "lastname",
|
||||||
|
initialValue: state.primaryInformation.lastName,
|
||||||
|
decoration: normalTextFieldStyle("Last name", ""),
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
FormBuilderTextField(
|
||||||
|
name: "firstname",
|
||||||
|
initialValue: state.primaryInformation.firstName,
|
||||||
|
decoration: normalTextFieldStyle("First name", ""),
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: "middlename",
|
||||||
|
initialValue: state.primaryInformation.middleName!,
|
||||||
|
decoration: normalTextFieldStyle("Middle name", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
//// name extension
|
||||||
|
child: DropdownButtonFormField<String>(
|
||||||
|
value: selectedExtension,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Name Extension", ""),
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
items: state.extensions
|
||||||
|
.map((element) => DropdownMenuItem<String>(
|
||||||
|
value: element, child: Text(element)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {
|
||||||
|
print(e);
|
||||||
|
print(selectedExtension);
|
||||||
|
selectedExtension = e;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
////Bday
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DateTimePicker(
|
||||||
|
controller: bdayController,
|
||||||
|
use24HourFormat: false,
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
timeHintText: "Birthdate",
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Birthdate *", "*").copyWith(
|
||||||
|
prefixIcon: const Icon(
|
||||||
|
Icons.date_range,
|
||||||
|
color: Colors.black87,
|
||||||
|
)),
|
||||||
|
firstDate: DateTime(1970),
|
||||||
|
lastDate: DateTime(2100),
|
||||||
|
icon: const Icon(Icons.date_range),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
|
||||||
|
////sex
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderDropdown<String>(
|
||||||
|
initialValue: selectedSex,
|
||||||
|
decoration: normalTextFieldStyle("Sex", ""),
|
||||||
|
name: "sex",
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
items: state.sexes
|
||||||
|
.map((element) => DropdownMenuItem<String>(
|
||||||
|
value: element, child: Text(element)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
////blood type
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderDropdown<String>(
|
||||||
|
initialValue: selectedBloodType,
|
||||||
|
decoration: normalTextFieldStyle("Blood type", ""),
|
||||||
|
name: "bloodtype",
|
||||||
|
items: state.bloodTypes
|
||||||
|
.map((element) => DropdownMenuItem<String>(
|
||||||
|
value: element, child: Text(element)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
//// civil status
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderDropdown<String>(
|
||||||
|
initialValue: selectedStatus,
|
||||||
|
decoration: normalTextFieldStyle("Civil status", ""),
|
||||||
|
name: "extension",
|
||||||
|
items: state.civilStatus
|
||||||
|
.map((element) => DropdownMenuItem<String>(
|
||||||
|
value: element, child: Text(element)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {
|
||||||
|
selectedStatus = e;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
//// gender
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DropdownButtonFormField<ProfileOtherInfo>(
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedGender,
|
||||||
|
decoration: normalTextFieldStyle("Gender", ""),
|
||||||
|
items: state.genders
|
||||||
|
.map((element) =>
|
||||||
|
DropdownMenuItem<ProfileOtherInfo>(
|
||||||
|
value: element,
|
||||||
|
child: Text(element.name!)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {
|
||||||
|
selectedGender = e;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: "height",
|
||||||
|
initialValue: state.primaryInformation.heightM
|
||||||
|
.toString()
|
||||||
|
.toString(),
|
||||||
|
decoration: normalTextFieldStyle("Height", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: "weigth",
|
||||||
|
initialValue:
|
||||||
|
state.primaryInformation.weightKg!.toString(),
|
||||||
|
decoration: normalTextFieldStyle("Weight", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: "prefix",
|
||||||
|
initialValue: state.primaryInformation.titlePrefix
|
||||||
|
.toString()
|
||||||
|
.toString(),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Title Prefix", "Dr.,Atty.,Engr."),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: "suffix",
|
||||||
|
initialValue: state.primaryInformation.titleSuffix,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Title Suffix", "PhD.,MD.,MS.,CE"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
////Indigency
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DropdownButtonFormField<ProfileOtherInfo>(
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedIndigency,
|
||||||
|
decoration: normalTextFieldStyle("Indigency", ""),
|
||||||
|
items: state.indigenous
|
||||||
|
.map((element) =>
|
||||||
|
DropdownMenuItem<ProfileOtherInfo>(
|
||||||
|
value: element,
|
||||||
|
child: Text(element.name!)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {
|
||||||
|
selectedIndigency = e;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
////Ethnicity
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DropdownButtonFormField<ProfileOtherInfo>(
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedEthnicity,
|
||||||
|
decoration: normalTextFieldStyle("Ethnicity", ""),
|
||||||
|
items: state.ethnicity
|
||||||
|
.map((element) =>
|
||||||
|
DropdownMenuItem<ProfileOtherInfo>(
|
||||||
|
value: element,
|
||||||
|
child: Text(element.name!)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {
|
||||||
|
selectedEthnicity = e;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
////religion
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DropdownButtonFormField<ProfileOtherInfo>(
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedReligion,
|
||||||
|
decoration: normalTextFieldStyle("Religion", ""),
|
||||||
|
items: state.religion
|
||||||
|
.map((element) =>
|
||||||
|
DropdownMenuItem<ProfileOtherInfo>(
|
||||||
|
value: element,
|
||||||
|
child: Text(element.name!)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {
|
||||||
|
selectedReligion = e;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
////disabilty
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DropdownButtonFormField<ProfileOtherInfo>(
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedDisability,
|
||||||
|
decoration: normalTextFieldStyle("Disability", ""),
|
||||||
|
items: state.disability
|
||||||
|
.map((element) =>
|
||||||
|
DropdownMenuItem<ProfileOtherInfo>(
|
||||||
|
value: element,
|
||||||
|
child: Text(element.name!)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (e) {
|
||||||
|
selectedDisability = e;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 60,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style:
|
||||||
|
mainBtnStyle(primary, Colors.transparent, second),
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!.saveAndValidate()) {
|
||||||
|
String lastName =
|
||||||
|
_formKey.currentState!.value['lastname'];
|
||||||
|
String firstName =
|
||||||
|
_formKey.currentState!.value['firstname'];
|
||||||
|
String? middleName =
|
||||||
|
_formKey.currentState?.value['middlename'];
|
||||||
|
String? pref =
|
||||||
|
_formKey.currentState?.value['prefix'];
|
||||||
|
String suf = _formKey.currentState?.value['suffix'];
|
||||||
|
DateTime birthdate =
|
||||||
|
DateTime.parse(bdayController.text);
|
||||||
|
double? hM =
|
||||||
|
_formKey.currentState!.value['height'] == null
|
||||||
|
? null
|
||||||
|
: double.parse(
|
||||||
|
_formKey.currentState?.value['height']);
|
||||||
|
double? wKg =
|
||||||
|
_formKey.currentState!.value['weigth'] == null
|
||||||
|
? null
|
||||||
|
: double.parse(
|
||||||
|
_formKey.currentState?.value['weigth']);
|
||||||
|
Profile primaryInformation = Profile(
|
||||||
|
id: state.primaryInformation.id,
|
||||||
|
lastName: lastName,
|
||||||
|
firstName: firstName,
|
||||||
|
middleName: middleName,
|
||||||
|
nameExtension: selectedExtension,
|
||||||
|
sex: selectedSex,
|
||||||
|
birthdate: birthdate,
|
||||||
|
civilStatus: selectedStatus,
|
||||||
|
bloodType: selectedBloodType,
|
||||||
|
heightM: hM,
|
||||||
|
weightKg: wKg,
|
||||||
|
photoPath: state.primaryInformation.photoPath,
|
||||||
|
esigPath: state.primaryInformation.esigPath,
|
||||||
|
maidenName: state.primaryInformation.maidenName,
|
||||||
|
deceased: state.primaryInformation.deceased,
|
||||||
|
uuidQrcode: state.primaryInformation.uuidQrcode,
|
||||||
|
titlePrefix: pref,
|
||||||
|
titleSuffix: suf,
|
||||||
|
showTitleId:
|
||||||
|
state.primaryInformation.showTitleId,
|
||||||
|
ethnicity: selectedEthnicity?.name,
|
||||||
|
disability: selectedDisability?.name,
|
||||||
|
gender: selectedGender?.name,
|
||||||
|
religion: selectedReligion?.name,
|
||||||
|
ip: selectedIndigency?.name);
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Loading...");
|
||||||
|
context.read<ProfileBloc>().add(
|
||||||
|
EditBasicProfileInformation(
|
||||||
|
disabilityId: selectedDisability?.id,
|
||||||
|
ethnicityId: selectedDisability?.id,
|
||||||
|
genderId: selectedGender?.id,
|
||||||
|
indigencyId: selectedIndigency?.id,
|
||||||
|
profileId: widget.profileId,
|
||||||
|
profileInformation: primaryInformation,
|
||||||
|
religionId: selectedReligion?.id,
|
||||||
|
token: widget.token));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text("Submit")),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Placeholder();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,31 @@
|
||||||
|
import 'package:date_time_picker/date_time_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
||||||
|
import 'package:unit2/screens/profile/components/basic_information/edit_basic_info_modal.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/btn-style.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:unit2/theme-data.dart/form-style.dart';
|
import 'package:unit2/theme-data.dart/form-style.dart';
|
||||||
import 'package:unit2/utils/global.dart';
|
import 'package:unit2/utils/global.dart';
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
|
import '../../../../utils/alerts.dart';
|
||||||
|
|
||||||
class PrimaryInfo extends StatefulWidget {
|
class PrimaryInfo extends StatefulWidget {
|
||||||
final PrimaryInformation primaryInformation;
|
final int profileId;
|
||||||
const PrimaryInfo({super.key, required this.primaryInformation});
|
final String token;
|
||||||
|
const PrimaryInfo({
|
||||||
|
super.key,
|
||||||
|
required this.profileId,
|
||||||
|
required this.token
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PrimaryInfo> createState() => _PrimaryInfoState();
|
State<PrimaryInfo> createState() => _PrimaryInfoState();
|
||||||
|
@ -19,141 +35,316 @@ class _PrimaryInfoState extends State<PrimaryInfo> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _formKey = GlobalKey<FormBuilderState>();
|
final _formKey = GlobalKey<FormBuilderState>();
|
||||||
|
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text(primaryInformationScreenTitle),
|
title: const Text(primaryInformationScreenTitle),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.read<ProfileBloc>().add(ShowPrimaryInfoEditForm(token: widget.token));
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.edit))
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: Container(
|
body: ProgressHUD(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 24),
|
padding: const EdgeInsets.all(24),
|
||||||
child: FormBuilder(
|
backgroundColor: Colors.black87,
|
||||||
child: Column(
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
children: [
|
child: BlocConsumer<ProfileBloc, ProfileState>(
|
||||||
FormBuilderTextField(
|
listener: (context, state) {
|
||||||
enabled: enabled,
|
if (state is BasicPrimaryInformationLoadingState) {
|
||||||
name: lastname,
|
final progress = ProgressHUD.of(context);
|
||||||
initialValue: widget.primaryInformation.lastName!,
|
progress!.showWithText("Please wait...");
|
||||||
decoration: normalTextFieldStyle("Last name", ""),
|
}
|
||||||
|
if (state is BasicInformationProfileLoaded ||
|
||||||
|
state is BasicInformationEditingState || state is BasicPrimaryInformationErrorState || state is BasicProfileInfoEditedState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.dismiss();
|
||||||
|
}
|
||||||
|
if (state is BasicProfileInfoEditedState) {
|
||||||
|
if (state.response['success']) {
|
||||||
|
successAlert(context, "Updated Successfull!",
|
||||||
|
state.response['message'], () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context
|
||||||
|
.read<ProfileBloc>()
|
||||||
|
.add(LoadBasicPrimaryInfo());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
errorAlert(context, "Update Failed",
|
||||||
|
"Something went wrong. Please try again.",
|
||||||
|
() {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context
|
||||||
|
.read<ProfileBloc>()
|
||||||
|
.add(LoadBasicPrimaryInfo());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is BasicInformationProfileLoaded) {
|
||||||
|
return Container(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 24, horizontal: 24),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 28,
|
||||||
|
),
|
||||||
|
FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: lastname,
|
||||||
|
initialValue: state.primaryBasicInformation.lastName!,
|
||||||
|
decoration: normalTextFieldStyle("Last name", ""),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: firstname,
|
||||||
|
initialValue: state.primaryBasicInformation.firstName!,
|
||||||
|
decoration: normalTextFieldStyle("First name", ""),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: middlename,
|
||||||
|
initialValue:
|
||||||
|
state.primaryBasicInformation.middleName!,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Middle name", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: extensionName,
|
||||||
|
initialValue: state.primaryBasicInformation
|
||||||
|
.nameExtension ??= 'N/A',
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Name extension", ""),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: extensionName,
|
||||||
|
initialValue: dteFormat2.format(
|
||||||
|
state.primaryBasicInformation.birthdate!),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Birth date", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: sex,
|
||||||
|
initialValue: state.primaryBasicInformation.sex!,
|
||||||
|
decoration: normalTextFieldStyle("Sex", ""),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: "bloodType",
|
||||||
|
initialValue:
|
||||||
|
state.primaryBasicInformation.bloodType!,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Blood type", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: "civilStatus",
|
||||||
|
initialValue:
|
||||||
|
state.primaryBasicInformation.civilStatus!,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Civil Status", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: "gender",
|
||||||
|
initialValue: state
|
||||||
|
.primaryBasicInformation.gender ??= "N/A",
|
||||||
|
decoration: normalTextFieldStyle("Gender", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: height,
|
||||||
|
initialValue: state
|
||||||
|
.primaryBasicInformation.heightM!
|
||||||
|
.toString(),
|
||||||
|
decoration: normalTextFieldStyle("Height", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: width,
|
||||||
|
initialValue: state
|
||||||
|
.primaryBasicInformation.weightKg!
|
||||||
|
.toString(),
|
||||||
|
decoration: normalTextFieldStyle("Weight", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: prefixSuffix,
|
||||||
|
initialValue:
|
||||||
|
"${state.primaryBasicInformation.titlePrefix ??= "NA"} | ${state.primaryBasicInformation.titleSuffix ??= "N/A"}",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Title Prefix and Suffix", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: height,
|
||||||
|
initialValue: state.primaryBasicInformation.ip ??=
|
||||||
|
"N/A",
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Indigenous", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: width,
|
||||||
|
initialValue: state
|
||||||
|
.primaryBasicInformation.ethnicity ??= "N/A",
|
||||||
|
decoration: normalTextFieldStyle("Ethnicity", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: height,
|
||||||
|
initialValue: state
|
||||||
|
.primaryBasicInformation.religion ??= "N/A",
|
||||||
|
decoration: normalTextFieldStyle("Religion", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: enabled,
|
||||||
|
name: width,
|
||||||
|
initialValue: state
|
||||||
|
.primaryBasicInformation.disability ??= "N/A",
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Disability", ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}if(state is BasicPrimaryInformationErrorState){
|
||||||
|
return SomethingWentWrong(message: state.message, onpressed: (){});
|
||||||
|
|
||||||
),
|
}if(state is BasicInformationEditingState){
|
||||||
const SizedBox(height: 15,),
|
return EditBasicProfileInfoScreen(profileId: widget.profileId, token: widget.token);
|
||||||
FormBuilderTextField(
|
}
|
||||||
enabled: enabled,
|
return Container();
|
||||||
name: firstname,
|
},
|
||||||
initialValue: widget.primaryInformation.firstName!,
|
),
|
||||||
decoration: normalTextFieldStyle("First name", ""),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15,),
|
|
||||||
SizedBox(
|
|
||||||
width: screenWidth,
|
|
||||||
child: Row(children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 2,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: middlename,
|
|
||||||
initialValue: widget.primaryInformation.middleName!,
|
|
||||||
decoration: normalTextFieldStyle("Middle name", ""),
|
|
||||||
),),
|
|
||||||
const SizedBox(width: 10,),
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: extensionName,
|
|
||||||
initialValue: widget.primaryInformation.nameExtension??='N/A',
|
|
||||||
decoration: normalTextFieldStyle("Name extension", ""),
|
|
||||||
),)
|
|
||||||
]),
|
|
||||||
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15,),
|
|
||||||
SizedBox(width: screenWidth,
|
|
||||||
child: Row(children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: extensionName,
|
|
||||||
initialValue: dteFormat2.format(widget.primaryInformation.birthdate!),
|
|
||||||
decoration: normalTextFieldStyle("Birth date", ""),
|
|
||||||
),),
|
|
||||||
const SizedBox(width: 10,),
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: sex,
|
|
||||||
initialValue: widget.primaryInformation.sex!,
|
|
||||||
decoration: normalTextFieldStyle("Sex", ""),
|
|
||||||
),)
|
|
||||||
]),),
|
|
||||||
const SizedBox(height: 15,),
|
|
||||||
SizedBox(width: screenWidth,
|
|
||||||
child: Row(children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: bloodType,
|
|
||||||
initialValue:widget.primaryInformation.bloodType!,
|
|
||||||
decoration: normalTextFieldStyle("Blood type", ""),
|
|
||||||
),),
|
|
||||||
const SizedBox(width: 10,),
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: civilStatus,
|
|
||||||
initialValue: widget.primaryInformation.civilStatus!,
|
|
||||||
decoration: normalTextFieldStyle("Civil Status", ""),
|
|
||||||
),),
|
|
||||||
const SizedBox(width: 10,),
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: gender,
|
|
||||||
initialValue:widget.primaryInformation.gender??="N/A",
|
|
||||||
decoration: normalTextFieldStyle("Gender", ""),
|
|
||||||
),),
|
|
||||||
]),),
|
|
||||||
|
|
||||||
const SizedBox(height: 15,),
|
|
||||||
SizedBox(width: screenWidth,
|
|
||||||
child: Row(children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: height,
|
|
||||||
initialValue:widget.primaryInformation.heightM!.toString(),
|
|
||||||
decoration: normalTextFieldStyle("Height", ""),
|
|
||||||
),),
|
|
||||||
const SizedBox(width: 10,),
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: width,
|
|
||||||
initialValue: widget.primaryInformation.weightKg!.toString(),
|
|
||||||
decoration: normalTextFieldStyle("Weight", ""),
|
|
||||||
),),
|
|
||||||
const SizedBox(width: 10,),
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
enabled: enabled,
|
|
||||||
name: prefixSuffix,
|
|
||||||
initialValue:"${widget.primaryInformation.titlePrefix??="NA"} | ${widget.primaryInformation.titleSuffix??="N/A"}",
|
|
||||||
decoration: normalTextFieldStyle("Title Prefix and Suffix", ""),
|
|
||||||
),),
|
|
||||||
]),),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
|
||||||
|
class ProfileOtherInfo {
|
||||||
|
final int? id;
|
||||||
|
final String? name;
|
||||||
|
final String? description;
|
||||||
|
|
||||||
|
ProfileOtherInfo({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.description,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ProfileOtherInfo.fromJson(Map<String, dynamic> json) => ProfileOtherInfo(
|
||||||
|
id: json["id"],
|
||||||
|
name: json["name"],
|
||||||
|
description: json["description"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"name": name,
|
||||||
|
"description": description,
|
||||||
|
};
|
||||||
|
}
|
|
@ -921,347 +921,307 @@ class _FamilyBackgroundScreenState extends State<FamilyBackgroundScreen> {
|
||||||
Container(
|
Container(
|
||||||
child: spouse != null
|
child: spouse != null
|
||||||
? Row(
|
? Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(children: [
|
child: Column(
|
||||||
const SizedBox(
|
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
dense: true,
|
|
||||||
visualDensity:
|
|
||||||
const VisualDensity(
|
|
||||||
horizontal: -4,
|
|
||||||
vertical: -4),
|
|
||||||
title: Text(
|
|
||||||
"${spouse?.relatedPerson?.firstName} ${spouse?.relatedPerson?.middleName} ${spouse?.relatedPerson!.lastName} ${spouse?.relatedPerson?.nameExtension ?? ''}",
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.titleMedium!
|
|
||||||
.copyWith(
|
|
||||||
fontWeight:
|
|
||||||
FontWeight
|
|
||||||
.w500),
|
|
||||||
),
|
|
||||||
subtitle: const Text(
|
|
||||||
"fullname"),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
children: [
|
||||||
Checkbox(
|
const SizedBox(
|
||||||
visualDensity:
|
height: 5,
|
||||||
const VisualDensity(
|
),
|
||||||
|
ListTile(
|
||||||
|
dense: true,
|
||||||
|
visualDensity:
|
||||||
|
const VisualDensity(
|
||||||
|
horizontal:
|
||||||
|
-4,
|
||||||
|
vertical:
|
||||||
|
-4),
|
||||||
|
title: Text(
|
||||||
|
"${spouse?.relatedPerson?.firstName} ${spouse?.relatedPerson?.middleName} ${spouse?.relatedPerson!.lastName} ${spouse?.relatedPerson?.nameExtension ?? ''}",
|
||||||
|
style: Theme.of(
|
||||||
|
context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w500),
|
||||||
|
),
|
||||||
|
subtitle:
|
||||||
|
const Text(
|
||||||
|
"fullname"),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
visualDensity: const VisualDensity(
|
||||||
horizontal:
|
horizontal:
|
||||||
0,
|
0,
|
||||||
vertical:
|
vertical:
|
||||||
-4),
|
-4),
|
||||||
value: spouse!
|
value: spouse!
|
||||||
.incaseOfEmergency!,
|
.incaseOfEmergency!,
|
||||||
onChanged: (value) {
|
onChanged:
|
||||||
confirmAlertWithCancel(
|
(value) {
|
||||||
context, () {
|
confirmAlertWithCancel(
|
||||||
final progress =
|
context,
|
||||||
ProgressHUD.of(
|
() {
|
||||||
context);
|
final progress =
|
||||||
progress!
|
ProgressHUD.of(context);
|
||||||
.showWithText(
|
progress!
|
||||||
"Loading...");
|
.showWithText("Loading...");
|
||||||
|
|
||||||
context.read<FamilyBloc>().add(AddEmergencyEvent(
|
context.read<FamilyBloc>().add(AddEmergencyEvent(
|
||||||
contactInfoId: spouse!.emergencyContact!.isNotEmpty
|
contactInfoId: spouse!.emergencyContact!.isNotEmpty ? spouse!.emergencyContact!.first.contactinfoid : null,
|
||||||
? spouse!
|
numberMail: spouse!.emergencyContact!.isNotEmpty ? spouse!.emergencyContact!.first.numbermail : null,
|
||||||
.emergencyContact!
|
profileId: profileId!,
|
||||||
.first
|
relatedPersonId: spouse!.relatedPerson!.id!,
|
||||||
.contactinfoid
|
token: token!,
|
||||||
: null,
|
requestType: "CHECKBOX"));
|
||||||
numberMail: spouse!
|
},
|
||||||
.emergencyContact!
|
() {},
|
||||||
.isNotEmpty
|
"Emergency Contact Information?",
|
||||||
? spouse!
|
spouse!.incaseOfEmergency == true
|
||||||
.emergencyContact!
|
? "Remove as emergency contact information?"
|
||||||
.first
|
: "Add as emergency contact information?");
|
||||||
.numbermail
|
}),
|
||||||
: null,
|
const Text(
|
||||||
profileId:
|
incaseOfEmergency),
|
||||||
profileId!,
|
////Add mobile icon
|
||||||
relatedPersonId:
|
Container(
|
||||||
spouse!
|
child: spouse!.incaseOfEmergency! &&
|
||||||
.relatedPerson!
|
spouse!.emergencyContact!.isEmpty
|
||||||
.id!,
|
? IconButton(
|
||||||
token:
|
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
|
||||||
token!,
|
onPressed: () {
|
||||||
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:
|
|
||||||
() {
|
|
||||||
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"));
|
|
||||||
},
|
|
||||||
formKey: formKey);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
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(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AddMobileNumber(
|
return AddMobileNumber(
|
||||||
formKey: formKey,
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(_scaffoldKey.currentContext!).pop();
|
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"));
|
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"));
|
||||||
});
|
},
|
||||||
|
formKey: formKey);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child:
|
icon: const Icon(
|
||||||
Row(
|
Entypo.plus_circled,
|
||||||
children: [
|
color: third,
|
||||||
const SizedBox(
|
size: 18,
|
||||||
width: 16,
|
))
|
||||||
|
: 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!),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Badge(
|
),
|
||||||
backgroundColor: third,
|
],
|
||||||
textColor: Colors.white,
|
)
|
||||||
label: Text(spouse!.emergencyContact!.first.numbermail!),
|
: Container())),
|
||||||
),
|
Container(
|
||||||
],
|
padding:
|
||||||
),
|
const EdgeInsets
|
||||||
),
|
.only(
|
||||||
],
|
left:
|
||||||
)
|
12),
|
||||||
: Container())),
|
alignment:
|
||||||
Container(
|
Alignment
|
||||||
padding:
|
.topLeft,
|
||||||
const EdgeInsets.only(
|
child: spouse
|
||||||
left: 12),
|
?.position !=
|
||||||
alignment:
|
null
|
||||||
Alignment.topLeft,
|
? Column(
|
||||||
child: spouse?.position !=
|
|
||||||
null
|
|
||||||
? Column(
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment
|
|
||||||
.start,
|
|
||||||
children: [
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"OCCUPATION",
|
|
||||||
textAlign:
|
|
||||||
TextAlign
|
|
||||||
.start,
|
|
||||||
style: Theme.of(
|
|
||||||
context)
|
|
||||||
.textTheme
|
|
||||||
.titleMedium!
|
|
||||||
.copyWith(
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.w500,
|
|
||||||
color: primary)),
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment
|
|
||||||
.start,
|
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment
|
CrossAxisAlignment.start,
|
||||||
.start,
|
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 3,
|
height:
|
||||||
|
12,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
spouse!
|
"OCCUPATION",
|
||||||
.position!
|
textAlign: TextAlign.start,
|
||||||
.title!,
|
style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500, color: primary)),
|
||||||
style: Theme.of(
|
Column(
|
||||||
context)
|
mainAxisAlignment:
|
||||||
.textTheme
|
MainAxisAlignment.start,
|
||||||
.titleMedium,
|
crossAxisAlignment:
|
||||||
),
|
CrossAxisAlignment.start,
|
||||||
Text(
|
children: [
|
||||||
spouse!
|
const SizedBox(
|
||||||
.company!
|
height: 3,
|
||||||
.name!,
|
),
|
||||||
style: Theme.of(
|
Text(
|
||||||
context)
|
spouse!.position!.title!,
|
||||||
.textTheme
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
.titleMedium,
|
),
|
||||||
),
|
Text(
|
||||||
Text(
|
spouse!.company!.name!,
|
||||||
spouse!
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
.companyAddress!,
|
),
|
||||||
style: Theme.of(
|
Text(
|
||||||
context)
|
spouse!.companyAddress!,
|
||||||
.textTheme
|
style: Theme.of(context).textTheme.labelMedium,
|
||||||
.labelMedium,
|
),
|
||||||
),
|
Text(
|
||||||
Text(
|
spouse!.companyContactNumber!,
|
||||||
spouse!
|
style: Theme.of(context).textTheme.labelMedium,
|
||||||
.companyContactNumber!,
|
),
|
||||||
style: Theme.of(
|
],
|
||||||
context)
|
)
|
||||||
.textTheme
|
|
||||||
.labelMedium,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
: const SizedBox(),
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
]),
|
||||||
)
|
),
|
||||||
]),
|
AppPopupMenu<int>(
|
||||||
),
|
offset: const Offset(
|
||||||
AppPopupMenu<int>(
|
-10, -10),
|
||||||
offset: const Offset(-10, -10),
|
elevation: 3,
|
||||||
elevation: 3,
|
onSelected:
|
||||||
onSelected: (value)async {
|
(value) async {
|
||||||
////delete -= = = = = = = = =>>
|
////delete -= = = = = = = = =>>
|
||||||
if (value == 2) {
|
if (value == 2) {
|
||||||
confirmAlert(context, () {
|
confirmAlert(
|
||||||
final progress =
|
context, () {
|
||||||
ProgressHUD.of(context);
|
final progress =
|
||||||
progress!.showWithText("Loading...");
|
ProgressHUD.of(
|
||||||
context.read<FamilyBloc>().add(
|
context);
|
||||||
DeleteFamily(
|
progress!
|
||||||
id: mother!
|
.showWithText(
|
||||||
.relatedPerson!.id!,
|
"Loading...");
|
||||||
profileId: profileId!,
|
context
|
||||||
token: token!));
|
.read<
|
||||||
}, "Delete?", "Confirm Delete?");
|
FamilyBloc>()
|
||||||
}
|
.add(DeleteFamily(
|
||||||
if (value == 1) {
|
id: mother!
|
||||||
////edit eligibilty-= = = = = = = = =>>
|
.relatedPerson!
|
||||||
|
.id!,
|
||||||
|
profileId:
|
||||||
|
profileId!,
|
||||||
|
token:
|
||||||
|
token!));
|
||||||
|
}, "Delete?",
|
||||||
|
"Confirm Delete?");
|
||||||
|
}
|
||||||
|
if (value == 1) {
|
||||||
|
////edit eligibilty-= = = = = = = = =>>
|
||||||
|
|
||||||
final progress =
|
final progress =
|
||||||
ProgressHUD.of(
|
ProgressHUD.of(
|
||||||
context);
|
context);
|
||||||
progress!.showWithText(
|
progress!
|
||||||
"Loading...");
|
.showWithText(
|
||||||
if (positions.isEmpty) {
|
"Loading...");
|
||||||
positions =
|
if (positions
|
||||||
await ProfileUtilities
|
.isEmpty) {
|
||||||
.instance
|
positions =
|
||||||
.getAgencyPosition();
|
await ProfileUtilities
|
||||||
}
|
.instance
|
||||||
|
.getAgencyPosition();
|
||||||
|
}
|
||||||
|
|
||||||
if (agencices.isEmpty) {
|
if (agencices
|
||||||
agencices =
|
.isEmpty) {
|
||||||
await ProfileUtilities
|
agencices =
|
||||||
.instance
|
await ProfileUtilities
|
||||||
.getAgecies();
|
.instance
|
||||||
}
|
.getAgecies();
|
||||||
if (categories
|
}
|
||||||
.isEmpty) {
|
if (categories
|
||||||
categories =
|
.isEmpty) {
|
||||||
await ProfileUtilities
|
categories =
|
||||||
.instance
|
await ProfileUtilities
|
||||||
.agencyCategory();
|
.instance
|
||||||
}
|
.agencyCategory();
|
||||||
progress.dismiss();
|
}
|
||||||
showDialog(
|
progress.dismiss();
|
||||||
context: NavigationService
|
showDialog(
|
||||||
.navigatorKey
|
context: NavigationService
|
||||||
.currentContext!,
|
.navigatorKey
|
||||||
builder:
|
.currentContext!,
|
||||||
(BuildContext
|
builder:
|
||||||
context) {
|
(BuildContext
|
||||||
return SpouseEditAlert(
|
context) {
|
||||||
familyBackground: spouse!,
|
return SpouseEditAlert(
|
||||||
familyBloc:
|
familyBackground:
|
||||||
familyBloc,
|
spouse!,
|
||||||
token: token!,
|
familyBloc:
|
||||||
profileId:
|
familyBloc,
|
||||||
profileId!,
|
token:
|
||||||
positions:
|
token!,
|
||||||
positions,
|
profileId:
|
||||||
agencies:
|
profileId!,
|
||||||
agencices,
|
positions:
|
||||||
category:
|
positions,
|
||||||
categories,
|
agencies:
|
||||||
bloodType:
|
agencices,
|
||||||
bloodType,
|
category:
|
||||||
civilStatus:
|
categories,
|
||||||
civilStatus,
|
bloodType:
|
||||||
gender:
|
bloodType,
|
||||||
gender,
|
civilStatus:
|
||||||
nameExtensions:
|
civilStatus,
|
||||||
nameExtensions,
|
gender:
|
||||||
sexes: sexes);
|
gender,
|
||||||
});
|
nameExtensions:
|
||||||
|
nameExtensions,
|
||||||
}
|
sexes:
|
||||||
},
|
sexes);
|
||||||
menuItems: [
|
});
|
||||||
popMenuItem(
|
}
|
||||||
text: "Update",
|
},
|
||||||
value: 1,
|
menuItems: [
|
||||||
icon: Icons.edit),
|
popMenuItem(
|
||||||
popMenuItem(
|
text: "Update",
|
||||||
text: "Reset",
|
value: 1,
|
||||||
value: 2,
|
icon: Icons.edit),
|
||||||
icon: Icons.delete),
|
popMenuItem(
|
||||||
],
|
text: "Reset",
|
||||||
icon: const Icon(
|
value: 2,
|
||||||
Icons.more_vert,
|
icon:
|
||||||
color: Colors.grey,
|
Icons.delete),
|
||||||
),
|
],
|
||||||
tooltip: "Options",
|
icon: const Icon(
|
||||||
)
|
Icons.more_vert,
|
||||||
],
|
color: Colors.grey,
|
||||||
)
|
),
|
||||||
|
tooltip: "Options",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: const Padding(
|
child: const Padding(
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
|
import 'package:app_popup_menu/app_popup_menu.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/src/widgets/framework.dart';
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
import 'package:flutter/src/widgets/placeholder.dart';
|
import 'package:flutter/src/widgets/placeholder.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:fluttericon/font_awesome_icons.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||||
import 'package:unit2/model/profile/learning_development.dart';
|
import 'package:unit2/model/profile/learning_development.dart';
|
||||||
|
import 'package:unit2/screens/profile/components/learning_development/edit_modal.dart';
|
||||||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:unit2/utils/global.dart';
|
import 'package:unit2/utils/global.dart';
|
||||||
|
@ -15,33 +18,44 @@ import 'package:unit2/utils/text_container.dart';
|
||||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
import 'package:unit2/widgets/empty_data.dart';
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
import 'package:unit2/widgets/error_state.dart';
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
import '../../../bloc/profile/learningDevelopment/learning_development_bloc.dart';
|
import '../../../bloc/profile/learningDevelopment/learning_development_bloc.dart';
|
||||||
|
import '../../../utils/alerts.dart';
|
||||||
|
import 'learning_development/add_modal.dart';
|
||||||
|
|
||||||
class LearningAndDevelopmentScreen extends StatelessWidget {
|
class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
|
const LearningAndDevelopmentScreen({
|
||||||
const LearningAndDevelopmentScreen(
|
super.key,
|
||||||
{super.key,});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
String token;
|
||||||
|
int profileId;
|
||||||
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text(learningAndDevelopmentScreenTitle),
|
title: const Text(learningAndDevelopmentScreenTitle),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
actions: [AddLeading(onPressed: () {})],
|
actions: [
|
||||||
|
AddLeading(onPressed: () {
|
||||||
|
context
|
||||||
|
.read<LearningDevelopmentBloc>()
|
||||||
|
.add(ShowAddLearningDevelopmentForm());
|
||||||
|
})
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: ProgressHUD(
|
body: ProgressHUD(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
indicatorWidget: const SpinKitFadingCircle(
|
indicatorWidget: const SpinKitFadingCircle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.black87,
|
backgroundColor: Colors.black87,
|
||||||
child: BlocBuilder<UserBloc, UserState>(
|
child: BlocBuilder<UserBloc, UserState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is UserLoggedIn) {
|
if (state is UserLoggedIn) {
|
||||||
|
token = state.userData!.user!.login!.token!;
|
||||||
|
profileId = state.userData!.user!.login!.user!.profileId!;
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is ProfileLoaded) {
|
if (state is ProfileLoaded) {
|
||||||
|
@ -53,10 +67,76 @@ class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
progress!.showWithText("Please wait...");
|
progress!.showWithText("Please wait...");
|
||||||
}
|
}
|
||||||
if (state is LearningDevelopmentLoadedState ||
|
if (state is LearningDevelopmentLoadedState ||
|
||||||
state is LeaningDevelopmentErrorState) {
|
state is LearningDevelopmentErrorState ||
|
||||||
|
state is LearningDevelopmentAddingState ||
|
||||||
|
state is LearningDevelopmentAddedState ||
|
||||||
|
state is LearningDevelopmentUpdatingState) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.dismiss();
|
progress!.dismiss();
|
||||||
}
|
}
|
||||||
|
//// Added State
|
||||||
|
if (state is LearningDevelopmentAddedState) {
|
||||||
|
if (state.response['success']) {
|
||||||
|
successAlert(context, "Adding Successfull!",
|
||||||
|
state.response['message'], () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context
|
||||||
|
.read<LearningDevelopmentBloc>()
|
||||||
|
.add(LoadLearniningDevelopment());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
errorAlert(context, "Adding Failed",
|
||||||
|
"Something went wrong. Please try again.",
|
||||||
|
() {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context
|
||||||
|
.read<LearningDevelopmentBloc>()
|
||||||
|
.add(LoadLearniningDevelopment());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////Updated State
|
||||||
|
if (state is LearningDevelopmentUpdatedState) {
|
||||||
|
if (state.response['success']) {
|
||||||
|
successAlert(context, "Update Successfull!",
|
||||||
|
state.response['message'], () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context
|
||||||
|
.read<LearningDevelopmentBloc>()
|
||||||
|
.add(LoadLearniningDevelopment());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
errorAlert(context, "Update Failed",
|
||||||
|
"Something went wrong. Please try again.",
|
||||||
|
() {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context
|
||||||
|
.read<LearningDevelopmentBloc>()
|
||||||
|
.add(LoadLearniningDevelopment());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////Deleted State
|
||||||
|
if (state is DeleteLearningDevelopmentState) {
|
||||||
|
if (state.success) {
|
||||||
|
successAlert(context, "Deletion Successfull!",
|
||||||
|
"Deleted Successfully", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context
|
||||||
|
.read<LearningDevelopmentBloc>()
|
||||||
|
.add(LoadLearniningDevelopment());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
errorAlert(context, "Deletion Failed",
|
||||||
|
"Something went wrong. Please try again.",
|
||||||
|
() {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context
|
||||||
|
.read<LearningDevelopmentBloc>()
|
||||||
|
.add(LoadLearniningDevelopment());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
// TODO: implement listener
|
// TODO: implement listener
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
@ -141,13 +221,98 @@ class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
|
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
IconButton(
|
AppPopupMenu<int>(
|
||||||
onPressed: () {},
|
offset: const Offset(-10, -10),
|
||||||
icon: const Icon(
|
elevation: 3,
|
||||||
Icons.more_vert)),
|
onSelected: (value) {
|
||||||
|
////delete -= = = = = = = = =>>
|
||||||
|
if (value == 2) {
|
||||||
|
confirmAlert(context, () {
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(
|
||||||
|
context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Loading...");
|
||||||
|
BlocProvider.of<
|
||||||
|
LearningDevelopmentBloc>(
|
||||||
|
context)
|
||||||
|
.add(DeleteLearningDevelopment(
|
||||||
|
trainingId: state
|
||||||
|
.learningsAndDevelopment[
|
||||||
|
index]
|
||||||
|
.conductedTraining!
|
||||||
|
.id!,
|
||||||
|
hours: state
|
||||||
|
.learningsAndDevelopment[
|
||||||
|
index]
|
||||||
|
.conductedTraining!
|
||||||
|
.totalHours!,
|
||||||
|
sponsorId: state
|
||||||
|
.learningsAndDevelopment[
|
||||||
|
index]
|
||||||
|
.sponsoredBy
|
||||||
|
?.id,
|
||||||
|
profileId:
|
||||||
|
profileId,
|
||||||
|
token: token));
|
||||||
|
}, "Delete?",
|
||||||
|
"Confirm Delete?");
|
||||||
|
}
|
||||||
|
if (value == 1) {
|
||||||
|
bool isOverseas;
|
||||||
|
////edit = = = = = = = =>>
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Loading...");
|
||||||
|
|
||||||
|
if (state
|
||||||
|
.learningsAndDevelopment[
|
||||||
|
index]
|
||||||
|
.conductedTraining
|
||||||
|
?.venue
|
||||||
|
?.cityMunicipality ==
|
||||||
|
null) {
|
||||||
|
isOverseas = true;
|
||||||
|
} else {
|
||||||
|
isOverseas = false;
|
||||||
|
}
|
||||||
|
context
|
||||||
|
.read<
|
||||||
|
LearningDevelopmentBloc>()
|
||||||
|
.add(ShowEditLearningDevelopmentForm(
|
||||||
|
profileId:
|
||||||
|
profileId,
|
||||||
|
token: token,
|
||||||
|
learningDevelopment:
|
||||||
|
state.learningsAndDevelopment[
|
||||||
|
index],
|
||||||
|
isOverseas:
|
||||||
|
isOverseas));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
menuItems: [
|
||||||
|
popMenuItem(
|
||||||
|
text: "Edit",
|
||||||
|
value: 1,
|
||||||
|
icon: Icons.edit),
|
||||||
|
popMenuItem(
|
||||||
|
text: "Delete",
|
||||||
|
value: 2,
|
||||||
|
icon: Icons.delete),
|
||||||
|
popMenuItem(
|
||||||
|
text: "Attachment",
|
||||||
|
value: 3,
|
||||||
|
icon: FontAwesome.attach)
|
||||||
|
],
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
tooltip: "Options",
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -158,15 +323,27 @@ class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const EmptyData(
|
return const EmptyData(
|
||||||
message:
|
message:
|
||||||
"You don't have any Learning and Development added. Please click + to add.");
|
"You don't have any Learning and Development added. Please click + to add.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state is LeaningDevelopmentErrorState) {
|
if (state is LearningDevelopmentErrorState) {
|
||||||
return (SomethingWentWrong(
|
return (SomethingWentWrong(
|
||||||
message: state.message, onpressed: () {}));
|
message: state.message, onpressed: () {}));
|
||||||
}
|
}
|
||||||
|
if (state is LearningDevelopmentAddingState) {
|
||||||
|
return AddLearningAndDevelopmentScreen(
|
||||||
|
token: token,
|
||||||
|
profileId: profileId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (state is LearningDevelopmentUpdatingState) {
|
||||||
|
return EditLearningAndDevelopmentScreen(
|
||||||
|
token: token,
|
||||||
|
profileId: profileId,
|
||||||
|
);
|
||||||
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -180,4 +357,23 @@ class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PopupMenuItem<int> popMenuItem({String? text, int? value, IconData? icon}) {
|
||||||
|
return PopupMenuItem(
|
||||||
|
value: value,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
icon,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
text!,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,150 @@
|
||||||
|
import 'package:date_time_picker/date_time_picker.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
import 'package:flutter/src/widgets/placeholder.dart';
|
||||||
|
|
||||||
|
import '../../../../theme-data.dart/form-style.dart';
|
||||||
|
import '../../../../utils/global.dart';
|
||||||
|
|
||||||
|
class TrainingDetails extends StatelessWidget {
|
||||||
|
final String trainingTitle;
|
||||||
|
final double totalHours;
|
||||||
|
final String trainingTopic;
|
||||||
|
final String toDate;
|
||||||
|
final String fromDate;
|
||||||
|
final String conductedBy;
|
||||||
|
|
||||||
|
const TrainingDetails({super.key, required this.trainingTitle, required this.totalHours, required this.trainingTopic, required this.toDate, required this.fromDate, required this.conductedBy});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: TextFormField(
|
||||||
|
enabled: false,
|
||||||
|
initialValue: trainingTitle,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("", "")
|
||||||
|
.copyWith(
|
||||||
|
labelText: "Type",
|
||||||
|
fillColor: Colors
|
||||||
|
.grey.shade200,
|
||||||
|
filled: true)),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 6,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: TextFormField(
|
||||||
|
enabled: false,
|
||||||
|
initialValue: totalHours
|
||||||
|
.toString(),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"", "")
|
||||||
|
.copyWith(
|
||||||
|
labelText:
|
||||||
|
"Total Hours Conducted",
|
||||||
|
fillColor: Colors
|
||||||
|
.grey.shade200,
|
||||||
|
filled: true))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
enabled: false,
|
||||||
|
maxLines: 3,
|
||||||
|
initialValue:
|
||||||
|
trainingTopic,
|
||||||
|
decoration: normalTextFieldStyle("", "")
|
||||||
|
.copyWith(
|
||||||
|
labelText: "Topic",
|
||||||
|
fillColor: Colors.grey.shade200,
|
||||||
|
filled: true)),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
//// FROM DATE
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DateTimePicker(
|
||||||
|
enabled: false,
|
||||||
|
firstDate: DateTime(1970),
|
||||||
|
lastDate: DateTime(2100),
|
||||||
|
initialValue:fromDate,
|
||||||
|
use24HourFormat: false,
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.date_range),
|
||||||
|
timeHintText:
|
||||||
|
"Date of Examination/Conferment",
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"From", "From")
|
||||||
|
.copyWith(
|
||||||
|
fillColor: Colors
|
||||||
|
.grey.shade200,
|
||||||
|
filled: true,
|
||||||
|
prefixIcon:
|
||||||
|
const Icon(
|
||||||
|
Icons.date_range,
|
||||||
|
color: Colors
|
||||||
|
.black87,
|
||||||
|
)),
|
||||||
|
)),
|
||||||
|
const SizedBox(
|
||||||
|
width: 6,
|
||||||
|
),
|
||||||
|
//// TO DATE
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: DateTimePicker(
|
||||||
|
enabled: false,
|
||||||
|
initialValue:toDate,
|
||||||
|
firstDate: DateTime(1970),
|
||||||
|
lastDate: DateTime(2100),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"To", "To")
|
||||||
|
.copyWith(
|
||||||
|
fillColor: Colors.grey.shade200,
|
||||||
|
filled: true,
|
||||||
|
prefixIcon: const Icon(
|
||||||
|
Icons.date_range,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
enabled: false,
|
||||||
|
maxLines: 3,
|
||||||
|
initialValue:conductedBy,
|
||||||
|
decoration: normalTextFieldStyle("", "")
|
||||||
|
.copyWith(
|
||||||
|
labelText: "Conducted By",
|
||||||
|
fillColor: Colors.grey.shade200,
|
||||||
|
filled: true)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,73 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
import 'package:flutter/src/widgets/placeholder.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import '../../../../model/profile/learning_development.dart';
|
||||||
|
|
||||||
|
class TrainingDisplayDetails extends StatelessWidget {
|
||||||
|
final ConductedTraining e;
|
||||||
|
final Function() notWhatYourLookingFor;
|
||||||
|
const TrainingDisplayDetails({super.key, required this.e, required this.notWhatYourLookingFor});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
||||||
|
return Card(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
e.title!.title!.toUpperCase(),
|
||||||
|
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 6,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"CONDUCTED BY:",
|
||||||
|
style:
|
||||||
|
Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 8),
|
||||||
|
),
|
||||||
|
Text(e.conductedBy!.name!, style: const TextStyle(fontSize: 12)),
|
||||||
|
const SizedBox(
|
||||||
|
height: 6,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
dteFormat2.format(e.fromDate!),
|
||||||
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
|
)),
|
||||||
|
const Text(" - "),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
dteFormat2.format(e.toDate!),
|
||||||
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text("Total (hours): ${e.totalHours}",
|
||||||
|
style: Theme.of(context).textTheme.labelSmall),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: notWhatYourLookingFor,
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
"NOT WHAT LOOKING FOR?",
|
||||||
|
style: TextStyle(fontSize: 10, color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -135,8 +135,8 @@ class LoadingScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 80,
|
height: 120,
|
||||||
width: 80,
|
width: 120,
|
||||||
decoration:const BoxDecoration(
|
decoration:const BoxDecoration(
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
borderRadius: BorderRadius.all(Radius.circular(8))
|
borderRadius: BorderRadius.all(Radius.circular(8))
|
||||||
|
@ -145,10 +145,14 @@ class LoadingScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: const[
|
children: const[
|
||||||
|
|
||||||
SpinKitFadingCircle(
|
SpinKitFadingCircle(
|
||||||
size: 42,
|
size: 42,
|
||||||
color: Colors.white),
|
color: Colors.white),
|
||||||
|
|
||||||
|
SizedBox(height: 12,),
|
||||||
|
Text("Please wait..",style: TextStyle(color: Colors.white),),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -124,7 +124,7 @@ class _AddVoluntaryWorkScreenState extends State<AddVoluntaryWorkScreen> {
|
||||||
state.positions.insert(0, newAgencyPosition);
|
state.positions.insert(0, newAgencyPosition);
|
||||||
|
|
||||||
addPositionController.text = "";
|
addPositionController.text = "";
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
validator: (position) {
|
validator: (position) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import 'package:unit2/bloc/profile/primary_information/address/address_bloc.dart
|
||||||
import 'package:unit2/bloc/profile/primary_information/contact/contact_bloc.dart';
|
import 'package:unit2/bloc/profile/primary_information/contact/contact_bloc.dart';
|
||||||
import 'package:unit2/bloc/profile/primary_information/identification/identification_bloc.dart';
|
import 'package:unit2/bloc/profile/primary_information/identification/identification_bloc.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
||||||
import 'package:unit2/screens/profile/components/basic_information/address_screen.dart';
|
import 'package:unit2/screens/profile/components/basic_information/address_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/basic_information/citizenship_screen.dart';
|
import 'package:unit2/screens/profile/components/basic_information/citizenship_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/basic_information/contact_information_screen.dart';
|
import 'package:unit2/screens/profile/components/basic_information/contact_information_screen.dart';
|
||||||
|
@ -29,6 +30,7 @@ import 'package:unit2/screens/profile/components/references_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/work_history_screen.dart';
|
import 'package:unit2/screens/profile/components/work_history_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/voluntary_works_screen.dart';
|
import 'package:unit2/screens/profile/components/voluntary_works_screen.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
import '../../bloc/profile/eligibility/eligibility_bloc.dart';
|
import '../../bloc/profile/eligibility/eligibility_bloc.dart';
|
||||||
import '../../bloc/profile/family/family_bloc.dart';
|
import '../../bloc/profile/family/family_bloc.dart';
|
||||||
import '../../bloc/profile/education/education_bloc.dart';
|
import '../../bloc/profile/education/education_bloc.dart';
|
||||||
|
@ -40,6 +42,8 @@ import '../../bloc/profile/references/references_bloc.dart';
|
||||||
import '../../bloc/profile/voluntary_works/voluntary_work_bloc.dart';
|
import '../../bloc/profile/voluntary_works/voluntary_work_bloc.dart';
|
||||||
import '../../bloc/profile/workHistory/workHistory_bloc.dart';
|
import '../../bloc/profile/workHistory/workHistory_bloc.dart';
|
||||||
import '../../bloc/user/user_bloc.dart';
|
import '../../bloc/user/user_bloc.dart';
|
||||||
|
import '../../model/profile/basic_information/primary-information.dart';
|
||||||
|
import '../unit2/homepage.dart/components/menu.dart';
|
||||||
import 'components/main_menu.dart';
|
import 'components/main_menu.dart';
|
||||||
import 'components/submenu.dart';
|
import 'components/submenu.dart';
|
||||||
|
|
||||||
|
@ -49,8 +53,8 @@ class ProfileInfo extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
int? profileId;
|
int? profileId;
|
||||||
|
|
||||||
String? token;
|
String? token;
|
||||||
|
Profile profile;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
|
@ -65,13 +69,15 @@ class ProfileInfo extends StatelessWidget {
|
||||||
if (state is UserLoggedIn) {
|
if (state is UserLoggedIn) {
|
||||||
profileId = state.userData!.user!.login!.user!.profileId;
|
profileId = state.userData!.user!.login!.user!.profileId;
|
||||||
token = state.userData!.user!.login!.token!;
|
token = state.userData!.user!.login!.token!;
|
||||||
|
profile = state.userData!.employeeInfo!.profile!;
|
||||||
|
|
||||||
return BlocConsumer<ProfileBloc, ProfileState>(
|
return BlocConsumer<ProfileBloc, ProfileState>(
|
||||||
listener: (context, state,){
|
listener: (context, state,){
|
||||||
if (state is ProfileLoading) {
|
if (state is ProfileLoading) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.showWithText("Please wait...");
|
progress!.showWithText("Please wait...");
|
||||||
}
|
}
|
||||||
if (state is ProfileLoaded || state is ProfileErrorState) {
|
if (state is ProfileLoaded || state is ProfileErrorState || state is BasicInformationEditingState) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress?.dismiss();
|
progress?.dismiss();
|
||||||
}
|
}
|
||||||
|
@ -104,13 +110,10 @@ class ProfileInfo extends StatelessWidget {
|
||||||
),
|
),
|
||||||
items: [
|
items: [
|
||||||
subMenu(Icons.person, "Primary", () {
|
subMenu(Icons.person, "Primary", () {
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(context, MaterialPageRoute(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return PrimaryInfo(
|
return BlocProvider<ProfileBloc>.value(value: ProfileBloc()..add(GetPrimaryBasicInfo(primaryBasicInformation: profile)),child: PrimaryInfo(token: token!,profileId: profileId!,),);
|
||||||
primaryInformation: state
|
|
||||||
.profileInformation
|
|
||||||
.basicInfo
|
|
||||||
.primaryInformation!);
|
|
||||||
}));
|
}));
|
||||||
}),
|
}),
|
||||||
subMenu(Icons.home, "Home Addresses", () {
|
subMenu(Icons.home, "Home Addresses", () {
|
||||||
|
@ -363,7 +366,9 @@ class ProfileInfo extends StatelessWidget {
|
||||||
return const LoadingScreen();
|
return const LoadingScreen();
|
||||||
}
|
}
|
||||||
if (state is ProfileErrorState) {
|
if (state is ProfileErrorState) {
|
||||||
return Text(state.mesage);
|
return SomethingWentWrong(message: state.mesage, onpressed: (){ BlocProvider.of<ProfileBloc>(
|
||||||
|
context)
|
||||||
|
.add(LoadProfile(token:token!, userID: profileId!));});
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container();
|
return Container();
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
|
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
|
||||||
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
||||||
import 'package:unit2/utils/alerts.dart';
|
import 'package:unit2/utils/alerts.dart';
|
||||||
|
import '../../../../model/profile/basic_information/primary-information.dart';
|
||||||
import '../../../../theme-data.dart/colors.dart';
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
import '../../../../utils/global.dart';
|
import '../../../../utils/global.dart';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:unit2/utils/request.dart';
|
import 'package:unit2/utils/request.dart';
|
||||||
|
import 'package:unit2/utils/text_container.dart';
|
||||||
|
|
||||||
import '../../model/profile/learning_development.dart';
|
import '../../model/profile/learning_development.dart';
|
||||||
import '../../utils/urls.dart';
|
import '../../utils/urls.dart';
|
||||||
|
@ -15,27 +17,265 @@ class LearningDevelopmentServices {
|
||||||
int profileId, String token) async {
|
int profileId, String token) async {
|
||||||
List<LearningDevelopement> learningsAndDevelopments = [];
|
List<LearningDevelopement> learningsAndDevelopments = [];
|
||||||
String authToken = "Token $token";
|
String authToken = "Token $token";
|
||||||
String path = "${Url.instance.getLearningAndDevelopments()}$profileId/";
|
String path = "${Url.instance.learningAndDevelopments()}$profileId/";
|
||||||
Map<String, String> headers = {
|
Map<String, String> headers = {
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': authToken
|
'Authorization': authToken
|
||||||
};
|
};
|
||||||
// try {
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(path: path, param: {}, headers: headers);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if (data['data'] != null) {
|
||||||
|
data['data'].forEach((var learnings) {
|
||||||
|
LearningDevelopement learningDevelopement =
|
||||||
|
LearningDevelopement.fromJson(learnings);
|
||||||
|
learningsAndDevelopments.add(learningDevelopement);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return learningsAndDevelopments;
|
||||||
|
}
|
||||||
|
|
||||||
|
////Add
|
||||||
|
Future<Map<dynamic, dynamic>> add(
|
||||||
|
{required LearningDevelopement learningDevelopement,
|
||||||
|
required String token,
|
||||||
|
required int profileId}) async {
|
||||||
|
String authtoken = "Token $token";
|
||||||
|
String path = '${Url.instance.learningAndDevelopments()}$profileId/';
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authtoken
|
||||||
|
};
|
||||||
|
Map<dynamic, dynamic> statusResponse = {};
|
||||||
|
try {
|
||||||
|
Map body = {
|
||||||
|
"training_conduct_id": learningDevelopement.conductedTraining?.id,
|
||||||
|
"total_hours_attended":
|
||||||
|
learningDevelopement.totalHoursAttended.toString(),
|
||||||
|
"sponsor_id": learningDevelopement.sponsoredBy?.id,
|
||||||
|
"sponsor_name": learningDevelopement.sponsoredBy?.name,
|
||||||
|
"sponsor_category": learningDevelopement.sponsoredBy?.category?.id,
|
||||||
|
"sponsor_private": learningDevelopement.sponsoredBy?.privateEntity,
|
||||||
|
"training_id": learningDevelopement.conductedTraining?.title?.id,
|
||||||
|
"training_title": learningDevelopement.conductedTraining?.title?.title,
|
||||||
|
"topic_id": learningDevelopement.conductedTraining?.topic?.id,
|
||||||
|
"topic_title": learningDevelopement.conductedTraining?.topic?.title,
|
||||||
|
"conductor_id": learningDevelopement.conductedTraining?.conductedBy?.id,
|
||||||
|
"conductor_name":
|
||||||
|
learningDevelopement.conductedTraining?.conductedBy?.name,
|
||||||
|
"conductor_category":
|
||||||
|
learningDevelopement.conductedTraining?.conductedBy?.category?.id!,
|
||||||
|
"conductor_private":
|
||||||
|
learningDevelopement.conductedTraining?.conductedBy?.privateEntity,
|
||||||
|
"venue_city_municipality": learningDevelopement
|
||||||
|
.conductedTraining?.venue?.cityMunicipality?.code,
|
||||||
|
"venue_barangay":
|
||||||
|
learningDevelopement.conductedTraining?.venue?.barangay?.code,
|
||||||
|
"learning_development_type":
|
||||||
|
learningDevelopement.conductedTraining?.learningDevelopmentType?.id,
|
||||||
|
"from_date":
|
||||||
|
learningDevelopement.conductedTraining?.fromDate?.toString(),
|
||||||
|
"to_date": learningDevelopement.conductedTraining?.toDate?.toString(),
|
||||||
|
"total_hours": learningDevelopement.conductedTraining?.totalHours,
|
||||||
|
"locked": false,
|
||||||
|
"venue_country":
|
||||||
|
learningDevelopement.conductedTraining!.venue!.country!.id
|
||||||
|
};
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.postRequest(path: path, param: {}, body: body, headers: headers);
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
statusResponse = data;
|
||||||
|
} else {
|
||||||
|
statusResponse.addAll({'success': false});
|
||||||
|
}
|
||||||
|
return statusResponse;
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////Add
|
||||||
|
Future<Map<dynamic, dynamic>> update(
|
||||||
|
{required LearningDevelopement learningDevelopement,
|
||||||
|
required String token,
|
||||||
|
required int profileId}) async {
|
||||||
|
String authtoken = "Token $token";
|
||||||
|
String path = '${Url.instance.learningAndDevelopments()}$profileId/';
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authtoken
|
||||||
|
};
|
||||||
|
Map<dynamic, dynamic> statusResponse = {};
|
||||||
|
try {
|
||||||
|
Map body = {
|
||||||
|
"training_conduct_id": learningDevelopement.conductedTraining?.id,
|
||||||
|
"total_hours_attended":
|
||||||
|
learningDevelopement.totalHoursAttended.toString(),
|
||||||
|
"sponsor_id": learningDevelopement.sponsoredBy?.id,
|
||||||
|
"sponsor_name": learningDevelopement.sponsoredBy?.name,
|
||||||
|
"sponsor_category": learningDevelopement.sponsoredBy?.category?.id,
|
||||||
|
"sponsor_private": learningDevelopement.sponsoredBy?.privateEntity,
|
||||||
|
"training_id": learningDevelopement.conductedTraining?.title?.id,
|
||||||
|
"training_title": learningDevelopement.conductedTraining?.title?.title,
|
||||||
|
"topic_id": learningDevelopement.conductedTraining?.topic?.id,
|
||||||
|
"topic_title": learningDevelopement.conductedTraining?.topic?.title,
|
||||||
|
"conductor_id": learningDevelopement.conductedTraining?.conductedBy?.id,
|
||||||
|
"conductor_name":
|
||||||
|
learningDevelopement.conductedTraining?.conductedBy?.name,
|
||||||
|
"conductor_category":
|
||||||
|
learningDevelopement.conductedTraining?.conductedBy?.category?.id!,
|
||||||
|
"conductor_private":
|
||||||
|
learningDevelopement.conductedTraining?.conductedBy?.privateEntity,
|
||||||
|
"venue_city_municipality": learningDevelopement
|
||||||
|
.conductedTraining?.venue?.cityMunicipality?.code,
|
||||||
|
"venue_barangay":
|
||||||
|
learningDevelopement.conductedTraining?.venue?.barangay?.code,
|
||||||
|
"learning_development_type":
|
||||||
|
learningDevelopement.conductedTraining?.learningDevelopmentType?.id,
|
||||||
|
"from_date":
|
||||||
|
learningDevelopement.conductedTraining?.fromDate?.toString(),
|
||||||
|
"to_date": learningDevelopement.conductedTraining?.toDate?.toString(),
|
||||||
|
"total_hours": learningDevelopement.conductedTraining?.totalHours,
|
||||||
|
"locked": learningDevelopement.conductedTraining?.locked,
|
||||||
|
"venue_country":
|
||||||
|
learningDevelopement.conductedTraining!.venue!.country!.id
|
||||||
|
};
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.putRequest(path: path, param: {}, body: body, headers: headers);
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
statusResponse = data;
|
||||||
|
} else {
|
||||||
|
statusResponse.addAll({'success': false});
|
||||||
|
}
|
||||||
|
return statusResponse;
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////Delete
|
||||||
|
Future<bool> delete(
|
||||||
|
{required int profileId,
|
||||||
|
required String token,
|
||||||
|
required int? sponsorId,
|
||||||
|
required double totalHours,
|
||||||
|
required int trainingId}) async {
|
||||||
|
bool? success;
|
||||||
|
Map<String, dynamic> params = {"force_mode": "true"};
|
||||||
|
String authToken = "Token $token";
|
||||||
|
String path = '${Url.instance.learningAndDevelopments()}$profileId/';
|
||||||
|
Map body = {
|
||||||
|
"sponsor_id": sponsorId,
|
||||||
|
"total_hours_attended": totalHours,
|
||||||
|
"training_conduct_id": trainingId
|
||||||
|
};
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authToken
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance.deleteRequest(
|
||||||
|
path: path, headers: headers, body: body, param: params);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
success = data['success'];
|
||||||
|
} else {
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return success!;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<ConductedTraining>> getConductedTrainings(
|
||||||
|
{required String key, required int page}) async {
|
||||||
|
List<ConductedTraining> trainings = [];
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
};
|
||||||
|
Map<String, String> params = {
|
||||||
|
"title__title___ilike": key,
|
||||||
|
"page": page.toString()
|
||||||
|
};
|
||||||
|
|
||||||
|
String path = Url.instance.conductedTrainings();
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(path: path, param: params, headers: headers);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if (data['data'] != null) {
|
||||||
|
data['data'].forEach((var element) {
|
||||||
|
ConductedTraining training = ConductedTraining.fromJson(element);
|
||||||
|
trainings.add(training);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return trainings;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<LearningDevelopmentType>> getLearningDevelopmentType() async {
|
||||||
|
List<LearningDevelopmentType> types = [];
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
};
|
||||||
|
|
||||||
|
String path = Url.instance.learningAndDevelopmentType();
|
||||||
|
try {
|
||||||
http.Response response = await Request.instance
|
http.Response response = await Request.instance
|
||||||
.getRequest(path: path, param: {}, headers: headers);
|
.getRequest(path: path, param: {}, headers: headers);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
if (data['data'] != null) {
|
if (data['data'] != null) {
|
||||||
data['data'].forEach((var learnings) {
|
data['data'].forEach((var element) {
|
||||||
LearningDevelopement learningDevelopement =
|
LearningDevelopmentType type =
|
||||||
LearningDevelopement.fromJson(learnings);
|
LearningDevelopmentType.fromJson(element);
|
||||||
learningsAndDevelopments.add(learningDevelopement);
|
types.add(type);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// } catch (e) {
|
} catch (e) {
|
||||||
// throw e.toString();
|
throw e.toString();
|
||||||
// }
|
}
|
||||||
return learningsAndDevelopments;
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<LearningDevelopmentType>> getTrainingTopics() async {
|
||||||
|
List<LearningDevelopmentType> topics = [];
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
};
|
||||||
|
|
||||||
|
String path = Url.instance.learningAndDevelopmentTopics();
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(path: path, param: {}, headers: headers);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if (data['data'] != null) {
|
||||||
|
data['data'].forEach((var element) {
|
||||||
|
LearningDevelopmentType type =
|
||||||
|
LearningDevelopmentType.fromJson(element);
|
||||||
|
topics.add(type);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return topics;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:unit2/screens/profile/components/basic_information/profile_other_info.dart';
|
||||||
|
import 'package:unit2/utils/urls.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../../utils/request.dart';
|
||||||
|
class ProfileOtherInfoServices{
|
||||||
|
static final ProfileOtherInfoServices _instance = ProfileOtherInfoServices();
|
||||||
|
|
||||||
|
static ProfileOtherInfoServices get instace => _instance;
|
||||||
|
|
||||||
|
Future<List<ProfileOtherInfo>>getReligions({String? token})async{
|
||||||
|
String path = Url.instance.getReligions();
|
||||||
|
List<ProfileOtherInfo> religions = [];
|
||||||
|
String authToken = "Token $token";
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authToken
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(path: path, headers: headers, param: {});
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if (data['data'] != null) {
|
||||||
|
data['data'].forEach((var e) {
|
||||||
|
religions.add(ProfileOtherInfo.fromJson(e));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return religions;
|
||||||
|
}
|
||||||
|
Future<List<ProfileOtherInfo>>getEthnicity({String? token})async{
|
||||||
|
String path = Url.instance.getEthnicity();
|
||||||
|
List<ProfileOtherInfo> ethnicity = [];
|
||||||
|
String authToken = "Token $token";
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authToken
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(path: path, headers: headers, param: {});
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if (data['data'] != null) {
|
||||||
|
data['data'].forEach((var e) {
|
||||||
|
ethnicity.add(ProfileOtherInfo.fromJson(e));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return ethnicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<ProfileOtherInfo>>getDisability({required token})async{
|
||||||
|
String path = Url.instance.getDisability();
|
||||||
|
List<ProfileOtherInfo> disabilities = [];
|
||||||
|
String authToken = "Token $token";
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authToken
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(path: path, headers: headers, param: {});
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if (data['data'] != null) {
|
||||||
|
data['data'].forEach((var e) {
|
||||||
|
disabilities.add(ProfileOtherInfo.fromJson(e));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return disabilities;
|
||||||
|
}
|
||||||
|
Future<List<ProfileOtherInfo>>getGenders({required token})async{
|
||||||
|
String path = Url.instance.getGenders();
|
||||||
|
List<ProfileOtherInfo> genders = [];
|
||||||
|
String authToken = "Token $token";
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authToken
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(path: path, headers: headers, param: {});
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if (data['data'] != null) {
|
||||||
|
data['data'].forEach((var e) {
|
||||||
|
genders.add(ProfileOtherInfo.fromJson(e));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return genders;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<ProfileOtherInfo>>getIndigency({required String? token})async{
|
||||||
|
String path = Url.instance.getIndigency();
|
||||||
|
List<ProfileOtherInfo> indigencies = [];
|
||||||
|
String authToken = "Token $token";
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authToken
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(path: path, headers: headers, param: {});
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
if (data['data'] != null) {
|
||||||
|
data['data'].forEach((var e) {
|
||||||
|
indigencies.add(ProfileOtherInfo.fromJson(e));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
return indigencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -30,7 +30,7 @@ class ProfileService {
|
||||||
String url = Url.instance.profileInformation();
|
String url = Url.instance.profileInformation();
|
||||||
String path = url + id.toString();
|
String path = url + id.toString();
|
||||||
ProfileInformation? profileInformation0;
|
ProfileInformation? profileInformation0;
|
||||||
PrimaryInformation? primaryInformation;
|
|
||||||
List<MainAdress> addresses = [];
|
List<MainAdress> addresses = [];
|
||||||
List<Identification> identificationInformation = [];
|
List<Identification> identificationInformation = [];
|
||||||
List<ContactInfo> contactInformation = [];
|
List<ContactInfo> contactInformation = [];
|
||||||
|
@ -39,172 +39,107 @@ class ProfileService {
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': "Token $token"
|
'Authorization': "Token $token"
|
||||||
};
|
};
|
||||||
Map<String,String> param={"basic":"true"};
|
Map<String, String> param = {"basic": "true"};
|
||||||
// try{
|
try {
|
||||||
http.Response response = await Request.instance
|
http.Response response = await Request.instance
|
||||||
.getRequest(path: path, param: param, headers: headers);
|
.getRequest(path: path, param: param, headers: headers);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
|
|
||||||
// get primary information
|
// get all contacts
|
||||||
if (data['data']['basic_information']['primary_information'] != null) {
|
if (data['data']['basic_information']['contact_information'] != null) {
|
||||||
primaryInformation = PrimaryInformation.fromJson(
|
data['data']['basic_information']['contact_information']
|
||||||
data['data']['basic_information']['primary_information']);
|
.forEach((var contact) {
|
||||||
} else {
|
ContactInfo contactInfo =
|
||||||
primaryInformation = null;
|
ContactInfo.fromJson(contact['contact_info']);
|
||||||
}
|
contactInformation.add(contactInfo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// get all contacts
|
// get all addresses
|
||||||
if (data['data']['basic_information']['contact_information'] != null) {
|
if (data['data']['basic_information']['addresses'] != null) {
|
||||||
data['data']['basic_information']['contact_information']
|
data['data']['basic_information']['addresses'].forEach((var address) {
|
||||||
.forEach((var contact) {
|
MainAdress mainAdress = MainAdress.fromJson(address);
|
||||||
ContactInfo contactInfo =
|
addresses.add(mainAdress);
|
||||||
ContactInfo.fromJson(contact['contact_info']);
|
});
|
||||||
contactInformation.add(contactInfo);
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// get all addresses
|
// get all identifications
|
||||||
if (data['data']['basic_information']['addresses'] != null) {
|
if (data['data']['basic_information']['identification_records'] !=
|
||||||
data['data']['basic_information']['addresses'].forEach((var address) {
|
null) {
|
||||||
MainAdress mainAdress = MainAdress.fromJson(address);
|
data['data']['basic_information']['identification_records']!
|
||||||
addresses.add(mainAdress);
|
.forEach((var identity) {
|
||||||
});
|
Identification identification = Identification.fromJson(identity);
|
||||||
}
|
identificationInformation.add(identification);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// get all identifications
|
BasicInfo basicInfo = BasicInfo(
|
||||||
if (data['data']['basic_information']['identification_records'] != null) {
|
contactInformation: contactInformation,
|
||||||
data['data']['basic_information']['identification_records']!
|
identifications: identificationInformation,
|
||||||
.forEach((var identity) {
|
citizenships: citizenships,
|
||||||
Identification identification = Identification.fromJson(identity);
|
addresses: addresses);
|
||||||
identificationInformation.add(identification);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// get all family background
|
ProfileInformation profileInformation = ProfileInformation(
|
||||||
// if(data['data']['family_background'] != null){
|
|
||||||
// data['data']['family_background'].forEach((var family){
|
|
||||||
// FamilyBackground familyBackground = FamilyBackground.fromJson(family);
|
|
||||||
// families.add(familyBackground);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
//get all eligibilities
|
|
||||||
// if (data['data']['eligibilities'] != null) {
|
|
||||||
// data['data']['eligibilities']!.forEach((var cert) {
|
|
||||||
// EligibityCert eligibility = EligibityCert.fromJson(cert);
|
|
||||||
// eligibilities.add(eligibility);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// get all citizenships
|
|
||||||
// if (data['data']['citizenship'] != null) {
|
|
||||||
// data['data']['citizenships']!.forEach((var citizenship) {
|
|
||||||
// Citizenship person = Citizenship.fromJson(citizenship);
|
|
||||||
// citizenships.add(person);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// get all references;
|
|
||||||
// if (data['data']['personal_references'] != null) {
|
|
||||||
// data['data']['personal_references'].forEach((var person) {
|
|
||||||
// PersonalReference reference = PersonalReference.fromJson(person);
|
|
||||||
// references.add(reference);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
//get all learning and developments
|
|
||||||
// if (data['data']['learning_development'] != null) {
|
|
||||||
// data['data']['learning_development'].forEach((var training) {
|
|
||||||
// LearningDevelopement learnings =
|
|
||||||
// LearningDevelopement.fromJson(training);
|
|
||||||
// learningsDevelopments.add(learnings);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
//get all educational background
|
|
||||||
// if (data['data']['education_background'] != null) {
|
|
||||||
// data['data']['education_background'].forEach((var education) {
|
|
||||||
// EducationalBackground educationalBackground =
|
|
||||||
// EducationalBackground.fromJson(education);
|
|
||||||
// educationalBackgrounds.add(educationalBackground);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// get all work history
|
|
||||||
// if (data['data']['work_experiences'] != null) {
|
|
||||||
// data['data']['work_experiences'].forEach((var work) {
|
|
||||||
// WorkHistory experience = WorkHistory.fromJson(work);
|
|
||||||
// workExperiences.add(experience);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// get all voluntary works
|
|
||||||
// if (data['data']['voluntary_works'] != null) {
|
|
||||||
// data['data']['voluntary_works'].forEach((var work) {
|
|
||||||
// VoluntaryWork vwork = VoluntaryWork.fromJson(work);
|
|
||||||
// voluntaryWorks.add(vwork);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// get all hobbies
|
|
||||||
// if (data['data']['other_information']['skills_hobbies'] != null) {
|
|
||||||
// data['data']['other_information']['skills_hobbies']
|
|
||||||
// .forEach((var skills_hobbies) {
|
|
||||||
// SkillsHobbies skillsAndHobbies =
|
|
||||||
// SkillsHobbies.fromJson(skills_hobbies);
|
|
||||||
// skillsHobbies.add(skillsAndHobbies);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
//get all organization memberships
|
|
||||||
// if (data['data']['other_information']['organization_memberships'] !=
|
|
||||||
// null) {
|
|
||||||
// data['data']['other_information']['organization_memberships']
|
|
||||||
// .forEach((var org) {
|
|
||||||
// OrganizationMembership organization =
|
|
||||||
// OrganizationMembership.fromJson(org);
|
|
||||||
// orgMemberships.add(organization);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
//get all non academic recognition
|
|
||||||
// if (data['data']['other_information']['non_academic_records'] != null) {
|
|
||||||
// data['data']['other_information']['non_academic_records']
|
|
||||||
// .forEach((var recognition) {
|
|
||||||
// NonAcademicRecognition nonAcademicRecognition =
|
|
||||||
// NonAcademicRecognition.fromJson(recognition);
|
|
||||||
// nonAcademicRecognitions.add(nonAcademicRecognition);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
BasicInfo basicInfo = BasicInfo(
|
|
||||||
contactInformation: contactInformation,
|
|
||||||
primaryInformation: primaryInformation,
|
|
||||||
identifications: identificationInformation,
|
|
||||||
citizenships: citizenships,
|
|
||||||
addresses: addresses);
|
|
||||||
// OtherInformation otherInformation = OtherInformation(
|
|
||||||
// skillsAndHobbies: skillsHobbies,
|
|
||||||
// orgMemberships: orgMemberships,
|
|
||||||
// nonAcademicRecognition: nonAcademicRecognitions);
|
|
||||||
ProfileInformation profileInformation = ProfileInformation(
|
|
||||||
// families: families,
|
|
||||||
// otherInformation: otherInformation,
|
|
||||||
// workExperiences: workExperiences,
|
|
||||||
basicInfo: basicInfo,
|
basicInfo: basicInfo,
|
||||||
// eligibilities: eligibilities,
|
);
|
||||||
// references: references,
|
profileInformation0 = profileInformation;
|
||||||
// learningsAndDevelopment: learningsDevelopments,
|
}
|
||||||
// educationalBackgrounds: educationalBackgrounds,
|
} catch (e) {
|
||||||
// voluntaryWorks: voluntaryWorks
|
throw (e.toString());
|
||||||
);
|
|
||||||
profileInformation0 = profileInformation;
|
|
||||||
}
|
}
|
||||||
// }catch(e){
|
|
||||||
// throw(e.toString());
|
|
||||||
// }
|
|
||||||
return profileInformation0;
|
return profileInformation0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////Update Profile info
|
||||||
|
Future<Map<dynamic, dynamic>> updateBasicProfileInfo(
|
||||||
|
{required String token,
|
||||||
|
required int profileId,
|
||||||
|
required Profile profileInfo,
|
||||||
|
required int? genderId,
|
||||||
|
required int? indigencyId,
|
||||||
|
required int? disabilityId,
|
||||||
|
required int? ethnicityId,
|
||||||
|
required int? reqligionId}) async {
|
||||||
|
String authtoken = "Token $token";
|
||||||
|
String path = Url.instance.updatePersonalInfor();
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': authtoken
|
||||||
|
};
|
||||||
|
Map<dynamic, dynamic>? statusResponse = {};
|
||||||
|
Map body = {
|
||||||
|
"profile_id": profileId,
|
||||||
|
"first_name": profileInfo.firstName,
|
||||||
|
"middle_name": profileInfo.middleName,
|
||||||
|
"last_name": profileInfo.lastName,
|
||||||
|
"name_extension": profileInfo.nameExtension,
|
||||||
|
"birthdate": profileInfo.birthdate.toString(),
|
||||||
|
"sex": profileInfo.sex,
|
||||||
|
"blood_type": profileInfo.bloodType,
|
||||||
|
"civil_status": profileInfo.civilStatus,
|
||||||
|
"height": profileInfo.heightM,
|
||||||
|
"weight": profileInfo.weightKg,
|
||||||
|
"ethnicity_id": ethnicityId,
|
||||||
|
"disability_id": disabilityId,
|
||||||
|
"gender_id": genderId,
|
||||||
|
"religion_id": reqligionId,
|
||||||
|
"ip_id": indigencyId,
|
||||||
|
"title_prefix": profileInfo.titlePrefix,
|
||||||
|
"title_suffix": profileInfo.titleSuffix
|
||||||
|
};
|
||||||
|
// try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.postRequest(path: path, headers: headers, body: body, param: {});
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
statusResponse = data;
|
||||||
|
} else {
|
||||||
|
statusResponse.addAll({'success': false});
|
||||||
|
}
|
||||||
|
return statusResponse;
|
||||||
|
// } catch (e) {
|
||||||
|
// throw e.toString();
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ double safeBlockHorizontal = 0;
|
||||||
double safeBlockVertical = 0;
|
double safeBlockVertical = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// hive boxes
|
//// hive boxes
|
||||||
Box? CREDENTIALS;
|
Box? CREDENTIALS;
|
||||||
Box? SOS;
|
Box? SOS;
|
|
@ -10,7 +10,7 @@ import 'package:unit2/utils/urls.dart';
|
||||||
class Request {
|
class Request {
|
||||||
static final Request _instance = Request();
|
static final Request _instance = Request();
|
||||||
static Request get instance => _instance;
|
static Request get instance => _instance;
|
||||||
int requestTimeout = 25;
|
int requestTimeout = 30;
|
||||||
String host = Url.instance.host();
|
String host = Url.instance.host();
|
||||||
|
|
||||||
Future<Response> getRequest(
|
Future<Response> getRequest(
|
||||||
|
|
|
@ -4,9 +4,10 @@ class Url {
|
||||||
|
|
||||||
String host() {
|
String host() {
|
||||||
// return '192.168.10.183:3000';
|
// return '192.168.10.183:3000';
|
||||||
// return 'agusandelnorte.gov.ph';
|
return 'agusandelnorte.gov.ph';
|
||||||
// return "192.168.10.219:3000";
|
// // return "192.168.10.219:3000";
|
||||||
return "playweb.agusandelnorte.gov.ph";
|
// return "192.168.10.241";
|
||||||
|
// return "playweb.agusandelnorte.gov.ph";
|
||||||
// return 'devapi.agusandelnorte.gov.ph:3004';
|
// return 'devapi.agusandelnorte.gov.ph:3004';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,9 +88,18 @@ String getHonors(){
|
||||||
|
|
||||||
//// learning and development paths
|
//// learning and development paths
|
||||||
|
|
||||||
String getLearningAndDevelopments(){
|
String learningAndDevelopments(){
|
||||||
return "api/jobnet_app/profile/pds/learning_development/";
|
return "api/jobnet_app/profile/pds/learning_development/";
|
||||||
}
|
}
|
||||||
|
String conductedTrainings(){
|
||||||
|
return "api/jobnet_app/conducted_trainings/";
|
||||||
|
}
|
||||||
|
String learningAndDevelopmentType(){
|
||||||
|
return "api/jobnet_app/learning_development/";
|
||||||
|
}
|
||||||
|
String learningAndDevelopmentTopics(){
|
||||||
|
return "api/jobnet_app/training_topics/";
|
||||||
|
}
|
||||||
|
|
||||||
//// references paths
|
//// references paths
|
||||||
String reference(){
|
String reference(){
|
||||||
|
@ -129,6 +139,9 @@ String addEmergency(){
|
||||||
String getRelationshipTypes(){
|
String getRelationshipTypes(){
|
||||||
return "/api/jobnet_app/relationship_types";
|
return "/api/jobnet_app/relationship_types";
|
||||||
}
|
}
|
||||||
|
String updatePersonalInfor(){
|
||||||
|
return "/api/jobnet_app/profile/pds/basic/personal/";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//// contacts path
|
//// contacts path
|
||||||
|
@ -150,8 +163,28 @@ String getCommunicationProvider(){
|
||||||
String deleteContact (){
|
String deleteContact (){
|
||||||
return "/api/jobnet_app/profile/pds/basic/contact/";
|
return "/api/jobnet_app/profile/pds/basic/contact/";
|
||||||
}
|
}
|
||||||
|
////profile other info
|
||||||
|
String getReligions(){
|
||||||
|
return "/api/profile_app/religion/";
|
||||||
|
}
|
||||||
|
String getEthnicity(){
|
||||||
|
return "/api/profile_app/ethnicity/";
|
||||||
|
}
|
||||||
|
|
||||||
// location utils path
|
String getDisability(){
|
||||||
|
return "api/profile_app/disability/";
|
||||||
|
}
|
||||||
|
|
||||||
|
String getIndigency(){
|
||||||
|
return "/api/profile_app/indigenous/";
|
||||||
|
}
|
||||||
|
|
||||||
|
String getGenders(){
|
||||||
|
return "/api/profile_app/gender/";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//// location utils path
|
||||||
String getCounties(){
|
String getCounties(){
|
||||||
return "/api/jobnet_app/countries/";
|
return "/api/jobnet_app/countries/";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1101,6 +1101,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.3"
|
version: "0.2.3"
|
||||||
|
searchable_paginated_dropdown:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: searchable_paginated_dropdown
|
||||||
|
sha256: "289a40f7b0964f91b3d8123b4654a8397ec9df9fd1a6bc8ab545ec33c81a9eb2"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.0"
|
||||||
searchfield:
|
searchfield:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -79,6 +79,7 @@ dependencies:
|
||||||
location: ^4.3.0
|
location: ^4.3.0
|
||||||
platform_device_id: ^1.0.1
|
platform_device_id: ^1.0.1
|
||||||
multi_dropdown: ^1.0.9
|
multi_dropdown: ^1.0.9
|
||||||
|
searchable_paginated_dropdown: ^1.2.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Reference in New Issue