integrated address API
parent
f74ad83667
commit
d2a34d8e22
|
@ -1,13 +1,15 @@
|
||||||
|
import 'package:unit2/model/profile/basic_information/adress.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/citizenship.dart';
|
import 'package:unit2/model/profile/basic_information/citizenship.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/contact_information.dart';
|
import 'package:unit2/model/profile/basic_information/contact_information.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/identification_information.dart';
|
import 'package:unit2/model/profile/basic_information/identification_information.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
||||||
|
|
||||||
class BasicInfo{
|
class BasicInfo{
|
||||||
PrimaryInformation primaryInformation;
|
PrimaryInformation? primaryInformation;
|
||||||
List<ContactInfo> contactInformation;
|
List<ContactInfo> contactInformation;
|
||||||
List<Identification> identifications;
|
List<Identification> identifications;
|
||||||
List<Citizenship> citizenships;
|
List<Citizenship> citizenships;
|
||||||
BasicInfo({required this.contactInformation, required this.primaryInformation,required this.identifications,required this.citizenships});
|
List<MainAdress> addresses;
|
||||||
|
BasicInfo({required this.addresses, required this.contactInformation, required this.primaryInformation,required this.identifications,required this.citizenships});
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,249 @@
|
||||||
|
|
||||||
|
|
||||||
|
class MainAdress {
|
||||||
|
MainAdress({
|
||||||
|
this.id,
|
||||||
|
this.address,
|
||||||
|
this.details,
|
||||||
|
this.subdivision,
|
||||||
|
});
|
||||||
|
|
||||||
|
final int? id;
|
||||||
|
final AddressClass? address;
|
||||||
|
final String? details;
|
||||||
|
final Subdivision? subdivision;
|
||||||
|
|
||||||
|
factory MainAdress.fromJson(Map<String, dynamic> json) => MainAdress(
|
||||||
|
id: json["id"],
|
||||||
|
address: json["address"] == null ? null : AddressClass.fromJson(json["address"]),
|
||||||
|
details: json["details"],
|
||||||
|
subdivision: json["subdivision"] == null ? null : Subdivision.fromJson(json["subdivision"]),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"address": address?.toJson(),
|
||||||
|
"details": details,
|
||||||
|
"subdivision": subdivision?.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddressClass {
|
||||||
|
AddressClass({
|
||||||
|
this.id,
|
||||||
|
this.country,
|
||||||
|
this.barangay,
|
||||||
|
this.category,
|
||||||
|
this.areaClass,
|
||||||
|
this.cityMunicipality,
|
||||||
|
});
|
||||||
|
|
||||||
|
final int? id;
|
||||||
|
final Country? country;
|
||||||
|
final Barangay? barangay;
|
||||||
|
final Category? category;
|
||||||
|
final String? areaClass;
|
||||||
|
final CityMunicipality? cityMunicipality;
|
||||||
|
|
||||||
|
factory AddressClass.fromJson(Map<String, dynamic> json) => AddressClass(
|
||||||
|
id: json["id"],
|
||||||
|
country: json["country"] == null ? null : Country.fromJson(json["country"]),
|
||||||
|
barangay: json["barangay"] == null ? null : Barangay.fromJson(json["barangay"]),
|
||||||
|
category: json["category"] == null ? null : Category.fromJson(json["category"]),
|
||||||
|
areaClass: json["area_class"],
|
||||||
|
cityMunicipality: json["city_municipality"] == null ? null : CityMunicipality.fromJson(json["city_municipality"]),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"country": country?.toJson(),
|
||||||
|
"barangay": barangay?.toJson(),
|
||||||
|
"category": category?.toJson(),
|
||||||
|
"area_class": areaClass,
|
||||||
|
"city_municipality": cityMunicipality?.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
|
import 'package:unit2/model/profile/other_information/non_acedimic_recognition.dart';
|
||||||
import 'package:unit2/model/profile/other_information/organization_memberships.dart';
|
import 'package:unit2/model/profile/other_information/organization_memberships.dart';
|
||||||
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
||||||
|
|
||||||
class OtherInformation{
|
class OtherInformation{
|
||||||
List<SkillsHobbies> skillsAndHobbies;
|
List<SkillsHobbies> skillsAndHobbies;
|
||||||
List<OrganizationMembership>orgMemberships;
|
List<OrganizationMembership>orgMemberships;
|
||||||
OtherInformation({required this.skillsAndHobbies, required this.orgMemberships});
|
List<NonAcademicRecognition> nonAcademicRecognition;
|
||||||
|
OtherInformation({required this.skillsAndHobbies, required this.orgMemberships, required this.nonAcademicRecognition});
|
||||||
}
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final nonAcademicRecognition = nonAcademicRecognitionFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
NonAcademicRecognition nonAcademicRecognitionFromJson(String str) => NonAcademicRecognition.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String nonAcademicRecognitionToJson(NonAcademicRecognition data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class NonAcademicRecognition {
|
||||||
|
NonAcademicRecognition({
|
||||||
|
this.id,
|
||||||
|
this.title,
|
||||||
|
this.presenter,
|
||||||
|
});
|
||||||
|
|
||||||
|
final int? id;
|
||||||
|
final String? title;
|
||||||
|
final Presenter? presenter;
|
||||||
|
|
||||||
|
factory NonAcademicRecognition.fromJson(Map<String, dynamic> json) => NonAcademicRecognition(
|
||||||
|
id: json["id"],
|
||||||
|
title: json["title"],
|
||||||
|
presenter: json["presenter"] == null ? null : Presenter.fromJson(json["presenter"]),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"title": title,
|
||||||
|
"presenter": presenter?.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class Presenter {
|
||||||
|
Presenter({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.category,
|
||||||
|
this.privateEntity,
|
||||||
|
});
|
||||||
|
|
||||||
|
final int? id;
|
||||||
|
final String? name;
|
||||||
|
final Category? category;
|
||||||
|
final bool? privateEntity;
|
||||||
|
|
||||||
|
factory Presenter.fromJson(Map<String, dynamic> json) => Presenter(
|
||||||
|
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 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,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:unit2/model/profile/basic_information/adress.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import 'package:unit2/utils/global.dart';
|
||||||
|
|
||||||
|
class AddressScreen extends StatefulWidget {
|
||||||
|
final List<MainAdress> addresses;
|
||||||
|
const AddressScreen({super.key, required this.addresses});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddressScreen> createState() => _AddressScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddressScreenState extends State<AddressScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: const Text("Addresses"),centerTitle: true, backgroundColor: primary,),
|
||||||
|
body: ListView.builder(
|
||||||
|
itemCount: widget.addresses.length,
|
||||||
|
itemBuilder: (
|
||||||
|
BuildContext context, int index){
|
||||||
|
String? subdivision = widget.addresses[index].details??'';
|
||||||
|
String category = widget.addresses[index].address!.category!.name!;
|
||||||
|
String? barangay = widget.addresses[index].address!.barangay != null?widget.addresses[index].address!.barangay!.description:'';
|
||||||
|
String cityMunicipality = widget.addresses[index].address!.cityMunicipality!.description!;
|
||||||
|
String province = widget.addresses[index].address!.cityMunicipality!.province!.description!;
|
||||||
|
String region = widget.addresses[index].address!.cityMunicipality!.province!.region!.description!;
|
||||||
|
return Column(children: [
|
||||||
|
Container(
|
||||||
|
width: screenWidth,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey[200],
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(12))),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 8),
|
||||||
|
child: Row(children: [
|
||||||
|
Expanded(child: Column(children: [
|
||||||
|
Row(children: [Text(subdivision), const SizedBox(width: 5,), Text(category)],),
|
||||||
|
Text("$barangay $cityMunicipality $province $region"),
|
||||||
|
],)),
|
||||||
|
IconButton(onPressed: (){}, icon: const Icon(Icons.more_vert))
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5,)
|
||||||
|
],);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
import 'package:flutter/src/widgets/placeholder.dart';
|
||||||
|
import 'package:unit2/model/profile/other_information/non_acedimic_recognition.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import 'package:unit2/utils/global.dart';
|
||||||
|
|
||||||
|
class NonAcademicRecognitionScreen extends StatefulWidget {
|
||||||
|
final List<NonAcademicRecognition> nonAcademicRecognitions;
|
||||||
|
const NonAcademicRecognitionScreen({super.key, required this.nonAcademicRecognitions});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<NonAcademicRecognitionScreen> createState() => _NonAcademicRecognitionScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NonAcademicRecognitionScreenState extends State<NonAcademicRecognitionScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: const Text("Non Academic Recognition"), centerTitle: true, backgroundColor: primary,),
|
||||||
|
body: ListView.builder(
|
||||||
|
itemCount: widget.nonAcademicRecognitions.length,
|
||||||
|
itemBuilder: (BuildContext context, int index){
|
||||||
|
String award = widget.nonAcademicRecognitions[index].title!;
|
||||||
|
String presenter = widget.nonAcademicRecognitions[index].presenter!.name!;
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: screenWidth,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey[200],
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(12))),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 8),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(award),
|
||||||
|
Text(presenter),
|
||||||
|
],)),
|
||||||
|
|
||||||
|
IconButton(onPressed: (){}, icon: const Icon(Icons.more_vert))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5,),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import 'package:fluttericon/entypo_icons.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
import 'package:fluttericon/modern_pictograms_icons.dart';
|
import 'package:fluttericon/modern_pictograms_icons.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
|
import 'package:unit2/screens/profile/components/basic_information/address_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/basic_information/citizenship_screen.dart';
|
import 'package:unit2/screens/profile/components/basic_information/citizenship_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/basic_information/contact_information.dart';
|
import 'package:unit2/screens/profile/components/basic_information/contact_information.dart';
|
||||||
import 'package:unit2/screens/profile/components/basic_information/identification_information.dart';
|
import 'package:unit2/screens/profile/components/basic_information/identification_information.dart';
|
||||||
|
@ -16,6 +17,7 @@ import 'package:unit2/screens/profile/components/education_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/eligibility.dart';
|
import 'package:unit2/screens/profile/components/eligibility.dart';
|
||||||
import 'package:unit2/screens/profile/components/learning_and_development_screen.dart';
|
import 'package:unit2/screens/profile/components/learning_and_development_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/loading_screen.dart';
|
import 'package:unit2/screens/profile/components/loading_screen.dart';
|
||||||
|
import 'package:unit2/screens/profile/components/other_information/non_academic_recognition.dart';
|
||||||
import 'package:unit2/screens/profile/components/other_information/org_membership.dart';
|
import 'package:unit2/screens/profile/components/other_information/org_membership.dart';
|
||||||
import 'package:unit2/screens/profile/components/other_information/skills_and_hobbies_screen.dart';
|
import 'package:unit2/screens/profile/components/other_information/skills_and_hobbies_screen.dart';
|
||||||
import 'package:unit2/screens/profile/components/references_screen.dart';
|
import 'package:unit2/screens/profile/components/references_screen.dart';
|
||||||
|
@ -89,10 +91,15 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
items: [
|
items: [
|
||||||
subMenu(Icons.person, "Primary",(){
|
subMenu(Icons.person, "Primary",(){
|
||||||
Navigator.push(context,MaterialPageRoute(builder: (BuildContext context){
|
Navigator.push(context,MaterialPageRoute(builder: (BuildContext context){
|
||||||
return PrimaryInfo(primaryInformation: state.profileInformation.basicInfo.primaryInformation);
|
return PrimaryInfo(primaryInformation: state.profileInformation.basicInfo.primaryInformation!);
|
||||||
}) );
|
}) );
|
||||||
}),
|
}),
|
||||||
subMenu(Icons.home, "Home Addresses",(){}),
|
subMenu(Icons.home, "Home Addresses",(){
|
||||||
|
Navigator.push(context,MaterialPageRoute(builder: (BuildContext context){
|
||||||
|
return AddressScreen(addresses: state.profileInformation.basicInfo.addresses);
|
||||||
|
}) );
|
||||||
|
|
||||||
|
}),
|
||||||
subMenu(
|
subMenu(
|
||||||
Icons.contact_mail, "Identifications",(){
|
Icons.contact_mail, "Identifications",(){
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||||
|
@ -207,7 +214,12 @@ class _ProfileInfoState extends State<ProfileInfo> {
|
||||||
}));
|
}));
|
||||||
}),
|
}),
|
||||||
subMenu(Entypo.doc_text,
|
subMenu(Entypo.doc_text,
|
||||||
"Non-Academic Recognitions",(){}),
|
"Non-Academic Recognitions",(){
|
||||||
|
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
|
||||||
|
return NonAcademicRecognitionScreen(nonAcademicRecognitions: state.profileInformation.otherInformation.nonAcademicRecognition);
|
||||||
|
}));
|
||||||
|
}),
|
||||||
]),
|
]),
|
||||||
ExpandableGroup(
|
ExpandableGroup(
|
||||||
collapsedIcon:
|
collapsedIcon:
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
|
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
|
||||||
import 'package:unit2/model/profile/basic_info.dart';
|
import 'package:unit2/model/profile/basic_info.dart';
|
||||||
|
import 'package:unit2/model/profile/basic_information/adress.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/citizenship.dart';
|
import 'package:unit2/model/profile/basic_information/citizenship.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/contact_information.dart';
|
import 'package:unit2/model/profile/basic_information/contact_information.dart';
|
||||||
import 'package:unit2/model/profile/basic_information/identification_information.dart';
|
import 'package:unit2/model/profile/basic_information/identification_information.dart';
|
||||||
|
@ -9,6 +10,7 @@ import 'package:unit2/model/profile/educational_background.dart';
|
||||||
import 'package:unit2/model/profile/eligibility.dart';
|
import 'package:unit2/model/profile/eligibility.dart';
|
||||||
import 'package:unit2/model/profile/learning_development.dart';
|
import 'package:unit2/model/profile/learning_development.dart';
|
||||||
import 'package:unit2/model/profile/other_info.dart';
|
import 'package:unit2/model/profile/other_info.dart';
|
||||||
|
import 'package:unit2/model/profile/other_information/non_acedimic_recognition.dart';
|
||||||
import 'package:unit2/model/profile/profileInfomation.dart';
|
import 'package:unit2/model/profile/profileInfomation.dart';
|
||||||
import 'package:unit2/model/profile/references.dart';
|
import 'package:unit2/model/profile/references.dart';
|
||||||
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
||||||
|
@ -28,18 +30,20 @@ class ProfileService {
|
||||||
String url = Url.instance.profileInformation();
|
String url = Url.instance.profileInformation();
|
||||||
String path = url + id.toString();
|
String path = url + id.toString();
|
||||||
ProfileInformation? profileInformation0;
|
ProfileInformation? profileInformation0;
|
||||||
PrimaryInformation primaryInformation;
|
PrimaryInformation? primaryInformation;
|
||||||
List<WorkHistory> workExperiences =[];
|
List<WorkHistory> workExperiences = [];
|
||||||
List<PersonalReference> references = [];
|
List<PersonalReference> references = [];
|
||||||
|
List<MainAdress> addresses = [];
|
||||||
List<Identification> identificationInformation = [];
|
List<Identification> identificationInformation = [];
|
||||||
List<ContactInfo> contactInformation = [];
|
List<ContactInfo> contactInformation = [];
|
||||||
List<EligibityCert> eligibilities = [];
|
List<EligibityCert> eligibilities = [];
|
||||||
List<Citizenship> citizenships = [];
|
List<Citizenship> citizenships = [];
|
||||||
List<LearningDevelopement> learningsDevelopments = [];
|
List<LearningDevelopement> learningsDevelopments = [];
|
||||||
List<EducationalBackground> educationalBackgrounds = [];
|
List<EducationalBackground> educationalBackgrounds = [];
|
||||||
List<VoluntaryWork> voluntaryWorks =[];
|
List<VoluntaryWork> voluntaryWorks = [];
|
||||||
List<SkillsHobbies> skillsHobbies = [];
|
List<SkillsHobbies> skillsHobbies = [];
|
||||||
List<OrganizationMembership> orgMemberships = [];
|
List<OrganizationMembership> orgMemberships = [];
|
||||||
|
List<NonAcademicRecognition> nonAcademicRecognitions = [];
|
||||||
Map<String, String> headers = {
|
Map<String, String> headers = {
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': "Token $token"
|
'Authorization': "Token $token"
|
||||||
|
@ -49,97 +53,149 @@ class ProfileService {
|
||||||
.getRequest(path: path, param: {}, headers: headers);
|
.getRequest(path: path, param: {}, headers: headers);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
|
|
||||||
// get primary information
|
// get primary information
|
||||||
primaryInformation = PrimaryInformation.fromJson(
|
if (data['data']['basic_information']['primary_information'] != null) {
|
||||||
data['data']['basic_information']['primary_information']);
|
primaryInformation = PrimaryInformation.fromJson(
|
||||||
|
data['data']['basic_information']['primary_information']);
|
||||||
|
} else {
|
||||||
|
primaryInformation = null;
|
||||||
|
}
|
||||||
|
|
||||||
// get all contacts
|
// get all contacts
|
||||||
data['data']['basic_information']['contact_information']
|
if (data['data']['basic_information']['contact_information'] != null) {
|
||||||
.forEach((var contact) {
|
data['data']['basic_information']['contact_information']
|
||||||
ContactInfo contactInfo = ContactInfo.fromJson(contact['contact_info']);
|
.forEach((var contact) {
|
||||||
contactInformation.add(contactInfo);
|
ContactInfo contactInfo =
|
||||||
});
|
ContactInfo.fromJson(contact['contact_info']);
|
||||||
|
contactInformation.add(contactInfo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// get all addresses
|
||||||
|
if (data['data']['basic_information']['addresses'] != null) {
|
||||||
|
data['data']['basic_information']['addresses'].forEach((var address) {
|
||||||
|
MainAdress mainAdress = MainAdress.fromJson(address);
|
||||||
|
addresses.add(mainAdress);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// get all identifications
|
// get all identifications
|
||||||
data['data']['basic_information']['identification_records']
|
if (data['data']['basic_information']['identification_records'] != null) {
|
||||||
.forEach((var identity) {
|
data['data']['basic_information']['identification_records']!
|
||||||
Identification identification = Identification.fromJson(identity);
|
.forEach((var identity) {
|
||||||
identificationInformation.add(identification);
|
Identification identification = Identification.fromJson(identity);
|
||||||
});
|
identificationInformation.add(identification);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//get all eligibilities
|
//get all eligibilities
|
||||||
data['data']['eligibilities'].forEach((var cert) {
|
if (data['data']['eligibilities'] != null) {
|
||||||
EligibityCert eligibility = EligibityCert.fromJson(cert);
|
data['data']['eligibilities']!.forEach((var cert) {
|
||||||
eligibilities.add(eligibility);
|
EligibityCert eligibility = EligibityCert.fromJson(cert);
|
||||||
});
|
eligibilities.add(eligibility);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// get all citizenships
|
// get all citizenships
|
||||||
if (data['data']['citizenship'] != null) {
|
if (data['data']['citizenship'] != null) {
|
||||||
data['data']['citizenships'].forEach((var citizenship) {
|
data['data']['citizenships']!.forEach((var citizenship) {
|
||||||
Citizenship person = Citizenship.fromJson(citizenship);
|
Citizenship person = Citizenship.fromJson(citizenship);
|
||||||
citizenships.add(person);
|
citizenships.add(person);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// get all references;
|
// get all references;
|
||||||
data['data']['personal_references'].forEach((var person) {
|
if (data['data']['personal_references'] != null) {
|
||||||
PersonalReference reference = PersonalReference.fromJson(person);
|
data['data']['personal_references'].forEach((var person) {
|
||||||
references.add(reference);
|
PersonalReference reference = PersonalReference.fromJson(person);
|
||||||
});
|
references.add(reference);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//get all learning and developments
|
//get all learning and developments
|
||||||
|
if (data['data']['learning_development'] != null) {
|
||||||
data['data']['learning_development'].forEach((var training) {
|
data['data']['learning_development'].forEach((var training) {
|
||||||
LearningDevelopement learnings =
|
LearningDevelopement learnings =
|
||||||
LearningDevelopement.fromJson(training);
|
LearningDevelopement.fromJson(training);
|
||||||
learningsDevelopments.add(learnings);
|
learningsDevelopments.add(learnings);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//get all educational background
|
//get all educational background
|
||||||
data['data']['education_background'].forEach((var education) {
|
if (data['data']['education_background'] != null) {
|
||||||
EducationalBackground educationalBackground =
|
data['data']['education_background'].forEach((var education) {
|
||||||
EducationalBackground.fromJson(education);
|
EducationalBackground educationalBackground =
|
||||||
educationalBackgrounds.add(educationalBackground);
|
EducationalBackground.fromJson(education);
|
||||||
});
|
educationalBackgrounds.add(educationalBackground);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// get all work history
|
// get all work history
|
||||||
|
if (data['data']['work_experiences'] != null) {
|
||||||
data['data']['work_experiences'].forEach((var work){
|
data['data']['work_experiences'].forEach((var work) {
|
||||||
WorkHistory experience = WorkHistory.fromJson(work);
|
WorkHistory experience = WorkHistory.fromJson(work);
|
||||||
workExperiences.add(experience);
|
workExperiences.add(experience);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// get all voluntary works
|
// get all voluntary works
|
||||||
data['data']['voluntary_works'].forEach((var work){
|
if (data['data']['voluntary_works'] != null) {
|
||||||
VoluntaryWork vwork = VoluntaryWork.fromJson(work);
|
data['data']['voluntary_works'].forEach((var work) {
|
||||||
voluntaryWorks.add(vwork);
|
VoluntaryWork vwork = VoluntaryWork.fromJson(work);
|
||||||
});
|
voluntaryWorks.add(vwork);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// get all hobbies
|
// get all hobbies
|
||||||
data['data']['other_information']['skills_hobbies'].forEach((var skills_hobbies){
|
if (data['data']['other_information']['skills_hobbies'] != null) {
|
||||||
SkillsHobbies skillsAndHobbies = SkillsHobbies.fromJson(skills_hobbies);
|
data['data']['other_information']['skills_hobbies']
|
||||||
skillsHobbies.add(skillsAndHobbies);
|
.forEach((var skills_hobbies) {
|
||||||
});
|
SkillsHobbies skillsAndHobbies =
|
||||||
|
SkillsHobbies.fromJson(skills_hobbies);
|
||||||
|
skillsHobbies.add(skillsAndHobbies);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
data['data']['other_information']['organization_memberships'].forEach((var org) {
|
//get all organization memberships
|
||||||
OrganizationMembership organization =
|
if (data['data']['other_information']['organization_memberships'] !=
|
||||||
OrganizationMembership.fromJson(org);
|
null) {
|
||||||
orgMemberships.add(organization);
|
data['data']['other_information']['organization_memberships']
|
||||||
});
|
.forEach((var org) {
|
||||||
|
OrganizationMembership organization =
|
||||||
|
OrganizationMembership.fromJson(org);
|
||||||
|
orgMemberships.add(organization);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//get all non academic recognition
|
||||||
|
if (data['data']['other_information']['non_academic_records'] != null) {
|
||||||
|
data['data']['other_information']['non_academic_records']
|
||||||
|
.forEach((var recognition) {
|
||||||
|
NonAcademicRecognition nonAcademicRecognition =
|
||||||
|
NonAcademicRecognition.fromJson(recognition);
|
||||||
|
nonAcademicRecognitions.add(nonAcademicRecognition);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
BasicInfo basicInfo = BasicInfo(
|
BasicInfo basicInfo = BasicInfo(
|
||||||
contactInformation: contactInformation,
|
contactInformation: contactInformation,
|
||||||
primaryInformation: primaryInformation,
|
primaryInformation: primaryInformation,
|
||||||
identifications: identificationInformation,
|
identifications: identificationInformation,
|
||||||
citizenships: citizenships);
|
citizenships: citizenships,
|
||||||
OtherInformation otherInformation = OtherInformation(skillsAndHobbies: skillsHobbies,orgMemberships: orgMemberships);
|
addresses: addresses);
|
||||||
|
OtherInformation otherInformation = OtherInformation(
|
||||||
|
skillsAndHobbies: skillsHobbies,
|
||||||
|
orgMemberships: orgMemberships,
|
||||||
|
nonAcademicRecognition: nonAcademicRecognitions);
|
||||||
ProfileInformation profileInformation = ProfileInformation(
|
ProfileInformation profileInformation = ProfileInformation(
|
||||||
otherInformation: otherInformation,
|
otherInformation: otherInformation,
|
||||||
workExperiences: workExperiences,
|
workExperiences: workExperiences,
|
||||||
basicInfo: basicInfo,
|
basicInfo: basicInfo,
|
||||||
eligibilities: eligibilities,
|
eligibilities: eligibilities,
|
||||||
references: references,
|
references: references,
|
||||||
learningsAndDevelopment: learningsDevelopments,
|
learningsAndDevelopment: learningsDevelopments,
|
||||||
educationalBackgrounds: educationalBackgrounds,
|
educationalBackgrounds: educationalBackgrounds,
|
||||||
voluntaryWorks: voluntaryWorks
|
voluntaryWorks: voluntaryWorks);
|
||||||
|
|
||||||
);
|
|
||||||
profileInformation0 = profileInformation;
|
profileInformation0 = profileInformation;
|
||||||
}
|
}
|
||||||
// }catch(e){
|
// }catch(e){
|
||||||
|
|
Loading…
Reference in New Issue