edit eligibility country error fix

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
PGAN-MIS 2023-02-20 15:48:24 +08:00
parent 3a53445ec6
commit fb1ec643cd
31 changed files with 658 additions and 1723 deletions

View File

@ -4,15 +4,15 @@ import 'package:unit2/model/profile/basic_info.dart';
import 'package:unit2/model/profile/basic_information/primary-information.dart';
import 'package:unit2/model/profile/eligibility.dart';
import 'package:unit2/model/profile/profileInfomation.dart';
import 'package:unit2/model/utils/eligibilities_choices.dart';
import 'package:unit2/model/utils/eligibility.dart';
import 'package:unit2/sevices/profile/profile_service.dart';
import 'package:unit2/utils/location_utilities.dart';
import 'package:unit2/utils/profile_utilities.dart';
import '../../model/location/country.dart' as country;
import '../../model/location/region.dart' as region;
import '../../model/location/provinces.dart' as province;
import '../../model/location/city.dart' as city;
import '../../model/location/barangay.dart' as barangay;
import '../../model/location/country.dart';
import '../../model/location/region.dart';
import '../../model/location/provinces.dart';
import '../../model/location/city.dart';
import '../../model/location/barangay.dart';
part 'profile_event.dart';
part 'profile_state.dart';
@ -35,17 +35,53 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
emit(ProfileLoading());
emit(EligibilityLoaded(eligibilities: event.eligibilities));
});
on<EditEligibility>((event, emit) async{
on<EditEligibilityNotOverseas>((event, emit) async {
// try{
List<country.Country> countries = await LocationUtils.instance.getCountries();
List<region.Region> regions = await LocationUtils.instance.getRegions();
List<EligibilityList> eligibilities = await ProfileUtilities.instance.getEligibilities();
List<province.Province> provinces = await LocationUtils.instance.getProvinces(regionCode: event.eligibityCert.examAddress!.cityMunicipality!.province!.region!.code!.toString());
emit(EditEligibilityState(provinces: provinces, eligibityCert: event.eligibityCert,countries: countries,regions: regions,eligibilities: eligibilities));
emit(ProfileLoading());
List<Region> regions = await LocationUtils.instance.getRegions();
List<Eligibility> eligibilities =
await ProfileUtilities.instance.getEligibilities();
bool? isOverseas = event.eligibityCert.overseas;
List<Province> provinces =
event.eligibityCert.examAddress?.cityMunicipality?.province?.region != null
? await LocationUtils.instance.getProvinces(
regionCode: event.eligibityCert.examAddress!.cityMunicipality!
.province!.region!.code!
.toString())
: [];
List<CityMunicipality> citymuns =
event.eligibityCert.examAddress?.cityMunicipality != null
? await LocationUtils.instance.getCities(
code: event.eligibityCert.examAddress!.cityMunicipality!
.province!.code!)
: [];
emit(EditNotOverseasEligibilityState(
currentEligibility: null,
currentRegion: null,
isOverseas: isOverseas!,
cityMuns: citymuns,
provinces: provinces,
eligibityCert: event.eligibityCert,
regions: regions,
eligibilities: eligibilities));
// }catch(e){
// emit(ProfileErrorState(mesage: e.toString()));
// }
});on<EditEligibilityOverseas>((event,emit)async{
emit(ProfileLoading());
List<Country> countries = await LocationUtils.instance.getCountries();
List<Eligibility> eligibilities =
await ProfileUtilities.instance.getEligibilities();
bool? isOverseas = event.eligibityCert.overseas;
emit(EditOverseasEligibilityState(
countries: countries,
currentCOuntry: null,
currentEligibility: null,
isOverseas: isOverseas!,
eligibityCert: event.eligibityCert,
eligibilities: eligibilities));
});
}
}

View File

@ -28,9 +28,16 @@ class LoadEligibility extends ProfileEvent{
List<Object> get props => [];
}
class EditEligibility extends ProfileEvent{
class EditEligibilityOverseas extends ProfileEvent{
final EligibityCert eligibityCert;
const EditEligibility({required this.eligibityCert});
const EditEligibilityOverseas({required this.eligibityCert});
@override
List<Object> get props => [];
}
class EditEligibilityNotOverseas extends ProfileEvent{
final EligibityCert eligibityCert;
const EditEligibilityNotOverseas({required this.eligibityCert});
@override
List<Object> get props => [];
}

View File

@ -23,9 +23,7 @@ class ProfileErrorState extends ProfileState{
List<Object> get props => [mesage];
}
class ProfileLoading extends ProfileState{
}
class ProfileLoading extends ProfileState {}
class EligibilityLoaded extends ProfileState {
final List<EligibityCert> eligibilities;
@ -34,13 +32,44 @@ class EligibilityLoaded extends ProfileState{
List<Object> get props => [eligibilities];
}
class EditEligibilityState extends ProfileState{
class EditNotOverseasEligibilityState extends ProfileState {
final EligibityCert eligibityCert;
final List<EligibilityList> eligibilities;
final List<country.Country> countries;
final List<region.Region> regions;
List<province.Province> provinces;
EditEligibilityState({ required this.provinces,required this.eligibityCert, required this.eligibilities, required this.countries, required this.regions});
@override
List<Object> get props => [eligibityCert];
final List<Eligibility> eligibilities;
final List<Region> regions;
List<Province> provinces;
List<CityMunicipality> cityMuns;
Eligibility? currentEligibility;
Region? currentRegion;
Province? currentProvince;
bool? isOverseas;
EditNotOverseasEligibilityState(
{required this.currentEligibility,
required this.currentRegion,
required this.isOverseas,
required this.cityMuns,
required this.provinces,
required this.eligibityCert,
required this.eligibilities,
required this.regions});
}
class EditOverseasEligibilityState extends ProfileState {
final List<Eligibility> eligibilities;
final EligibityCert eligibityCert;
final Eligibility? currentEligibility;
final List<Country> countries;
final Country? currentCOuntry;
bool? isOverseas;
EditOverseasEligibilityState(
{required this.currentEligibility,
required this.eligibilities,
required this.isOverseas,
required this.eligibityCert,
required this.countries,
required this.currentCOuntry});
}

View File

@ -0,0 +1,23 @@
class AddressCategory {
AddressCategory({
required this.id,
required this.name,
required this.type,
});
final int? id;
final String? name;
final String? type;
factory AddressCategory.fromJson(Map<String, dynamic> json) => AddressCategory(
id: json["id"],
name: json["name"],
type: json["type"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"type": type,
};
}

View File

@ -5,6 +5,9 @@
import 'package:meta/meta.dart';
import 'dart:convert';
import 'city.dart';
import 'provinces.dart';
Barangay barangayFromJson(String str) => Barangay.fromJson(json.decode(str));
String barangayToJson(Barangay data) => json.encode(data.toJson());
@ -33,90 +36,6 @@ class Barangay {
};
}
class CityMunicipality {
CityMunicipality({
required this.code,
required this.description,
required this.province,
required this.psgcCode,
required this.zipcode,
});
final String? code;
final String? description;
final Province? province;
final String? psgcCode;
final String? zipcode;
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"],
description: json["description"],
province: json['province'] == null? null:Province.fromJson(json["province"]),
psgcCode: json["psgc_code"],
zipcode: json["zipcode"],
);
Map<String, dynamic> toJson() => {
"code": code,
"description": description,
"province": province!.toJson(),
"psgc_code": psgcCode,
"zipcode": zipcode,
};
}
class Province {
Province({
required this.code,
required this.description,
required this.region,
required this.psgcCode,
required this.shortname,
});
final String? code;
final String? description;
final Region? region;
final String? psgcCode;
final String? shortname;
factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"],
description: json["description"],
region: json['region'] == null? null: Region.fromJson(json["region"]),
psgcCode: json["psgc_code"],
shortname: json["shortname"],
);
Map<String, dynamic> toJson() => {
"code": code,
"description": description,
"region": region!.toJson(),
"psgc_code": psgcCode,
"shortname": shortname,
};
}
class Region {
Region({
required this.code,
required this.description,
required this.psgcCode,
});
final int? code;
final String? description;
final String? psgcCode;
factory Region.fromJson(Map<String, dynamic> json) => Region(
code: json["code"],
description: json["description"],
psgcCode: json["psgc_code"],
);
Map<String, dynamic> toJson() => {
"code": code,
"description": description,
"psgc_code": psgcCode,
};
}

View File

@ -5,12 +5,15 @@
import 'package:meta/meta.dart';
import 'dart:convert';
City cityFromJson(String str) => City.fromJson(json.decode(str));
import 'provinces.dart';
import 'region.dart';
String cityToJson(City data) => json.encode(data.toJson());
CityMunicipality cityFromJson(String str) => CityMunicipality.fromJson(json.decode(str));
class City {
City({
String cityToJson(CityMunicipality data) => json.encode(data.toJson());
class CityMunicipality {
CityMunicipality({
required this.code,
required this.description,
required this.province,
@ -24,7 +27,7 @@ class City {
final String? psgcCode;
final String? zipcode;
factory City.fromJson(Map<String, dynamic> json) => City(
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"],
description: json["description"],
province: json['province'] == null? null : Province.fromJson(json["province"]),
@ -41,58 +44,4 @@ class City {
};
}
class Province {
Province({
required this.code,
required this.description,
required this.region,
required this.psgcCode,
required this.shortname,
});
final String? code;
final String? description;
final Region? region;
final String? psgcCode;
final String? shortname;
factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"],
description: json["description"],
region: json['region'] == null ? null : Region.fromJson(json["region"]),
psgcCode: json["psgc_code"],
shortname: json["shortname"],
);
Map<String, dynamic> toJson() => {
"code": code,
"description": description,
"region": region!.toJson(),
"psgc_code": psgcCode,
"shortname": shortname,
};
}
class Region {
Region({
required this.code,
required this.description,
required this.psgcCode,
});
final int? code;
final String? description;
final String? psgcCode;
factory Region.fromJson(Map<String, dynamic> json) => Region(
code: json["code"],
description: json["description"],
psgcCode: json["psgc_code"],
);
Map<String, dynamic> toJson() => {
"code": code,
"description": description,
"psgc_code": psgcCode,
};
}

View File

@ -0,0 +1,23 @@
class Subdivision {
Subdivision({
this.id,
this.lotNo,
this.blockNo,
});
final int? id;
final int? lotNo;
final int? blockNo;
factory Subdivision.fromJson(Map<String, dynamic> json) => Subdivision(
id: json["id"],
lotNo: json["lot_no"],
blockNo: json["block_no"],
);
Map<String, dynamic> toJson() => {
"id": id,
"lot_no": lotNo,
"block_no": blockNo,
};
}

View File

@ -1,5 +1,11 @@
import '../../location/barangay.dart';
import '../../location/city.dart';
import '../../location/country.dart';
import '../../location/subdivision.dart';
import '../../utils/category.dart';
class MainAdress {
MainAdress({
this.id,
@ -64,186 +70,7 @@ class AddressClass {
};
}
class Barangay {
Barangay({
this.code,
this.description,
this.cityMunicipality,
});
final String? code;
final String? description;
final CityMunicipality? cityMunicipality;
factory Barangay.fromJson(Map<String, dynamic> json) => Barangay(
code: json["code"],
description: json["description"],
cityMunicipality: json["city_municipality"] == null ? null : CityMunicipality.fromJson(json["city_municipality"]),
);
Map<String, dynamic> toJson() => {
"code": code,
"description": description,
"city_municipality": cityMunicipality?.toJson(),
};
}
class CityMunicipality {
CityMunicipality({
this.code,
this.zipcode,
this.province,
this.psgcCode,
this.description,
});
final String? code;
final String? zipcode;
final Province? province;
final String? psgcCode;
final String? description;
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"],
zipcode: json["zipcode"],
province: json["province"] == null ? null : Province.fromJson(json["province"]),
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"zipcode": zipcode,
"province": province?.toJson(),
"psgc_code": psgcCode,
"description": description,
};
}
class Province {
Province({
this.code,
this.region,
this.psgcCode,
this.shortname,
this.description,
});
final String? code;
final Region? region;
final String? psgcCode;
final String? shortname;
final String? description;
factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"],
region: json["region"] == null ? null : Region.fromJson(json["region"]),
psgcCode: json["psgc_code"],
shortname: json["shortname"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"region": region?.toJson(),
"psgc_code": psgcCode,
"shortname": shortname,
"description": description,
};
}
class Region {
Region({
this.code,
this.psgcCode,
this.description,
});
final int? code;
final String? psgcCode;
final String? description;
factory Region.fromJson(Map<String, dynamic> json) => Region(
code: json["code"],
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"psgc_code": psgcCode,
"description": description,
};
}
class Category {
Category({
this.id,
this.name,
this.type,
});
final int? id;
final String? name;
final String? type;
factory Category.fromJson(Map<String, dynamic> json) => Category(
id: json["id"],
name: json["name"],
type: json["type"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"type": type,
};
}
class Country {
Country({
this.id,
this.code,
this.name,
});
final int? id;
final String? code;
final String? name;
factory Country.fromJson(Map<String, dynamic> json) => Country(
id: json["id"],
code: json["code"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"name": name,
};
}
class Subdivision {
Subdivision({
this.id,
this.lotNo,
this.blockNo,
});
final int? id;
final int? lotNo;
final int? blockNo;
factory Subdivision.fromJson(Map<String, dynamic> json) => Subdivision(
id: json["id"],
lotNo: json["lot_no"],
blockNo: json["block_no"],
);
Map<String, dynamic> toJson() => {
"id": id,
"lot_no": lotNo,
"block_no": blockNo,
};
}

View File

@ -1,4 +1,6 @@
import '../../location/country.dart';
class Citizenship {
Citizenship({
required this.country,
@ -18,27 +20,3 @@ class Citizenship {
"natural_born": naturalBorn,
};
}
class Country {
Country({
required this.id,
required this.code,
required this.name,
});
final int? id;
final String? code;
final String? name;
factory Country.fromJson(Map<String, dynamic> json) => Country(
id: json["id"],
code: json["code"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"name": name,
};
}

View File

@ -3,6 +3,8 @@
// final contactInformation = contactInformationFromJson(jsonString);
import '../../utils/agency.dart';
class ContactInfo {
ContactInfo({
required this.id,
@ -83,81 +85,6 @@ class ServiceProvider {
};
}
class Agency {
Agency({
required this.id,
required this.name,
required this.category,
required this.privateEntity,
});
int? id;
String? name;
Category? category;
bool? privateEntity;
factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"],
name: json["name"],
category: json["category"] == null? null : Category.fromJson(json["category"]),
privateEntity: json["private_entity"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"category": category!.toJson(),
"private_entity": privateEntity,
};
}
class Category {
Category({
required this.id,
required this.name,
required this.industryClass,
});
int? id;
String? name;
IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
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 IndustryClass {
IndustryClass({
required this.id,
required this.name,
this.description,
});
int? id;
String? name;
String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}
class ServiceType {
ServiceType({

View File

@ -1,5 +1,9 @@
import 'dart:convert';
import '../../location/city.dart';
import '../../location/country.dart';
import '../../utils/agency.dart';
Identification identificationFromJson(String str) => Identification.fromJson(json.decode(str));
String identificationToJson(Identification data) => json.encode(data.toJson());
@ -44,81 +48,6 @@ class Identification {
};
}
class Agency {
Agency({
required this.id,
required this.name,
required this.category,
required this.privateEntity,
});
int? id;
String? name;
Category? category;
bool? privateEntity;
factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"],
name: json["name"],
category: json["category"] == null? null: Category.fromJson(json["category"]),
privateEntity: json["private_entity"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"category": category!.toJson(),
"private_entity": privateEntity,
};
}
class Category {
Category({
required this.id,
required this.name,
required this.industryClass,
});
int? id;
String? name;
IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
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 IndustryClass {
IndustryClass({
required this.id,
required this.name,
this.description,
});
int? id;
String? name;
String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}
class IssuedAt {
IssuedAt({
@ -179,115 +108,3 @@ class AddressCategory {
"type": type,
};
}
class CityMunicipality {
CityMunicipality({
required this.code,
required this.zipcode,
required this.province,
required this.psgcCode,
required this.description,
});
String? code;
String? zipcode;
Province? province;
String? psgcCode;
String? description;
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"],
zipcode: json["zipcode"],
province:json["province"] == null? null : Province.fromJson(json["province"]),
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"zipcode": zipcode,
"province": province!.toJson(),
"psgc_code": psgcCode,
"description": description,
};
}
class Province {
Province({
required this.code,
required this.region,
required this.psgcCode,
required this.shortname,
required this.description,
});
String? code;
Region? region;
String? psgcCode;
String? shortname;
String? description;
factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"],
region: json["region"] == null? null:Region.fromJson(json["region"]),
psgcCode: json["psgc_code"],
shortname: json["shortname"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"region": region!.toJson(),
"psgc_code": psgcCode,
"shortname": shortname,
"description": description,
};
}
class Region {
Region({
required this.code,
required this.psgcCode,
required this.description,
});
int? code;
String? psgcCode;
String? description;
factory Region.fromJson(Map<String, dynamic> json) => Region(
code: json["code"],
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"psgc_code": psgcCode,
"description": description,
};
}
class Country {
Country({
required this.id,
required this.code,
required this.name,
});
int? id;
String? code;
String? name;
factory Country.fromJson(Map<String, dynamic> json) => Country(
id: json["id"],
code: json["code"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"name": name,
};
}

View File

@ -5,6 +5,13 @@
import 'package:meta/meta.dart';
import 'dart:convert';
import 'package:unit2/model/location/region.dart';
import '../location/address_category.dart';
import '../location/city.dart';
import '../location/country.dart';
import '../utils/eligibility.dart';
EligibityCert eligibityFromJson(String str) => EligibityCert.fromJson(json.decode(str));
String eligibityToJson(EligibityCert data) => json.encode(data.toJson());
@ -19,8 +26,9 @@ class EligibityCert {
required this.examAddress,
required this.validityDate,
required this.licenseNumber,
required this.overseas,
});
bool? overseas;
final int? id;
final double? rating;
final DateTime? examDate;
@ -39,6 +47,7 @@ class EligibityCert {
examAddress: json['exam_address'] == null? null: ExamAddress.fromJson(json["exam_address"]),
validityDate: json["validity_date"],
licenseNumber: json["license_number"],
overseas: null,
);
Map<String, dynamic> toJson() => {
@ -53,29 +62,6 @@ class EligibityCert {
};
}
class Eligibility {
Eligibility({
required this.id,
required this.type,
required this.title,
});
final int? id;
final String? type;
final String? title;
factory Eligibility.fromJson(Map<String, dynamic> json) => Eligibility(
id: json["id"],
type: json["type"],
title: json["title"],
);
Map<String, dynamic> toJson() => {
"id": id,
"type": type,
"title": title,
};
}
class ExamAddress {
ExamAddress({
@ -113,138 +99,3 @@ class ExamAddress {
};
}
class AddressCategory {
AddressCategory({
required this.id,
required this.name,
required this.type,
});
final int? id;
final String? name;
final String? type;
factory AddressCategory.fromJson(Map<String, dynamic> json) => AddressCategory(
id: json["id"],
name: json["name"],
type: json["type"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"type": type,
};
}
class CityMunicipality {
CityMunicipality({
required this.code,
required this.zipcode,
required this.province,
required this.psgcCode,
required this.description,
});
final String? code;
final String? zipcode;
final Province? province;
final String? psgcCode;
final String? description;
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"],
zipcode: json["zipcode"],
province: json["province"]== null? null: Province.fromJson(json["province"]),
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"zipcode": zipcode,
"province": province!.toJson(),
"psgc_code": psgcCode,
"description": description,
};
}
class Province {
Province({
required this.code,
required this.region,
required this.psgcCode,
required this.shortname,
required this.description,
});
final String? code;
final Region? region;
final String? psgcCode;
final String? shortname;
final String? description;
factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"],
region:json["region"] == null? null: Region.fromJson(json["region"]),
psgcCode: json["psgc_code"],
shortname: json["shortname"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"region": region!.toJson(),
"psgc_code": psgcCode,
"shortname": shortname,
"description": description,
};
}
class Region {
Region({
required this.code,
required this.psgcCode,
required this.description,
});
final int? code;
final String? psgcCode;
final String? description;
factory Region.fromJson(Map<String, dynamic> json) => Region(
code: json["code"],
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"psgc_code": psgcCode,
"description": description,
};
}
class Country {
Country({
required this.id,
required this.code,
required this.name,
});
final int? id;
final String? code;
final String? name;
factory Country.fromJson(Map<String, dynamic> json) => Country(
id: json["id"],
code: json["code"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"name": name,
};
}

View File

@ -5,6 +5,9 @@
import 'dart:convert';
import 'dart:ffi';
import '../utils/category.dart';
import '../utils/position.dart';
FamilyBackground familyBackgroundFromJson(String str) => FamilyBackground.fromJson(json.decode(str));
String familyBackgroundToJson(FamilyBackground data) => json.encode(data.toJson());
@ -81,53 +84,6 @@ class Company {
};
}
class Category {
Category({
this.id,
this.name,
this.industryClass,
});
final int? id;
final String? name;
final IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
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 IndustryClass {
IndustryClass({
this.id,
this.name,
this.description,
});
final int? id;
final String? name;
final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}
class EmergencyContact {
EmergencyContact({
@ -173,25 +129,6 @@ class EmergencyContact {
};
}
class Position {
Position({
this.id,
this.title,
});
final int? id;
final String? title;
factory Position.fromJson(Map<String, dynamic> json) => Position(
id: json["id"],
title: json["title"],
);
Map<String, dynamic> toJson() => {
"id": id,
"title": title,
};
}
class RelatedPerson {
RelatedPerson({

View File

@ -4,6 +4,10 @@
import 'dart:convert';
import '../location/city.dart';
import '../location/country.dart';
import '../utils/industry_class.dart';
LearningDevelopement learningDevelopementFromJson(String str) => LearningDevelopement.fromJson(json.decode(str));
String learningDevelopementToJson(LearningDevelopement data) => json.encode(data.toJson());
@ -144,29 +148,6 @@ class SponsoredByCategory {
};
}
class IndustryClass {
IndustryClass({
this.id,
this.name,
this.description,
});
final int? id;
final String? name;
final dynamic description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}
class LearningDevelopmentType {
LearningDevelopmentType({
@ -248,114 +229,3 @@ class VenueCategory {
};
}
class CityMunicipality {
CityMunicipality({
this.code,
this.zipcode,
this.province,
this.psgcCode,
this.description,
});
final String? code;
final String? zipcode;
final Province? province;
final String? psgcCode;
final String? description;
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"],
zipcode: json["zipcode"],
province: json["province"] == null ? null : Province.fromJson(json["province"]),
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"zipcode": zipcode,
"province": province?.toJson(),
"psgc_code": psgcCode,
"description": description,
};
}
class Province {
Province({
this.code,
this.region,
this.psgcCode,
this.shortname,
this.description,
});
final String? code;
final Region? region;
final String? psgcCode;
final String? shortname;
final String? description;
factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"],
region: json["region"] == null ? null : Region.fromJson(json["region"]),
psgcCode: json["psgc_code"],
shortname: json["shortname"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"region": region?.toJson(),
"psgc_code": psgcCode,
"shortname": shortname,
"description": description,
};
}
class Region {
Region({
this.code,
this.psgcCode,
this.description,
});
final int? code;
final String? psgcCode;
final String? description;
factory Region.fromJson(Map<String, dynamic> json) => Region(
code: json["code"],
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"psgc_code": psgcCode,
"description": description,
};
}
class Country {
Country({
this.id,
this.code,
this.name,
});
final int? id;
final String? code;
final String? name;
factory Country.fromJson(Map<String, dynamic> json) => Country(
id: json["id"],
code: json["code"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"name": name,
};
}

View File

@ -4,6 +4,8 @@
import 'dart:convert';
import '../../utils/category.dart';
NonAcademicRecognition nonAcademicRecognitionFromJson(String str) => NonAcademicRecognition.fromJson(json.decode(str));
String nonAcademicRecognitionToJson(NonAcademicRecognition data) => json.encode(data.toJson());
@ -60,50 +62,3 @@ class Presenter {
};
}
class Category {
Category({
this.id,
this.name,
this.industryClass,
});
final int? id;
final String? name;
final IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
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 IndustryClass {
IndustryClass({
this.id,
this.name,
this.description,
});
final int? id;
final String? name;
final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}

View File

@ -4,6 +4,8 @@
import 'dart:convert';
import '../../utils/agency.dart';
OrganizationMembership organizationMembershipFromJson(String str) => OrganizationMembership.fromJson(json.decode(str));
String organizationMembershipToJson(OrganizationMembership data) => json.encode(data.toJson());
@ -24,78 +26,4 @@ class OrganizationMembership {
};
}
class Agency {
Agency({
this.id,
this.name,
this.category,
this.privateEntity,
});
final int? id;
final String? name;
final Category? category;
final bool? privateEntity;
factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"],
name: json["name"],
category: json["category"] == null ? null : Category.fromJson(json["category"]),
privateEntity: json["private_entity"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"category": category?.toJson(),
"private_entity": privateEntity,
};
}
class Category {
Category({
this.id,
this.name,
this.industryClass,
});
final int? id;
final String? name;
final IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
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 IndustryClass {
IndustryClass({
this.id,
this.name,
this.description,
});
final int? id;
final String? name;
final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}

View File

@ -1,6 +1,12 @@
// To parse this JSON data, do
//
// final references = referencesFromJson(jsonString);
import '../location/address_category.dart';
import '../location/barangay.dart';
import '../location/city.dart';
import '../location/country.dart';
import '../location/provinces.dart';
class PersonalReference {
PersonalReference({
required this.id,
@ -73,162 +79,6 @@ class Address {
};
}
class AddressCategory {
AddressCategory({
required this.id,
required this.name,
required this.type,
});
final int? id;
final String? name;
final String? type;
factory AddressCategory.fromJson(Map<String, dynamic> json) => AddressCategory(
id: json["id"],
name: json["name"],
type: json["type"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"type": type,
};
}
class Barangay {
Barangay({
required this.code,
required this.description,
required this.cityMunicipality,
});
final String? code;
final String? description;
final CityMunicipality? cityMunicipality;
factory Barangay.fromJson(Map<String, dynamic> json) => Barangay(
code: json["code"],
description: json["description"],
cityMunicipality: CityMunicipality.fromJson(json["city_municipality"]),
);
Map<String, dynamic> toJson() => {
"code": code,
"description": description,
"city_municipality": cityMunicipality!.toJson(),
};
}
class CityMunicipality {
CityMunicipality({
required this.code,
required this.zipcode,
required this.province,
required this.psgcCode,
required this.description,
});
final String? code;
final String? zipcode;
final Province? province;
final String? psgcCode;
final String? description;
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"],
zipcode: json["zipcode"],
province: json["province"] == null? null : Province.fromJson(json["province"]),
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"zipcode": zipcode,
"province": province!.toJson(),
"psgc_code": psgcCode,
"description": description,
};
}
class Province {
Province({
required this.code,
required this.region,
required this.psgcCode,
required this.shortname,
required this.description,
});
final String? code;
final Region? region;
final String? psgcCode;
final String? shortname;
final String? description;
factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"],
region: json["region"] == null? null : Region.fromJson(json["region"]),
psgcCode: json["psgc_code"],
shortname: json["shortname"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"region": region!.toJson(),
"psgc_code": psgcCode,
"shortname": shortname,
"description": description,
};
}
class Region {
Region({
required this.code,
required this.psgcCode,
required this.description,
});
final int? code;
final String? psgcCode;
final String? description;
factory Region.fromJson(Map<String, dynamic> json) => Region(
code: json["code"],
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"psgc_code": psgcCode,
"description": description,
};
}
class Country {
Country({
required this.id,
required this.code,
required this.name,
});
final int? id;
final String? code;
final String? name;
factory Country.fromJson(Map<String, dynamic> json) => Country(
id: json["id"],
code: json["code"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"name": name,
};
}

View File

@ -4,6 +4,12 @@
import 'dart:convert';
import '../location/address_category.dart';
import '../location/city.dart';
import '../location/country.dart';
import '../utils/agency.dart';
import '../utils/position.dart';
VoluntaryWork voluntaryWorkFromJson(String str) => VoluntaryWork.fromJson(json.decode(str));
String voluntaryWorkToJson(VoluntaryWork data) => json.encode(data.toJson());
@ -80,234 +86,10 @@ class Address {
};
}
class AddressCategory {
AddressCategory({
this.id,
this.name,
this.type,
});
final int? id;
final String? name;
final String? type;
factory AddressCategory.fromJson(Map<String, dynamic> json) => AddressCategory(
id: json["id"],
name: json["name"],
type: json["type"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"type": type,
};
}
class CityMunicipality {
CityMunicipality({
this.code,
this.zipcode,
this.province,
this.psgcCode,
this.description,
});
final String? code;
final String? zipcode;
final Province? province;
final String? psgcCode;
final String? description;
factory CityMunicipality.fromJson(Map<String, dynamic> json) => CityMunicipality(
code: json["code"],
zipcode: json["zipcode"],
province: json["province"] == null ? null : Province.fromJson(json["province"]),
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"zipcode": zipcode,
"province": province?.toJson(),
"psgc_code": psgcCode,
"description": description,
};
}
class Province {
Province({
this.code,
this.region,
this.psgcCode,
this.shortname,
this.description,
});
final String? code;
final Region? region;
final String? psgcCode;
final String? shortname;
final String? description;
factory Province.fromJson(Map<String, dynamic> json) => Province(
code: json["code"],
region: json["region"] == null ? null : Region.fromJson(json["region"]),
psgcCode: json["psgc_code"],
shortname: json["shortname"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"region": region?.toJson(),
"psgc_code": psgcCode,
"shortname": shortname,
"description": description,
};
}
class Region {
Region({
this.code,
this.psgcCode,
this.description,
});
final int? code;
final String? psgcCode;
final String? description;
factory Region.fromJson(Map<String, dynamic> json) => Region(
code: json["code"],
psgcCode: json["psgc_code"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"code": code,
"psgc_code": psgcCode,
"description": description,
};
}
class Country {
Country({
this.id,
this.code,
this.name,
});
final int? id;
final String? code;
final String? name;
factory Country.fromJson(Map<String, dynamic> json) => Country(
id: json["id"],
code: json["code"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"name": name,
};
}
class Agency {
Agency({
this.id,
this.name,
this.category,
this.privateEntity,
});
final int? id;
final String? name;
final Category? category;
final bool? privateEntity;
factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"],
name: json["name"],
category: json["category"] == null ? null : Category.fromJson(json["category"]),
privateEntity: json["private_entity"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"category": category?.toJson(),
"private_entity": privateEntity,
};
}
class Category {
Category({
this.id,
this.name,
this.industryClass,
});
final int? id;
final String? name;
final IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
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 IndustryClass {
IndustryClass({
this.id,
this.name,
this.description,
});
final int? id;
final String? name;
final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}
class Position {
Position({
this.id,
this.title,
});
final int? id;
final String? title;
factory Position.fromJson(Map<String, dynamic> json) => Position(
id: json["id"],
title: json["title"],
);
Map<String, dynamic> toJson() => {
"id": id,
"title": title,
};
}

View File

@ -4,6 +4,11 @@
import 'dart:convert';
import '../utils/agency.dart';
import '../utils/category.dart';
import '../utils/industry_class.dart';
import '../utils/position.dart';
WorkHistory workHistoryFromJson(String str) => WorkHistory.fromJson(json.decode(str));
String workHistoryToJson(WorkHistory data) => json.encode(data.toJson());
@ -60,98 +65,10 @@ class WorkHistory {
};
}
class Agency {
Agency({
this.id,
this.name,
this.category,
this.privateEntity,
});
final int? id;
final String? name;
final Category? category;
final bool? privateEntity;
factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"],
name: json["name"],
category: json["category"] == null ? null : Category.fromJson(json["category"]),
privateEntity: json["private_entity"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"category": category?.toJson(),
"private_entity": privateEntity,
};
}
class Category {
Category({
this.id,
this.name,
this.industryClass,
});
final int? id;
final String? name;
final IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
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 IndustryClass {
IndustryClass({
this.id,
this.name,
this.description,
});
final int? id;
final String? name;
final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}
class Position {
Position({
this.id,
this.title,
});
final int? id;
final String? title;
factory Position.fromJson(Map<String, dynamic> json) => Position(
id: json["id"],
title: json["title"],
);
Map<String, dynamic> toJson() => {
"id": id,
"title": title,
};
}

View File

@ -0,0 +1,29 @@
import 'package:unit2/model/utils/category.dart';
class Agency {
Agency({
this.id,
this.name,
this.category,
this.privateEntity,
});
final int? id;
final String? name;
final Category? category;
final bool? privateEntity;
factory Agency.fromJson(Map<String, dynamic> json) => Agency(
id: json["id"],
name: json["name"],
category: json["category"] == null ? null : Category.fromJson(json["category"]),
privateEntity: json["private_entity"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"category": category?.toJson(),
"private_entity": privateEntity,
};
}

View File

@ -0,0 +1,25 @@
import 'package:unit2/model/utils/industry_class.dart';
class Category {
Category({
this.id,
this.name,
this.industryClass,
});
final int? id;
final String? name;
final IndustryClass? industryClass;
factory Category.fromJson(Map<String, dynamic> json) => Category(
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(),
};
}

View File

@ -5,12 +5,12 @@
import 'package:meta/meta.dart';
import 'dart:convert';
EligibilityList eligibilitiesFromJson(String str) => EligibilityList.fromJson(json.decode(str));
Eligibility eligibilitiesFromJson(String str) => Eligibility.fromJson(json.decode(str));
String eligibilitiesToJson(EligibilityList data) => json.encode(data.toJson());
String eligibilitiesToJson(Eligibility data) => json.encode(data.toJson());
class EligibilityList {
EligibilityList({
class Eligibility {
Eligibility({
required this.id,
required this.title,
required this.type,
@ -20,7 +20,7 @@ class EligibilityList {
final String title;
final String type;
factory EligibilityList.fromJson(Map<String, dynamic> json) => EligibilityList(
factory Eligibility.fromJson(Map<String, dynamic> json) => Eligibility(
id: json["id"],
title: json["title"],
type: json["type"],

View File

@ -0,0 +1,23 @@
class IndustryClass {
IndustryClass({
this.id,
this.name,
this.description,
});
final int? id;
final String? name;
final String? description;
factory IndustryClass.fromJson(Map<String, dynamic> json) => IndustryClass(
id: json["id"],
name: json["name"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"description": description,
};
}

View File

@ -0,0 +1,19 @@
class Position {
Position({
this.id,
this.title,
});
final int? id;
final String? title;
factory Position.fromJson(Map<String, dynamic> json) => Position(
id: json["id"],
title: json["title"],
);
Map<String, dynamic> toJson() => {
"id": id,
"title": title,
};
}

View File

@ -1,17 +1,17 @@
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:intl/intl.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/eligibilities_choices.dart';
import '../../../../model/location/country.dart' as c;
import '../../../../model/location/region.dart' as r;
import '../../../../model/location/provinces.dart' as p;
import 'package:unit2/model/utils/eligibility.dart';
import '../../../../model/location/country.dart';
import '../../../../model/location/region.dart';
import '../../../../model/location/provinces.dart';
import '../../../../theme-data.dart/btn-style.dart';
import '../../../../theme-data.dart/colors.dart';
import '../../../../theme-data.dart/form-style.dart';
@ -28,9 +28,10 @@ class EditEligibilityScreen extends StatefulWidget {
class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
final formKey = GlobalKey<FormBuilderState>();
bool overseas = false;
final countryKey = GlobalKey<FormBuilderState>();
bool? overseas;
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
c.Country? selectedCountry;
Country? selectedCountry;
@override
Widget build(BuildContext context) {
//USERBLOC
@ -42,13 +43,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
return BlocBuilder<ProfileBloc, ProfileState>(
builder: (context, state) {
//EDIT ELIGIBILITY STATE
if (state is EditEligibilityState) {
String? region = state.eligibityCert.examAddress!
.cityMunicipality!.province!.region!.description;
String? eligibiltyTitle =
state.eligibityCert.eligibility!.title!;
String? province = state.eligibityCert.examAddress!
.cityMunicipality!.province!.description!;
if (state is EditNotOverseasEligibilityState) {
overseas = state.isOverseas;
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(
@ -60,18 +56,18 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//ELIGIBILITIES DROPDOWN
FormBuilderDropdown<dynamic>(
initialValue: state.eligibityCert.eligibility,
FormBuilderDropdown<Eligibility>(
initialValue: null,
items: state.eligibilities
.map<DropdownMenuItem<EligibilityList>>(
(EligibilityList eligibility) {
return DropdownMenuItem<EligibilityList>(
.map<DropdownMenuItem<Eligibility>>(
(Eligibility eligibility) {
return DropdownMenuItem<Eligibility>(
value: eligibility,
child: Text(eligibility.title));
}).toList(),
name: "eligibility",
decoration: normalTextFieldStyle(
"Eligibility", eligibiltyTitle)
"Eligibility", "")
.copyWith(
hintStyle: const TextStyle(
color: Colors.black,
@ -177,9 +173,12 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
initialValue: overseas,
activeColor: second,
onChanged: (value) {
setState(() {
overseas = value!;
});
EligibityCert newEligibility =
state.eligibityCert;
newEligibility.overseas = value!;
context.read<ProfileBloc>().add(
EditEligibilityOverseas(
eligibityCert: newEligibility));
},
decoration: normalTextFieldStyle("", ''),
name: 'overseas',
@ -188,97 +187,68 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
const SizedBox(
height: 20,
),
//COUNTRY DROPDOWN
SizedBox(
child: overseas == true
? FormBuilderDropdown<dynamic>(
items: state.countries
.map<DropdownMenuItem<c.Country>>(
(c.Country country) {
return DropdownMenuItem<c.Country>(
value: country,
child: Text(country.name!));
}).toList(),
name: 'country',
decoration: normalTextFieldStyle(
"Country", "Country"),
onChanged: (value) {
setState(() {
selectedCountry = value;
});
},
)
: Column(
Column(
children: [
//REGION DROPDOWN
FormBuilderDropdown<dynamic>(
FormBuilderDropdown<Region?>(
onChanged: (Region? region) {},
// initialValue:state.eligibityCert.examAddress!.cityMunicipality!.province!.description!,
decoration: normalTextFieldStyle(
"Region", region ??
"Region*")
.copyWith(
hintStyle: const TextStyle(
color: Colors.black,
),
labelStyle: const TextStyle(
color: Colors.black)),
decoration:
normalTextFieldStyle("Region*", "Region"),
name: 'region',
items: state.regions.map<
DropdownMenuItem<r.Region>>(
(r.Region region) {
return DropdownMenuItem<r.Region>(
items: state.regions
.map<DropdownMenuItem<Region>>(
(Region region) {
return DropdownMenuItem<Region>(
value: region,
child: Text(
region.description!));
child: Text(region.description!));
}).toList(),
),
const SizedBox(
height: 20,
),
//PROVINCE DROPDOWN
FormBuilderDropdown(
FormBuilderDropdown<Province?>(
initialValue: null,
name: 'province',
items: state.provinces.map<
DropdownMenuItem<
p.Province>>(
(p.Province province) {
items: state.provinces.isEmpty
? []
: state.provinces
.map<DropdownMenuItem<Province>>(
(Province province) {
return DropdownMenuItem(
value: province,
child: Text(
province.description!));
}).toList(),
decoration: normalTextFieldStyle(
"Province", province)
.copyWith(
hintStyle: const TextStyle(
color: Colors.black,
),
labelStyle: const TextStyle(
color: Colors.black),
)),
"Province*", "Province")),
const SizedBox(
height: 20,
),
FormBuilderDropdown(
FormBuilderDropdown<CityMunicipality>(
decoration: normalTextFieldStyle(
"Municipality", "Municipality"),
"Municipality*", "Municipality"),
name: 'municipality',
items: [],
initialValue: widget
.eligibityCert
.examAddress
?.cityMunicipality
?.description ==
null
? 'region'
: 'municipality',
items: state.cityMuns.isEmpty
? []
: state.cityMuns.map<
DropdownMenuItem<
CityMunicipality>>(
(CityMunicipality c) {
return DropdownMenuItem(
value: c,
child: Text(c.description!));
}).toList(),
initialValue: null),
const SizedBox(
height: 20,
),
],
)),
const SizedBox(
height: 20,
),
SizedBox(
width: screenWidth,
height: 60,
@ -296,6 +266,195 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
),
);
}
//===========================================================================
if (state is EditOverseasEligibilityState) {
overseas = state.isOverseas;
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
FormBuilderDropdown<Eligibility>(
initialValue: null,
items: state.eligibilities
.map<DropdownMenuItem<Eligibility>>(
(Eligibility eligibility) {
return DropdownMenuItem<Eligibility>(
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,
),
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"),
),
),
const SizedBox(
width: 12,
),
//RATING
Flexible(
flex: 1,
child: FormBuilderTextField(
name: 'rating',
initialValue: 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(
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(
flex: 1,
child: DateTimePicker(
firstDate: DateTime(2000),
lastDate: DateTime(2100),
decoration: normalTextFieldStyle(
"Validity date", "Validity date"),
initialValue:
widget.eligibityCert.validityDate ==
null
? ''
: dteFormat2.format(widget
.eligibityCert.validityDate!),
),
),
],
),
),
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
FormBuilderSwitch(
initialValue: overseas,
activeColor: second,
onChanged: (value) {
EligibityCert newEligibility =
state.eligibityCert;
newEligibility.overseas = value!;
// countryKey.currentState?.fields['country']
// ?.reset();
context.read<ProfileBloc>().add(
EditEligibilityNotOverseas(
eligibityCert: newEligibility));
},
decoration: normalTextFieldStyle("", ''),
name: 'overseas',
title: const Text("Overseas Address?"),
),
const SizedBox(
height: 20,
),
FormBuilderDropdown<Country>(
key: countryKey,
onChanged: (Country? country) {
selectedCountry = country;
},
// initialValue:state.eligibityCert.examAddress!.cityMunicipality!.province!.description!,
initialValue:selectedCountry,
decoration:
normalTextFieldStyle("Country*", "country"),
name: 'country',
items: state.countries.isNotEmpty
? state.countries
.map<DropdownMenuItem<Country>>(
(Country country) {
return DropdownMenuItem<Country>(
value: country,
child: Text(country.name!));
}).toList()
: []),
SizedBox(
width: screenWidth,
height: 60,
child: ElevatedButton(
style: mainBtnStyle(
primary, Colors.transparent, second),
onPressed: () {},
child: const Text(submit)),
),
const SizedBox(
height: 20,
),
]),
),
),
);
}
return Container();
},
);

View File

@ -36,7 +36,17 @@ class EligibiltyScreen extends StatelessWidget {
return ProgressHUD(
child: BlocConsumer<ProfileBloc, ProfileState>(
listener: (context, state) {
if (state is EditEligibilityState) {
if(state is ProfileLoading){
final progress = ProgressHUD.of(context);
progress!.showWithText("Loading");
}
if (state is EditNotOverseasEligibilityState) {
final progress = ProgressHUD.of(context);
progress!.dismiss();
}if (state is EditOverseasEligibilityState) {
final progress = ProgressHUD.of(context);
progress!.dismiss();
}if(state is EligibilityLoaded){
final progress = ProgressHUD.of(context);
progress!.dismiss();
}
@ -94,7 +104,7 @@ class EligibiltyScreen extends StatelessWidget {
height: 3,
),
Text(
" : ${state.eligibilities[index].rating}.",
"Rating : ${state.eligibilities[index].rating}.",
style: Theme.of(context)
.textTheme
.titleSmall)
@ -112,15 +122,35 @@ class EligibiltyScreen extends StatelessWidget {
"Confirm Delete?");
}
if (value == 1) {
EligibityCert eligibityCert =
state.eligibilities[index];
bool overseas = eligibityCert
.examAddress!
.country!
.id
.toString() ==
'175'
? false
: true;
eligibityCert.overseas =
overseas;
final progress =
ProgressHUD.of(context);
eligibityCert.overseas =
overseas;
progress!
.showWithText("Loading...");
if (eligibityCert.overseas!) {
context.read<ProfileBloc>().add(
EditEligibility(
EditEligibilityOverseas(
eligibityCert:
state.eligibilities[
index]));
eligibityCert));
} else {
context.read<ProfileBloc>().add(
EditEligibilityNotOverseas(
eligibityCert:
eligibityCert));
}
}
},
menuItems: [
@ -153,7 +183,10 @@ class EligibiltyScreen extends StatelessWidget {
);
});
}
if (state is EditEligibilityState) {
if (state is EditNotOverseasEligibilityState) {
return EditEligibilityScreen(
eligibityCert: state.eligibityCert);
}if(state is EditOverseasEligibilityState){
return EditEligibilityScreen(
eligibityCert: state.eligibityCert);
}

View File

@ -230,8 +230,8 @@ class _UniT2LoginState extends State<UniT2Login> {
BlocProvider.of<UserBloc>(context)
.add(UserLogin(
username: "rodolfobacuinjr",
password: "nav071394",
username: "rjvincentlopeplopez",
password: "shesthequ33n",
// username: _formKey
// .currentState!
// .value['username'],

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:unit2/model/location/city.dart';
import 'package:unit2/model/location/country.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/model/location/provinces.dart';
@ -80,4 +81,22 @@ Future<List<Region>>getRegions()async{
}
return provinces;
}
Future<List<CityMunicipality>>getCities({required String code})async{
List<CityMunicipality> cities = [];
String path = Url.instance.getCities()+code;
try{
http.Response response = await Request.instance.getRequest(path: path, param: {},headers: headers);
Map data = jsonDecode(response.body);
if(data['data'] != null){
data['data'].forEach((var city){
CityMunicipality cityMun = CityMunicipality.fromJson(city);
cities.add(cityMun);
});
}
}catch(e){
throw(e.toString());
}
return cities;
}
}

View File

@ -4,15 +4,15 @@ import 'dart:convert';
import 'package:unit2/model/location/country.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/model/location/region.dart';
import 'package:unit2/model/utils/eligibilities_choices.dart';
import 'package:unit2/model/utils/eligibility.dart';
import 'package:unit2/utils/request.dart';
import 'package:unit2/utils/urls.dart';
class ProfileUtilities {
static final ProfileUtilities _instance = ProfileUtilities();
static ProfileUtilities get instance => _instance;
Future<List<EligibilityList>>getEligibilities()async{
List<EligibilityList> eligibilities=[];
Future<List<Eligibility>>getEligibilities()async{
List<Eligibility> eligibilities=[];
String path = Url.instance.eligibilities();
Map<String, String> headers = {
@ -24,7 +24,7 @@ class ProfileUtilities {
Map data = jsonDecode(response.body);
if(data['data'] != null){
data['data'].forEach((var eligibility){
EligibilityList newEligibilities = EligibilityList.fromJson(eligibility);
Eligibility newEligibilities = Eligibility.fromJson(eligibility);
eligibilities.add(newEligibilities);
});
}

View File

@ -29,4 +29,7 @@ String eligibilities(){
String getProvinces(){
return "api/web_app/location/province/";
}
String getCities(){
return "/api/web_app/location/citymun/";
}
}

View File

@ -971,5 +971,5 @@ packages:
source: hosted
version: "6.2.2"
sdks:
dart: ">=2.19.0 <4.0.0"
dart: ">=2.19.0 <3.0.0"
flutter: ">=3.3.0"