add and edit eligibility with individual pds info API
parent
66adcf924f
commit
5dcc1c1efb
|
@ -23,15 +23,20 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||
List<EligibityCert>? eligibilities;
|
||||
////=========================================================================
|
||||
on<LoadProfile>((event, emit) async {
|
||||
// try {
|
||||
emit(ProfileLoading());
|
||||
ProfileInformation? profileInformation =
|
||||
await ProfileService.instance.getProfile(event.token, event.userID);
|
||||
globalProfileInformation = profileInformation;
|
||||
emit(ProfileLoaded(profileInformation: globalProfileInformation!));
|
||||
// } catch (e) {
|
||||
// emit(ProfileErrorState(mesage: e.toString()));
|
||||
// }
|
||||
try {
|
||||
emit(ProfileLoading());
|
||||
ProfileInformation? profileInformation =
|
||||
await ProfileService.instance.getProfile(event.token, event.userID);
|
||||
globalProfileInformation = profileInformation;
|
||||
emit(ProfileLoaded(profileInformation: globalProfileInformation!));
|
||||
} catch (e) {
|
||||
emit(ProfileErrorState(mesage: e.toString()));
|
||||
}
|
||||
});
|
||||
|
||||
on<CallErrorState>((event, emit) {
|
||||
emit(const ProfileErrorState(
|
||||
mesage: "Something went wrong. Please try again"));
|
||||
});
|
||||
////=====================================================================
|
||||
on<LoadEligibility>((event, emit) {
|
||||
|
@ -40,36 +45,121 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||
emit(EligibilityLoaded(eligibilities: event.eligibilities));
|
||||
});
|
||||
////====================================================================
|
||||
on<EditEligibility>((event, emit) async {
|
||||
// try{
|
||||
emit(ProfileLoading());
|
||||
if (globalCountries == null) {
|
||||
List<Country> countries = await LocationUtils.instance.getCountries();
|
||||
globalCountries = countries;
|
||||
}
|
||||
if (globalRegions == null) {
|
||||
List<Region> regions = await LocationUtils.instance.getRegions();
|
||||
globalRegions = regions;
|
||||
}
|
||||
if (globalEligibilities == null) {
|
||||
List<Eligibility> eligibilities =
|
||||
await ProfileUtilities.instance.getEligibilities();
|
||||
globalEligibilities = eligibilities;
|
||||
}
|
||||
bool? isOverseas = event.eligibityCert.overseas;
|
||||
on<GetEligibilities>((event,emit)async{
|
||||
|
||||
emit(EditEligibilityState(
|
||||
isOverseas: isOverseas!,
|
||||
eligibityCert: event.eligibityCert,
|
||||
countries: globalCountries!,
|
||||
regions: globalRegions!,
|
||||
eligibilities: globalEligibilities!));
|
||||
print(eligibilities?.length);
|
||||
try{
|
||||
if(eligibilities != null){
|
||||
emit(EligibilityLoaded(eligibilities: eligibilities!));
|
||||
}else{
|
||||
emit(ProfileLoading());
|
||||
eligibilities = await EligibilityService.instance.getEligibilities(event.profileId, event.token);
|
||||
emit(EligibilityLoaded(eligibilities: eligibilities!));
|
||||
}
|
||||
|
||||
// }catch(e){
|
||||
// emit(ProfileErrorState(mesage: e.toString()));
|
||||
// }
|
||||
}catch(e){
|
||||
emit(ProfileErrorState(mesage: e.toString()));
|
||||
}
|
||||
});
|
||||
////====================================================================
|
||||
on<ShowEditEligibilityForm>((event, emit) async {
|
||||
try {
|
||||
emit(ProfileLoading());
|
||||
if (globalCountries == null) {
|
||||
List<Country> countries = await LocationUtils.instance.getCountries();
|
||||
globalCountries = countries;
|
||||
}
|
||||
if (globalRegions == null) {
|
||||
List<Region> regions = await LocationUtils.instance.getRegions();
|
||||
globalRegions = regions;
|
||||
}
|
||||
if (globalEligibilities == null) {
|
||||
List<Eligibility> eligibilities =
|
||||
await ProfileUtilities.instance.getEligibilities();
|
||||
globalEligibilities = eligibilities;
|
||||
}
|
||||
Eligibility currentEligibility = globalEligibilities!.firstWhere(
|
||||
(Eligibility eligibility) =>
|
||||
event.eligibityCert.eligibility!.id == eligibility.id);
|
||||
bool? isOverseas = event.eligibityCert.overseas;
|
||||
Country currentCountry = globalCountries!.firstWhere(
|
||||
(Country country) =>
|
||||
event.eligibityCert.examAddress!.country!.code == country.code);
|
||||
if (event.eligibityCert.examAddress?.cityMunicipality?.province
|
||||
?.region !=
|
||||
null) {
|
||||
Region currrentRegion = globalRegions!.firstWhere((Region region) =>
|
||||
event.eligibityCert.examAddress!.cityMunicipality!.province!
|
||||
.region!.code ==
|
||||
region.code);
|
||||
List<Province> provinces = await LocationUtils.instance
|
||||
.getProvinces(regionCode: currrentRegion.code.toString());
|
||||
Province currentProvince = provinces.firstWhere((Province province) =>
|
||||
event.eligibityCert.examAddress!.cityMunicipality!.province!
|
||||
.code ==
|
||||
province.code);
|
||||
List<CityMunicipality> cities = await LocationUtils.instance
|
||||
.getCities(code: currentProvince.code.toString());
|
||||
CityMunicipality currentCity = cities.firstWhere(
|
||||
(CityMunicipality cityMunicipality) =>
|
||||
event.eligibityCert.examAddress!.cityMunicipality!.code ==
|
||||
cityMunicipality.code);
|
||||
|
||||
////====================================================================
|
||||
emit(EditEligibilityState(
|
||||
currentCity: currentCity,
|
||||
selectedCountry: currentCountry,
|
||||
currentProvince: currentProvince,
|
||||
currentRegion: currrentRegion,
|
||||
currentEligibility: currentEligibility,
|
||||
provinces: provinces,
|
||||
cities: cities,
|
||||
isOverseas: isOverseas!,
|
||||
eligibityCert: event.eligibityCert,
|
||||
countries: globalCountries!,
|
||||
regions: globalRegions!,
|
||||
eligibilities: globalEligibilities!));
|
||||
} else {
|
||||
emit(EditEligibilityState(
|
||||
selectedCountry: currentCountry,
|
||||
currentCity: null,
|
||||
currentProvince: null,
|
||||
currentRegion: null,
|
||||
provinces: null,
|
||||
cities: null,
|
||||
currentEligibility: currentEligibility,
|
||||
isOverseas: isOverseas!,
|
||||
eligibityCert: event.eligibityCert,
|
||||
countries: globalCountries!,
|
||||
regions: globalRegions!,
|
||||
eligibilities: globalEligibilities!));
|
||||
}
|
||||
} catch (e) {
|
||||
emit(ProfileErrorState(mesage: e.toString()));
|
||||
}
|
||||
});
|
||||
////====================================================================
|
||||
on<UpdateEligibility>((event, emit) async {
|
||||
try {
|
||||
emit(ProfileLoading());
|
||||
Map<dynamic, dynamic> status = await EligibilityService.instance.update(
|
||||
eligibityCert: event.eligibityCert,
|
||||
token: event.token,
|
||||
profileId: int.parse(event.profileId),
|
||||
oldEligibility: event.oldEligibility);
|
||||
if (status['success']) {
|
||||
EligibityCert newEligibility = EligibityCert.fromJson(status['data']);
|
||||
eligibilities!.removeWhere(
|
||||
(EligibityCert element) => element.id == event.eligibityCert.id);
|
||||
eligibilities!.add(newEligibility);
|
||||
emit(EligibilityEditedState(
|
||||
eligibilities: eligibilities!, response: status));
|
||||
} else {
|
||||
emit(EligibilityEditedState(
|
||||
eligibilities: eligibilities!, response: status));
|
||||
}
|
||||
} catch (e) {
|
||||
emit(ProfileErrorState(mesage: e.toString()));
|
||||
}
|
||||
});
|
||||
on<ShowAddEligibilityForm>((event, emit) async {
|
||||
emit(ProfileLoading());
|
||||
|
@ -113,6 +203,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||
emit(ProfileErrorState(mesage: e.toString()));
|
||||
}
|
||||
});
|
||||
////====================================================================
|
||||
on<AddEligibility>(
|
||||
(event, emit) async {
|
||||
try {
|
||||
|
|
|
@ -27,9 +27,9 @@ class LoadEligibility extends ProfileEvent {
|
|||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class EditEligibility extends ProfileEvent {
|
||||
class ShowEditEligibilityForm extends ProfileEvent {
|
||||
final EligibityCert eligibityCert;
|
||||
const EditEligibility({required this.eligibityCert});
|
||||
const ShowEditEligibilityForm({required this.eligibityCert});
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
@ -51,6 +51,15 @@ class DeleteEligibility extends ProfileEvent {
|
|||
class ShowAddEligibilityForm extends ProfileEvent {
|
||||
|
||||
}
|
||||
|
||||
class GetEligibilities extends ProfileEvent{
|
||||
final int profileId;
|
||||
final String token;
|
||||
const GetEligibilities({required this.profileId, required this.token});
|
||||
@override
|
||||
List<Object> get props => [profileId,token];
|
||||
}
|
||||
|
||||
class AddEligibility extends ProfileEvent{
|
||||
final EligibityCert eligibityCert;
|
||||
final String profileId;
|
||||
|
@ -59,3 +68,17 @@ class AddEligibility extends ProfileEvent{
|
|||
@override
|
||||
List<Object> get props => [eligibityCert, profileId, token];
|
||||
}
|
||||
class UpdateEligibility extends ProfileEvent{
|
||||
final EligibityCert eligibityCert;
|
||||
final String profileId;
|
||||
final String token;
|
||||
final int oldEligibility;
|
||||
const UpdateEligibility({required this.eligibityCert, required this.oldEligibility,required this.profileId, required this.token});
|
||||
|
||||
@override
|
||||
List<Object> get props =>[eligibityCert,profileId,token,oldEligibility];
|
||||
}
|
||||
|
||||
class CallErrorState extends ProfileEvent{
|
||||
|
||||
}
|
||||
|
|
|
@ -36,13 +36,27 @@ class EditEligibilityState extends ProfileState {
|
|||
final List<Eligibility> eligibilities;
|
||||
final List<Country> countries;
|
||||
final List<Region> regions;
|
||||
final List<Province>? provinces;
|
||||
final List<CityMunicipality>? cities;
|
||||
final bool isOverseas;
|
||||
final Eligibility currentEligibility;
|
||||
final Region? currentRegion;
|
||||
final Province? currentProvince;
|
||||
final CityMunicipality? currentCity;
|
||||
final Country selectedCountry;
|
||||
const EditEligibilityState({
|
||||
required this.provinces,
|
||||
required this.cities,
|
||||
required this.currentProvince,
|
||||
required this.currentCity,
|
||||
required this.currentRegion,
|
||||
required this.currentEligibility,
|
||||
required this.isOverseas,
|
||||
required this.eligibityCert,
|
||||
required this.eligibilities,
|
||||
required this.countries,
|
||||
required this.regions,
|
||||
required this.selectedCountry,
|
||||
});
|
||||
@override
|
||||
List<Object> get props =>
|
||||
|
@ -69,6 +83,13 @@ class AddEligibilityState extends ProfileState {
|
|||
@override
|
||||
List<Object> get props => [eligibilities,countries,regions];
|
||||
}
|
||||
class EligibilityEditedState extends ProfileState{
|
||||
final List<EligibityCert> eligibilities;
|
||||
final Map<dynamic,dynamic> response;
|
||||
const EligibilityEditedState({required this.eligibilities, required this.response});
|
||||
@override
|
||||
List<Object> get props =>[eligibilities, response];
|
||||
}
|
||||
|
||||
class EligibilityAddedState extends ProfileState{
|
||||
final List<EligibityCert> eligibilities;
|
||||
|
|
|
@ -52,7 +52,9 @@ class EligibityCert {
|
|||
examAddress: json['exam_address'] == null
|
||||
? null
|
||||
: ExamAddress.fromJson(json["exam_address"]),
|
||||
validityDate: json["validity_date"],
|
||||
validityDate: json['validity_date'] == null
|
||||
? null
|
||||
: DateTime.parse(json["validity_date"]),
|
||||
licenseNumber: json["license_number"],
|
||||
overseas: null,
|
||||
);
|
||||
|
@ -65,7 +67,7 @@ class EligibityCert {
|
|||
"attachments": attachments,
|
||||
"eligibility": eligibility!.toJson(),
|
||||
"exam_address": examAddress!.toJson(),
|
||||
"validity_date": validityDate,
|
||||
"validity_date": "${validityDate!.year.toString().padLeft(4, '0')}-${validityDate!.month.toString().padLeft(2, '0')}-${validityDate!.day.toString().padLeft(2, '0')}",
|
||||
"license_number": licenseNumber,
|
||||
};
|
||||
@override
|
||||
|
|
|
@ -10,14 +10,14 @@ import 'package:unit2/model/profile/voluntary_works.dart';
|
|||
import 'package:unit2/model/profile/work_history.dart';
|
||||
|
||||
class ProfileInformation{
|
||||
BasicInfo basicInfo;
|
||||
OtherInformation otherInformation;
|
||||
List<EligibityCert> eligibilities;
|
||||
List<PersonalReference> references;
|
||||
List<LearningDevelopement> learningsAndDevelopment;
|
||||
List<EducationalBackground> educationalBackgrounds;
|
||||
List<FamilyBackground> families;
|
||||
List<WorkHistory>workExperiences;
|
||||
List<VoluntaryWork> voluntaryWorks;
|
||||
ProfileInformation({required this.families, required this.otherInformation, required this.voluntaryWorks, required this.workExperiences, required this.basicInfo,required this.eligibilities,required this.references, required this.learningsAndDevelopment,required this.educationalBackgrounds});
|
||||
final BasicInfo basicInfo;
|
||||
// OtherInformation otherInformation;
|
||||
// List<EligibityCert> eligibilities;
|
||||
// List<PersonalReference> references;
|
||||
// List<LearningDevelopement> learningsAndDevelopment;
|
||||
// List<EducationalBackground> educationalBackgrounds;
|
||||
// List<FamilyBackground> families;
|
||||
// List<WorkHistory>workExperiences;
|
||||
// List<VoluntaryWork> voluntaryWorks;
|
||||
ProfileInformation({required this.basicInfo});
|
||||
}
|
|
@ -4,7 +4,7 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
|
|||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class AddressScreen extends StatelessWidget {
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'package:unit2/model/profile/basic_information/contact_information.dart';
|
|||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class ContactInformationScreen extends StatelessWidget {
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
|
|||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class IdentificationsScreen extends StatelessWidget {
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:unit2/model/profile/educational_background.dart';
|
|||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class EducationScreen extends StatelessWidget {
|
||||
|
|
|
@ -124,6 +124,8 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
|||
Flexible(
|
||||
flex: 1,
|
||||
child: FormBuilderTextField(
|
||||
keyboardType: const TextInputType
|
||||
.numberWithOptions(),
|
||||
onChanged: (value) {
|
||||
rating = value;
|
||||
},
|
||||
|
@ -149,8 +151,8 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
|||
use24HourFormat: false,
|
||||
icon: const Icon(Icons.date_range),
|
||||
controller: examDateController,
|
||||
firstDate: DateTime(1970),
|
||||
lastDate: DateTime(2100),
|
||||
firstDate: DateTime(1970),
|
||||
lastDate: DateTime(2100),
|
||||
timeHintText:
|
||||
"Date of Examination/Conferment",
|
||||
decoration: normalTextFieldStyle(
|
||||
|
@ -222,8 +224,10 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
|||
child: overseas == true
|
||||
? FormBuilderDropdown<Country>(
|
||||
initialValue: null,
|
||||
validator: (value) =>
|
||||
value == null ? 'required' : null,
|
||||
validator: (value) =>
|
||||
value == null
|
||||
? 'required'
|
||||
: null,
|
||||
items: state.countries.map<
|
||||
DropdownMenuItem<
|
||||
Country>>(
|
||||
|
@ -249,8 +253,10 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
|||
autovalidateMode:
|
||||
AutovalidateMode
|
||||
.onUserInteraction,
|
||||
validator: (value) =>
|
||||
value == null ? 'required' : null,
|
||||
validator: (value) =>
|
||||
value == null
|
||||
? 'required'
|
||||
: null,
|
||||
onChanged:
|
||||
(Region? region) async {
|
||||
setState(() {
|
||||
|
@ -283,14 +289,16 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
|||
height: 70,
|
||||
child: ModalProgressHUD(
|
||||
color: Colors.transparent,
|
||||
inAsyncCall: cityCall,
|
||||
inAsyncCall: provinceCall,
|
||||
child: DropdownButtonFormField<
|
||||
Province?>(
|
||||
autovalidateMode:
|
||||
AutovalidateMode
|
||||
.onUserInteraction,
|
||||
validator: (value) =>
|
||||
value == null ? 'required' : null,
|
||||
validator: (value) =>
|
||||
value == null
|
||||
? 'required'
|
||||
: null,
|
||||
isExpanded: true,
|
||||
value: selectedProvince,
|
||||
onChanged: (Province?
|
||||
|
@ -325,40 +333,46 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
|||
"Province")),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
||||
// CityMunicipalities dropdown
|
||||
SizedBox(
|
||||
height: 70,
|
||||
child:
|
||||
DropdownButtonFormField<
|
||||
CityMunicipality>(
|
||||
validator: (value) =>
|
||||
value == null ? 'required' : null,
|
||||
isExpanded: true,
|
||||
onChanged:
|
||||
(CityMunicipality?
|
||||
city) {
|
||||
selectedMunicipality =
|
||||
city;
|
||||
},
|
||||
decoration:
|
||||
normalTextFieldStyle(
|
||||
"Municipality*",
|
||||
"Municipality"),
|
||||
value: selectedMunicipality,
|
||||
items: citymuns == null
|
||||
? []
|
||||
: citymuns!.map<
|
||||
DropdownMenuItem<
|
||||
CityMunicipality>>(
|
||||
(CityMunicipality
|
||||
c) {
|
||||
return DropdownMenuItem(
|
||||
value: c,
|
||||
child: Text(c
|
||||
.description!));
|
||||
}).toList(),
|
||||
child: ModalProgressHUD(
|
||||
color: Colors.white,
|
||||
inAsyncCall: cityCall,
|
||||
child:
|
||||
DropdownButtonFormField<
|
||||
CityMunicipality>(
|
||||
validator: (value) =>
|
||||
value == null
|
||||
? 'required'
|
||||
: null,
|
||||
isExpanded: true,
|
||||
onChanged:
|
||||
(CityMunicipality?
|
||||
city) {
|
||||
selectedMunicipality =
|
||||
city;
|
||||
},
|
||||
decoration:
|
||||
normalTextFieldStyle(
|
||||
"Municipality*",
|
||||
"Municipality"),
|
||||
value:
|
||||
selectedMunicipality,
|
||||
items: citymuns == null
|
||||
? []
|
||||
: citymuns!.map<
|
||||
DropdownMenuItem<
|
||||
CityMunicipality>>(
|
||||
(CityMunicipality
|
||||
c) {
|
||||
return DropdownMenuItem(
|
||||
value: c,
|
||||
child: Text(c
|
||||
.description!));
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
|
@ -380,9 +394,11 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
|||
style: mainBtnStyle(
|
||||
primary, Colors.transparent, second),
|
||||
onPressed: () {
|
||||
//rating
|
||||
double? rate = rating == null
|
||||
? null
|
||||
: double.parse(rating!);
|
||||
//lisence
|
||||
String? licenseNumber = license;
|
||||
CityMunicipality? cityMunicipality =
|
||||
selectedMunicipality;
|
||||
|
@ -450,23 +466,32 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
|||
}
|
||||
|
||||
Future<void> getProvinces() async {
|
||||
List<Province> newProvinces = await LocationUtils.instance
|
||||
.getProvinces(regionCode: selectedRegion!.code.toString());
|
||||
setState(() {
|
||||
provinces = newProvinces;
|
||||
selectedProvince = provinces![0];
|
||||
getCities();
|
||||
provinceCall = false;
|
||||
});
|
||||
try {
|
||||
List<Province> newProvinces = await LocationUtils.instance
|
||||
.getProvinces(regionCode: selectedRegion!.code.toString());
|
||||
setState(() {
|
||||
provinces = newProvinces;
|
||||
selectedProvince = provinces![0];
|
||||
provinceCall = false;
|
||||
cityCall = true;
|
||||
getCities();
|
||||
});
|
||||
} catch (e) {
|
||||
context.read<ProfileBloc>().add(CallErrorState());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getCities() async {
|
||||
List<CityMunicipality> newCities = await LocationUtils.instance
|
||||
.getCities(code: selectedProvince!.code.toString());
|
||||
citymuns = newCities;
|
||||
setState(() {
|
||||
selectedMunicipality = newCities[0];
|
||||
cityCall = false;
|
||||
});
|
||||
try {
|
||||
List<CityMunicipality> newCities = await LocationUtils.instance
|
||||
.getCities(code: selectedProvince!.code.toString());
|
||||
citymuns = newCities;
|
||||
setState(() {
|
||||
selectedMunicipality = newCities[0];
|
||||
cityCall = false;
|
||||
});
|
||||
} catch (e) {
|
||||
context.read<ProfileBloc>().add(CallErrorState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,11 @@ import 'package:date_time_picker/date_time_picker.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_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||
import 'package:unit2/model/location/city.dart';
|
||||
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
|
||||
import 'package:unit2/model/profile/eligibility.dart';
|
||||
import 'package:unit2/model/utils/eligibility.dart';
|
||||
import 'package:unit2/utils/location_utilities.dart';
|
||||
|
@ -33,18 +31,23 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
final formKey = GlobalKey<FormBuilderState>();
|
||||
final provinceKey = GlobalKey<FormBuilderState>();
|
||||
bool? overseas;
|
||||
List<Province>? provinces;
|
||||
List<CityMunicipality>? citymuns;
|
||||
List<Region>? regions;
|
||||
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
||||
Region? selectedRegion;
|
||||
Province? selectedProvince;
|
||||
CityMunicipality? selectedMunicipality;
|
||||
Country? selectedCountry;
|
||||
Eligibility? selectedEligibility;
|
||||
List<Province>? provinces;
|
||||
List<CityMunicipality>? citymuns;
|
||||
bool provinceCall = false;
|
||||
bool cityCall = false;
|
||||
// final examDateController = TextEditingController();
|
||||
// final validityDateController = TextEditingController();
|
||||
String? token;
|
||||
String? profileId;
|
||||
String? rating;
|
||||
String? license;
|
||||
final examDateController = TextEditingController();
|
||||
final validityDateController = TextEditingController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//USERBLOC
|
||||
|
@ -53,6 +56,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
//LOGGED IN USER STATE
|
||||
if (state is UserLoggedIn) {
|
||||
//PROFIILE BLOC
|
||||
token = state.userData!.user!.login!.token;
|
||||
profileId = state.userData!.user!.login!.user!.profileId.toString();
|
||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||
buildWhen: (previous, current) {
|
||||
if (state is EditEligibilityState) {}
|
||||
|
@ -61,23 +66,38 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
builder: (context, state) {
|
||||
//EDIT ELIGIBILITY STATE
|
||||
if (state is EditEligibilityState) {
|
||||
return ProgressHUD(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 25, horizontal: 18),
|
||||
child: FormBuilder(
|
||||
key: formKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
//ELIGIBILITIES DROPDOWN
|
||||
FormBuilderDropdown<Eligibility>(
|
||||
examDateController.text = state.eligibityCert.examDate == null?'': state.eligibityCert.examDate.toString();
|
||||
validityDateController.text = state.eligibityCert.validityDate == null?'': state.eligibityCert.validityDate.toString();
|
||||
|
||||
provinces = state.provinces;
|
||||
citymuns = state.cities;
|
||||
regions = state.regions;
|
||||
overseas = state.isOverseas;
|
||||
selectedRegion = state.currentRegion;
|
||||
selectedProvince = state.currentProvince;
|
||||
selectedMunicipality = state.currentCity;
|
||||
selectedEligibility= state.currentEligibility;
|
||||
rating = state.eligibityCert.rating?.toString();
|
||||
license = state.eligibityCert.licenseNumber;
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 25, horizontal: 18),
|
||||
child: FormBuilder(
|
||||
key: formKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
//ELIGIBILITIES DROPDOWN
|
||||
DropdownButtonFormField<Eligibility>(
|
||||
validator: (value) =>
|
||||
value == null ? 'required' : null,
|
||||
isExpanded: true,
|
||||
onChanged: (Eligibility? eligibility) {
|
||||
selectedEligibility = eligibility;
|
||||
},
|
||||
initialValue: null,
|
||||
value: selectedEligibility,
|
||||
items: state.eligibilities
|
||||
.map<DropdownMenuItem<Eligibility>>(
|
||||
(Eligibility eligibility) {
|
||||
|
@ -85,120 +105,116 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
value: eligibility,
|
||||
child: Text(eligibility.title));
|
||||
}).toList(),
|
||||
name: "eligibility",
|
||||
decoration:
|
||||
normalTextFieldStyle("Eligibility", "")
|
||||
.copyWith(
|
||||
hintStyle: const TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.black)),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
normalTextFieldStyle("Eligibility", "")),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
//LICENSE NUMBER
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: FormBuilderTextField(
|
||||
name: 'license_number',
|
||||
initialValue:
|
||||
widget.eligibityCert.licenseNumber,
|
||||
decoration: normalTextFieldStyle(
|
||||
"license number", "license number"),
|
||||
),
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
//LICENSE NUMBER
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: FormBuilderTextField(
|
||||
onChanged: (value) {
|
||||
license = value;
|
||||
},
|
||||
name: 'license_number',
|
||||
initialValue:
|
||||
license,
|
||||
decoration: normalTextFieldStyle(
|
||||
"license number", "license number"),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
//RATING
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: FormBuilderTextField(
|
||||
keyboardType: const TextInputType
|
||||
.numberWithOptions(),
|
||||
onChanged: (value) {
|
||||
rating = value;
|
||||
},
|
||||
name: 'rating',
|
||||
initialValue: rating == null
|
||||
? 'N/A'
|
||||
: rating.toString(),
|
||||
decoration: normalTextFieldStyle(
|
||||
'rating', 'rating'),
|
||||
),
|
||||
//RATING
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: FormBuilderTextField(
|
||||
name: 'rating',
|
||||
|
||||
// ignore: prefer_null_aware_operators
|
||||
initialValue:
|
||||
widget.eligibityCert.rating == null
|
||||
? null
|
||||
: widget.eligibityCert.rating
|
||||
.toString(),
|
||||
|
||||
decoration: normalTextFieldStyle(
|
||||
'rating', 'rating'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
//EXAM DATE
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: DateTimePicker(
|
||||
// controller: examDateController,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
decoration: normalTextFieldStyle(
|
||||
"Exam date", "Exam date"),
|
||||
initialValue:
|
||||
widget.eligibityCert.examDate ==
|
||||
null
|
||||
? ''
|
||||
: dteFormat2.format(widget
|
||||
.eligibityCert.examDate!),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
//VALIDITY DATE
|
||||
Flexible(
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
//EXAM DATE
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: DateTimePicker(
|
||||
// controller: validityDateController,
|
||||
firstDate: DateTime(2000),
|
||||
use24HourFormat: false,
|
||||
controller: examDateController,
|
||||
firstDate: DateTime(1970),
|
||||
lastDate: DateTime(2100),
|
||||
decoration: normalTextFieldStyle(
|
||||
"Validity date", "Validity date"),
|
||||
initialValue:
|
||||
widget.eligibityCert.validityDate ==
|
||||
null
|
||||
? ''
|
||||
: dteFormat2.format(widget
|
||||
.eligibityCert
|
||||
.validityDate!),
|
||||
),
|
||||
"Exam date", "")
|
||||
.copyWith(
|
||||
prefixIcon: const Icon(
|
||||
Icons.date_range,
|
||||
color: Colors.black87,
|
||||
)),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
//VALIDITY DATE
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: DateTimePicker(
|
||||
use24HourFormat: false,
|
||||
controller: validityDateController,
|
||||
firstDate: DateTime(1970),
|
||||
lastDate: DateTime(2100),
|
||||
decoration: normalTextFieldStyle(
|
||||
"validity date", "")
|
||||
.copyWith(
|
||||
prefixIcon: const Icon(
|
||||
Icons.date_range,
|
||||
color: Colors.black87,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
"Placement of Examination/Confinement",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.displaySmall!
|
||||
.copyWith(fontSize: blockSizeVertical * 2),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
//OVERSEAS ADDRESS SWITCH
|
||||
Column(
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
"Placement of Examination/Confinement",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.displaySmall!
|
||||
.copyWith(fontSize: blockSizeVertical * 2),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
//OVERSEAS ADDRESS SWITCH
|
||||
StatefulBuilder(
|
||||
builder: (context, StateSetter setState) {
|
||||
return Column(
|
||||
children: [
|
||||
FormBuilderSwitch(
|
||||
initialValue: overseas,
|
||||
|
@ -219,7 +235,12 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
SizedBox(
|
||||
child: overseas == true
|
||||
? FormBuilderDropdown<Country>(
|
||||
initialValue: null,
|
||||
validator: (value) =>
|
||||
value == null
|
||||
? 'required'
|
||||
: null,
|
||||
initialValue:
|
||||
state.selectedCountry,
|
||||
items: state.countries.map<
|
||||
DropdownMenuItem<
|
||||
Country>>(
|
||||
|
@ -241,50 +262,96 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
: Column(
|
||||
children: [
|
||||
//REGION DROPDOWN
|
||||
FormBuilderDropdown<Region?>(
|
||||
DropdownButtonFormField<
|
||||
Region?>(
|
||||
validator: (value) =>
|
||||
value == null
|
||||
? 'required'
|
||||
: null,
|
||||
isExpanded: true,
|
||||
onChanged:
|
||||
(Region? region) async {
|
||||
setState(() {
|
||||
provinceCall = true;
|
||||
});
|
||||
selectedRegion = region;
|
||||
getProvinces();
|
||||
provinces = await LocationUtils
|
||||
.instance
|
||||
.getProvinces(
|
||||
regionCode:
|
||||
selectedRegion!
|
||||
.code
|
||||
.toString());
|
||||
selectedProvince =
|
||||
provinces![0];
|
||||
setState(() {
|
||||
provinceCall = false;
|
||||
cityCall = true;
|
||||
});
|
||||
citymuns = await LocationUtils
|
||||
.instance
|
||||
.getCities(
|
||||
code:
|
||||
selectedProvince!
|
||||
.code!);
|
||||
selectedMunicipality =
|
||||
citymuns![0];
|
||||
setState(() {
|
||||
cityCall = false;
|
||||
});
|
||||
},
|
||||
initialValue: selectedRegion,
|
||||
value: selectedRegion,
|
||||
decoration:
|
||||
normalTextFieldStyle(
|
||||
"Region*", "Region"),
|
||||
name: 'region',
|
||||
items: state.regions.map<
|
||||
DropdownMenuItem<
|
||||
Region>>(
|
||||
(Region region) {
|
||||
return DropdownMenuItem<
|
||||
Region>(
|
||||
value: region,
|
||||
child: Text(region
|
||||
.description!));
|
||||
}).toList(),
|
||||
items: regions == null
|
||||
? []
|
||||
: regions!.map<
|
||||
DropdownMenuItem<
|
||||
Region>>(
|
||||
(Region region) {
|
||||
return DropdownMenuItem<
|
||||
Region>(
|
||||
value: region,
|
||||
child: Text(region
|
||||
.description!));
|
||||
}).toList(),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
//PROVINCE DROPDOWN
|
||||
SizedBox(
|
||||
height: 50,
|
||||
height: 70,
|
||||
child: ModalProgressHUD(
|
||||
inAsyncCall: cityCall,
|
||||
color: Colors.transparent,
|
||||
inAsyncCall: provinceCall,
|
||||
child: DropdownButtonFormField<
|
||||
Province?>(
|
||||
isExpanded: true,
|
||||
validator: (value) =>
|
||||
value == null
|
||||
? 'required'
|
||||
: null,
|
||||
isExpanded: true,
|
||||
value: selectedProvince,
|
||||
onChanged: (Province?
|
||||
province) {
|
||||
province) async {
|
||||
setState(() {
|
||||
cityCall = true;
|
||||
cityCall = true;
|
||||
});
|
||||
selectedProvince =
|
||||
province;
|
||||
citymuns = await LocationUtils
|
||||
.instance
|
||||
.getCities(
|
||||
code: selectedProvince!
|
||||
.code
|
||||
.toString());
|
||||
selectedMunicipality =
|
||||
citymuns![0];
|
||||
setState(() {
|
||||
cityCall = false;
|
||||
});
|
||||
selectedProvince = province;
|
||||
getCities();
|
||||
},
|
||||
items: provinces == null
|
||||
? []
|
||||
|
@ -296,7 +363,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
return DropdownMenuItem(
|
||||
value:
|
||||
province,
|
||||
child: FittedBox(
|
||||
child:
|
||||
FittedBox(
|
||||
child: Text(
|
||||
province
|
||||
.description!),
|
||||
|
@ -308,13 +376,21 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
"Province")),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
||||
// City municipality
|
||||
SizedBox(
|
||||
height: 50,
|
||||
child: DropdownButtonFormField<
|
||||
CityMunicipality>(
|
||||
height: 70,
|
||||
child: ModalProgressHUD(
|
||||
color: Colors.transparent,
|
||||
inAsyncCall: cityCall,
|
||||
child:
|
||||
DropdownButtonFormField<
|
||||
CityMunicipality>(
|
||||
validator: (value) =>
|
||||
value == null
|
||||
? 'required'
|
||||
: null,
|
||||
isExpanded: true,
|
||||
onChanged:
|
||||
(CityMunicipality?
|
||||
city) {
|
||||
|
@ -325,7 +401,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
normalTextFieldStyle(
|
||||
"Municipality*",
|
||||
"Municipality"),
|
||||
value: selectedMunicipality,
|
||||
value:
|
||||
selectedMunicipality,
|
||||
items: citymuns == null
|
||||
? []
|
||||
: citymuns!.map<
|
||||
|
@ -338,7 +415,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
child: Text(c
|
||||
.description!));
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
|
@ -346,26 +424,75 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
const Expanded(
|
||||
child: SizedBox(),
|
||||
),
|
||||
const Expanded(
|
||||
child: SizedBox(),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
height: 60,
|
||||
child: ElevatedButton(
|
||||
style: mainBtnStyle(
|
||||
primary, Colors.transparent, second),
|
||||
onPressed: () {},
|
||||
child: const Text(submit)),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
]),
|
||||
),
|
||||
SizedBox(
|
||||
width: screenWidth,
|
||||
height: 60,
|
||||
child: ElevatedButton(
|
||||
style: mainBtnStyle(
|
||||
primary, Colors.transparent, second),
|
||||
onPressed: () {
|
||||
|
||||
//rating
|
||||
double? rate = rating == null
|
||||
? null
|
||||
: double.parse(rating!);
|
||||
//license
|
||||
String? newLicense = license;
|
||||
//city municipality
|
||||
CityMunicipality? cityMunicipality =
|
||||
selectedMunicipality;
|
||||
//exam date
|
||||
DateTime? examDate =
|
||||
examDateController.text.isEmpty
|
||||
? null
|
||||
: DateTime.parse(
|
||||
examDateController.text);
|
||||
// validity date
|
||||
DateTime? validityDate =
|
||||
validityDateController.text.isEmpty
|
||||
? null
|
||||
: DateTime.parse(
|
||||
validityDateController.text);
|
||||
// exam address
|
||||
ExamAddress examAddress = ExamAddress(
|
||||
barangay: state.eligibityCert.examAddress?.barangay,
|
||||
id: state.eligibityCert.examAddress?.id,
|
||||
addressCategory: state.eligibityCert.examAddress?.addressCategory,
|
||||
examAddressClass: state.eligibityCert.examAddress?.examAddressClass,
|
||||
country: selectedCountry ??= Country(
|
||||
id: 175,
|
||||
name: 'Philippines',
|
||||
code: 'PH'),
|
||||
cityMunicipality: cityMunicipality);
|
||||
EligibityCert eligibityCert =
|
||||
EligibityCert(
|
||||
id: state.eligibityCert.id,
|
||||
rating: rate,
|
||||
examDate: examDate,
|
||||
attachments: null,
|
||||
eligibility: selectedEligibility,
|
||||
examAddress: examAddress,
|
||||
validityDate: validityDate,
|
||||
licenseNumber: newLicense,
|
||||
overseas: overseas);
|
||||
if (formKey.currentState!
|
||||
.saveAndValidate()) {
|
||||
context.read<ProfileBloc>().add(UpdateEligibility(eligibityCert: eligibityCert, oldEligibility: state.eligibityCert.eligibility!.id, profileId: profileId!, token: token!));
|
||||
}
|
||||
},
|
||||
child: const Text(submit)),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -378,23 +505,4 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> getProvinces() async {
|
||||
List<Province> _provinces = await LocationUtils.instance
|
||||
.getProvinces(regionCode: selectedRegion!.code.toString());
|
||||
setState(() {
|
||||
provinces = _provinces;
|
||||
selectedProvince = provinces![0];
|
||||
getCities();
|
||||
provinceCall = false;
|
||||
});
|
||||
}
|
||||
Future<void> getCities()async{
|
||||
List<CityMunicipality> _cities = await LocationUtils.instance.getCities(code: selectedProvince!.code.toString());
|
||||
citymuns = _cities;
|
||||
setState(() {
|
||||
selectedMunicipality = _cities[0];
|
||||
cityCall = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:app_popup_menu/app_popup_menu.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:fluttericon/font_awesome_icons.dart';
|
||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||
|
@ -12,9 +13,9 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
|
|||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/close_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
import '../../../utils/alerts.dart';
|
||||
|
||||
class EligibiltyScreen extends StatelessWidget {
|
||||
|
@ -24,240 +25,298 @@ class EligibiltyScreen extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
String? token;
|
||||
String? profileId;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(elibilityScreenTitle),
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
actions: [
|
||||
AddLeading(onPressed: () {
|
||||
context.read<ProfileBloc>().add(ShowAddEligibilityForm());
|
||||
})
|
||||
],
|
||||
),
|
||||
body: BlocBuilder<UserBloc, UserState>(
|
||||
builder: (context, state) {
|
||||
if (state is UserLoggedIn) {
|
||||
token = state.userData!.user!.login!.token;
|
||||
profileId =
|
||||
state.userData!.user!.login!.user!.profileId.toString();
|
||||
return ProgressHUD(
|
||||
child: BlocConsumer<ProfileBloc, ProfileState>(
|
||||
listener: (context, state) {
|
||||
if (state is EditEligibilityState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
if (state is ProfileLoading) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Loading");
|
||||
}
|
||||
if (state is EligibilityLoaded ||
|
||||
state is AddEligibilityState ||
|
||||
state is ProfileErrorState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
if (state is DeletedState) {
|
||||
if (state.success) {
|
||||
successAlert(context, "Deletion Successfull",
|
||||
"Eligibility has been deleted successfully", () {
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
} else {
|
||||
errorAlert(context, "Deletion Failed",
|
||||
"Error deleting eligibility", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
List<EligibityCert>? eligibilities;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return true;
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: context.watch<ProfileBloc>().state is AddEligibilityState
|
||||
? const Text("Add Eligiblity")
|
||||
: context.watch<ProfileBloc>().state is EditEligibilityState
|
||||
? const Text("Edit Eligibilty")
|
||||
: const Text(elibilityScreenTitle),
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
actions: (context.watch<ProfileBloc>().state is EligibilityLoaded ||
|
||||
context.watch<ProfileBloc>().state is ProfileLoading)
|
||||
? [
|
||||
AddLeading(onPressed: () {
|
||||
context.read<ProfileBloc>().add(ShowAddEligibilityForm());
|
||||
})
|
||||
]
|
||||
: [
|
||||
CloseLeading(onPressed: () {
|
||||
context
|
||||
.read<ProfileBloc>()
|
||||
.add(GetEligibilities(profileId: int.parse(profileId!), token: token!));
|
||||
})
|
||||
],
|
||||
),
|
||||
body: BlocBuilder<UserBloc, UserState>(
|
||||
builder: (context, state) {
|
||||
if (state is UserLoggedIn) {
|
||||
token = state.userData!.user!.login!.token;
|
||||
profileId =
|
||||
state.userData!.user!.login!.user!.profileId.toString();
|
||||
return ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
indicatorWidget: const SpinKitFadingCircle(
|
||||
color: Colors.white,
|
||||
),
|
||||
backgroundColor: Colors.black87,
|
||||
child: BlocConsumer<ProfileBloc, ProfileState>(
|
||||
listener: (context, state) {
|
||||
if (state is ProfileLoading) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Loading");
|
||||
}
|
||||
}
|
||||
if (state is EligibilityAddedState) {
|
||||
if (state.response['success']) {
|
||||
Navigator.of(context).pop();
|
||||
successAlert(context, "Adding Successfull!",
|
||||
state.response['message'], () {
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
} else {
|
||||
errorAlert(context, "Adding Failed",
|
||||
"Something went wrong. Please try again.", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
if (state is EligibilityLoaded ||
|
||||
state is AddEligibilityState ||
|
||||
state is ProfileErrorState ||
|
||||
state is EditEligibilityState ||
|
||||
state is DeletedState ||
|
||||
state is EligibilityAddedState ||
|
||||
state is EligibilityEditedState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||
builder: (context, state) {
|
||||
if (state is EligibilityLoaded) {
|
||||
if (state.eligibilities.isNotEmpty) {
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 10),
|
||||
itemCount: state.eligibilities.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
String title = state
|
||||
.eligibilities[index].eligibility!.title;
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: screenWidth,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 8),
|
||||
decoration: box1(),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w500),
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"$licenseNumber: ${state.eligibilities[index].licenseNumber == null ? 'N/A' : state.eligibilities[index].licenseNumber.toString()}",
|
||||
//DELETED STATE
|
||||
if (state is DeletedState) {
|
||||
if (state.success) {
|
||||
successAlert(context, "Deletion Successfull",
|
||||
"Eligibility has been deleted successfully", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
} else {
|
||||
errorAlert(context, "Deletion Failed",
|
||||
"Error deleting eligibility", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
}
|
||||
}
|
||||
//ADDED STATE
|
||||
if (state is EligibilityAddedState) {
|
||||
if (state.response['success']) {
|
||||
successAlert(context, "Adding Successfull!",
|
||||
state.response['message'], () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
} else {
|
||||
errorAlert(context, "Adding Failed",
|
||||
"Something went wrong. Please try again.", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
}
|
||||
}
|
||||
//UPDATED STATE
|
||||
if (state is EligibilityEditedState) {
|
||||
if (state.response['success']) {
|
||||
successAlert(context, "Update Successfull!",
|
||||
state.response['message'], () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
} else {
|
||||
errorAlert(context, "Update Failed",
|
||||
"Something went wrong. Please try again.", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<ProfileBloc>().add(LoadEligibility(
|
||||
eligibilities: state.eligibilities));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||
builder: (context, state) {
|
||||
if (state is EligibilityLoaded) {
|
||||
eligibilities = state.eligibilities;
|
||||
if (state.eligibilities.isNotEmpty) {
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 10),
|
||||
itemCount: state.eligibilities.length,
|
||||
itemBuilder:
|
||||
(BuildContext context, int index) {
|
||||
String title = state.eligibilities[index]
|
||||
.eligibility!.title;
|
||||
return Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: screenWidth,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 8),
|
||||
decoration: box1(),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
"Rating : ${state.eligibilities[index].rating ?? 'N/A'}.",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall)
|
||||
]),
|
||||
),
|
||||
AppPopupMenu<int>(
|
||||
offset: const Offset(-10, -10),
|
||||
elevation: 3,
|
||||
onSelected: (value) {
|
||||
if (value == 2) {
|
||||
confirmAlert(context, () {
|
||||
BlocProvider.of<
|
||||
ProfileBloc>(
|
||||
context)
|
||||
.add(DeleteEligibility(
|
||||
eligibilities: state
|
||||
.eligibilities,
|
||||
eligibilityId: state
|
||||
.eligibilities[
|
||||
index]
|
||||
.id!,
|
||||
profileId:
|
||||
profileId!,
|
||||
token: token!));
|
||||
}, "Delete?",
|
||||
"Confirm Delete?");
|
||||
}
|
||||
if (value == 1) {
|
||||
EligibityCert eligibityCert =
|
||||
state
|
||||
.eligibilities[index];
|
||||
bool overseas = eligibityCert
|
||||
.examAddress!
|
||||
.country!
|
||||
.id
|
||||
.toString() ==
|
||||
'175'
|
||||
? false
|
||||
: true;
|
||||
eligibityCert.overseas =
|
||||
overseas;
|
||||
.titleMedium!
|
||||
.copyWith(
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w500),
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"$licenseNumber: ${state.eligibilities[index].licenseNumber == null ? 'N/A' : state.eligibilities[index].licenseNumber.toString()}",
|
||||
style:
|
||||
Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
"Rating : ${state.eligibilities[index].rating ?? 'N/A'}.",
|
||||
style:
|
||||
Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall)
|
||||
]),
|
||||
),
|
||||
AppPopupMenu<int>(
|
||||
offset: const Offset(-10, -10),
|
||||
elevation: 3,
|
||||
onSelected: (value) {
|
||||
final progress =
|
||||
ProgressHUD.of(context);
|
||||
eligibityCert.overseas =
|
||||
overseas;
|
||||
progress!.showWithText(
|
||||
"Loading...");
|
||||
context
|
||||
.read<ProfileBloc>()
|
||||
.add(EditEligibility(
|
||||
eligibityCert:
|
||||
eligibityCert));
|
||||
}
|
||||
},
|
||||
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",
|
||||
)
|
||||
],
|
||||
////delete eligibilty-= = = = = = = = =>>
|
||||
if (value == 2) {
|
||||
confirmAlert(context, () {
|
||||
BlocProvider.of<
|
||||
ProfileBloc>(
|
||||
context)
|
||||
.add(DeleteEligibility(
|
||||
eligibilities:
|
||||
state
|
||||
.eligibilities,
|
||||
eligibilityId: state
|
||||
.eligibilities[
|
||||
index]
|
||||
.id!,
|
||||
profileId:
|
||||
profileId!,
|
||||
token: token!));
|
||||
}, "Delete?",
|
||||
"Confirm Delete?");
|
||||
}
|
||||
if (value == 1) {
|
||||
////edit eligibilty-= = = = = = = = =>>
|
||||
EligibityCert
|
||||
eligibityCert =
|
||||
state.eligibilities[
|
||||
index];
|
||||
bool overseas = eligibityCert
|
||||
.examAddress!
|
||||
.country!
|
||||
.id
|
||||
.toString() ==
|
||||
'175'
|
||||
? false
|
||||
: true;
|
||||
eligibityCert.overseas =
|
||||
overseas;
|
||||
|
||||
eligibityCert.overseas =
|
||||
overseas;
|
||||
|
||||
context.read<ProfileBloc>().add(
|
||||
ShowEditEligibilityForm(
|
||||
eligibityCert:
|
||||
eligibityCert));
|
||||
}
|
||||
},
|
||||
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",
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return const EmptyData(
|
||||
message:
|
||||
"You don't have any eligibilities added. Please click + to add");
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return const EmptyData(
|
||||
message:
|
||||
"You don't have any eligibilities added. Please click + to add");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state is EditEligibilityState) {
|
||||
return EditEligibilityScreen(
|
||||
eligibityCert: state.eligibityCert);
|
||||
}
|
||||
if (state is AddEligibilityState) {
|
||||
return const AddEligibilityScreen();
|
||||
}
|
||||
if (state is ProfileErrorState) {
|
||||
return Center(
|
||||
child: Text(state.mesage),
|
||||
if (state is EditEligibilityState) {
|
||||
return EditEligibilityScreen(
|
||||
eligibityCert: state.eligibityCert);
|
||||
}
|
||||
if (state is AddEligibilityState) {
|
||||
return const AddEligibilityScreen();
|
||||
}
|
||||
if (state is ProfileErrorState) {
|
||||
return Center(
|
||||
child: Text(state.mesage),
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
color: Colors.grey.shade200,
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
));
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
PopupMenuItem<int> popMenuItem({String? text, int? value, IconData? icon}) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
|
|||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class LearningAndDevelopmentScreen extends StatelessWidget {
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
|
|||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class NonAcademicRecognitionScreen extends StatelessWidget {
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'package:unit2/model/profile/other_information/organization_memberships.d
|
|||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
import '../../../../utils/global.dart';
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
|||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class SkillHobbiesScreen extends StatelessWidget {
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:unit2/model/profile/references.dart';
|
|||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class ReferencesScreen extends StatelessWidget {
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:unit2/model/profile/voluntary_works.dart';
|
|||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
class VolunataryWorkScreen extends StatelessWidget {
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:unit2/model/profile/work_history.dart';
|
|||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/add_leading.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/empty_data.dart';
|
||||
|
||||
import '../../../utils/global.dart';
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:expandable_group/expandable_group_widget.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:fluttericon/brandico_icons.dart';
|
||||
import 'package:fluttericon/elusive_icons.dart';
|
||||
import 'package:fluttericon/entypo_icons.dart';
|
||||
|
@ -38,6 +39,8 @@ class ProfileInfo extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _ProfileInfoState extends State<ProfileInfo> {
|
||||
int? profileId;
|
||||
String? token;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
@ -47,8 +50,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
title: const Text('Profile'),
|
||||
),
|
||||
body: ProgressHUD(
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
|
||||
if (state is UserLoggedIn) {
|
||||
profileId = state.userData!.user!.login!.user!.profileId;
|
||||
token = state.userData!.user!.login!.token!;
|
||||
return BlocConsumer<ProfileBloc, ProfileState>(
|
||||
listener: (context, state) {
|
||||
if (state is ProfileLoading) {
|
||||
|
@ -57,7 +64,7 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
'Loading Profile',
|
||||
);
|
||||
}
|
||||
if (state is ProfileLoaded) {
|
||||
if (state is ProfileLoaded || state is ProfileErrorState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress?.dismiss();
|
||||
}
|
||||
|
@ -141,12 +148,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: Elusive.group,
|
||||
title: "Family",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return FamilyBackgroundScreen(
|
||||
familyBackground:
|
||||
state.profileInformation.families);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return FamilyBackgroundScreen(
|
||||
// familyBackground:
|
||||
// state.profileInformation.families);
|
||||
// }));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
|
@ -154,13 +161,13 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: FontAwesome5.graduation_cap,
|
||||
title: "Education",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return EducationScreen(
|
||||
educationBackgrounds: state
|
||||
.profileInformation
|
||||
.educationalBackgrounds);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return EducationScreen(
|
||||
// educationBackgrounds: state
|
||||
// .profileInformation
|
||||
// .educationalBackgrounds);
|
||||
// }));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
|
@ -170,10 +177,11 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider<ProfileBloc>.value(value: ProfileBloc()..add(LoadEligibility(eligibilities: state.profileInformation.eligibilities)),
|
||||
|
||||
child: EligibiltyScreen(
|
||||
),
|
||||
return BlocProvider<ProfileBloc>.value(
|
||||
value: ProfileBloc()
|
||||
..add(GetEligibilities(
|
||||
profileId: profileId!, token: token!)),
|
||||
child: const EligibiltyScreen(),
|
||||
);
|
||||
}));
|
||||
},
|
||||
|
@ -183,12 +191,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: FontAwesome5.shopping_bag,
|
||||
title: "Work History",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return WorkHistoryScreen(
|
||||
workExperiences: state
|
||||
.profileInformation.workExperiences);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return WorkHistoryScreen(
|
||||
// workExperiences: state
|
||||
// .profileInformation.workExperiences);
|
||||
// }));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
|
@ -196,12 +204,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: FontAwesome5.walking,
|
||||
title: "Voluntary Work & Civic Services",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return VolunataryWorkScreen(
|
||||
voluntaryWorks: state
|
||||
.profileInformation.voluntaryWorks);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return VolunataryWorkScreen(
|
||||
// voluntaryWorks: state
|
||||
// .profileInformation.voluntaryWorks);
|
||||
// }));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
|
@ -209,13 +217,13 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: Elusive.lightbulb,
|
||||
title: "Learning & Development",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return LearningAndDevelopmentScreen(
|
||||
learningDevelopments: state
|
||||
.profileInformation
|
||||
.learningsAndDevelopment);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return LearningAndDevelopmentScreen(
|
||||
// learningDevelopments: state
|
||||
// .profileInformation
|
||||
// .learningsAndDevelopment);
|
||||
// }));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
|
@ -223,12 +231,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
icon: Brandico.codepen,
|
||||
title: "Personal References",
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ReferencesScreen(
|
||||
references:
|
||||
state.profileInformation.references);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return ReferencesScreen(
|
||||
// references:
|
||||
// state.profileInformation.references);
|
||||
// }));
|
||||
},
|
||||
),
|
||||
ExpandableGroup(
|
||||
|
@ -249,32 +257,32 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
subMenu(
|
||||
Icons.fitness_center, "Skills & Hobbies",
|
||||
() {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return SkillHobbiesScreen(
|
||||
skillsHobbies: state.profileInformation
|
||||
.otherInformation.skillsAndHobbies);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return SkillHobbiesScreen(
|
||||
// skillsHobbies: state.profileInformation
|
||||
// .otherInformation.skillsAndHobbies);
|
||||
// }));
|
||||
}),
|
||||
subMenu(FontAwesome5.certificate,
|
||||
"Organization Memberships", () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return OrgMembershipsScreen(
|
||||
orgMemberships: state.profileInformation
|
||||
.otherInformation.orgMemberships);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return OrgMembershipsScreen(
|
||||
// orgMemberships: state.profileInformation
|
||||
// .otherInformation.orgMemberships);
|
||||
// }));
|
||||
}),
|
||||
subMenu(Entypo.doc_text,
|
||||
"Non-Academic Recognitions", () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return NonAcademicRecognitionScreen(
|
||||
nonAcademicRecognitions: state
|
||||
.profileInformation
|
||||
.otherInformation
|
||||
.nonAcademicRecognition);
|
||||
}));
|
||||
// Navigator.push(context, MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return NonAcademicRecognitionScreen(
|
||||
// nonAcademicRecognitions: state
|
||||
// .profileInformation
|
||||
// .otherInformation
|
||||
// .nonAcademicRecognition);
|
||||
// }));
|
||||
}),
|
||||
]),
|
||||
ExpandableGroup(
|
||||
|
@ -302,6 +310,9 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
|||
if (state is ProfileLoading) {
|
||||
return const LoadingScreen();
|
||||
}
|
||||
if (state is ProfileErrorState) {
|
||||
return Text(state.mesage);
|
||||
}
|
||||
|
||||
return Container();
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||
|
@ -38,29 +39,21 @@ class _UniT2LoginState extends State<UniT2Login> {
|
|||
onWillPop: pressAgainToExit,
|
||||
child: Scaffold(
|
||||
body: ProgressHUD(
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
|
||||
if (state is UserLoggedIn) {
|
||||
if (state is UserLoggedIn ||
|
||||
state is UuidLoaded ||
|
||||
state is UserError ||
|
||||
state is InternetTimeout) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
Navigator.pushReplacementNamed(context, '/module-screen');
|
||||
}
|
||||
if (state is UuidLoaded) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
Navigator.pushNamed(context, '/qr-login');
|
||||
}
|
||||
if (state is UserError) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
if (state is InternetTimeout) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
}
|
||||
if (state is InvalidCredentials) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.dismiss();
|
||||
errorAlert(context, "Error Login", state.message,(){});
|
||||
errorAlert(context, "Error Login", state.message, () {});
|
||||
context.read<UserBloc>().add(LoadVersion());
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
|
@ -321,8 +314,8 @@ class _UniT2LoginState extends State<UniT2Login> {
|
|||
}
|
||||
if (state is UserError) {
|
||||
return SomethingWentWrong(
|
||||
message:onError ,
|
||||
onpressed:(){} ,
|
||||
message: onError,
|
||||
onpressed: () {},
|
||||
);
|
||||
}
|
||||
if (state is InternetTimeout) {
|
||||
|
|
|
@ -9,6 +9,34 @@ class EligibilityService {
|
|||
static final EligibilityService _instance = EligibilityService();
|
||||
static EligibilityService get instance => _instance;
|
||||
|
||||
|
||||
Future<List<EligibityCert>> getEligibilities(int profileId, String token)async{
|
||||
List<EligibityCert> eligibilities = [];
|
||||
String authToken = "Token $token";
|
||||
String path = "${Url.instance.getEligibilities()}$profileId/";
|
||||
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 cert) {
|
||||
EligibityCert eligibility = EligibityCert.fromJson(cert);
|
||||
eligibilities.add(eligibility);
|
||||
});
|
||||
}
|
||||
}
|
||||
// }catch(e){
|
||||
// throw e.toString();
|
||||
// }
|
||||
return eligibilities;
|
||||
}
|
||||
|
||||
Future<bool> delete(
|
||||
{required int eligibilityId,
|
||||
required int profileId,
|
||||
|
@ -22,7 +50,7 @@ class EligibilityService {
|
|||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': authtoken
|
||||
};
|
||||
// try{
|
||||
try{
|
||||
http.Response response = await Request.instance
|
||||
.deleteRequest(path: path, headers: headers, body: body, param: params);
|
||||
if (response.statusCode == 200) {
|
||||
|
@ -32,9 +60,9 @@ class EligibilityService {
|
|||
success = false;
|
||||
}
|
||||
|
||||
// }catch(e){
|
||||
// throw(e.toString());
|
||||
// }
|
||||
}catch(e){
|
||||
throw(e.toString());
|
||||
}
|
||||
return success!;
|
||||
}
|
||||
|
||||
|
@ -43,7 +71,7 @@ class EligibilityService {
|
|||
required String token,
|
||||
required int profileId}) async {
|
||||
Map<dynamic, dynamic>? _response={};
|
||||
String authtoken = "Token $token+1";
|
||||
String authtoken = "Token $token";
|
||||
String path = '${Url.instance.addEligibility()}$profileId/';
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
@ -74,4 +102,42 @@ class EligibilityService {
|
|||
throw e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<dynamic, dynamic>> update(
|
||||
{required EligibityCert eligibityCert,
|
||||
required String token,
|
||||
required int profileId, required int oldEligibility}) async {
|
||||
Map<dynamic, dynamic>? response={};
|
||||
String authtoken = "Token $token";
|
||||
String path = '${Url.instance.addEligibility()}$profileId/';
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': authtoken
|
||||
};
|
||||
|
||||
Map body = {
|
||||
'eligibility_id': eligibityCert.eligibility!.id,
|
||||
'license_number': eligibityCert.licenseNumber,
|
||||
'exam_date': eligibityCert.examDate?.toString(),
|
||||
'validity_date': eligibityCert.validityDate?.toString(),
|
||||
'rating': eligibityCert.rating,
|
||||
'_citymunCode': eligibityCert.examAddress?.cityMunicipality?.code,
|
||||
'_countryId': eligibityCert.examAddress?.country!.id,
|
||||
'_oldEligibilityId': oldEligibility
|
||||
};
|
||||
try {
|
||||
http.Response res = await Request.instance
|
||||
.putRequest(path: path, body: body, headers: headers, param: {});
|
||||
if (res.statusCode == 200) {
|
||||
Map data = jsonDecode(res.body);
|
||||
response = data;
|
||||
} else {
|
||||
response.addAll({'success':false});
|
||||
}
|
||||
|
||||
return response;
|
||||
} catch (e) {
|
||||
throw e.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class ProfileService {
|
|||
List<MainAdress> addresses = [];
|
||||
List<Identification> identificationInformation = [];
|
||||
List<ContactInfo> contactInformation = [];
|
||||
List<EligibityCert> eligibilities = [];
|
||||
|
||||
List<FamilyBackground> families = [];
|
||||
List<Citizenship> citizenships = [];
|
||||
List<LearningDevelopement> learningsDevelopments = [];
|
||||
|
@ -50,9 +50,10 @@ class ProfileService {
|
|||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': "Token $token"
|
||||
};
|
||||
Map<String,String> param={"basic":"true"};
|
||||
// try{
|
||||
http.Response response = await Request.instance
|
||||
.getRequest(path: path, param: {}, headers: headers);
|
||||
.getRequest(path: path, param: param, headers: headers);
|
||||
if (response.statusCode == 200) {
|
||||
Map data = jsonDecode(response.body);
|
||||
|
||||
|
@ -92,100 +93,100 @@ class ProfileService {
|
|||
}
|
||||
|
||||
// get all family background
|
||||
if(data['data']['family_background'] != null){
|
||||
data['data']['family_background'].forEach((var family){
|
||||
FamilyBackground familyBackground = FamilyBackground.fromJson(family);
|
||||
families.add(familyBackground);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
// 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,
|
||||
|
@ -193,20 +194,21 @@ class ProfileService {
|
|||
identifications: identificationInformation,
|
||||
citizenships: citizenships,
|
||||
addresses: addresses);
|
||||
OtherInformation otherInformation = OtherInformation(
|
||||
skillsAndHobbies: skillsHobbies,
|
||||
orgMemberships: orgMemberships,
|
||||
nonAcademicRecognition: nonAcademicRecognitions);
|
||||
// OtherInformation otherInformation = OtherInformation(
|
||||
// skillsAndHobbies: skillsHobbies,
|
||||
// orgMemberships: orgMemberships,
|
||||
// nonAcademicRecognition: nonAcademicRecognitions);
|
||||
ProfileInformation profileInformation = ProfileInformation(
|
||||
families: families,
|
||||
otherInformation: otherInformation,
|
||||
workExperiences: workExperiences,
|
||||
// families: families,
|
||||
// otherInformation: otherInformation,
|
||||
// workExperiences: workExperiences,
|
||||
basicInfo: basicInfo,
|
||||
eligibilities: eligibilities,
|
||||
references: references,
|
||||
learningsAndDevelopment: learningsDevelopments,
|
||||
educationalBackgrounds: educationalBackgrounds,
|
||||
voluntaryWorks: voluntaryWorks);
|
||||
// eligibilities: eligibilities,
|
||||
// references: references,
|
||||
// learningsAndDevelopment: learningsDevelopments,
|
||||
// educationalBackgrounds: educationalBackgrounds,
|
||||
// voluntaryWorks: voluntaryWorks
|
||||
);
|
||||
profileInformation0 = profileInformation;
|
||||
}
|
||||
// }catch(e){
|
||||
|
@ -215,3 +217,5 @@ class ProfileService {
|
|||
return profileInformation0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,6 +58,6 @@ successAlert(context, title, description,Function() func) {
|
|||
headerAnimationLoop: false,
|
||||
title: title,
|
||||
desc: description,
|
||||
btnOk: SizedBox(height: 50,child: ElevatedButton(style: mainBtnStyle(primary, Colors.transparent, second), onPressed: func, child: const Text("OK")), )
|
||||
btnOk: SizedBox(height: 50,child: ElevatedButton(style: mainBtnStyle(success2, Colors.transparent, success), onPressed: func, child: const Text("OK")), )
|
||||
).show();
|
||||
}
|
||||
|
|
|
@ -97,46 +97,86 @@ class Request {
|
|||
return response;
|
||||
}
|
||||
|
||||
Future<Response> putRequest(
|
||||
{required String path,
|
||||
required Map<String, String>? headers,
|
||||
required Map? body,
|
||||
required Map<String, dynamic>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response =await put(Uri.http(host,path,param),headers: headers,body: jsonEncode(body));
|
||||
} on TimeoutException catch (_) {
|
||||
Fluttertoast.showToast(
|
||||
msg: timeoutError,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
throw (timeoutError);
|
||||
} on SocketException catch (_) {
|
||||
Fluttertoast.showToast(
|
||||
msg: timeoutError,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
throw (timeoutError);
|
||||
} on FormatException catch (_) {
|
||||
throw const FormatException(formatError);
|
||||
} on HttpException catch (_) {
|
||||
throw const HttpException(httpError);
|
||||
} on Error catch (e) {
|
||||
debugPrint("post request error: $e");
|
||||
Fluttertoast.showToast(
|
||||
msg: onError,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
throw (e.toString());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<Response> deleteRequest(
|
||||
{required String path,
|
||||
required Map<String, String>? headers,
|
||||
required Map? body,
|
||||
required Map<String, dynamic>? param}) async {
|
||||
Response response;
|
||||
// try {
|
||||
try {
|
||||
response = await delete(Uri.http(host, path, param),
|
||||
headers: headers, body: jsonEncode(body))
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
// } on TimeoutException catch (_) {
|
||||
// Fluttertoast.showToast(
|
||||
// msg: timeoutError,
|
||||
// toastLength: Toast.LENGTH_LONG,
|
||||
// gravity: ToastGravity.BOTTOM,
|
||||
// backgroundColor: Colors.black,
|
||||
// );
|
||||
// throw (timeoutError);
|
||||
// } on SocketException catch (_) {
|
||||
// Fluttertoast.showToast(
|
||||
// msg: timeoutError,
|
||||
// toastLength: Toast.LENGTH_LONG,
|
||||
// gravity: ToastGravity.BOTTOM,
|
||||
// backgroundColor: Colors.black,
|
||||
// );
|
||||
// throw (timeoutError);
|
||||
// } on FormatException catch (_) {
|
||||
// throw const FormatException(formatError);
|
||||
// } on HttpException catch (_) {
|
||||
// throw const HttpException(httpError);
|
||||
// } on Error catch (e) {
|
||||
// debugPrint("post request error: $e");
|
||||
// Fluttertoast.showToast(
|
||||
// msg: onError,
|
||||
// toastLength: Toast.LENGTH_LONG,
|
||||
// gravity: ToastGravity.BOTTOM,
|
||||
// backgroundColor: Colors.black,
|
||||
// );
|
||||
// throw (e.toString());
|
||||
// }
|
||||
} on TimeoutException catch (_) {
|
||||
Fluttertoast.showToast(
|
||||
msg: timeoutError,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
throw (timeoutError);
|
||||
} on SocketException catch (_) {
|
||||
Fluttertoast.showToast(
|
||||
msg: timeoutError,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
throw (timeoutError);
|
||||
} on FormatException catch (_) {
|
||||
throw const FormatException(formatError);
|
||||
} on HttpException catch (_) {
|
||||
throw const HttpException(httpError);
|
||||
} on Error catch (e) {
|
||||
Fluttertoast.showToast(
|
||||
msg: onError,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
throw (e.toString());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,11 @@ class Url {
|
|||
static Url get instance => _instance;
|
||||
|
||||
String host() {
|
||||
// return '192.168.10.221:3003';
|
||||
// // return '192.168.10.221:3003';
|
||||
// return 'agusandelnorte.gov.ph';
|
||||
// return "192.168.10.219:3000";
|
||||
return 'devweb.agusandelnorte.gov.ph';
|
||||
return "devweb.agusandelnorte.gov.ph";
|
||||
// return 'devapi.agusandelnorte.gov.ph:3004';
|
||||
}
|
||||
|
||||
String authentication() {
|
||||
|
@ -14,23 +15,33 @@ class Url {
|
|||
}
|
||||
|
||||
String profileInformation(){
|
||||
return '/api/jobnet_app/profile/pds/';
|
||||
return 'api/jobnet_app/profile/pds/';
|
||||
}
|
||||
|
||||
String latestApk(){
|
||||
return "/api/system_app/apk_version/latest";
|
||||
}
|
||||
|
||||
////ELIGIBILITIES PATHS
|
||||
String eligibilities(){
|
||||
return "/api/jobnet_app/eligibilities/";
|
||||
}
|
||||
|
||||
String getEligibilities(){
|
||||
return "/api/jobnet_app/profile/pds/eligibility/";
|
||||
}
|
||||
|
||||
String addEligibility(){
|
||||
return "/api/jobnet_app/profile/pds/eligibility/";
|
||||
}
|
||||
String deleteEligibility(){
|
||||
return "/api/jobnet_app/profile/pds/eligibility/";
|
||||
}
|
||||
|
||||
String updateEligibility(){
|
||||
return "/api/jobnet_app/profile/pds/eligibility/";
|
||||
}
|
||||
|
||||
// location utils path
|
||||
String getCounties(){
|
||||
return "/api/jobnet_app/countries/";
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:flutter/src/widgets/placeholder.dart';
|
||||
|
||||
class CloseLeading extends StatelessWidget {
|
||||
final Function() onPressed;
|
||||
const CloseLeading({super.key, required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IconButton(onPressed: onPressed, icon: const Icon(Icons.close));
|
||||
}
|
||||
}
|
|
@ -3,6 +3,8 @@ PODS:
|
|||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
- modal_progress_hud_nsn (0.0.1):
|
||||
- FlutterMacOS
|
||||
- package_info_plus (0.0.1):
|
||||
- FlutterMacOS
|
||||
- path_provider_foundation (0.0.1):
|
||||
|
@ -17,6 +19,7 @@ PODS:
|
|||
|
||||
DEPENDENCIES:
|
||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||
- modal_progress_hud_nsn (from `Flutter/ephemeral/.symlinks/plugins/modal_progress_hud_nsn/macos`)
|
||||
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
|
||||
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`)
|
||||
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos`)
|
||||
|
@ -29,6 +32,8 @@ SPEC REPOS:
|
|||
EXTERNAL SOURCES:
|
||||
FlutterMacOS:
|
||||
:path: Flutter/ephemeral
|
||||
modal_progress_hud_nsn:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/modal_progress_hud_nsn/macos
|
||||
package_info_plus:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
|
||||
path_provider_foundation:
|
||||
|
@ -41,6 +46,7 @@ EXTERNAL SOURCES:
|
|||
SPEC CHECKSUMS:
|
||||
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
modal_progress_hud_nsn: 8099d46c2cf9de7af8fe0a3f8f5d2aa32cf956c3
|
||||
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
|
||||
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
|
||||
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
|
||||
|
|
Loading…
Reference in New Issue