erge into develop
parent
3789d998a8
commit
5dcfd32a51
|
@ -16,33 +16,57 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
||||||
EligibilityBloc() : super(EligibilityInitial()) {
|
EligibilityBloc() : super(EligibilityInitial()) {
|
||||||
List<Country>? globalCountries;
|
List<Country>? globalCountries;
|
||||||
List<Region>? globalRegions;
|
List<Region>? globalRegions;
|
||||||
List<Eligibility>? globalEligibilities;
|
List<Eligibility> globalEligibilities = [];
|
||||||
List<EligibityCert>? eligibilities;
|
List<EligibityCert> eligibilities = [];
|
||||||
////=====================================================================
|
//// LOAD ELIGIBILTY
|
||||||
on<LoadEligibility>((event, emit) {
|
on<LoadEligibility>((event, emit) {
|
||||||
emit(EligibilityLoadingState());
|
emit(EligibilityLoadingState());
|
||||||
eligibilities = event.eligibilities;
|
if (eligibilities.isEmpty) {
|
||||||
emit(EligibilityLoaded(eligibilities: event.eligibilities));
|
GetEligibilities(profileId: event.profileId!, token: event.token!);
|
||||||
|
} else {
|
||||||
|
emit(EligibilityLoaded(eligibilities: eligibilities));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
////====================================================================
|
|
||||||
on<GetEligibilities>((event, emit) async {
|
//// DELETE
|
||||||
|
on<DeleteEligibility>((event, emit) async {
|
||||||
try {
|
try {
|
||||||
if (eligibilities != null) {
|
final bool success = await EligibilityService.instance.delete(
|
||||||
emit(EligibilityLoaded(eligibilities: eligibilities!));
|
eligibilityId: event.eligibilityId,
|
||||||
|
profileId: int.parse(event.profileId),
|
||||||
|
token: event.token);
|
||||||
|
if (success) {
|
||||||
|
eligibilities.removeWhere(
|
||||||
|
((EligibityCert element) => element.id == event.eligibilityId));
|
||||||
|
emit(DeletedState(
|
||||||
|
success: success,
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
emit(EligibilityLoadingState());
|
emit(DeletedState(success: success));
|
||||||
eligibilities = await EligibilityService.instance
|
|
||||||
.getEligibilities(event.profileId, event.token);
|
|
||||||
emit(EligibilityLoaded(eligibilities: eligibilities!));
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(EligibilityErrorState(message: e.toString()));
|
emit(EligibilityErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
////====================================================================
|
|
||||||
|
//// GET ELIGIBILITY
|
||||||
|
on<GetEligibilities>((event, emit) async {
|
||||||
|
try {
|
||||||
|
if (eligibilities.isNotEmpty) {
|
||||||
|
emit(EligibilityLoaded(eligibilities: eligibilities));
|
||||||
|
} else {
|
||||||
|
emit(EligibilityLoadingState());
|
||||||
|
eligibilities = await EligibilityService.instance
|
||||||
|
.getEligibilities(event.profileId, event.token);
|
||||||
|
emit(EligibilityLoaded(eligibilities: eligibilities));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(EligibilityErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//// SHOW EDIT FORM
|
||||||
on<ShowEditEligibilityForm>((event, emit) async {
|
on<ShowEditEligibilityForm>((event, emit) async {
|
||||||
try {
|
try {
|
||||||
emit(EligibilityLoadingState());
|
|
||||||
if (globalCountries == null) {
|
if (globalCountries == null) {
|
||||||
List<Country> countries = await LocationUtils.instance.getCountries();
|
List<Country> countries = await LocationUtils.instance.getCountries();
|
||||||
globalCountries = countries;
|
globalCountries = countries;
|
||||||
|
@ -51,12 +75,12 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
||||||
List<Region> regions = await LocationUtils.instance.getRegions();
|
List<Region> regions = await LocationUtils.instance.getRegions();
|
||||||
globalRegions = regions;
|
globalRegions = regions;
|
||||||
}
|
}
|
||||||
if (globalEligibilities == null) {
|
if (globalEligibilities.isEmpty) {
|
||||||
List<Eligibility> eligibilities =
|
List<Eligibility> eligibilities =
|
||||||
await ProfileUtilities.instance.getEligibilities();
|
await ProfileUtilities.instance.getEligibilities();
|
||||||
globalEligibilities = eligibilities;
|
globalEligibilities = eligibilities;
|
||||||
}
|
}
|
||||||
Eligibility currentEligibility = globalEligibilities!.firstWhere(
|
Eligibility currentEligibility = globalEligibilities.firstWhere(
|
||||||
(Eligibility eligibility) =>
|
(Eligibility eligibility) =>
|
||||||
event.eligibityCert.eligibility!.id == eligibility.id);
|
event.eligibityCert.eligibility!.id == eligibility.id);
|
||||||
bool? isOverseas = event.eligibityCert.overseas;
|
bool? isOverseas = event.eligibityCert.overseas;
|
||||||
|
@ -95,7 +119,7 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
||||||
eligibityCert: event.eligibityCert,
|
eligibityCert: event.eligibityCert,
|
||||||
countries: globalCountries!,
|
countries: globalCountries!,
|
||||||
regions: globalRegions!,
|
regions: globalRegions!,
|
||||||
eligibilities: globalEligibilities!));
|
eligibilities: globalEligibilities));
|
||||||
} else {
|
} else {
|
||||||
emit(EditEligibilityState(
|
emit(EditEligibilityState(
|
||||||
selectedCountry: currentCountry,
|
selectedCountry: currentCountry,
|
||||||
|
@ -109,17 +133,16 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
||||||
eligibityCert: event.eligibityCert,
|
eligibityCert: event.eligibityCert,
|
||||||
countries: globalCountries!,
|
countries: globalCountries!,
|
||||||
regions: globalRegions!,
|
regions: globalRegions!,
|
||||||
eligibilities: globalEligibilities!));
|
eligibilities: globalEligibilities));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(EligibilityErrorState(message: e.toString()));
|
emit(EligibilityErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
////====================================================================
|
//// UPDATE
|
||||||
on<UpdateEligibility>((event, emit) async {
|
on<UpdateEligibility>((event, emit) async {
|
||||||
try {
|
try {
|
||||||
emit(EligibilityLoadingState());
|
|
||||||
Map<dynamic, dynamic> status = await EligibilityService.instance.update(
|
Map<dynamic, dynamic> status = await EligibilityService.instance.update(
|
||||||
eligibityCert: event.eligibityCert,
|
eligibityCert: event.eligibityCert,
|
||||||
token: event.token,
|
token: event.token,
|
||||||
|
@ -127,26 +150,25 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
||||||
oldEligibility: event.oldEligibility);
|
oldEligibility: event.oldEligibility);
|
||||||
if (status['success']) {
|
if (status['success']) {
|
||||||
EligibityCert newEligibility = EligibityCert.fromJson(status['data']);
|
EligibityCert newEligibility = EligibityCert.fromJson(status['data']);
|
||||||
eligibilities!.removeWhere(
|
eligibilities.removeWhere(
|
||||||
(EligibityCert element) => element.id == event.eligibityCert.id);
|
(EligibityCert element) => element.id == event.eligibityCert.id);
|
||||||
eligibilities!.add(newEligibility);
|
eligibilities.add(newEligibility);
|
||||||
emit(EligibilityEditedState(
|
emit(EligibilityEditedState(response: status));
|
||||||
eligibilities: eligibilities!, response: status));
|
|
||||||
} else {
|
} else {
|
||||||
emit(EligibilityEditedState(
|
emit(EligibilityEditedState(response: status));
|
||||||
eligibilities: eligibilities!, response: status));
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(EligibilityErrorState(message: e.toString()));
|
emit(EligibilityErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//// SHOW ADD FORM
|
||||||
on<ShowAddEligibilityForm>((event, emit) async {
|
on<ShowAddEligibilityForm>((event, emit) async {
|
||||||
emit(EligibilityLoadingState());
|
emit(EligibilityLoadingState());
|
||||||
if (globalRegions == null) {
|
if (globalRegions == null) {
|
||||||
List<Region> regions = await LocationUtils.instance.getRegions();
|
List<Region> regions = await LocationUtils.instance.getRegions();
|
||||||
globalRegions = regions;
|
globalRegions = regions;
|
||||||
}
|
}
|
||||||
if (globalEligibilities == null) {
|
if (globalEligibilities.isEmpty) {
|
||||||
List<Eligibility> eligibilities =
|
List<Eligibility> eligibilities =
|
||||||
await ProfileUtilities.instance.getEligibilities();
|
await ProfileUtilities.instance.getEligibilities();
|
||||||
globalEligibilities = eligibilities;
|
globalEligibilities = eligibilities;
|
||||||
|
@ -157,37 +179,15 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(AddEligibilityState(
|
emit(AddEligibilityState(
|
||||||
eligibilities: globalEligibilities!,
|
eligibilities: globalEligibilities,
|
||||||
regions: globalRegions!,
|
regions: globalRegions!,
|
||||||
countries: globalCountries!));
|
countries: globalCountries!));
|
||||||
});
|
});
|
||||||
////====================================================================
|
|
||||||
on<DeleteEligibility>((event, emit) async {
|
|
||||||
emit(EligibilityLoadingState());
|
|
||||||
try {
|
|
||||||
final bool success = await EligibilityService.instance.delete(
|
|
||||||
eligibilityId: event.eligibilityId,
|
|
||||||
profileId: int.parse(event.profileId),
|
|
||||||
token: event.token);
|
|
||||||
if (success) {
|
|
||||||
event.eligibilities.removeWhere(
|
|
||||||
((EligibityCert element) => element.id == event.eligibilityId));
|
|
||||||
|
|
||||||
List<EligibityCert> eligibilities = event.eligibilities;
|
//// ADD
|
||||||
emit(DeletedState(success: success, eligibilities: eligibilities));
|
|
||||||
} else {
|
|
||||||
emit(DeletedState(
|
|
||||||
success: success, eligibilities: event.eligibilities));
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
emit(EligibilityErrorState(message: e.toString()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
////====================================================================
|
|
||||||
on<AddEligibility>(
|
on<AddEligibility>(
|
||||||
(event, emit) async {
|
(event, emit) async {
|
||||||
try {
|
try {
|
||||||
emit(EligibilityLoadingState());
|
|
||||||
Map<dynamic, dynamic> status = await EligibilityService.instance.add(
|
Map<dynamic, dynamic> status = await EligibilityService.instance.add(
|
||||||
eligibityCert: event.eligibityCert,
|
eligibityCert: event.eligibityCert,
|
||||||
token: event.token,
|
token: event.token,
|
||||||
|
@ -195,12 +195,10 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
||||||
if (status['success']) {
|
if (status['success']) {
|
||||||
EligibityCert? eligibityCert =
|
EligibityCert? eligibityCert =
|
||||||
EligibityCert.fromJson(status['data']);
|
EligibityCert.fromJson(status['data']);
|
||||||
eligibilities!.add(eligibityCert);
|
eligibilities.add(eligibityCert);
|
||||||
emit(EligibilityAddedState(
|
emit(EligibilityAddedState(response: status));
|
||||||
eligibilities: eligibilities!, response: status));
|
|
||||||
} else {
|
} else {
|
||||||
emit(EligibilityAddedState(
|
emit(EligibilityAddedState(response: status));
|
||||||
eligibilities: eligibilities!, response: status));
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(EligibilityErrorState(message: e.toString()));
|
emit(EligibilityErrorState(message: e.toString()));
|
||||||
|
|
|
@ -38,8 +38,9 @@ class UpdateEligibility extends EligibilityEvent{
|
||||||
List<Object> get props =>[eligibityCert,profileId,token,oldEligibility];
|
List<Object> get props =>[eligibityCert,profileId,token,oldEligibility];
|
||||||
}
|
}
|
||||||
class LoadEligibility extends EligibilityEvent {
|
class LoadEligibility extends EligibilityEvent {
|
||||||
final List<EligibityCert> eligibilities;
|
final int? profileId;
|
||||||
const LoadEligibility({required this.eligibilities});
|
final String? token;
|
||||||
|
const LoadEligibility({ this.profileId, this.token});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
@ -52,17 +53,16 @@ class ShowEditEligibilityForm extends EligibilityEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeleteEligibility extends EligibilityEvent {
|
class DeleteEligibility extends EligibilityEvent {
|
||||||
final List<EligibityCert> eligibilities;
|
|
||||||
final String profileId;
|
final String profileId;
|
||||||
final int eligibilityId;
|
final int eligibilityId;
|
||||||
final String token;
|
final String token;
|
||||||
const DeleteEligibility(
|
const DeleteEligibility(
|
||||||
{required this.eligibilities,
|
{
|
||||||
required this.eligibilityId,
|
required this.eligibilityId,
|
||||||
required this.profileId,
|
required this.profileId,
|
||||||
required this.token});
|
required this.token});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [eligibilities, profileId, eligibilityId, token];
|
List<Object> get props => [ profileId, eligibilityId, token];
|
||||||
}
|
}
|
||||||
|
|
||||||
class CallErrorState extends EligibilityEvent{
|
class CallErrorState extends EligibilityEvent{
|
||||||
|
|
|
@ -43,11 +43,10 @@ class EditEligibilityState extends EligibilityState {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeletedState extends EligibilityState {
|
class DeletedState extends EligibilityState {
|
||||||
final List<EligibityCert> eligibilities;
|
|
||||||
final bool success;
|
final bool success;
|
||||||
const DeletedState({required this.eligibilities, required this.success});
|
const DeletedState({required this.success});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [success, eligibilities];
|
List<Object> get props => [success];
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddEligibilityState extends EligibilityState {
|
class AddEligibilityState extends EligibilityState {
|
||||||
|
@ -63,20 +62,18 @@ class AddEligibilityState extends EligibilityState {
|
||||||
List<Object> get props => [eligibilities,countries,regions];
|
List<Object> get props => [eligibilities,countries,regions];
|
||||||
}
|
}
|
||||||
class EligibilityEditedState extends EligibilityState{
|
class EligibilityEditedState extends EligibilityState{
|
||||||
final List<EligibityCert> eligibilities;
|
|
||||||
final Map<dynamic,dynamic> response;
|
final Map<dynamic,dynamic> response;
|
||||||
const EligibilityEditedState({required this.eligibilities, required this.response});
|
const EligibilityEditedState({required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props =>[eligibilities, response];
|
List<Object> get props =>[ response];
|
||||||
}
|
}
|
||||||
|
|
||||||
class EligibilityAddedState extends EligibilityState{
|
class EligibilityAddedState extends EligibilityState{
|
||||||
final List<EligibityCert> eligibilities;
|
|
||||||
final Map<dynamic,dynamic> response;
|
final Map<dynamic,dynamic> response;
|
||||||
|
|
||||||
const EligibilityAddedState({required this.eligibilities, required this.response});
|
const EligibilityAddedState({ required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props =>[eligibilities,response];
|
List<Object> get props =>[response];
|
||||||
}
|
}
|
||||||
class EligibilityLoadingState extends EligibilityState{
|
class EligibilityLoadingState extends EligibilityState{
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:unit2/model/profile/work_history.dart';
|
|
||||||
import 'package:unit2/model/utils/agency.dart';
|
import 'package:unit2/model/utils/agency.dart';
|
||||||
import 'package:unit2/model/utils/category.dart';
|
import 'package:unit2/model/utils/category.dart';
|
||||||
import 'package:unit2/sevices/profile/orgmembership_services.dart';
|
import 'package:unit2/sevices/profile/orgmembership_services.dart';
|
||||||
|
@ -30,7 +29,7 @@ class OrganizationMembershipBloc extends Bloc<OrganizationMembershipEvent, Organ
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
on<LoadOrganizationMemberships>((event,emit){
|
on<LoadOrganizationMemberships>((event,emit){
|
||||||
emit(OrganizationMembershipLoaded(orgMemberships: event.organizationMemberships));
|
emit(OrganizationMembershipLoaded(orgMemberships: organizationMemberships));
|
||||||
});
|
});
|
||||||
|
|
||||||
////SHOW ADD ORG MEMBERSHIP FORM
|
////SHOW ADD ORG MEMBERSHIP FORM
|
||||||
|
@ -52,15 +51,14 @@ class OrganizationMembershipBloc extends Bloc<OrganizationMembershipEvent, Organ
|
||||||
});
|
});
|
||||||
//// ADD ORGMEMBERSHIP
|
//// ADD ORGMEMBERSHIP
|
||||||
on<AddOrgMembership>((event,emit)async{
|
on<AddOrgMembership>((event,emit)async{
|
||||||
emit(OrgmembershipLoadingState());
|
|
||||||
try{
|
try{
|
||||||
Map<dynamic,dynamic> status= await OrganizationMembershipServices.instance.add(agency: event.agency, token: event.token, profileId: event.profileId.toString());
|
Map<dynamic,dynamic> status= await OrganizationMembershipServices.instance.add(agency: event.agency, token: event.token, profileId: event.profileId.toString());
|
||||||
if(status["success"]){
|
if(status["success"]){
|
||||||
OrganizationMembership organizationMembership = OrganizationMembership.fromJson(status["data"]);
|
OrganizationMembership organizationMembership = OrganizationMembership.fromJson(status["data"]);
|
||||||
organizationMemberships.add(organizationMembership);
|
organizationMemberships.add(organizationMembership);
|
||||||
emit(OrgMembershipAddedState(orgMemberships: organizationMemberships, response: status));
|
emit(OrgMembershipAddedState( response: status));
|
||||||
}else{
|
}else{
|
||||||
emit(OrgMembershipAddedState(orgMemberships: organizationMemberships, response: status));
|
emit(OrgMembershipAddedState( response: status));
|
||||||
}
|
}
|
||||||
}catch(e){
|
}catch(e){
|
||||||
emit(OrganizationMembershipErrorState(message: e.toString()));
|
emit(OrganizationMembershipErrorState(message: e.toString()));
|
||||||
|
@ -72,11 +70,10 @@ class OrganizationMembershipBloc extends Bloc<OrganizationMembershipEvent, Organ
|
||||||
try{
|
try{
|
||||||
final bool success = await OrganizationMembershipServices.instance.delete(agency: event.org.agency!, profileId: event.profileId, token: event.token);
|
final bool success = await OrganizationMembershipServices.instance.delete(agency: event.org.agency!, profileId: event.profileId, token: event.token);
|
||||||
if(success){
|
if(success){
|
||||||
event.organizationMemberships.removeWhere((element) => element.agency!.id == event.org.agency!.id );
|
organizationMemberships.removeWhere((element) => element.agency!.id == event.org.agency!.id );
|
||||||
List<OrganizationMembership> orgmemberships = event.organizationMemberships;
|
emit(OrgMembershipDeletedState(success: success));
|
||||||
emit(OrgMembershipDeletedState(organizationMemberships: orgmemberships, success: success));
|
|
||||||
}else{
|
}else{
|
||||||
emit(OrgMembershipDeletedState(organizationMemberships: organizationMemberships, success: success));
|
emit(OrgMembershipDeletedState(success: success));
|
||||||
}
|
}
|
||||||
}catch(e){
|
}catch(e){
|
||||||
emit(OrganizationMembershipErrorState(message: e.toString()));
|
emit(OrganizationMembershipErrorState(message: e.toString()));
|
||||||
|
|
|
@ -8,17 +8,15 @@ abstract class OrganizationMembershipEvent extends Equatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoadOrganizationMemberships extends OrganizationMembershipEvent{
|
class LoadOrganizationMemberships extends OrganizationMembershipEvent{
|
||||||
final List<OrganizationMembership> organizationMemberships;
|
|
||||||
const LoadOrganizationMemberships({required this.organizationMemberships});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [organizationMemberships];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetOrganizationMembership extends OrganizationMembershipEvent{
|
class GetOrganizationMembership extends OrganizationMembershipEvent{
|
||||||
final int? profileId;
|
final int? profileId;
|
||||||
final String? token;
|
final String? token;
|
||||||
const GetOrganizationMembership({ this.profileId, this.token});
|
const GetOrganizationMembership({this.profileId, this.token});
|
||||||
|
|
||||||
}
|
}
|
||||||
class ShowAddOrgMembershipForm extends OrganizationMembershipEvent{
|
class ShowAddOrgMembershipForm extends OrganizationMembershipEvent{
|
||||||
|
@ -37,9 +35,9 @@ class DeleteOrgMemberShip extends OrganizationMembershipEvent{
|
||||||
final int profileId;
|
final int profileId;
|
||||||
final String token;
|
final String token;
|
||||||
final OrganizationMembership org;
|
final OrganizationMembership org;
|
||||||
final List<OrganizationMembership> organizationMemberships;
|
|
||||||
const DeleteOrgMemberShip({required this.profileId, required this.token, required this.org, required this.organizationMemberships});
|
const DeleteOrgMemberShip({required this.profileId, required this.token, required this.org,});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [profileId,token,org,organizationMemberships];
|
List<Object> get props => [profileId,token,org];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,18 +27,16 @@ class OrgmembershipLoadingState extends OrganizationMembershipState{
|
||||||
|
|
||||||
}
|
}
|
||||||
class OrgMembershipDeletedState extends OrganizationMembershipState{
|
class OrgMembershipDeletedState extends OrganizationMembershipState{
|
||||||
final List<OrganizationMembership> organizationMemberships;
|
|
||||||
final bool success;
|
final bool success;
|
||||||
const OrgMembershipDeletedState({required this.organizationMemberships, required this.success});
|
const OrgMembershipDeletedState({ required this.success});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [organizationMemberships,success];
|
List<Object> get props => [success];
|
||||||
}
|
}
|
||||||
class OrgMembershipAddedState extends OrganizationMembershipState{
|
class OrgMembershipAddedState extends OrganizationMembershipState{
|
||||||
final List<OrganizationMembership> orgMemberships;
|
|
||||||
final Map<dynamic,dynamic> response;
|
final Map<dynamic,dynamic> response;
|
||||||
const OrgMembershipAddedState({required this.orgMemberships, required this.response});
|
const OrgMembershipAddedState({required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [orgMemberships,response];
|
List<Object> get props => [response];
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddOrgMembershipState extends OrganizationMembershipState{
|
class AddOrgMembershipState extends OrganizationMembershipState{
|
||||||
|
|
|
@ -14,7 +14,7 @@ part 'contact_state.dart';
|
||||||
class ContactBloc extends Bloc<ContactEvent, ContactState> {
|
class ContactBloc extends Bloc<ContactEvent, ContactState> {
|
||||||
ContactBloc() : super(ContactInitial()) {
|
ContactBloc() : super(ContactInitial()) {
|
||||||
List<ContactInfo> contactInformations = [];
|
List<ContactInfo> contactInformations = [];
|
||||||
List<ServiceType> serviceTypes =[];
|
List<ServiceType> serviceTypes = [];
|
||||||
//// get all contacts
|
//// get all contacts
|
||||||
on<GetContacts>((event, emit) {
|
on<GetContacts>((event, emit) {
|
||||||
emit(ContactLoadingState());
|
emit(ContactLoadingState());
|
||||||
|
@ -26,72 +26,118 @@ class ContactBloc extends Bloc<ContactEvent, ContactState> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//// Load Contacts
|
//// Load Contacts
|
||||||
on<LoadContacts>((event,emit){
|
on<LoadContacts>((event, emit) {
|
||||||
emit(ContactLoadedState(contactInformation: event.contactInformation));
|
emit(ContactLoadedState(contactInformation: contactInformations));
|
||||||
});
|
});
|
||||||
//// show add form
|
//// show add form
|
||||||
on<ShowAddForm>((event,emit)async{
|
on<ShowAddForm>((event, emit) async {
|
||||||
try{
|
try {
|
||||||
emit(ContactLoadingState());
|
emit(ContactLoadingState());
|
||||||
if(serviceTypes.isEmpty){
|
if (serviceTypes.isEmpty) {
|
||||||
|
serviceTypes = await ProfileUtilities.instance.getServiceType();
|
||||||
|
}
|
||||||
|
emit(ContactAddingState(serviceTypes: serviceTypes));
|
||||||
|
} catch (e) {
|
||||||
|
emit(ContactErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
///// Show edit form
|
||||||
|
on<ShowEditForm>((event, emit) async {
|
||||||
|
ServiceType serviceType;
|
||||||
|
List<CommService> commServiceProvivers;
|
||||||
|
CommService serviceProvider;
|
||||||
|
try{
|
||||||
|
if (serviceTypes.isEmpty) {
|
||||||
serviceTypes = await ProfileUtilities.instance.getServiceType();
|
serviceTypes = await ProfileUtilities.instance.getServiceType();
|
||||||
}
|
}
|
||||||
emit(ContactAddingState(serviceTypes: serviceTypes));
|
serviceType = serviceTypes.firstWhere((ServiceType element) {
|
||||||
}catch(e){
|
return element.id == event.contactInfo.commService!.serviceType!.id;
|
||||||
emit(ContactErrorState(message: e.toString()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
///// Show edit form
|
|
||||||
on<ShowEditForm>((event,emit)async{
|
|
||||||
ServiceType serviceType;
|
|
||||||
List<ServiceProvider> serviceProvivers;
|
|
||||||
ServiceProvider serviceProvider;
|
|
||||||
try{
|
|
||||||
if(serviceTypes.isEmpty){
|
|
||||||
serviceTypes = await ProfileUtilities.instance.getServiceType();
|
|
||||||
}
|
|
||||||
serviceType = serviceTypes.firstWhere((var element){
|
|
||||||
return event.contactInfo.commService!.serviceType!.id == element.id;
|
|
||||||
});
|
});
|
||||||
serviceProvivers = await ContactService.instance.getServiceProvider(serviceTypeId: serviceType.id!);
|
commServiceProvivers = await ContactService.instance
|
||||||
serviceProvider = serviceProvivers.firstWhere((element) => element.id == event.contactInfo.commService!.serviceProvider!.id);
|
.getServiceProvider(serviceTypeId: serviceType.id!);
|
||||||
emit(ContactEditingState(serviceTypes: serviceTypes,selectedServiceType: serviceType,serviceProviders: serviceProvivers,selectedProvider: serviceProvider, contactInfo: event.contactInfo));
|
serviceProvider = commServiceProvivers.firstWhere((CommService element) =>
|
||||||
}catch(e){
|
element.id == event.contactInfo.commService!.id);
|
||||||
emit(ContactErrorState(message: e.toString()));
|
emit(ContactEditingState(
|
||||||
}
|
serviceTypes: serviceTypes,
|
||||||
});
|
selectedServiceType: serviceType,
|
||||||
////edit contact
|
commServiceProviders: commServiceProvivers,
|
||||||
on<EditContactInformation>((event,emit)async{
|
selectedProvider: serviceProvider,
|
||||||
Map<dynamic,dynamic> responseStatus = await ContactService.instance.update(profileId: event.profileId, token: event.token, contactInfo: event.contactInfo);
|
contactInfo: event.contactInfo));
|
||||||
if(responseStatus['success']){
|
}catch(e){
|
||||||
ContactInfo contactInfo = ContactInfo.fromJson(responseStatus['data']['contact_info']);
|
emit(ContactErrorState(message: e.toString()));
|
||||||
contactInformations.removeWhere((ContactInfo element) => element.id == event.contactInfo.id);
|
|
||||||
contactInformations.add(contactInfo);
|
|
||||||
emit(ContactEditedState(contactInformation: contactInformations, response: responseStatus));
|
|
||||||
}else{
|
|
||||||
emit(ContactEditedState(contactInformation: contactInformations, response: responseStatus));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//// add contact
|
|
||||||
try{
|
|
||||||
|
|
||||||
}catch(e){
|
|
||||||
emit(ContactErrorState(message: e.toString()));
|
|
||||||
}
|
|
||||||
//// delete contact
|
|
||||||
on<DeleteContactInformation>((event, emit)async{
|
|
||||||
try{
|
|
||||||
final bool success = await ContactService.instance.deleteContact(profileId: event.profileId, token: event.token, contactInfo: event.contactInfo);
|
|
||||||
if(success){
|
|
||||||
contactInformations.removeWhere((element) => element.id == event.contactInfo.id);
|
|
||||||
emit(ContactDeletedState(contactInformation: contactInformations, succcess: success));
|
|
||||||
}else{
|
|
||||||
emit(ContactDeletedState(contactInformation: contactInformations, succcess: success));
|
|
||||||
}
|
}
|
||||||
}catch(e){
|
});
|
||||||
emit(ContactErrorState(message: e.toString()));
|
////edit contact
|
||||||
}
|
on<EditContactInformation>((event, emit) async {
|
||||||
});
|
try {
|
||||||
|
Map<dynamic, dynamic> responseStatus = await ContactService.instance
|
||||||
|
.update(
|
||||||
|
profileId: event.profileId,
|
||||||
|
token: event.token,
|
||||||
|
contactInfo: event.contactInfo);
|
||||||
|
if (responseStatus['success']) {
|
||||||
|
ContactInfo contactInfo =
|
||||||
|
ContactInfo.fromJson(responseStatus['data']['contact_info']);
|
||||||
|
contactInformations.removeWhere(
|
||||||
|
(ContactInfo element) => element.id == event.contactInfo.id);
|
||||||
|
contactInformations.add(contactInfo);
|
||||||
|
emit(ContactEditedState(
|
||||||
|
|
||||||
|
response: responseStatus));
|
||||||
|
} else {
|
||||||
|
emit(ContactEditedState(
|
||||||
|
|
||||||
|
response: responseStatus));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(ContactErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//// add contact
|
||||||
|
|
||||||
|
on<AddContactInformation>((event, emit) async {
|
||||||
|
try {
|
||||||
|
Map<dynamic, dynamic> responseStatus = await ContactService.instance
|
||||||
|
.add(
|
||||||
|
profileId: event.profileId,
|
||||||
|
token: event.token,
|
||||||
|
contactInfo: event.contactInfo);
|
||||||
|
if (responseStatus['success']) {
|
||||||
|
ContactInfo contactInfo =
|
||||||
|
ContactInfo.fromJson(responseStatus['data']['contact_info']);
|
||||||
|
contactInformations.add(contactInfo);
|
||||||
|
emit(ContactEditedState(
|
||||||
|
|
||||||
|
response: responseStatus));
|
||||||
|
} else {
|
||||||
|
emit(ContactEditedState(
|
||||||
|
|
||||||
|
response: responseStatus));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(ContactErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//// delete contact
|
||||||
|
on<DeleteContactInformation>((event, emit) async {
|
||||||
|
try {
|
||||||
|
final bool success = await ContactService.instance.deleteContact(
|
||||||
|
profileId: event.profileId,
|
||||||
|
token: event.token,
|
||||||
|
contactInfo: event.contactInfo);
|
||||||
|
if (success) {
|
||||||
|
contactInformations
|
||||||
|
.removeWhere((element) => element.id == event.contactInfo.id);
|
||||||
|
emit(ContactDeletedState(
|
||||||
|
succcess: success));
|
||||||
|
} else {
|
||||||
|
emit(ContactDeletedState(
|
||||||
|
succcess: success));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(ContactErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,9 @@ class GetContacts extends ContactEvent{
|
||||||
|
|
||||||
//// load contacts
|
//// load contacts
|
||||||
class LoadContacts extends ContactEvent{
|
class LoadContacts extends ContactEvent{
|
||||||
final List<ContactInfo> contactInformation;
|
|
||||||
const LoadContacts({required this.contactInformation});
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [contactInformation];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
//// show add form
|
//// show add form
|
||||||
|
|
|
@ -30,11 +30,11 @@ class ContactAddingState extends ContactState{
|
||||||
//// Editing state
|
//// Editing state
|
||||||
class ContactEditingState extends ContactState{
|
class ContactEditingState extends ContactState{
|
||||||
final List<ServiceType> serviceTypes;
|
final List<ServiceType> serviceTypes;
|
||||||
final List<ServiceProvider> serviceProviders;
|
final List<CommService> commServiceProviders;
|
||||||
final ServiceProvider selectedProvider;
|
final CommService selectedProvider;
|
||||||
final ServiceType selectedServiceType;
|
final ServiceType selectedServiceType;
|
||||||
final ContactInfo contactInfo;
|
final ContactInfo contactInfo;
|
||||||
const ContactEditingState({ required this.serviceTypes, required this.selectedServiceType, required this.selectedProvider, required this.serviceProviders, required this.contactInfo});
|
const ContactEditingState({ required this.serviceTypes, required this.selectedServiceType, required this.selectedProvider, required this.commServiceProviders, required this.contactInfo});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [serviceTypes];
|
List<Object> get props => [serviceTypes];
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,11 @@ class ContactEditingState extends ContactState{
|
||||||
|
|
||||||
//// added state
|
//// added state
|
||||||
class ContactAddedState extends ContactState{
|
class ContactAddedState extends ContactState{
|
||||||
final List<ContactInfo> contactInformation;
|
|
||||||
final Map<dynamic,dynamic> response;
|
final Map<dynamic,dynamic> response;
|
||||||
const ContactAddedState({required this.contactInformation, required this.response});
|
const ContactAddedState({ required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [contactInformation,response];
|
List<Object> get props => [response];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,19 +54,19 @@ class ContactAddedState extends ContactState{
|
||||||
|
|
||||||
//// edited state
|
//// edited state
|
||||||
class ContactEditedState extends ContactState{
|
class ContactEditedState extends ContactState{
|
||||||
final List<ContactInfo> contactInformation;
|
|
||||||
final Map<dynamic,dynamic> response;
|
final Map<dynamic,dynamic> response;
|
||||||
const ContactEditedState({required this.contactInformation, required this.response});
|
const ContactEditedState({ required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [contactInformation,response];
|
List<Object> get props => [response];
|
||||||
}
|
}
|
||||||
////deleted state
|
////deleted state
|
||||||
class ContactDeletedState extends ContactState{
|
class ContactDeletedState extends ContactState{
|
||||||
final List<ContactInfo> contactInformation;
|
|
||||||
final bool succcess;
|
final bool succcess;
|
||||||
const ContactDeletedState({required this.contactInformation, required this.succcess});
|
const ContactDeletedState({required this.succcess});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [contactInformation,succcess];
|
List<Object> get props => [succcess];
|
||||||
}
|
}
|
||||||
|
|
||||||
////error state
|
////error state
|
||||||
|
|
|
@ -104,7 +104,11 @@ class ReferencesBloc extends Bloc<ReferencesEvent, ReferencesState> {
|
||||||
event.personalReference.address!.cityMunicipality!.code ==
|
event.personalReference.address!.cityMunicipality!.code ==
|
||||||
city.code);
|
city.code);
|
||||||
List<Barangay> barangays = await LocationUtils.instance.getBarangay(code: selectedCity.code.toString());
|
List<Barangay> barangays = await LocationUtils.instance.getBarangay(code: selectedCity.code.toString());
|
||||||
selectedBarangay = barangays.firstWhere((Barangay barangay)=>event.personalReference.address!.barangay!.code == barangay.code);
|
if(event.personalReference.address?.barangay!=null){
|
||||||
|
selectedBarangay = barangays.firstWhere((Barangay barangay)=>event.personalReference.address?.barangay?.code == barangay.code);
|
||||||
|
}else{
|
||||||
|
selectedBarangay = null;
|
||||||
|
}
|
||||||
emit(EditReferenceState(
|
emit(EditReferenceState(
|
||||||
selectedRegion: selectedRegion,
|
selectedRegion: selectedRegion,
|
||||||
ref: event.personalReference,
|
ref: event.personalReference,
|
||||||
|
@ -144,17 +148,16 @@ class ReferencesBloc extends Bloc<ReferencesEvent, ReferencesState> {
|
||||||
message: "Something went wrong. Please try again"));
|
message: "Something went wrong. Please try again"));
|
||||||
//// EDIT REFERENCES EVENT
|
//// EDIT REFERENCES EVENT
|
||||||
});on<EditReference>((event,emit)async{
|
});on<EditReference>((event,emit)async{
|
||||||
emit(ReferencesLoadingState());
|
|
||||||
Map<dynamic,dynamic> status =await ReferencesServices.instace.update(ref: event.reference, token: event.token, profileId: event.profileId);
|
Map<dynamic,dynamic> status =await ReferencesServices.instace.update(ref: event.reference, token: event.token, profileId: event.profileId);
|
||||||
if (status['success']) {
|
if (status['success']) {
|
||||||
PersonalReference ref = PersonalReference.fromJson(status['data']);
|
PersonalReference ref = PersonalReference.fromJson(status['data']);
|
||||||
references.removeWhere((PersonalReference element)=>element.id == event.reference.id);
|
references.removeWhere((PersonalReference element)=>element.id == event.reference.id);
|
||||||
references.add(ref);
|
references.add(ref);
|
||||||
emit(
|
emit(
|
||||||
ReferenceEditedState(personalRefs: references, response: status));
|
ReferenceEditedState( response: status));
|
||||||
} else {
|
} else {
|
||||||
emit(
|
emit(
|
||||||
ReferenceEditedState(personalRefs: references, response: status));
|
ReferenceEditedState( response: status));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -171,10 +174,10 @@ class ReferencesBloc extends Bloc<ReferencesEvent, ReferencesState> {
|
||||||
PersonalReference ref = PersonalReference.fromJson(status['data']);
|
PersonalReference ref = PersonalReference.fromJson(status['data']);
|
||||||
references.add(ref);
|
references.add(ref);
|
||||||
emit(
|
emit(
|
||||||
ReferencesAddedState(personalRefs: references, response: status));
|
ReferencesAddedState( response: status));
|
||||||
} else {
|
} else {
|
||||||
emit(
|
emit(
|
||||||
ReferencesAddedState(personalRefs: references, response: status));
|
ReferencesAddedState( response: status));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(ReferencesErrorState(message: e.toString()));
|
emit(ReferencesErrorState(message: e.toString()));
|
||||||
|
@ -183,7 +186,6 @@ class ReferencesBloc extends Bloc<ReferencesEvent, ReferencesState> {
|
||||||
////LOAD REFERENCE
|
////LOAD REFERENCE
|
||||||
on<LoadReferences>((event, emit) {
|
on<LoadReferences>((event, emit) {
|
||||||
emit(ReferencesLoadingState());
|
emit(ReferencesLoadingState());
|
||||||
references = event.references;
|
|
||||||
emit(ReferencesLoadedState(references: references));
|
emit(ReferencesLoadedState(references: references));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -196,9 +198,9 @@ class ReferencesBloc extends Bloc<ReferencesEvent, ReferencesState> {
|
||||||
event.references.removeWhere(
|
event.references.removeWhere(
|
||||||
(PersonalReference element) => element.id == event.refId);
|
(PersonalReference element) => element.id == event.refId);
|
||||||
references = event.references;
|
references = event.references;
|
||||||
emit(DeleteReferenceState(references: references, success: success));
|
emit(DeleteReferenceState( success: success));
|
||||||
} else {
|
} else {
|
||||||
emit(DeleteReferenceState(references: references, success: success));
|
emit(DeleteReferenceState(success: success));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(ReferencesErrorState(message: e.toString()));
|
emit(ReferencesErrorState(message: e.toString()));
|
||||||
|
|
|
@ -7,63 +7,60 @@ abstract class ReferencesEvent extends Equatable {
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetReferences extends ReferencesEvent{
|
class GetReferences extends ReferencesEvent {
|
||||||
final int profileId;
|
final int profileId;
|
||||||
final String token;
|
final String token;
|
||||||
const GetReferences({required this.profileId, required this.token});
|
const GetReferences({required this.profileId, required this.token});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [profileId,token];
|
List<Object> get props => [profileId, token];
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShowAddReferenceForm extends ReferencesEvent{
|
class ShowAddReferenceForm extends ReferencesEvent {}
|
||||||
|
|
||||||
}
|
class ShowEditReferenceForm extends ReferencesEvent {
|
||||||
|
|
||||||
class ShowEditReferenceForm extends ReferencesEvent{
|
|
||||||
final PersonalReference personalReference;
|
final PersonalReference personalReference;
|
||||||
const ShowEditReferenceForm({required this.personalReference});
|
const ShowEditReferenceForm({required this.personalReference});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [personalReference];
|
List<Object> get props => [personalReference];
|
||||||
|
|
||||||
}
|
|
||||||
class CallErrorState extends ReferencesEvent{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CallErrorState extends ReferencesEvent {}
|
||||||
|
|
||||||
class AddReference extends ReferencesEvent{
|
class AddReference extends ReferencesEvent {
|
||||||
final PersonalReference reference;
|
final PersonalReference reference;
|
||||||
final String token;
|
final String token;
|
||||||
final int profileId;
|
final int profileId;
|
||||||
const AddReference({required this.profileId, required this.reference,required this.token});
|
const AddReference(
|
||||||
@override
|
{required this.profileId, required this.reference, required this.token});
|
||||||
List<Object> get props => [profileId,token,reference];
|
@override
|
||||||
}
|
List<Object> get props => [profileId, token, reference];
|
||||||
class EditReference extends ReferencesEvent{
|
|
||||||
final PersonalReference reference;
|
|
||||||
final String token;
|
|
||||||
final int profileId;
|
|
||||||
const EditReference({required this.profileId, required this.reference,required this.token});
|
|
||||||
@override
|
|
||||||
List<Object> get props => [profileId,token,reference];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeleteReference extends ReferencesEvent{
|
class EditReference extends ReferencesEvent {
|
||||||
final List<PersonalReference>references;
|
final PersonalReference reference;
|
||||||
|
final String token;
|
||||||
|
final int profileId;
|
||||||
|
const EditReference(
|
||||||
|
{required this.profileId, required this.reference, required this.token});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [profileId, token, reference];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteReference extends ReferencesEvent {
|
||||||
|
final List<PersonalReference> references;
|
||||||
final int profileId;
|
final int profileId;
|
||||||
final String token;
|
final String token;
|
||||||
final int refId;
|
final int refId;
|
||||||
const DeleteReference({required this.profileId, required this.refId, required this.references, required this.token});
|
const DeleteReference(
|
||||||
@override
|
{required this.profileId,
|
||||||
List<Object> get props => [profileId,token,refId,references];
|
required this.refId,
|
||||||
}
|
required this.references,
|
||||||
|
required this.token});
|
||||||
class LoadReferences extends ReferencesEvent{
|
|
||||||
final List<PersonalReference> references;
|
|
||||||
const LoadReferences({required this.references});
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [references];
|
List<Object> get props => [profileId, token, refId, references];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class LoadReferences extends ReferencesEvent {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
|
@ -28,20 +28,19 @@ class ReferencesErrorState extends ReferencesState {
|
||||||
class ReferencesLoadingState extends ReferencesState {}
|
class ReferencesLoadingState extends ReferencesState {}
|
||||||
|
|
||||||
class ReferencesAddedState extends ReferencesState {
|
class ReferencesAddedState extends ReferencesState {
|
||||||
final List<PersonalReference> personalRefs;
|
|
||||||
final Map<dynamic, dynamic> response;
|
final Map<dynamic, dynamic> response;
|
||||||
const ReferencesAddedState(
|
const ReferencesAddedState(
|
||||||
{required this.personalRefs, required this.response});
|
{ required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [personalRefs, response];
|
List<Object> get props => [ response];
|
||||||
}
|
}
|
||||||
class ReferenceEditedState extends ReferencesState {
|
class ReferenceEditedState extends ReferencesState {
|
||||||
final List<PersonalReference> personalRefs;
|
|
||||||
final Map<dynamic, dynamic> response;
|
final Map<dynamic, dynamic> response;
|
||||||
const ReferenceEditedState(
|
const ReferenceEditedState(
|
||||||
{required this.personalRefs, required this.response});
|
{ required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [personalRefs, response];
|
List<Object> get props => [ response];
|
||||||
}
|
}
|
||||||
|
|
||||||
class EditReferenceState extends ReferencesState {
|
class EditReferenceState extends ReferencesState {
|
||||||
|
@ -89,7 +88,6 @@ class AddReferenceState extends ReferencesState {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeleteReferenceState extends ReferencesState {
|
class DeleteReferenceState extends ReferencesState {
|
||||||
final List<PersonalReference> references;
|
|
||||||
final bool success;
|
final bool success;
|
||||||
const DeleteReferenceState({required this.references, required this.success});
|
const DeleteReferenceState({ required this.success});
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,12 @@ class WorkHistoryBloc extends Bloc<WorkHistorytEvent, WorkHistoryState> {
|
||||||
on<GetWorkHistories>((event, emit) async {
|
on<GetWorkHistories>((event, emit) async {
|
||||||
emit(WorkHistoryLoadingState());
|
emit(WorkHistoryLoadingState());
|
||||||
try {
|
try {
|
||||||
List<WorkHistory> works = await WorkHistoryService.instance
|
if (workExperiences.isEmpty) {
|
||||||
.getWorkExperiences(event.profileId, event.token);
|
List<WorkHistory> works = await WorkHistoryService.instance
|
||||||
workExperiences = works;
|
.getWorkExperiences(event.profileId!, event.token!);
|
||||||
|
workExperiences = works;
|
||||||
|
}
|
||||||
|
|
||||||
emit(WorkHistoryLoaded(workExperiences: workExperiences));
|
emit(WorkHistoryLoaded(workExperiences: workExperiences));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(WorkHistoryErrorState(message: e.toString()));
|
emit(WorkHistoryErrorState(message: e.toString()));
|
||||||
|
@ -35,34 +38,29 @@ class WorkHistoryBloc extends Bloc<WorkHistorytEvent, WorkHistoryState> {
|
||||||
///// LOAD WORK HISTORIES
|
///// LOAD WORK HISTORIES
|
||||||
on<LoadWorkHistories>((event, emit) {
|
on<LoadWorkHistories>((event, emit) {
|
||||||
emit(WorkHistoryLoadingState());
|
emit(WorkHistoryLoadingState());
|
||||||
workExperiences = event.workHistories;
|
|
||||||
emit(WorkHistoryLoaded(workExperiences: workExperiences));
|
emit(WorkHistoryLoaded(workExperiences: workExperiences));
|
||||||
});
|
});
|
||||||
////DELETE
|
////DELETE
|
||||||
on<DeleteWorkHistory>((event, emit) async {
|
on<DeleteWorkHistory>((event, emit) async {
|
||||||
emit(WorkHistoryLoadingState());
|
|
||||||
try {
|
try {
|
||||||
final bool success = await WorkHistoryService.instance.delete(
|
final bool success = await WorkHistoryService.instance.delete(
|
||||||
profileId: event.profileId,
|
profileId: event.profileId,
|
||||||
token: event.token,
|
token: event.token,
|
||||||
work: event.workHistory);
|
work: event.workHistory);
|
||||||
if (success) {
|
if (success) {
|
||||||
event.workHistories.removeWhere(
|
workExperiences.removeWhere(
|
||||||
(WorkHistory element) => element.id == event.workHistory.id);
|
(WorkHistory element) => element.id == event.workHistory.id);
|
||||||
List<WorkHistory> newWorkHistories = event.workHistories;
|
emit(DeletedState(success: success));
|
||||||
emit(DeletedState(success: success, workHistories: newWorkHistories));
|
|
||||||
} else {
|
} else {
|
||||||
emit(DeletedState(
|
emit(DeletedState(success: success));
|
||||||
success: success, workHistories: event.workHistories));
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(WorkHistoryErrorState(message: e.toString()));
|
emit(WorkHistoryErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//// ADD WORK HISTORIES
|
//// ADD WORK HISTORIES
|
||||||
on<AddWorkHostory>((event, emit) async {
|
on<AddWorkHostory>((event, emit) async {
|
||||||
try {
|
try {
|
||||||
emit(WorkHistoryLoadingState());
|
|
||||||
Map<dynamic, dynamic> status = await WorkHistoryService.instance.add(
|
Map<dynamic, dynamic> status = await WorkHistoryService.instance.add(
|
||||||
isPrivate: event.isPrivate,
|
isPrivate: event.isPrivate,
|
||||||
workHistory: event.workHistory,
|
workHistory: event.workHistory,
|
||||||
|
@ -71,39 +69,39 @@ class WorkHistoryBloc extends Bloc<WorkHistorytEvent, WorkHistoryState> {
|
||||||
if (status['success']) {
|
if (status['success']) {
|
||||||
WorkHistory workHistory = WorkHistory.fromJson(status['data']);
|
WorkHistory workHistory = WorkHistory.fromJson(status['data']);
|
||||||
workExperiences.add(workHistory);
|
workExperiences.add(workHistory);
|
||||||
emit(WorkHistoryAddedState(
|
emit(WorkHistoryAddedState(response: status));
|
||||||
response: status, workExperiences: workExperiences));
|
|
||||||
} else {
|
} else {
|
||||||
emit(WorkHistoryAddedState(
|
emit(WorkHistoryAddedState(response: status));
|
||||||
response: status, workExperiences: workExperiences));
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(WorkHistoryErrorState(message: e.toString()));
|
emit(WorkHistoryErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
////UPDATE WORK HISTORY
|
////UPDATE WORK HISTORY
|
||||||
on<UpdateWorkHistory>((event, emit)async{
|
on<UpdateWorkHistory>((event, emit) async {
|
||||||
emit(WorkHistoryLoadingState());
|
try {
|
||||||
// try{
|
Map<dynamic, dynamic> status = await WorkHistoryService.instance.update(
|
||||||
Map<dynamic,dynamic> status = await WorkHistoryService.instance.update(oldWorkHistory: event.oldWorkHistory, newWorkHistory: event.workHistory, token: event.token, profileId: event.profileId);
|
oldWorkHistory: event.oldWorkHistory,
|
||||||
if(status['success']){
|
newWorkHistory: event.workHistory,
|
||||||
WorkHistory workHistory = WorkHistory.fromJson(status['data']);
|
token: event.token,
|
||||||
workExperiences.removeWhere((WorkHistory work) {
|
profileId: event.profileId);
|
||||||
return work.id == event.oldWorkHistory.id;
|
if (status['success']) {
|
||||||
|
WorkHistory workHistory = WorkHistory.fromJson(status['data']);
|
||||||
|
workExperiences.removeWhere((WorkHistory work) {
|
||||||
|
return work.id == event.oldWorkHistory.id;
|
||||||
|
});
|
||||||
|
workExperiences.add(workHistory);
|
||||||
|
emit(WorkHistoryEditedState(response: status));
|
||||||
|
} else {
|
||||||
|
emit(WorkHistoryEditedState(
|
||||||
|
response: status,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(WorkHistoryErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
workExperiences.add(workHistory);
|
|
||||||
emit(WorkHistoryEditedState(workExperiences: workExperiences,response: status));
|
|
||||||
}else{
|
|
||||||
emit(WorkHistoryEditedState(response: status, workExperiences: workExperiences));
|
|
||||||
}
|
|
||||||
|
|
||||||
// }catch(e){
|
|
||||||
// emit(WorkHistoryErrorState(message: e.toString()));
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
////SHOW EDIT WORK HISTORIES
|
////SHOW EDIT WORK HISTORIES
|
||||||
on<ShowEditWorkHistoryForm>((event, emit) async {
|
on<ShowEditWorkHistoryForm>((event, emit) async {
|
||||||
|
@ -150,23 +148,31 @@ on<UpdateWorkHistory>((event, emit)async{
|
||||||
emit(WorkHistoryLoadingState());
|
emit(WorkHistoryLoadingState());
|
||||||
try {
|
try {
|
||||||
/////POSITIONS------------------------------------------
|
/////POSITIONS------------------------------------------
|
||||||
List<Position> positions =
|
if (agencyPositions.isEmpty) {
|
||||||
await WorkHistoryService.instance.getAgencyPosition();
|
List<Position> positions =
|
||||||
agencyPositions = positions;
|
await WorkHistoryService.instance.getAgencyPosition();
|
||||||
|
agencyPositions = positions;
|
||||||
|
}
|
||||||
|
|
||||||
/////AGENCIES------------------------------------------
|
/////AGENCIES------------------------------------------
|
||||||
List<Agency> newAgencies =
|
if (agencies.isEmpty) {
|
||||||
await ProfileUtilities.instance.getAgecies();
|
List<Agency> newAgencies =
|
||||||
agencies = newAgencies;
|
await ProfileUtilities.instance.getAgecies();
|
||||||
|
agencies = newAgencies;
|
||||||
|
}
|
||||||
|
|
||||||
/////Category Agency------------------------------------------
|
/////Category Agency------------------------------------------
|
||||||
List<Category> categoryAgencies =
|
if (agencyCategory.isEmpty) {
|
||||||
await ProfileUtilities.instance.agencyCategory();
|
List<Category> categoryAgencies =
|
||||||
agencyCategory = categoryAgencies;
|
await ProfileUtilities.instance.agencyCategory();
|
||||||
|
agencyCategory = categoryAgencies;
|
||||||
|
}
|
||||||
/////////-------------------------------------
|
/////////-------------------------------------
|
||||||
List<AppoinemtStatus> status =
|
if (appointmentStatus.isEmpty) {
|
||||||
WorkHistoryService.instance.getAppointmentStatusList();
|
List<AppoinemtStatus> status =
|
||||||
appointmentStatus = status;
|
WorkHistoryService.instance.getAppointmentStatusList();
|
||||||
|
appointmentStatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
emit(AddWorkHistoryState(
|
emit(AddWorkHistoryState(
|
||||||
agencyPositions: agencyPositions,
|
agencyPositions: agencyPositions,
|
||||||
|
|
|
@ -18,10 +18,8 @@ class GetWorkHistories extends WorkHistorytEvent{
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoadWorkHistories extends WorkHistorytEvent{
|
class LoadWorkHistories extends WorkHistorytEvent{
|
||||||
final List<WorkHistory> workHistories;
|
|
||||||
const LoadWorkHistories({required this.workHistories});
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [workHistories];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShowAddWorkHistoryForm extends WorkHistorytEvent{
|
class ShowAddWorkHistoryForm extends WorkHistorytEvent{
|
||||||
|
@ -35,13 +33,12 @@ class ShowEditWorkHistoryForm extends WorkHistorytEvent{
|
||||||
|
|
||||||
}
|
}
|
||||||
class DeleteWorkHistory extends WorkHistorytEvent{
|
class DeleteWorkHistory extends WorkHistorytEvent{
|
||||||
final List<WorkHistory> workHistories;
|
|
||||||
final String token;
|
final String token;
|
||||||
final int profileId;
|
final int profileId;
|
||||||
final WorkHistory workHistory;
|
final WorkHistory workHistory;
|
||||||
const DeleteWorkHistory({required this.profileId, required this.token, required this.workHistory, required this.workHistories});
|
const DeleteWorkHistory({required this.profileId, required this.token, required this.workHistory});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [token, profileId,workHistory, workHistories];
|
List<Object> get props => [token, profileId,workHistory];
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateWorkHistory extends WorkHistorytEvent{
|
class UpdateWorkHistory extends WorkHistorytEvent{
|
||||||
|
|
|
@ -53,25 +53,22 @@ class EditWorkHistoryState extends WorkHistoryState{
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeletedState extends WorkHistoryState{
|
class DeletedState extends WorkHistoryState{
|
||||||
final List<WorkHistory> workHistories;
|
|
||||||
final bool success;
|
final bool success;
|
||||||
const DeletedState({required this.success, required this.workHistories});
|
const DeletedState({required this.success});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [workHistories,success];
|
List<Object> get props => [success];
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorkHistoryEditedState extends WorkHistoryState{
|
class WorkHistoryEditedState extends WorkHistoryState{
|
||||||
final List<WorkHistory> workExperiences;
|
|
||||||
final Map<dynamic,dynamic> response;
|
final Map<dynamic,dynamic> response;
|
||||||
const WorkHistoryEditedState({required this.response, required this.workExperiences});
|
const WorkHistoryEditedState({required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [workExperiences,response];
|
List<Object> get props => [response];
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorkHistoryAddedState extends WorkHistoryState{
|
class WorkHistoryAddedState extends WorkHistoryState{
|
||||||
final List<WorkHistory> workExperiences;
|
|
||||||
final Map<dynamic,dynamic> response;
|
final Map<dynamic,dynamic> response;
|
||||||
const WorkHistoryAddedState({required this.response, required this.workExperiences});
|
const WorkHistoryAddedState({required this.response});
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [workExperiences,response];
|
List<Object> get props => [response];
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ class UserBloc extends Bloc<UserEvent, UserState> {
|
||||||
final String? saved = CREDENTIALS?.get('saved');
|
final String? saved = CREDENTIALS?.get('saved');
|
||||||
final String? username = CREDENTIALS?.get('username');
|
final String? username = CREDENTIALS?.get('username');
|
||||||
final String? password = CREDENTIALS?.get('password');
|
final String? password = CREDENTIALS?.get('password');
|
||||||
|
debugPrint(username);
|
||||||
|
debugPrint(password);
|
||||||
if (saved != null) {
|
if (saved != null) {
|
||||||
save = true;
|
save = true;
|
||||||
add(UserLogin(username: username, password: password));
|
add(UserLogin(username: username, password: password));
|
||||||
|
|
|
@ -31,14 +31,14 @@ class _AddContactInformationScreenState
|
||||||
extends State<AddContactInformationScreen> {
|
extends State<AddContactInformationScreen> {
|
||||||
final formKey = GlobalKey<FormBuilderState>();
|
final formKey = GlobalKey<FormBuilderState>();
|
||||||
ServiceType? selectedServiceType;
|
ServiceType? selectedServiceType;
|
||||||
ServiceProvider? selectedProvider;
|
CommService? selectedCommServiceProvider;
|
||||||
List<ServiceProvider> serviceProviders = [];
|
List<CommService> commServiceProviders = [];
|
||||||
bool callServiceType = false;
|
bool callServiceType = false;
|
||||||
bool primaryaContact = false;
|
bool primaryaContact = false;
|
||||||
bool active = false;
|
bool active = false;
|
||||||
String? numberMail;
|
String? numberMail;
|
||||||
var mobileFormatter = MaskTextInputFormatter(
|
var mobileFormatter = MaskTextInputFormatter(
|
||||||
mask: "+63 (##) ###-###",
|
mask: "+63 (###) ###-####",
|
||||||
filter: {"#": RegExp(r"^[1-9][0-9]*$")},
|
filter: {"#": RegExp(r"^[1-9][0-9]*$")},
|
||||||
type: MaskAutoCompletionType.lazy,
|
type: MaskAutoCompletionType.lazy,
|
||||||
initialText: "0");
|
initialText: "0");
|
||||||
|
@ -82,7 +82,7 @@ class _AddContactInformationScreenState
|
||||||
setState(() {
|
setState(() {
|
||||||
callServiceType = true;
|
callServiceType = true;
|
||||||
});
|
});
|
||||||
serviceProviders = await ContactService.instance
|
commServiceProviders = await ContactService.instance
|
||||||
.getServiceProvider(
|
.getServiceProvider(
|
||||||
serviceTypeId: selectedServiceType!.id!);
|
serviceTypeId: selectedServiceType!.id!);
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -101,22 +101,22 @@ class _AddContactInformationScreenState
|
||||||
child: ModalProgressHUD(
|
child: ModalProgressHUD(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
inAsyncCall: callServiceType,
|
inAsyncCall: callServiceType,
|
||||||
child: FormBuilderDropdown<ServiceProvider>(
|
child: FormBuilderDropdown<CommService>(
|
||||||
validator: FormBuilderValidators.required(
|
validator: FormBuilderValidators.required(
|
||||||
errorText: "This field is required"),
|
errorText: "This field is required"),
|
||||||
name: "Service Provider",
|
name: "Service Provider",
|
||||||
items: serviceProviders.isEmpty
|
items: commServiceProviders.isEmpty
|
||||||
? []
|
? []
|
||||||
: serviceProviders
|
: commServiceProviders
|
||||||
.map<DropdownMenuItem<ServiceProvider>>(
|
.map<DropdownMenuItem<CommService>>(
|
||||||
(ServiceProvider e) {
|
(CommService e) {
|
||||||
return DropdownMenuItem<ServiceProvider>(
|
return DropdownMenuItem<CommService>(
|
||||||
value: e, child: Text(e.agency!.name!));
|
value: e, child: Text(e.serviceProvider!.agency!.name!));
|
||||||
}).toList(),
|
}).toList(),
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Communication Service *", ""),
|
"Communication Service *", ""),
|
||||||
onChanged: (var serviceProvider) {
|
onChanged: (var serviceProvider) {
|
||||||
selectedProvider = serviceProvider;
|
selectedCommServiceProvider = serviceProvider;
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -215,10 +215,7 @@ class _AddContactInformationScreenState
|
||||||
|
|
||||||
numberMail =
|
numberMail =
|
||||||
formKey.currentState!.value['number-mail'];
|
formKey.currentState!.value['number-mail'];
|
||||||
CommService commService = CommService(
|
CommService commService = selectedCommServiceProvider!;
|
||||||
id: null,
|
|
||||||
serviceType: selectedServiceType,
|
|
||||||
serviceProvider: selectedProvider);
|
|
||||||
ContactInfo contactInfo = ContactInfo(
|
ContactInfo contactInfo = ContactInfo(
|
||||||
id: null,
|
id: null,
|
||||||
active: active,
|
active: active,
|
||||||
|
|
|
@ -31,15 +31,15 @@ class _EditContactInformationScreenState
|
||||||
extends State<EditContactInformationScreen> {
|
extends State<EditContactInformationScreen> {
|
||||||
final formKey = GlobalKey<FormBuilderState>();
|
final formKey = GlobalKey<FormBuilderState>();
|
||||||
ServiceType? selectedServiceType;
|
ServiceType? selectedServiceType;
|
||||||
ServiceProvider? selectedProvider;
|
CommService? selectedCommProvider;
|
||||||
List<ServiceProvider> serviceProviders = [];
|
List<CommService> commServiceProviders = [];
|
||||||
String? numberMail;
|
String? numberMail;
|
||||||
bool callServiceType = false;
|
bool callServiceType = false;
|
||||||
bool? primaryaContact;
|
bool? primaryaContact;
|
||||||
bool? active;
|
bool? active;
|
||||||
|
|
||||||
var mobileFormatter = MaskTextInputFormatter(
|
var mobileFormatter = MaskTextInputFormatter(
|
||||||
mask: "+63 (##) ###-###",
|
mask: "+63 (###) ###-####",
|
||||||
filter: {"#": RegExp(r"^[1-9][0-9]*$")},
|
filter: {"#": RegExp(r"^[1-9][0-9]*$")},
|
||||||
type: MaskAutoCompletionType.lazy,
|
type: MaskAutoCompletionType.lazy,
|
||||||
initialText: "0");
|
initialText: "0");
|
||||||
|
@ -56,8 +56,8 @@ class _EditContactInformationScreenState
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is ContactEditingState) {
|
if (state is ContactEditingState) {
|
||||||
selectedServiceType = state.selectedServiceType;
|
selectedServiceType = state.selectedServiceType;
|
||||||
selectedProvider = state.selectedProvider;
|
selectedCommProvider = state.selectedProvider;
|
||||||
serviceProviders = state.serviceProviders;
|
commServiceProviders = state.commServiceProviders;
|
||||||
primaryaContact = state.contactInfo.primary!;
|
primaryaContact = state.contactInfo.primary!;
|
||||||
active = state.contactInfo.active!;
|
active = state.contactInfo.active!;
|
||||||
return FormBuilder(
|
return FormBuilder(
|
||||||
|
@ -91,11 +91,11 @@ class _EditContactInformationScreenState
|
||||||
setState(() {
|
setState(() {
|
||||||
callServiceType = true;
|
callServiceType = true;
|
||||||
});
|
});
|
||||||
serviceProviders = await ContactService.instance
|
commServiceProviders = await ContactService.instance
|
||||||
.getServiceProvider(
|
.getServiceProvider(
|
||||||
serviceTypeId:
|
serviceTypeId:
|
||||||
selectedServiceType!.id!);
|
selectedServiceType!.id!);
|
||||||
selectedProvider = null;
|
selectedCommProvider = null;
|
||||||
setState(() {
|
setState(() {
|
||||||
setState(() {
|
setState(() {
|
||||||
callServiceType = false;
|
callServiceType = false;
|
||||||
|
@ -112,24 +112,24 @@ class _EditContactInformationScreenState
|
||||||
child: ModalProgressHUD(
|
child: ModalProgressHUD(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
inAsyncCall: callServiceType,
|
inAsyncCall: callServiceType,
|
||||||
child: DropdownButtonFormField<ServiceProvider>(
|
child: DropdownButtonFormField<CommService>(
|
||||||
value: selectedProvider,
|
value: selectedCommProvider,
|
||||||
validator: FormBuilderValidators.required(
|
validator: FormBuilderValidators.required(
|
||||||
errorText: "This field is required"),
|
errorText: "This field is required"),
|
||||||
items: serviceProviders.isEmpty
|
items: commServiceProviders.isEmpty
|
||||||
? []
|
? []
|
||||||
: serviceProviders
|
: commServiceProviders
|
||||||
.map<DropdownMenuItem<ServiceProvider>>(
|
.map<DropdownMenuItem<CommService>>(
|
||||||
(ServiceProvider e) {
|
(CommService e) {
|
||||||
return DropdownMenuItem<
|
return DropdownMenuItem<
|
||||||
ServiceProvider>(
|
CommService>(
|
||||||
value: e,
|
value: e,
|
||||||
child: Text(e.agency!.name!));
|
child: Text(e.serviceProvider!.agency!.name!));
|
||||||
}).toList(),
|
}).toList(),
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"Communication Service *", ""),
|
"Communication Service *", ""),
|
||||||
onChanged: (var serviceProvider) {
|
onChanged: (var commServiceProvider) {
|
||||||
selectedProvider = serviceProvider;
|
selectedCommProvider = commServiceProvider;
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -243,10 +243,7 @@ class _EditContactInformationScreenState
|
||||||
if (formKey.currentState!.saveAndValidate()) {
|
if (formKey.currentState!.saveAndValidate()) {
|
||||||
numberMail =
|
numberMail =
|
||||||
formKey.currentState!.value['number-mail'];
|
formKey.currentState!.value['number-mail'];
|
||||||
CommService commService = CommService(
|
CommService commService = selectedCommProvider!;
|
||||||
id: state.contactInfo.commService!.id,
|
|
||||||
serviceType: selectedServiceType,
|
|
||||||
serviceProvider: selectedProvider);
|
|
||||||
ContactInfo contactInfo = ContactInfo(
|
ContactInfo contactInfo = ContactInfo(
|
||||||
id: state.contactInfo.id,
|
id: state.contactInfo.id,
|
||||||
active: active,
|
active: active,
|
||||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:fluttericon/font_awesome_icons.dart';
|
|
||||||
import 'package:unit2/bloc/profile/primary_information/contact/contact_bloc.dart';
|
import 'package:unit2/bloc/profile/primary_information/contact/contact_bloc.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||||
|
@ -14,9 +13,9 @@ import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:unit2/utils/alerts.dart';
|
import 'package:unit2/utils/alerts.dart';
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
|
import 'package:unit2/widgets/Leadings/close_leading.dart';
|
||||||
import 'package:unit2/widgets/empty_data.dart';
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
import '../../../../bloc/profile/eligibility/eligibility_bloc.dart';
|
|
||||||
|
|
||||||
class ContactInformationScreen extends StatelessWidget {
|
class ContactInformationScreen extends StatelessWidget {
|
||||||
const ContactInformationScreen({
|
const ContactInformationScreen({
|
||||||
|
@ -33,11 +32,15 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
title: const Text(contactScreenTitle),
|
title: const Text(contactScreenTitle),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
actions: [
|
actions: context.watch<ContactBloc>().state is ContactLoadedState? [
|
||||||
AddLeading(onPressed: () {
|
AddLeading(onPressed: () {
|
||||||
context.read<ContactBloc>().add(ShowAddForm());
|
context.read<ContactBloc>().add(ShowAddForm());
|
||||||
})
|
})
|
||||||
],
|
]:( context.watch<ContactBloc>().state is ContactAddingState || context.watch<ContactBloc>().state is ContactEditingState)?[
|
||||||
|
CloseLeading(onPressed: (){
|
||||||
|
context.read<ContactBloc>().add(LoadContacts());
|
||||||
|
})
|
||||||
|
]:[]
|
||||||
),
|
),
|
||||||
body: ProgressHUD(
|
body: ProgressHUD(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
|
@ -67,15 +70,14 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.dismiss();
|
progress!.dismiss();
|
||||||
}
|
}
|
||||||
////EDIT CONTACT STATE
|
////ADDED CONTACT STATE
|
||||||
if (state is ContactEditedState) {
|
if (state is ContactAddedState) {
|
||||||
if (state.response['success']) {
|
if (state.response['success']) {
|
||||||
successAlert(context, "Update Successfull!",
|
successAlert(context, "Update Successfull!",
|
||||||
state.response['message'], () {
|
state.response['message'], () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ContactBloc>().add(LoadContacts(
|
context.read<ContactBloc>().add(LoadContacts(
|
||||||
contactInformation:
|
));
|
||||||
state.contactInformation));
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Update Failed",
|
errorAlert(context, "Update Failed",
|
||||||
|
@ -83,8 +85,27 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
() {
|
() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ContactBloc>().add(LoadContacts(
|
context.read<ContactBloc>().add(LoadContacts(
|
||||||
contactInformation:
|
));
|
||||||
state.contactInformation));
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////EDIT CONTACT STATE
|
||||||
|
if (state is ContactEditedState) {
|
||||||
|
if (state.response['success']) {
|
||||||
|
successAlert(context, "Update Successfull!",
|
||||||
|
state.response['message'], () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context.read<ContactBloc>().add(LoadContacts(
|
||||||
|
));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
errorAlert(context, "Update Failed",
|
||||||
|
"Something went wrong. Please try again.",
|
||||||
|
() {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context.read<ContactBloc>().add(LoadContacts(
|
||||||
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,16 +118,14 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
() {
|
() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ContactBloc>().add(LoadContacts(
|
context.read<ContactBloc>().add(LoadContacts(
|
||||||
contactInformation:
|
));
|
||||||
state.contactInformation));
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Deletion Failed",
|
errorAlert(context, "Deletion Failed",
|
||||||
"Error deleting Contact Info", () {
|
"Error deleting Contact Info", () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ContactBloc>().add(LoadContacts(
|
context.read<ContactBloc>().add(LoadContacts(
|
||||||
contactInformation:
|
));
|
||||||
state.contactInformation));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,8 +155,7 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
decoration: box1(),
|
decoration: box1(),
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.fromLTRB(12, 12, 0, 12),
|
||||||
horizontal: 12, vertical: 8),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -149,30 +167,18 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
CrossAxisAlignment
|
CrossAxisAlignment
|
||||||
.start,
|
.start,
|
||||||
children: [
|
children: [
|
||||||
Text(numberMail,
|
|
||||||
style: Theme.of(
|
|
||||||
context)
|
|
||||||
.textTheme
|
|
||||||
.titleMedium!
|
|
||||||
.copyWith(
|
|
||||||
fontWeight:
|
|
||||||
FontWeight
|
|
||||||
.w500)),
|
|
||||||
const Divider(),
|
|
||||||
const SizedBox(
|
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
commService
|
numberMail,
|
||||||
.toString(),
|
style: Theme.of(
|
||||||
style: Theme.of(
|
context)
|
||||||
context)
|
.textTheme
|
||||||
.textTheme
|
.titleMedium!
|
||||||
.titleSmall,
|
.copyWith(
|
||||||
),
|
fontWeight:
|
||||||
|
FontWeight.w500)),
|
||||||
),
|
),
|
||||||
state.contactInformation[index]
|
state.contactInformation[index]
|
||||||
.active ==
|
.active ==
|
||||||
|
@ -201,17 +207,40 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
: const SizedBox()
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const Divider(),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
Text(state
|
Row(
|
||||||
.contactInformation[
|
children: [
|
||||||
index]
|
Flexible(
|
||||||
.commService!
|
flex: 2,
|
||||||
.serviceProvider!
|
child: Text(
|
||||||
.agency!
|
commService
|
||||||
.name
|
.toString().toUpperCase(),
|
||||||
.toString()),
|
style: Theme.of(
|
||||||
|
context)
|
||||||
|
.textTheme
|
||||||
|
.titleSmall,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
|
||||||
|
child: Text(" - "),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(state
|
||||||
|
.contactInformation[
|
||||||
|
index]
|
||||||
|
.commService!
|
||||||
|
.serviceProvider!
|
||||||
|
.agency!
|
||||||
|
.name
|
||||||
|
.toString()),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
AppPopupMenu<int>(
|
AppPopupMenu<int>(
|
||||||
|
@ -298,6 +327,12 @@ class ContactInformationScreen extends StatelessWidget {
|
||||||
return EditContactInformationScreen(
|
return EditContactInformationScreen(
|
||||||
profileId: profileId, token: token);
|
profileId: profileId, token: token);
|
||||||
}
|
}
|
||||||
|
if (state is ContactErrorState) {
|
||||||
|
return SomethingWentWrong(
|
||||||
|
message: state.message, onpressed: () {
|
||||||
|
context.read<ContactBloc>().add(LoadContacts());
|
||||||
|
});
|
||||||
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,7 +24,10 @@ import '../../../../utils/location_utilities.dart';
|
||||||
import '../../../../utils/text_container.dart';
|
import '../../../../utils/text_container.dart';
|
||||||
|
|
||||||
class AddEligibilityScreen extends StatefulWidget {
|
class AddEligibilityScreen extends StatefulWidget {
|
||||||
const AddEligibilityScreen({super.key});
|
const AddEligibilityScreen(
|
||||||
|
{super.key, required this.profileId, required this.token});
|
||||||
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddEligibilityScreen> createState() => _AddEligibilityScreenState();
|
State<AddEligibilityScreen> createState() => _AddEligibilityScreenState();
|
||||||
|
@ -32,7 +35,7 @@ class AddEligibilityScreen extends StatefulWidget {
|
||||||
|
|
||||||
class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
||||||
final formKey = GlobalKey<FormBuilderState>();
|
final formKey = GlobalKey<FormBuilderState>();
|
||||||
bool? overseas;
|
bool? overseas = false;
|
||||||
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
|
||||||
Region? selectedRegion;
|
Region? selectedRegion;
|
||||||
Province? selectedProvince;
|
Province? selectedProvince;
|
||||||
|
@ -51,449 +54,400 @@ class _AddEligibilityScreenState extends State<AddEligibilityScreen> {
|
||||||
String? license;
|
String? license;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
////USERBLOC
|
return BlocBuilder<EligibilityBloc, EligibilityState>(
|
||||||
return BlocBuilder<UserBloc, UserState>(
|
buildWhen: (previous, current) {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
////LOGGED IN USER STATE
|
////ADD ELIGIBILITY STATE
|
||||||
if (state is UserLoggedIn) {
|
if (state is AddEligibilityState) {
|
||||||
////PROFIILE BLOC
|
return SingleChildScrollView(
|
||||||
token = state.userData!.user!.login!.token;
|
child: SizedBox(
|
||||||
profileId = state.userData!.user!.login!.user!.profileId.toString();
|
height: screenHeight * .95,
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
child: ProgressHUD(
|
||||||
builder: (context, state) {
|
child: Center(
|
||||||
if (state is ProfileLoaded) {
|
child: Padding(
|
||||||
return BlocBuilder<EligibilityBloc, EligibilityState>(
|
padding:
|
||||||
buildWhen: (previous, current) {
|
const EdgeInsets.symmetric(vertical: 25, horizontal: 18),
|
||||||
if (state is EditEligibilityState) {}
|
child: FormBuilder(
|
||||||
return false;
|
key: formKey,
|
||||||
},
|
child: Column(
|
||||||
builder: (context, state) {
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
////ADD ELIGIBILITY STATE
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
if (state is AddEligibilityState) {
|
children: [
|
||||||
return ProgressHUD(
|
////ELIGIBILITIES DROPDOWN
|
||||||
child: Center(
|
FormBuilderDropdown<Eligibility>(
|
||||||
child: Padding(
|
onChanged: (Eligibility? eligibility) {
|
||||||
padding: const EdgeInsets.symmetric(
|
selectedEligibility = eligibility;
|
||||||
vertical: 25, horizontal: 18),
|
},
|
||||||
child: FormBuilder(
|
autovalidateMode:
|
||||||
key: formKey,
|
AutovalidateMode.onUserInteraction,
|
||||||
child: Column(
|
validator: (value) =>
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
value == null ? 'required' : null,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
items: state.eligibilities
|
||||||
children: [
|
.map<DropdownMenuItem<Eligibility>>(
|
||||||
////ELIGIBILITIES DROPDOWN
|
(Eligibility eligibility) {
|
||||||
FormBuilderDropdown<Eligibility>(
|
return DropdownMenuItem<Eligibility>(
|
||||||
onChanged: (Eligibility? eligibility) {
|
value: eligibility,
|
||||||
selectedEligibility = eligibility;
|
child: Text(eligibility.title));
|
||||||
},
|
}).toList(),
|
||||||
autovalidateMode:
|
name: "eligibility",
|
||||||
AutovalidateMode.onUserInteraction,
|
decoration: normalTextFieldStyle(
|
||||||
validator: (value) =>
|
"Eligibility", "Eligibility")),
|
||||||
value == null ? 'required' : null,
|
const SizedBox(
|
||||||
items: state.eligibilities
|
height: 8,
|
||||||
.map<DropdownMenuItem<Eligibility>>(
|
),
|
||||||
(Eligibility eligibility) {
|
|
||||||
return DropdownMenuItem<Eligibility>(
|
|
||||||
value: eligibility,
|
|
||||||
child: Text(eligibility.title));
|
|
||||||
}).toList(),
|
|
||||||
name: "eligibility",
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Eligibility", "Eligibility")),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
////LICENSE NUMBER
|
////LICENSE NUMBER
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: FormBuilderTextField(
|
child: FormBuilderTextField(
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
license = value;
|
license = value;
|
||||||
},
|
},
|
||||||
name: 'license_number',
|
name: 'license_number',
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
"license number",
|
"license number", "license number"),
|
||||||
"license number"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 12,
|
|
||||||
),
|
|
||||||
////RATING
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: FormBuilderTextField(
|
|
||||||
keyboardType: const TextInputType
|
|
||||||
.numberWithOptions(),
|
|
||||||
onChanged: (value) {
|
|
||||||
rating = value;
|
|
||||||
},
|
|
||||||
name: 'rating',
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
'rating %', 'rating'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 20,
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
////RATING
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
keyboardType:
|
||||||
|
const TextInputType.numberWithOptions(),
|
||||||
|
onChanged: (value) {
|
||||||
|
rating = value;
|
||||||
|
},
|
||||||
|
name: 'rating',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
'rating %', 'rating'),
|
||||||
),
|
),
|
||||||
SizedBox(
|
),
|
||||||
width: screenWidth,
|
],
|
||||||
child: Row(
|
),
|
||||||
children: [
|
),
|
||||||
////EXAM DATE
|
const SizedBox(
|
||||||
Flexible(
|
height: 8,
|
||||||
flex: 1,
|
),
|
||||||
child: DateTimePicker(
|
SizedBox(
|
||||||
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
width: screenWidth,
|
||||||
use24HourFormat: false,
|
child: Row(
|
||||||
icon: const Icon(
|
children: [
|
||||||
Icons.date_range),
|
////EXAM DATE
|
||||||
controller: examDateController,
|
Flexible(
|
||||||
firstDate: DateTime(1970),
|
flex: 1,
|
||||||
lastDate: DateTime(2100),
|
child: DateTimePicker(
|
||||||
timeHintText:
|
validator: FormBuilderValidators.required(
|
||||||
"Date of Examination/Conferment",
|
errorText: "This field is required"),
|
||||||
decoration:
|
use24HourFormat: false,
|
||||||
normalTextFieldStyle(
|
icon: const Icon(Icons.date_range),
|
||||||
"Exam date", "")
|
controller: examDateController,
|
||||||
.copyWith(
|
firstDate: DateTime(1970),
|
||||||
prefixIcon:
|
lastDate: DateTime(2100),
|
||||||
const Icon(
|
timeHintText:
|
||||||
Icons.date_range,
|
"Date of Examination/Conferment",
|
||||||
color: Colors.black87,
|
decoration:
|
||||||
)),
|
normalTextFieldStyle("Exam date", "")
|
||||||
initialValue: null,
|
.copyWith(
|
||||||
)),
|
prefixIcon: const Icon(
|
||||||
const SizedBox(
|
Icons.date_range,
|
||||||
width: 12,
|
color: Colors.black87,
|
||||||
),
|
)),
|
||||||
////VALIDITY DATE
|
initialValue: null,
|
||||||
Flexible(
|
)),
|
||||||
flex: 1,
|
const SizedBox(
|
||||||
child: DateTimePicker(
|
width: 8,
|
||||||
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
),
|
||||||
controller:
|
////VALIDITY DATE
|
||||||
validityDateController,
|
Flexible(
|
||||||
firstDate: DateTime(1970),
|
flex: 1,
|
||||||
lastDate: DateTime(2100),
|
child: DateTimePicker(
|
||||||
decoration: normalTextFieldStyle(
|
validator: FormBuilderValidators.required(
|
||||||
"Validity date",
|
errorText: "This field is required"),
|
||||||
"Validity date")
|
controller: validityDateController,
|
||||||
.copyWith(
|
firstDate: DateTime(1970),
|
||||||
prefixIcon: const Icon(
|
lastDate: DateTime(2100),
|
||||||
Icons.date_range,
|
decoration: normalTextFieldStyle(
|
||||||
color: Colors.black87,
|
"Validity date", "Validity date")
|
||||||
)),
|
|
||||||
initialValue: null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Placement of Examination/Conferment",
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.displaySmall!
|
|
||||||
.copyWith(
|
.copyWith(
|
||||||
fontSize: blockSizeVertical * 2),
|
prefixIcon: const Icon(
|
||||||
|
Icons.date_range,
|
||||||
|
color: Colors.black87,
|
||||||
|
)),
|
||||||
|
initialValue: null,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 12,
|
],
|
||||||
),
|
),
|
||||||
////OVERSEAS ADDRESS SWITCH
|
),
|
||||||
Column(
|
const SizedBox(
|
||||||
children: [
|
height: 8,
|
||||||
FormBuilderSwitch(
|
),
|
||||||
validator: FormBuilderValidators.required(errorText: 'This field is required'),
|
Text(
|
||||||
initialValue: overseas,
|
"Placement of Examination/Conferment",
|
||||||
activeColor: second,
|
style: Theme.of(context)
|
||||||
onChanged: (value) {
|
.textTheme
|
||||||
setState(() {
|
.displaySmall!
|
||||||
overseas = value;
|
.copyWith(fontSize: blockSizeVertical * 2),
|
||||||
});
|
),
|
||||||
},
|
const SizedBox(
|
||||||
decoration:
|
height: 8,
|
||||||
normalTextFieldStyle("", ''),
|
),
|
||||||
name: 'overseas',
|
////OVERSEAS ADDRESS SWITCH
|
||||||
title:
|
Column(
|
||||||
const Text("Overseas Address?"),
|
children: [
|
||||||
),
|
FormBuilderSwitch(
|
||||||
const SizedBox(
|
validator: FormBuilderValidators.required(
|
||||||
height: 20,
|
errorText: 'This field is required'),
|
||||||
),
|
initialValue: overseas,
|
||||||
////COUNTRY DROPDOWN
|
activeColor: second,
|
||||||
SizedBox(
|
onChanged: (value) {
|
||||||
child: overseas == true
|
setState(() {
|
||||||
? FormBuilderDropdown<Country>(
|
overseas = value;
|
||||||
initialValue: null,
|
});
|
||||||
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
},
|
||||||
items: state.countries.map<
|
decoration: normalTextFieldStyle("", ''),
|
||||||
DropdownMenuItem<
|
name: 'overseas',
|
||||||
Country>>(
|
title: const Text("Overseas Address?"),
|
||||||
(Country country) {
|
),
|
||||||
return DropdownMenuItem<
|
const SizedBox(
|
||||||
Country>(
|
height: 8,
|
||||||
value: country,
|
),
|
||||||
child: FittedBox(
|
////COUNTRY DROPDOWN
|
||||||
child: Text(
|
SizedBox(
|
||||||
country
|
child: overseas == true
|
||||||
.name!)));
|
? FormBuilderDropdown<Country>(
|
||||||
}).toList(),
|
initialValue: null,
|
||||||
name: 'country',
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
items: state.countries
|
||||||
|
.map<DropdownMenuItem<Country>>(
|
||||||
|
(Country country) {
|
||||||
|
return DropdownMenuItem<Country>(
|
||||||
|
value: country,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(country.name!)));
|
||||||
|
}).toList(),
|
||||||
|
name: 'country',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Country*", "Country"),
|
||||||
|
onChanged: (Country? value) {
|
||||||
|
selectedCountry = value;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
////REGION DROPDOWN
|
||||||
|
FormBuilderDropdown<Region?>(
|
||||||
|
autovalidateMode: AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
//// region onchange
|
||||||
|
onChanged: (Region? region) async {
|
||||||
|
|
||||||
|
if(selectedRegion != region){
|
||||||
|
setState(() {
|
||||||
|
provinceCall = true;
|
||||||
|
});
|
||||||
|
selectedRegion = region;
|
||||||
|
getProvinces();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initialValue: selectedRegion,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Region*", "Region"),
|
||||||
|
name: 'region',
|
||||||
|
items: state.regions
|
||||||
|
.map<DropdownMenuItem<Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(
|
||||||
|
region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
////PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
Province?>(
|
||||||
|
autovalidateMode:
|
||||||
|
AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedProvince,
|
||||||
|
onChanged:
|
||||||
|
(Province? province) {
|
||||||
|
|
||||||
|
if(selectedProvince != province){
|
||||||
|
setState(() {
|
||||||
|
cityCall = true;
|
||||||
|
});
|
||||||
|
selectedProvince = province;
|
||||||
|
getCities();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
items: provinces == null
|
||||||
|
? []
|
||||||
|
: provinces!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Province>>(
|
||||||
|
(Province province) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: province,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(province
|
||||||
|
.description!),
|
||||||
|
));
|
||||||
|
}).toList(),
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Province*",
|
||||||
|
"Province")),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
//// CityMunicipalities dropdown
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: cityCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
CityMunicipality>(
|
||||||
|
validator: (value) =>
|
||||||
|
value == null
|
||||||
|
? 'required'
|
||||||
|
: null,
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged:
|
||||||
|
(CityMunicipality? city) {
|
||||||
|
selectedMunicipality = city;
|
||||||
|
},
|
||||||
decoration:
|
decoration:
|
||||||
normalTextFieldStyle(
|
normalTextFieldStyle(
|
||||||
"Country*",
|
"Municipality*",
|
||||||
"Country"),
|
"Municipality"),
|
||||||
onChanged:
|
value: selectedMunicipality,
|
||||||
(Country? value) {
|
items: citymuns == null
|
||||||
selectedCountry = value;
|
? []
|
||||||
},
|
: citymuns!.map<
|
||||||
)
|
DropdownMenuItem<
|
||||||
: Column(
|
CityMunicipality>>(
|
||||||
children: [
|
(CityMunicipality c) {
|
||||||
////REGION DROPDOWN
|
return DropdownMenuItem(
|
||||||
FormBuilderDropdown<
|
value: c,
|
||||||
Region?>(
|
child: Text(c
|
||||||
autovalidateMode:
|
.description!));
|
||||||
AutovalidateMode
|
}).toList(),
|
||||||
.onUserInteraction,
|
),
|
||||||
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
),
|
||||||
//// region onchange
|
),
|
||||||
onChanged: (Region?
|
|
||||||
region) async {
|
|
||||||
setState(() {
|
|
||||||
provinceCall = true;
|
|
||||||
});
|
|
||||||
selectedRegion =
|
|
||||||
region;
|
|
||||||
getProvinces();
|
|
||||||
},
|
|
||||||
initialValue:
|
|
||||||
selectedRegion,
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Region*",
|
|
||||||
"Region"),
|
|
||||||
name: 'region',
|
|
||||||
items: state.regions.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Region>>((Region
|
|
||||||
region) {
|
|
||||||
return DropdownMenuItem<
|
|
||||||
Region>(
|
|
||||||
value: region,
|
|
||||||
child: Text(region
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
////PROVINCE DROPDOWN
|
|
||||||
SizedBox(
|
|
||||||
height: 70,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors
|
|
||||||
.transparent,
|
|
||||||
inAsyncCall:
|
|
||||||
provinceCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Province?>(
|
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
value:
|
|
||||||
selectedProvince,
|
|
||||||
onChanged:
|
|
||||||
(Province?
|
|
||||||
province) {
|
|
||||||
setState(() {
|
|
||||||
cityCall =
|
|
||||||
true;
|
|
||||||
});
|
|
||||||
selectedProvince =
|
|
||||||
province;
|
|
||||||
getCities();
|
|
||||||
},
|
|
||||||
items: provinces ==
|
|
||||||
null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>((Province
|
|
||||||
province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value:
|
|
||||||
province,
|
|
||||||
child:
|
|
||||||
FittedBox(
|
|
||||||
child:
|
|
||||||
Text(province.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Province*",
|
|
||||||
"Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
//// CityMunicipalities dropdown
|
],
|
||||||
SizedBox(
|
)),
|
||||||
height: 70,
|
],
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(CityMunicipality?
|
|
||||||
city) {
|
|
||||||
selectedMunicipality =
|
|
||||||
city;
|
|
||||||
},
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Municipality*",
|
|
||||||
"Municipality"),
|
|
||||||
value:
|
|
||||||
selectedMunicipality,
|
|
||||||
items: citymuns ==
|
|
||||||
null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality
|
|
||||||
c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value:
|
|
||||||
c,
|
|
||||||
child: Text(
|
|
||||||
c.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
const Expanded(
|
|
||||||
child: SizedBox(),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
width: screenWidth,
|
|
||||||
height: 60,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: mainBtnStyle(primary,
|
|
||||||
Colors.transparent, second),
|
|
||||||
onPressed: () {
|
|
||||||
//rating
|
|
||||||
double? rate = rating == null
|
|
||||||
? null
|
|
||||||
: double.parse(rating!);
|
|
||||||
//lisence
|
|
||||||
String? licenseNumber = license;
|
|
||||||
CityMunicipality? cityMunicipality =
|
|
||||||
selectedMunicipality;
|
|
||||||
DateTime? examDate =
|
|
||||||
examDateController.text.isEmpty
|
|
||||||
? null
|
|
||||||
: DateTime.parse(
|
|
||||||
examDateController
|
|
||||||
.text);
|
|
||||||
DateTime? validityDate =
|
|
||||||
validityDateController
|
|
||||||
.text.isEmpty
|
|
||||||
? null
|
|
||||||
: DateTime.parse(
|
|
||||||
validityDateController
|
|
||||||
.text);
|
|
||||||
|
|
||||||
ExamAddress examAddress =
|
|
||||||
ExamAddress(
|
|
||||||
barangay: null,
|
|
||||||
id: null,
|
|
||||||
addressCategory: null,
|
|
||||||
examAddressClass: null,
|
|
||||||
country: selectedCountry ??
|
|
||||||
Country(
|
|
||||||
id: 175,
|
|
||||||
name: 'Philippines',
|
|
||||||
code: 'PH'),
|
|
||||||
cityMunicipality:
|
|
||||||
cityMunicipality);
|
|
||||||
EligibityCert eligibityCert =
|
|
||||||
EligibityCert(
|
|
||||||
id: null,
|
|
||||||
rating: rate,
|
|
||||||
examDate: examDate,
|
|
||||||
attachments: null,
|
|
||||||
eligibility:
|
|
||||||
selectedEligibility,
|
|
||||||
examAddress: examAddress,
|
|
||||||
validityDate: validityDate,
|
|
||||||
licenseNumber:
|
|
||||||
licenseNumber,
|
|
||||||
overseas: overseas);
|
|
||||||
if (formKey.currentState!
|
|
||||||
.saveAndValidate()) {
|
|
||||||
context
|
|
||||||
.read<EligibilityBloc>()
|
|
||||||
.add(AddEligibility(
|
|
||||||
eligibityCert:
|
|
||||||
eligibityCert,
|
|
||||||
profileId: profileId!,
|
|
||||||
token: token!));
|
|
||||||
}
|
|
||||||
// context.read<ProfileBloc>().add(AddEligibility(eligibityCert: eligibityCert, profileId: profileId, token: token))
|
|
||||||
},
|
|
||||||
child: const Text(submit)),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
const Expanded(
|
||||||
);
|
child: SizedBox(),
|
||||||
}
|
),
|
||||||
return Container();
|
|
||||||
},
|
SizedBox(
|
||||||
);
|
width: screenWidth,
|
||||||
}
|
height: 60,
|
||||||
return Container();
|
child: ElevatedButton(
|
||||||
},
|
style: mainBtnStyle(
|
||||||
|
primary, Colors.transparent, second),
|
||||||
|
onPressed: () {
|
||||||
|
//rating
|
||||||
|
double? rate = rating == null
|
||||||
|
? null
|
||||||
|
: double.parse(rating!);
|
||||||
|
//lisence
|
||||||
|
String? licenseNumber = license;
|
||||||
|
CityMunicipality? cityMunicipality =
|
||||||
|
selectedMunicipality;
|
||||||
|
DateTime? examDate = examDateController
|
||||||
|
.text.isEmpty
|
||||||
|
? null
|
||||||
|
: DateTime.parse(examDateController.text);
|
||||||
|
DateTime? validityDate =
|
||||||
|
validityDateController.text.isEmpty
|
||||||
|
? null
|
||||||
|
: DateTime.parse(
|
||||||
|
validityDateController.text);
|
||||||
|
|
||||||
|
ExamAddress examAddress = ExamAddress(
|
||||||
|
barangay: null,
|
||||||
|
id: null,
|
||||||
|
addressCategory: null,
|
||||||
|
examAddressClass: null,
|
||||||
|
country: selectedCountry ??
|
||||||
|
Country(
|
||||||
|
id: 175,
|
||||||
|
name: 'Philippines',
|
||||||
|
code: 'PH'),
|
||||||
|
cityMunicipality: cityMunicipality);
|
||||||
|
EligibityCert eligibityCert = EligibityCert(
|
||||||
|
id: null,
|
||||||
|
rating: rate,
|
||||||
|
examDate: examDate,
|
||||||
|
attachments: null,
|
||||||
|
eligibility: selectedEligibility,
|
||||||
|
examAddress: examAddress,
|
||||||
|
validityDate: validityDate,
|
||||||
|
licenseNumber: licenseNumber,
|
||||||
|
overseas: overseas);
|
||||||
|
if (formKey.currentState!.saveAndValidate()) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Loading...");
|
||||||
|
context.read<EligibilityBloc>().add(
|
||||||
|
AddEligibility(
|
||||||
|
eligibityCert: eligibityCert,
|
||||||
|
profileId:
|
||||||
|
widget.profileId.toString(),
|
||||||
|
token: widget.token));
|
||||||
|
}
|
||||||
|
// context.read<ProfileBloc>().add(AddEligibility(eligibityCert: eligibityCert, profileId: profileId, token: token))
|
||||||
|
},
|
||||||
|
child: const Text(submit)),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,11 +2,10 @@ import 'package:date_time_picker/date_time_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
|
||||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
|
||||||
import 'package:unit2/model/location/city.dart';
|
import 'package:unit2/model/location/city.dart';
|
||||||
import 'package:unit2/model/profile/eligibility.dart';
|
import 'package:unit2/model/profile/eligibility.dart';
|
||||||
import 'package:unit2/model/utils/eligibility.dart';
|
import 'package:unit2/model/utils/eligibility.dart';
|
||||||
|
@ -23,7 +22,9 @@ import '../../../../utils/text_container.dart';
|
||||||
|
|
||||||
class EditEligibilityScreen extends StatefulWidget {
|
class EditEligibilityScreen extends StatefulWidget {
|
||||||
final EligibityCert eligibityCert;
|
final EligibityCert eligibityCert;
|
||||||
const EditEligibilityScreen({super.key, required this.eligibityCert});
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
const EditEligibilityScreen({super.key, required this.eligibityCert, required this.profileId, required this.token});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<EditEligibilityScreen> createState() => _EditEligibilityScreenState();
|
State<EditEligibilityScreen> createState() => _EditEligibilityScreenState();
|
||||||
|
@ -52,20 +53,10 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
final validityDateController = TextEditingController();
|
final validityDateController = TextEditingController();
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//USERBLOC
|
|
||||||
return BlocBuilder<UserBloc, UserState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
//LOGGED IN USER STATE
|
|
||||||
if (state is UserLoggedIn) {
|
|
||||||
//PROFIILE BLOC
|
|
||||||
token = state.userData!.user!.login!.token;
|
|
||||||
profileId = state.userData!.user!.login!.user!.profileId.toString();
|
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if(state is ProfileLoaded){
|
|
||||||
return BlocBuilder<EligibilityBloc, EligibilityState>(
|
return BlocBuilder<EligibilityBloc, EligibilityState>(
|
||||||
buildWhen: (previous, current) {
|
buildWhen: (previous, current) {
|
||||||
if (state is EditEligibilityState) {}
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
@ -194,6 +185,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: DateTimePicker(
|
child: DateTimePicker(
|
||||||
|
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
||||||
|
|
||||||
use24HourFormat: false,
|
use24HourFormat: false,
|
||||||
controller: validityDateController,
|
controller: validityDateController,
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1970),
|
||||||
|
@ -514,6 +507,11 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
overseas: overseas);
|
overseas: overseas);
|
||||||
if (formKey.currentState!
|
if (formKey.currentState!
|
||||||
.saveAndValidate()) {
|
.saveAndValidate()) {
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(
|
||||||
|
context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Loading...");
|
||||||
context.read<EligibilityBloc>().add(
|
context.read<EligibilityBloc>().add(
|
||||||
UpdateEligibility(
|
UpdateEligibility(
|
||||||
eligibityCert: eligibityCert,
|
eligibityCert: eligibityCert,
|
||||||
|
@ -521,8 +519,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
.eligibityCert
|
.eligibityCert
|
||||||
.eligibility!
|
.eligibility!
|
||||||
.id,
|
.id,
|
||||||
profileId: profileId!,
|
profileId:widget.profileId.toString(),
|
||||||
token: token!));
|
token: widget.token));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
child: const Text(submit)),
|
||||||
|
@ -534,15 +532,8 @@ class _EditEligibilityScreenState extends State<EditEligibilityScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
},
|
|
||||||
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,6 +16,7 @@ import 'package:unit2/utils/text_container.dart';
|
||||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
import 'package:unit2/widgets/Leadings/close_leading.dart';
|
import 'package:unit2/widgets/Leadings/close_leading.dart';
|
||||||
import 'package:unit2/widgets/empty_data.dart';
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
import '../../../bloc/profile/eligibility/eligibility_bloc.dart';
|
import '../../../bloc/profile/eligibility/eligibility_bloc.dart';
|
||||||
import '../../../utils/alerts.dart';
|
import '../../../utils/alerts.dart';
|
||||||
|
|
||||||
|
@ -25,13 +26,14 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String? token;
|
String? token;
|
||||||
String? profileId;
|
int? profileId;
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<EligibilityBloc>().state is AddEligibilityState
|
title: context.watch<EligibilityBloc>().state is AddEligibilityState
|
||||||
? const Text("Add Eligiblity")
|
? const Text("Add Eligiblity")
|
||||||
|
@ -40,8 +42,8 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
: const Text(elibilityScreenTitle),
|
: const Text(elibilityScreenTitle),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
actions: (context.watch<EligibilityBloc>().state is EligibilityLoaded ||
|
actions: (context.watch<EligibilityBloc>().state is EligibilityLoaded)
|
||||||
context.watch<EligibilityBloc>().state is ProfileLoading)
|
|
||||||
? [
|
? [
|
||||||
AddLeading(onPressed: () {
|
AddLeading(onPressed: () {
|
||||||
context
|
context
|
||||||
|
@ -49,19 +51,18 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
.add(ShowAddEligibilityForm());
|
.add(ShowAddEligibilityForm());
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
: [
|
:(context.watch<EligibilityBloc>().state is AddEligibilityState || context.watch<EligibilityBloc>().state is EditEligibilityState)? [
|
||||||
CloseLeading(onPressed: () {
|
CloseLeading(onPressed: () {
|
||||||
context.read<EligibilityBloc>().add(GetEligibilities(
|
context.read<EligibilityBloc>().add(const LoadEligibility());
|
||||||
profileId: int.parse(profileId!), token: token!));
|
|
||||||
})
|
})
|
||||||
],
|
]:[],
|
||||||
),
|
),
|
||||||
body: BlocBuilder<UserBloc, UserState>(
|
body: BlocBuilder<UserBloc, UserState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is UserLoggedIn) {
|
if (state is UserLoggedIn) {
|
||||||
token = state.userData!.user!.login!.token;
|
token = state.userData!.user!.login!.token;
|
||||||
profileId =
|
profileId =
|
||||||
state.userData!.user!.login!.user!.profileId.toString();
|
state.userData!.user!.login!.user!.profileId;
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
return BlocBuilder<ProfileBloc, ProfileState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if(state is ProfileLoaded){
|
if(state is ProfileLoaded){
|
||||||
|
@ -82,7 +83,9 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
state is EditEligibilityState ||
|
state is EditEligibilityState ||
|
||||||
state is DeletedState ||
|
state is DeletedState ||
|
||||||
state is EligibilityAddedState ||
|
state is EligibilityAddedState ||
|
||||||
state is EligibilityEditedState) {
|
state is EligibilityEditedState ||
|
||||||
|
state is EligibilityErrorState
|
||||||
|
) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.dismiss();
|
progress!.dismiss();
|
||||||
}
|
}
|
||||||
|
@ -93,15 +96,15 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
"Eligibility has been deleted successfully",
|
"Eligibility has been deleted successfully",
|
||||||
() {
|
() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<EligibilityBloc>().add(LoadEligibility(
|
context.read<EligibilityBloc>().add(const LoadEligibility(
|
||||||
eligibilities: state.eligibilities));
|
));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Deletion Failed",
|
errorAlert(context, "Deletion Failed",
|
||||||
"Error deleting eligibility", () {
|
"Error deleting eligibility", () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<EligibilityBloc>().add(LoadEligibility(
|
context.read<EligibilityBloc>().add(const LoadEligibility(
|
||||||
eligibilities: state.eligibilities));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,16 +114,16 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
successAlert(context, "Adding Successfull!",
|
successAlert(context, "Adding Successfull!",
|
||||||
state.response['message'], () {
|
state.response['message'], () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<EligibilityBloc>().add(LoadEligibility(
|
context.read<EligibilityBloc>().add(const LoadEligibility(
|
||||||
eligibilities: state.eligibilities));
|
));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Adding Failed",
|
errorAlert(context, "Adding Failed",
|
||||||
"Something went wrong. Please try again.",
|
"Something went wrong. Please try again.",
|
||||||
() {
|
() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<EligibilityBloc>().add(LoadEligibility(
|
context.read<EligibilityBloc>().add(const LoadEligibility(
|
||||||
eligibilities: state.eligibilities));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,16 +133,16 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
successAlert(context, "Update Successfull!",
|
successAlert(context, "Update Successfull!",
|
||||||
state.response['message'], () {
|
state.response['message'], () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<EligibilityBloc>().add(LoadEligibility(
|
context.read<EligibilityBloc>().add(const LoadEligibility(
|
||||||
eligibilities: state.eligibilities));
|
));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Update Failed",
|
errorAlert(context, "Update Failed",
|
||||||
"Something went wrong. Please try again.",
|
"Something went wrong. Please try again.",
|
||||||
() {
|
() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<EligibilityBloc>().add(LoadEligibility(
|
context.read<EligibilityBloc>().add(const LoadEligibility(
|
||||||
eligibilities: state.eligibilities));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,27 +224,29 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
const Offset(-10, -10),
|
const Offset(-10, -10),
|
||||||
elevation: 3,
|
elevation: 3,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
final progress =
|
|
||||||
|
////delete eligibilty-= = = = = = = = =>>
|
||||||
|
if (value == 2) {
|
||||||
|
|
||||||
|
confirmAlert(context,
|
||||||
|
() {
|
||||||
|
final progress =
|
||||||
ProgressHUD.of(
|
ProgressHUD.of(
|
||||||
context);
|
context);
|
||||||
progress!.showWithText(
|
progress!.showWithText(
|
||||||
"Loading...");
|
"Loading...");
|
||||||
////delete eligibilty-= = = = = = = = =>>
|
|
||||||
if (value == 2) {
|
|
||||||
confirmAlert(context,
|
|
||||||
() {
|
|
||||||
BlocProvider.of<
|
BlocProvider.of<
|
||||||
EligibilityBloc>(
|
EligibilityBloc>(
|
||||||
context)
|
context)
|
||||||
.add(DeleteEligibility(
|
.add(DeleteEligibility(
|
||||||
eligibilities: state
|
|
||||||
.eligibilities,
|
|
||||||
eligibilityId: state
|
eligibilityId: state
|
||||||
.eligibilities[
|
.eligibilities[
|
||||||
index]
|
index]
|
||||||
.id!,
|
.id!,
|
||||||
profileId:
|
profileId:
|
||||||
profileId!,
|
profileId.toString(),
|
||||||
token:
|
token:
|
||||||
token!));
|
token!));
|
||||||
}, "Delete?",
|
}, "Delete?",
|
||||||
|
@ -249,6 +254,11 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
if (value == 1) {
|
if (value == 1) {
|
||||||
////edit eligibilty-= = = = = = = = =>>
|
////edit eligibilty-= = = = = = = = =>>
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(
|
||||||
|
context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Loading...");
|
||||||
EligibityCert
|
EligibityCert
|
||||||
eligibityCert =
|
eligibityCert =
|
||||||
state.eligibilities[
|
state.eligibilities[
|
||||||
|
@ -312,15 +322,17 @@ class EligibiltyScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
if (state is EditEligibilityState) {
|
if (state is EditEligibilityState) {
|
||||||
return EditEligibilityScreen(
|
return EditEligibilityScreen(
|
||||||
|
profileId: profileId!,
|
||||||
|
token: token!,
|
||||||
eligibityCert: state.eligibityCert);
|
eligibityCert: state.eligibityCert);
|
||||||
}
|
}
|
||||||
if (state is AddEligibilityState) {
|
if (state is AddEligibilityState) {
|
||||||
return const AddEligibilityScreen();
|
return AddEligibilityScreen(token: token!,profileId: profileId!,);
|
||||||
}
|
}
|
||||||
if (state is EligibilityErrorState) {
|
if (state is EligibilityErrorState) {
|
||||||
return Center(
|
return SomethingWentWrong(message: state.message, onpressed: (){
|
||||||
child: Text(state.message),
|
context.read<EligibilityBloc>().add(LoadEligibility(token: token,profileId: profileId));
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.grey.shade200,
|
color: Colors.grey.shade200,
|
||||||
|
|
|
@ -135,21 +135,20 @@ class LoadingScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 120,
|
height: 80,
|
||||||
width: 120,
|
width: 80,
|
||||||
decoration:const BoxDecoration(
|
decoration:const BoxDecoration(
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
borderRadius: BorderRadius.all(Radius.circular(25))
|
borderRadius: BorderRadius.all(Radius.circular(8))
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: const[
|
children: const[
|
||||||
SpinKitFadingCircle(
|
SpinKitFadingCircle(
|
||||||
|
size: 42,
|
||||||
color: Colors.white),
|
color: Colors.white),
|
||||||
SizedBox(height: 10,),
|
|
||||||
Text("Loading Profile",textAlign: TextAlign.center, style: TextStyle(color: Colors.white,fontSize: 10),)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -5,11 +5,8 @@ import 'package:fluttericon/font_awesome_icons.dart';
|
||||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
import 'package:searchfield/searchfield.dart';
|
import 'package:searchfield/searchfield.dart';
|
||||||
import 'package:unit2/bloc/profile/other_information/org_membership/organization_membership_bloc.dart';
|
import 'package:unit2/bloc/profile/other_information/org_membership/organization_membership_bloc.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
|
||||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
|
||||||
import 'package:unit2/model/utils/agency.dart';
|
import 'package:unit2/model/utils/agency.dart';
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
|
|
||||||
import '../../../../../model/utils/category.dart';
|
import '../../../../../model/utils/category.dart';
|
||||||
import '../../../../../theme-data.dart/box_shadow.dart';
|
import '../../../../../theme-data.dart/box_shadow.dart';
|
||||||
import '../../../../../theme-data.dart/btn-style.dart';
|
import '../../../../../theme-data.dart/btn-style.dart';
|
||||||
|
@ -17,7 +14,10 @@ import '../../../../../theme-data.dart/colors.dart';
|
||||||
import '../../../../../theme-data.dart/form-style.dart';
|
import '../../../../../theme-data.dart/form-style.dart';
|
||||||
|
|
||||||
class AddOrgMemberShipScreen extends StatefulWidget {
|
class AddOrgMemberShipScreen extends StatefulWidget {
|
||||||
const AddOrgMemberShipScreen({super.key});
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
const AddOrgMemberShipScreen(
|
||||||
|
{super.key, required this.profileId, required this.token});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddOrgMemberShipScreen> createState() => _AddOrgMemberShipScreenState();
|
State<AddOrgMemberShipScreen> createState() => _AddOrgMemberShipScreenState();
|
||||||
|
@ -34,339 +34,290 @@ Agency? newAgency;
|
||||||
bool showIsPrivateRadio = false;
|
bool showIsPrivateRadio = false;
|
||||||
bool? isPrivate = false;
|
bool? isPrivate = false;
|
||||||
final _formKey = GlobalKey<FormBuilderState>();
|
final _formKey = GlobalKey<FormBuilderState>();
|
||||||
int? profileId;
|
|
||||||
String? token;
|
|
||||||
class _AddOrgMemberShipScreenState extends State<AddOrgMemberShipScreen> {
|
class _AddOrgMemberShipScreenState extends State<AddOrgMemberShipScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<UserBloc, UserState>(
|
return BlocBuilder<OrganizationMembershipBloc, OrganizationMembershipState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is UserLoggedIn) {
|
if (state is AddOrgMembershipState) {
|
||||||
token = state.userData!.user!.login!.token;
|
return SingleChildScrollView(
|
||||||
profileId = state.userData!.user!.login!.user!.profileId;
|
child: FormBuilder(
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
key: _formKey,
|
||||||
builder: (context, state) {
|
child: Padding(
|
||||||
if (state is ProfileLoaded) {
|
padding:
|
||||||
return BlocBuilder<OrganizationMembershipBloc,
|
const EdgeInsets.symmetric(vertical: 25, horizontal: 18),
|
||||||
OrganizationMembershipState>(
|
child: Column(
|
||||||
builder: (context, state) {
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
if (state is AddOrgMembershipState) {
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
return SingleChildScrollView(
|
children: [
|
||||||
child: FormBuilder(
|
const SizedBox(
|
||||||
key: _formKey,
|
height: 100,
|
||||||
child: Padding(
|
),
|
||||||
padding: const EdgeInsets.symmetric(
|
StatefulBuilder(builder: (context, setState) {
|
||||||
vertical: 25, horizontal: 18),
|
//// AGENCY SEARCHFIELD
|
||||||
child: Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
crossAxisAlignment:
|
SearchField(
|
||||||
CrossAxisAlignment.center,
|
itemHeight: 70,
|
||||||
children: [
|
suggestions: state.agencies
|
||||||
const SizedBox(
|
.map((Agency agency) =>
|
||||||
height: 100,
|
SearchFieldListItem(agency.name!,
|
||||||
),
|
item: agency,
|
||||||
StatefulBuilder(
|
child: ListTile(
|
||||||
builder: (context, setState) {
|
title: Text(
|
||||||
//// AGENCY SEARCHFIELD
|
agency.name!.toUpperCase(),
|
||||||
return Column(
|
overflow: TextOverflow.ellipsis,
|
||||||
children: [
|
),
|
||||||
SearchField(
|
subtitle: Text(
|
||||||
itemHeight: 70,
|
agency.privateEntity == true
|
||||||
suggestions: state.agencies
|
? "Private"
|
||||||
.map((Agency agency) =>
|
: agency.privateEntity ==
|
||||||
SearchFieldListItem(
|
false
|
||||||
agency.name!,
|
? "Government"
|
||||||
item: agency,
|
: ""),
|
||||||
child: ListTile(
|
)))
|
||||||
title: Text(
|
.toList(),
|
||||||
agency.name!
|
validator: FormBuilderValidators.required(
|
||||||
.toUpperCase(),
|
errorText: "This field is required"),
|
||||||
overflow:
|
focusNode: agencyFocusNode,
|
||||||
TextOverflow
|
searchInputDecoration: normalTextFieldStyle(
|
||||||
.ellipsis,
|
"Agency *", "")
|
||||||
),
|
.copyWith(
|
||||||
subtitle: Text(agency
|
suffixIcon:
|
||||||
.privateEntity ==
|
const Icon(Icons.arrow_drop_down)),
|
||||||
true
|
////agency suggestion tap
|
||||||
? "Private"
|
onSuggestionTap: (agency) {
|
||||||
: agency.privateEntity ==
|
setState(() {
|
||||||
false
|
selectedAgency = agency.item;
|
||||||
? "Government"
|
agencyFocusNode.unfocus();
|
||||||
: ""),
|
if (selectedAgency?.category == null) {
|
||||||
)))
|
showAgencyCategory = true;
|
||||||
.toList(),
|
showIsPrivateRadio = true;
|
||||||
validator: FormBuilderValidators
|
} else {
|
||||||
.required(
|
showAgencyCategory = false;
|
||||||
errorText:
|
showIsPrivateRadio = false;
|
||||||
"This field is required"),
|
}
|
||||||
focusNode: agencyFocusNode,
|
});
|
||||||
searchInputDecoration:
|
},
|
||||||
normalTextFieldStyle(
|
emptyWidget: Container(
|
||||||
"Agency *", "")
|
decoration: box1(),
|
||||||
.copyWith(
|
height: 100,
|
||||||
suffixIcon:
|
child: Column(
|
||||||
const Icon(Icons
|
mainAxisAlignment:
|
||||||
.arrow_drop_down)),
|
MainAxisAlignment.center,
|
||||||
////agency suggestion tap
|
crossAxisAlignment:
|
||||||
onSuggestionTap: (agency) {
|
CrossAxisAlignment.center,
|
||||||
setState(() {
|
children: [
|
||||||
selectedAgency = agency.item;
|
const SizedBox(
|
||||||
agencyFocusNode.unfocus();
|
height: 20,
|
||||||
if (selectedAgency
|
),
|
||||||
?.category ==
|
const Text("No result found..."),
|
||||||
null) {
|
const SizedBox(
|
||||||
showAgencyCategory = true;
|
height: 10,
|
||||||
showIsPrivateRadio = true;
|
),
|
||||||
} else {
|
TextButton(
|
||||||
showAgencyCategory = false;
|
//// Add agency onpressed
|
||||||
showIsPrivateRadio = false;
|
onPressed: () {
|
||||||
}
|
showDialog(
|
||||||
});
|
context: context,
|
||||||
},
|
builder:
|
||||||
emptyWidget: Container(
|
(BuildContext context) {
|
||||||
decoration: box1(),
|
return AlertDialog(
|
||||||
height: 100,
|
title: const Text(
|
||||||
child: Column(
|
"Add Agency?"),
|
||||||
mainAxisAlignment:
|
content: SizedBox(
|
||||||
MainAxisAlignment
|
height: 130,
|
||||||
.center,
|
child: Column(
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment
|
|
||||||
.center,
|
|
||||||
children: [
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
const Text(
|
|
||||||
"No result found..."),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
//// Add agency onpressed
|
|
||||||
onPressed: () {
|
|
||||||
showDialog(
|
|
||||||
context:
|
|
||||||
context,
|
|
||||||
builder:
|
|
||||||
(BuildContext
|
|
||||||
context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text(
|
|
||||||
"Add Agency?"),
|
|
||||||
content:
|
|
||||||
SizedBox(
|
|
||||||
height:
|
|
||||||
130,
|
|
||||||
child:
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
controller:
|
|
||||||
addAgencyController,
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle("", ""),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height:
|
|
||||||
12,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 50,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: mainBtnStyle(primary, Colors.transparent, second),
|
|
||||||
//// onpressed
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
newAgency = Agency(id: null, name: addAgencyController.text.toUpperCase(), category: null, privateEntity: null);
|
|
||||||
state.agencies.insert(0, newAgency!);
|
|
||||||
addAgencyController.clear();
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: const Text("Add"))),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: const Text(
|
|
||||||
"Add position"))
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
child: showAgencyCategory
|
|
||||||
? SearchField(
|
|
||||||
focusNode:
|
|
||||||
agencyCategoryFocusNode,
|
|
||||||
itemHeight: 70,
|
|
||||||
suggestions: state
|
|
||||||
.agencyCategories
|
|
||||||
.map((Category
|
|
||||||
category) =>
|
|
||||||
SearchFieldListItem(
|
|
||||||
category
|
|
||||||
.name!,
|
|
||||||
item:
|
|
||||||
category,
|
|
||||||
child:
|
|
||||||
ListTile(
|
|
||||||
title: Text(
|
|
||||||
category
|
|
||||||
.name!),
|
|
||||||
subtitle: Text(category
|
|
||||||
.industryClass!
|
|
||||||
.name!),
|
|
||||||
)))
|
|
||||||
.toList(),
|
|
||||||
emptyWidget: Container(
|
|
||||||
height: 100,
|
|
||||||
decoration: box1(),
|
|
||||||
child: const Center(
|
|
||||||
child: Text(
|
|
||||||
"No result found ...")),
|
|
||||||
),
|
|
||||||
////agency controller suggestion tap
|
|
||||||
onSuggestionTap:
|
|
||||||
(agencyCategory) {
|
|
||||||
setState(() {
|
|
||||||
selectedCategory =
|
|
||||||
agencyCategory
|
|
||||||
.item;
|
|
||||||
|
|
||||||
agencyCategoryFocusNode
|
|
||||||
.unfocus();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
searchInputDecoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Category *",
|
|
||||||
"")
|
|
||||||
.copyWith(
|
|
||||||
suffixIcon:
|
|
||||||
const Icon(
|
|
||||||
Icons
|
|
||||||
.arrow_drop_down)),
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
),
|
|
||||||
|
|
||||||
////PRVIATE SECTOR
|
|
||||||
SizedBox(
|
|
||||||
child: showIsPrivateRadio
|
|
||||||
? FormBuilderRadioGroup(
|
|
||||||
decoration:
|
|
||||||
InputDecoration(
|
|
||||||
border:
|
|
||||||
InputBorder.none,
|
|
||||||
label: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
TextFormField(
|
||||||
"Is this private sector? ",
|
controller:
|
||||||
style: Theme.of(
|
addAgencyController,
|
||||||
context)
|
decoration:
|
||||||
.textTheme
|
normalTextFieldStyle(
|
||||||
.headlineSmall!
|
"", ""),
|
||||||
.copyWith(
|
|
||||||
fontSize:
|
|
||||||
24),
|
|
||||||
),
|
),
|
||||||
const Icon(FontAwesome
|
const SizedBox(
|
||||||
.help_circled)
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: double
|
||||||
|
.infinity,
|
||||||
|
height: 50,
|
||||||
|
child:
|
||||||
|
ElevatedButton(
|
||||||
|
style: mainBtnStyle(
|
||||||
|
primary,
|
||||||
|
Colors
|
||||||
|
.transparent,
|
||||||
|
second),
|
||||||
|
//// onpressed
|
||||||
|
onPressed:
|
||||||
|
() {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
newAgency = Agency(
|
||||||
|
id: null,
|
||||||
|
name: addAgencyController.text.toUpperCase(),
|
||||||
|
category: null,
|
||||||
|
privateEntity: null);
|
||||||
|
state.agencies.insert(0,
|
||||||
|
newAgency!);
|
||||||
|
addAgencyController.clear();
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
"Add"))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
////onvhange private sector
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
if (value
|
|
||||||
.toString() ==
|
|
||||||
"YES") {
|
|
||||||
isPrivate = true;
|
|
||||||
} else {
|
|
||||||
isPrivate = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
name: 'isPrivate',
|
|
||||||
validator:
|
|
||||||
FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
options: ["YES", "NO"]
|
|
||||||
.map((lang) =>
|
|
||||||
FormBuilderFieldOption(
|
|
||||||
value:
|
|
||||||
lang))
|
|
||||||
.toList(
|
|
||||||
growable:
|
|
||||||
false),
|
|
||||||
)
|
|
||||||
: const SizedBox()),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
////SHOW CATEGORY AGENCY
|
|
||||||
|
|
||||||
const SizedBox(
|
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
width: double.infinity,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: mainBtnStyle(primary,
|
|
||||||
Colors.transparent, second),
|
|
||||||
onPressed: () {
|
|
||||||
if (_formKey.currentState!
|
|
||||||
.saveAndValidate()) {
|
|
||||||
if(selectedAgency?.privateEntity != null){
|
|
||||||
newAgency = selectedAgency;
|
|
||||||
}else{
|
|
||||||
newAgency = Agency(
|
|
||||||
id: selectedAgency?.id,
|
|
||||||
name: selectedAgency!.name,
|
|
||||||
category:
|
|
||||||
selectedCategory,
|
|
||||||
privateEntity: isPrivate);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.read<OrganizationMembershipBloc>().add(AddOrgMembership(agency: newAgency!, profileId: profileId!, token: token!));
|
|
||||||
setState(() {
|
|
||||||
showAgencyCategory = false;
|
|
||||||
showIsPrivateRadio = false;
|
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
child: const Text("Add position"))
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
child: showAgencyCategory
|
||||||
|
? SearchField(
|
||||||
|
focusNode: agencyCategoryFocusNode,
|
||||||
|
itemHeight: 70,
|
||||||
|
suggestions: state.agencyCategories
|
||||||
|
.map((Category category) =>
|
||||||
|
SearchFieldListItem(
|
||||||
|
category.name!,
|
||||||
|
item: category,
|
||||||
|
child: ListTile(
|
||||||
|
title:
|
||||||
|
Text(category.name!),
|
||||||
|
subtitle: Text(category
|
||||||
|
.industryClass!
|
||||||
|
.name!),
|
||||||
|
)))
|
||||||
|
.toList(),
|
||||||
|
emptyWidget: Container(
|
||||||
|
height: 100,
|
||||||
|
decoration: box1(),
|
||||||
|
child: const Center(
|
||||||
|
child:
|
||||||
|
Text("No result found ...")),
|
||||||
|
),
|
||||||
|
////agency controller suggestion tap
|
||||||
|
onSuggestionTap: (agencyCategory) {
|
||||||
|
setState(() {
|
||||||
|
selectedCategory =
|
||||||
|
agencyCategory.item;
|
||||||
|
|
||||||
|
agencyCategoryFocusNode.unfocus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
searchInputDecoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Category *", "")
|
||||||
|
.copyWith(
|
||||||
|
suffixIcon: const Icon(
|
||||||
|
Icons.arrow_drop_down)),
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
),
|
||||||
|
|
||||||
|
////PRVIATE SECTOR
|
||||||
|
SizedBox(
|
||||||
|
child: showIsPrivateRadio
|
||||||
|
? FormBuilderRadioGroup(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
label: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Is this private sector? ",
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.headlineSmall!
|
||||||
|
.copyWith(fontSize: 24),
|
||||||
|
),
|
||||||
|
const Icon(
|
||||||
|
FontAwesome.help_circled)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
////onvhange private sector
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
if (value.toString() == "YES") {
|
||||||
|
isPrivate = true;
|
||||||
|
} else {
|
||||||
|
isPrivate = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
child: const Text(submit)),
|
|
||||||
)
|
name: 'isPrivate',
|
||||||
]),
|
validator:
|
||||||
)),
|
FormBuilderValidators.required(
|
||||||
);
|
errorText:
|
||||||
}
|
"This field is required"),
|
||||||
return Container();
|
options: ["YES", "NO"]
|
||||||
},
|
.map((lang) =>
|
||||||
);
|
FormBuilderFieldOption(
|
||||||
}
|
value: lang))
|
||||||
return Container();
|
.toList(growable: false),
|
||||||
},
|
)
|
||||||
|
: const SizedBox()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
////SHOW CATEGORY AGENCY
|
||||||
|
|
||||||
|
const SizedBox(
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
width: double.infinity,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: mainBtnStyle(
|
||||||
|
primary, Colors.transparent, second),
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!.saveAndValidate()) {
|
||||||
|
if (selectedAgency?.privateEntity != null) {
|
||||||
|
newAgency = selectedAgency;
|
||||||
|
} else {
|
||||||
|
newAgency = Agency(
|
||||||
|
id: selectedAgency?.id,
|
||||||
|
name: selectedAgency!.name,
|
||||||
|
category: selectedCategory,
|
||||||
|
privateEntity: isPrivate);
|
||||||
|
}
|
||||||
|
|
||||||
|
context
|
||||||
|
.read<OrganizationMembershipBloc>()
|
||||||
|
.add(AddOrgMembership(
|
||||||
|
agency: newAgency!,
|
||||||
|
profileId: widget.profileId,
|
||||||
|
token: widget.token));
|
||||||
|
setState(() {
|
||||||
|
showAgencyCategory = false;
|
||||||
|
showIsPrivateRadio = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text(submit)),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return const Placeholder();
|
return Container();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import 'package:unit2/utils/text_container.dart';
|
||||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
import 'package:unit2/widgets/Leadings/close_leading.dart';
|
import 'package:unit2/widgets/Leadings/close_leading.dart';
|
||||||
import 'package:unit2/widgets/empty_data.dart';
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
import '../../../../bloc/profile/other_information/org_membership/organization_membership_bloc.dart';
|
import '../../../../bloc/profile/other_information/org_membership/organization_membership_bloc.dart';
|
||||||
import '../../../../utils/alerts.dart';
|
import '../../../../utils/alerts.dart';
|
||||||
import '../../../../utils/global.dart';
|
import '../../../../utils/global.dart';
|
||||||
|
@ -65,6 +66,7 @@ class OrgMembershipsScreen extends StatelessWidget {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.dismiss();
|
progress!.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
////ADDED STATE
|
////ADDED STATE
|
||||||
if (state is OrgMembershipAddedState) {
|
if (state is OrgMembershipAddedState) {
|
||||||
if (state.response['success']) {
|
if (state.response['success']) {
|
||||||
|
@ -73,8 +75,7 @@ class OrgMembershipsScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<OrganizationMembershipBloc>().add(
|
context.read<OrganizationMembershipBloc>().add(
|
||||||
LoadOrganizationMemberships(
|
LoadOrganizationMemberships(
|
||||||
organizationMemberships:
|
));
|
||||||
state.orgMemberships));
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Adding Failed",
|
errorAlert(context, "Adding Failed",
|
||||||
|
@ -83,8 +84,7 @@ class OrgMembershipsScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<OrganizationMembershipBloc>().add(
|
context.read<OrganizationMembershipBloc>().add(
|
||||||
LoadOrganizationMemberships(
|
LoadOrganizationMemberships(
|
||||||
organizationMemberships:
|
));
|
||||||
state.orgMemberships));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class OrgMembershipsScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<OrganizationMembershipBloc>().add(
|
context.read<OrganizationMembershipBloc>().add(
|
||||||
LoadOrganizationMemberships(
|
LoadOrganizationMemberships(
|
||||||
organizationMemberships: state.organizationMemberships));
|
));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Deletion Failed",
|
errorAlert(context, "Deletion Failed",
|
||||||
|
@ -104,7 +104,7 @@ class OrgMembershipsScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<OrganizationMembershipBloc>().add(
|
context.read<OrganizationMembershipBloc>().add(
|
||||||
LoadOrganizationMemberships(
|
LoadOrganizationMemberships(
|
||||||
organizationMemberships: state.organizationMemberships));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,14 +161,15 @@ class OrgMembershipsScreen extends StatelessWidget {
|
||||||
offset: const Offset(-10, -10),
|
offset: const Offset(-10, -10),
|
||||||
elevation: 3,
|
elevation: 3,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
final progress =
|
|
||||||
ProgressHUD.of(context);
|
|
||||||
progress!
|
|
||||||
.showWithText("Loading...");
|
|
||||||
////delete orgmembership-= = = = = = = = =>>
|
////delete orgmembership-= = = = = = = = =>>
|
||||||
if (value == 1) {
|
if (value == 1) {
|
||||||
confirmAlert(context, () {
|
confirmAlert(context, () {
|
||||||
context.read<OrganizationMembershipBloc>().add(DeleteOrgMemberShip(profileId: profileId, token: token!, org: state.orgMemberships[index], organizationMemberships: state.orgMemberships));
|
final progress =
|
||||||
|
ProgressHUD.of(context);
|
||||||
|
progress!
|
||||||
|
.showWithText("Loading...");
|
||||||
|
context.read<OrganizationMembershipBloc>().add(DeleteOrgMemberShip(profileId: profileId, token: token!, org: state.orgMemberships[index]));
|
||||||
}, "Delete?",
|
}, "Delete?",
|
||||||
"Confirm Delete?");
|
"Confirm Delete?");
|
||||||
}
|
}
|
||||||
|
@ -198,9 +199,13 @@ class OrgMembershipsScreen extends StatelessWidget {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (state is AddOrgMembershipState) {
|
if (state is AddOrgMembershipState) {
|
||||||
return const AddOrgMemberShipScreen();
|
return AlertDialog(
|
||||||
|
content: AddOrgMemberShipScreen(profileId: profileId,token: token!,)
|
||||||
|
);
|
||||||
}if(state is OrganizationMembershipErrorState){
|
}if(state is OrganizationMembershipErrorState){
|
||||||
return Container(child: Text(state.message),);
|
return SomethingWentWrong(message: state.message, onpressed: (){
|
||||||
|
context.read<OrganizationMembershipBloc>().add(GetOrganizationMembership(token: token,profileId: profileId));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import 'package:flutter/material.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_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
@ -9,9 +7,7 @@ import 'package:unit2/bloc/profile/profile_bloc.dart';
|
||||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
||||||
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
import 'package:unit2/model/profile/other_information/skills_and_hobbies.dart';
|
||||||
import 'package:unit2/screens/profile/components/other_information/skills_hobbies/add_modal.dart';
|
import 'package:unit2/screens/profile/components/other_information/skills_hobbies/add_modal.dart';
|
||||||
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:unit2/utils/global.dart';
|
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
import 'package:unit2/widgets/empty_data.dart';
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
|
|
|
@ -4,14 +4,13 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||||
import 'package:unit2/bloc/profile/profile_bloc.dart';
|
|
||||||
import 'package:unit2/bloc/profile/references/references_bloc.dart';
|
import 'package:unit2/bloc/profile/references/references_bloc.dart';
|
||||||
import 'package:unit2/bloc/user/user_bloc.dart';
|
|
||||||
import 'package:unit2/model/location/address_category.dart';
|
import 'package:unit2/model/location/address_category.dart';
|
||||||
import 'package:unit2/model/location/barangay.dart';
|
import 'package:unit2/model/location/barangay.dart';
|
||||||
import 'package:unit2/model/profile/references.dart';
|
import 'package:unit2/model/profile/references.dart';
|
||||||
import 'package:unit2/theme-data.dart/btn-style.dart';
|
import 'package:unit2/theme-data.dart/btn-style.dart';
|
||||||
import 'package:unit2/theme-data.dart/form-style.dart';
|
import 'package:unit2/theme-data.dart/form-style.dart';
|
||||||
|
import 'package:unit2/utils/global.dart';
|
||||||
import '../../../../model/location/city.dart';
|
import '../../../../model/location/city.dart';
|
||||||
import '../../../../model/location/country.dart';
|
import '../../../../model/location/country.dart';
|
||||||
import '../../../../model/location/provinces.dart';
|
import '../../../../model/location/provinces.dart';
|
||||||
|
@ -21,7 +20,10 @@ import '../../../../utils/location_utilities.dart';
|
||||||
import '../../../../utils/text_container.dart';
|
import '../../../../utils/text_container.dart';
|
||||||
|
|
||||||
class AddReferenceScreen extends StatefulWidget {
|
class AddReferenceScreen extends StatefulWidget {
|
||||||
const AddReferenceScreen({super.key});
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
const AddReferenceScreen(
|
||||||
|
{super.key, required this.profileId, required this.token});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddReferenceScreen> createState() => _AddReferenceScreenState();
|
State<AddReferenceScreen> createState() => _AddReferenceScreenState();
|
||||||
|
@ -29,8 +31,6 @@ class AddReferenceScreen extends StatefulWidget {
|
||||||
|
|
||||||
class _AddReferenceScreenState extends State<AddReferenceScreen> {
|
class _AddReferenceScreenState extends State<AddReferenceScreen> {
|
||||||
final formKey = GlobalKey<FormBuilderState>();
|
final formKey = GlobalKey<FormBuilderState>();
|
||||||
String? token;
|
|
||||||
String? profileId;
|
|
||||||
bool provinceCall = false;
|
bool provinceCall = false;
|
||||||
bool cityCall = false;
|
bool cityCall = false;
|
||||||
bool barangayCall = false;
|
bool barangayCall = false;
|
||||||
|
@ -48,452 +48,376 @@ class _AddReferenceScreenState extends State<AddReferenceScreen> {
|
||||||
AddressCategory? selectedCategory;
|
AddressCategory? selectedCategory;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<UserBloc, UserState>(
|
return BlocBuilder<ReferencesBloc, ReferencesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is UserLoggedIn) {
|
if (state is AddReferenceState) {
|
||||||
token = state.userData!.user!.login!.token;
|
return SingleChildScrollView(
|
||||||
profileId = state.userData!.user!.login!.user!.profileId.toString();
|
child: SizedBox(
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
height: screenHeight * .95,
|
||||||
builder: (context, state) {
|
child: ProgressHUD(
|
||||||
if (state is ProfileLoaded) {
|
child: Padding(
|
||||||
return BlocBuilder<ReferencesBloc, ReferencesState>(
|
padding: const EdgeInsets.symmetric(vertical: 25, horizontal: 18),
|
||||||
builder: (context, state) {
|
child: FormBuilder(
|
||||||
if (state is AddReferenceState) {
|
key: formKey,
|
||||||
return ProgressHUD(
|
child: Column(
|
||||||
child: Padding(
|
children: [
|
||||||
padding: const EdgeInsets.symmetric(
|
const SizedBox(height: 25),
|
||||||
vertical: 25, horizontal: 18),
|
Row(
|
||||||
child: FormBuilder(
|
children: [
|
||||||
key: formKey,
|
////LAST NAME
|
||||||
child: Column(
|
Flexible(
|
||||||
children: [
|
flex: 1,
|
||||||
const SizedBox(height: 25),
|
child: FormBuilderTextField(
|
||||||
Row(
|
decoration: normalTextFieldStyle(
|
||||||
children: [
|
"Last name *", "Last name *"),
|
||||||
////LAST NAME
|
name: "lastname",
|
||||||
Flexible(
|
validator: FormBuilderValidators.required(
|
||||||
flex: 1,
|
errorText: "This field is required"),
|
||||||
child: FormBuilderTextField(
|
),
|
||||||
decoration: normalTextFieldStyle(
|
),
|
||||||
"Last name *", "Last name *"),
|
const SizedBox(
|
||||||
name: "lastname",
|
width: 5,
|
||||||
validator:
|
),
|
||||||
FormBuilderValidators.required(
|
////FIRST NAME
|
||||||
errorText:
|
Flexible(
|
||||||
"This field is required"),
|
flex: 1,
|
||||||
),
|
child: FormBuilderTextField(
|
||||||
),
|
decoration: normalTextFieldStyle(
|
||||||
const SizedBox(
|
"First name *", "First name *"),
|
||||||
width: 5,
|
name: "firstname",
|
||||||
),
|
validator: FormBuilderValidators.required(
|
||||||
////FIRST NAME
|
errorText: "This field is required"),
|
||||||
Flexible(
|
),
|
||||||
flex: 1,
|
),
|
||||||
child: FormBuilderTextField(
|
],
|
||||||
decoration: normalTextFieldStyle(
|
),
|
||||||
"First name *", "First name *"),
|
const SizedBox(
|
||||||
name: "firstname",
|
height: 8,
|
||||||
validator:
|
),
|
||||||
FormBuilderValidators.required(
|
Row(
|
||||||
errorText:
|
children: [
|
||||||
"This field is required"),
|
Flexible(
|
||||||
),
|
flex: 1,
|
||||||
),
|
child: FormBuilderTextField(
|
||||||
],
|
decoration: normalTextFieldStyle(
|
||||||
),
|
"Middle name *", "Midlle name *"),
|
||||||
const SizedBox(
|
name: "middlename",
|
||||||
height: 8,
|
validator: FormBuilderValidators.required(
|
||||||
),
|
errorText: "This field is required"),
|
||||||
Row(
|
),
|
||||||
children: [
|
),
|
||||||
Flexible(
|
const SizedBox(
|
||||||
flex: 1,
|
width: 5,
|
||||||
child: FormBuilderTextField(
|
),
|
||||||
decoration: normalTextFieldStyle(
|
////CATEGORY
|
||||||
"Middle name *", "Midlle name *"),
|
Flexible(
|
||||||
name: "middlename",
|
flex: 1,
|
||||||
validator:
|
child: FormBuilderDropdown<AddressCategory>(
|
||||||
FormBuilderValidators.required(
|
name: 'category',
|
||||||
errorText:
|
validator:
|
||||||
"This field is required"),
|
FormBuilderValidators.required(errorText: ""),
|
||||||
),
|
decoration:
|
||||||
),
|
normalTextFieldStyle("Category", "Category"),
|
||||||
const SizedBox(
|
items: state.categories
|
||||||
width: 5,
|
.map<DropdownMenuItem<AddressCategory>>(
|
||||||
),
|
(AddressCategory cat) {
|
||||||
////CATEGORY
|
return DropdownMenuItem<AddressCategory>(
|
||||||
Flexible(
|
value: cat,
|
||||||
flex: 1,
|
child: Text(cat.name!),
|
||||||
child: FormBuilderDropdown<
|
);
|
||||||
AddressCategory>(
|
}).toList(),
|
||||||
name: 'category',
|
onChanged: (value) {
|
||||||
validator:
|
setState(() {
|
||||||
FormBuilderValidators.required(
|
selectedCategory = value;
|
||||||
errorText: ""),
|
});
|
||||||
decoration: normalTextFieldStyle(
|
},
|
||||||
"Category", "Category"),
|
),
|
||||||
items: state.categories.map<
|
),
|
||||||
DropdownMenuItem<
|
],
|
||||||
AddressCategory>>(
|
),
|
||||||
(AddressCategory cat) {
|
const SizedBox(
|
||||||
return DropdownMenuItem<
|
height: 8,
|
||||||
AddressCategory>(
|
),
|
||||||
value: cat,
|
|
||||||
child: Text(cat.name!),
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
selectedCategory = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
|
|
||||||
////OVERSEAS ADDRESS
|
////OVERSEAS ADDRESS
|
||||||
FormBuilderSwitch(
|
FormBuilderSwitch(
|
||||||
initialValue: overseas,
|
initialValue: overseas,
|
||||||
activeColor: second,
|
activeColor: second,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
overseas = value!;
|
overseas = value!;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
decoration: normalTextFieldStyle("", ''),
|
decoration: normalTextFieldStyle("", ''),
|
||||||
name: 'overseas',
|
name: 'overseas',
|
||||||
title: const Text("Overseas Address?"),
|
title: const Text("Overseas Address?"),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: overseas == true ? 8 : 0,
|
height: overseas == true ? 8 : 0,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: overseas == false
|
child: overseas == false
|
||||||
? Column(
|
? Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
////REGION DROPDOWN
|
////REGION DROPDOWN
|
||||||
FormBuilderDropdown<Region?>(
|
FormBuilderDropdown<Region?>(
|
||||||
autovalidateMode:
|
autovalidateMode:
|
||||||
AutovalidateMode
|
AutovalidateMode.onUserInteraction,
|
||||||
.onUserInteraction,
|
validator: FormBuilderValidators.required(
|
||||||
validator: FormBuilderValidators
|
errorText: "This field is required"),
|
||||||
.required(
|
onChanged: (Region? region) async {
|
||||||
errorText:
|
if(selectedRegion != region){
|
||||||
"This field is required"),
|
setState(() {
|
||||||
onChanged:
|
provinceCall = true;
|
||||||
(Region? region) async {
|
});
|
||||||
|
selectedRegion = region;
|
||||||
|
getProvinces();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initialValue: null,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Region*", "Region"),
|
||||||
|
name: 'region',
|
||||||
|
items: state.regions
|
||||||
|
.map<DropdownMenuItem<Region>>(
|
||||||
|
(Region region) {
|
||||||
|
return DropdownMenuItem<Region>(
|
||||||
|
value: region,
|
||||||
|
child: Text(region.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
//// PROVINCE DROPDOWN
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
|
inAsyncCall: provinceCall,
|
||||||
|
child: DropdownButtonFormField<Province?>(
|
||||||
|
autovalidateMode: AutovalidateMode
|
||||||
|
.onUserInteraction,
|
||||||
|
validator: (value) =>
|
||||||
|
value == null ? 'required' : null,
|
||||||
|
isExpanded: true,
|
||||||
|
value: selectedProvince,
|
||||||
|
onChanged: (Province? province) {
|
||||||
|
if(selectedProvince != province){
|
||||||
setState(() {
|
setState(() {
|
||||||
provinceCall = true;
|
cityCall = true;
|
||||||
});
|
});
|
||||||
selectedRegion = region;
|
selectedProvince = province;
|
||||||
getProvinces();
|
getCities();
|
||||||
},
|
}
|
||||||
initialValue: null,
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Region*", "Region"),
|
|
||||||
name: 'region',
|
|
||||||
items: state.regions.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Region>>(
|
|
||||||
(Region region) {
|
|
||||||
return DropdownMenuItem<
|
|
||||||
Region>(
|
|
||||||
value: region,
|
|
||||||
child: Text(
|
|
||||||
region.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
//// PROVINCE DROPDOWN
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.transparent,
|
|
||||||
inAsyncCall: provinceCall,
|
|
||||||
child: DropdownButtonFormField<
|
|
||||||
Province?>(
|
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
validator: (value) =>
|
|
||||||
value == null
|
|
||||||
? 'required'
|
|
||||||
: null,
|
|
||||||
isExpanded: true,
|
|
||||||
value: selectedProvince,
|
|
||||||
onChanged:
|
|
||||||
(Province? province) {
|
|
||||||
setState(() {
|
|
||||||
cityCall = true;
|
|
||||||
});
|
|
||||||
selectedProvince =
|
|
||||||
province;
|
|
||||||
getCities();
|
|
||||||
},
|
|
||||||
items: provinces == null
|
|
||||||
? []
|
|
||||||
: provinces!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Province>>(
|
|
||||||
(Province
|
|
||||||
province) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value:
|
|
||||||
province,
|
|
||||||
child:
|
|
||||||
FittedBox(
|
|
||||||
child: Text(
|
|
||||||
province
|
|
||||||
.description!),
|
|
||||||
));
|
|
||||||
}).toList(),
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Province*",
|
|
||||||
"Province")),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
////CITY MUNICIPALITY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: cityCall,
|
|
||||||
child:
|
|
||||||
DropdownButtonFormField<
|
|
||||||
CityMunicipality>(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(CityMunicipality?
|
|
||||||
city) {
|
|
||||||
setState(() {
|
|
||||||
barangayCall = true;
|
|
||||||
});
|
|
||||||
selectedMunicipality =
|
|
||||||
city;
|
|
||||||
getBarangays();
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Municipality*",
|
|
||||||
"Municipality"),
|
|
||||||
value: selectedMunicipality,
|
|
||||||
items: citymuns == null
|
|
||||||
? []
|
|
||||||
: citymuns!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
CityMunicipality>>(
|
|
||||||
(CityMunicipality
|
|
||||||
c) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: c,
|
|
||||||
child: Text(c
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
//// BARANGAY
|
|
||||||
SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: ModalProgressHUD(
|
|
||||||
color: Colors.white,
|
|
||||||
inAsyncCall: barangayCall,
|
|
||||||
child:
|
|
||||||
DropdownButtonFormField<
|
|
||||||
Barangay>(
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
isExpanded: true,
|
|
||||||
onChanged:
|
|
||||||
(Barangay? baragay) {
|
|
||||||
selectedBarangay =
|
|
||||||
baragay;
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
normalTextFieldStyle(
|
|
||||||
"Barangay*",
|
|
||||||
"Barangay"),
|
|
||||||
value: selectedBarangay,
|
|
||||||
items: barangays == null
|
|
||||||
? []
|
|
||||||
: barangays!.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Barangay>>(
|
|
||||||
(Barangay
|
|
||||||
barangay) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: barangay,
|
|
||||||
child: Text(barangay
|
|
||||||
.description!));
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
//// COUNTRY DROPDOWN
|
|
||||||
: SizedBox(
|
|
||||||
height: 60,
|
|
||||||
child: FormBuilderDropdown<Country>(
|
|
||||||
initialValue: null,
|
|
||||||
validator: FormBuilderValidators
|
|
||||||
.required(
|
|
||||||
errorText:
|
|
||||||
"This field is required"),
|
|
||||||
items: state.countries.map<
|
|
||||||
DropdownMenuItem<
|
|
||||||
Country>>(
|
|
||||||
(Country country) {
|
|
||||||
return DropdownMenuItem<
|
|
||||||
Country>(
|
|
||||||
value: country,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(
|
|
||||||
country.name!)));
|
|
||||||
}).toList(),
|
|
||||||
name: 'country',
|
|
||||||
decoration: normalTextFieldStyle(
|
|
||||||
"Country*", "Country"),
|
|
||||||
onChanged: (Country? value) {
|
|
||||||
selectedCountry = value;
|
|
||||||
},
|
},
|
||||||
),
|
items: provinces == null
|
||||||
|
? []
|
||||||
|
: provinces!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
Province>>(
|
||||||
|
(Province province) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: province,
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(province
|
||||||
|
.description!),
|
||||||
|
));
|
||||||
|
}).toList(),
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Province*", "Province")),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
////CITY MUNICIPALITY
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: cityCall,
|
||||||
|
child: DropdownButtonFormField<
|
||||||
|
CityMunicipality>(
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged: (CityMunicipality? city) {
|
||||||
|
if(selectedMunicipality != city){
|
||||||
|
setState(() {
|
||||||
|
barangayCall = true;
|
||||||
|
});
|
||||||
|
selectedMunicipality = city;
|
||||||
|
getBarangays();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Municipality*", "Municipality"),
|
||||||
|
value: selectedMunicipality,
|
||||||
|
items: citymuns == null
|
||||||
|
? []
|
||||||
|
: citymuns!.map<
|
||||||
|
DropdownMenuItem<
|
||||||
|
CityMunicipality>>(
|
||||||
|
(CityMunicipality c) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: c,
|
||||||
|
child:
|
||||||
|
Text(c.description!));
|
||||||
|
}).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
//// BARANGAY
|
||||||
|
SizedBox(
|
||||||
|
height: 60,
|
||||||
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.white,
|
||||||
|
inAsyncCall: barangayCall,
|
||||||
|
child: DropdownButtonFormField<Barangay>(
|
||||||
|
|
||||||
FormBuilderTextField(
|
isExpanded: true,
|
||||||
name: "mobile",
|
onChanged: (Barangay? baragay) {
|
||||||
decoration: normalTextFieldStyle(
|
selectedBarangay = baragay;
|
||||||
"Tel./Mobile *", "Tel./Mobile"),
|
},
|
||||||
validator: FormBuilderValidators.required(
|
decoration: normalTextFieldStyle(
|
||||||
errorText: "This field is required"),
|
"Barangay*", "Barangay"),
|
||||||
),
|
value: selectedBarangay,
|
||||||
const Expanded(
|
items: barangays == null
|
||||||
child: SizedBox(),
|
? []
|
||||||
),
|
: barangays!.map<
|
||||||
SizedBox(
|
DropdownMenuItem<Barangay>>(
|
||||||
width: double.infinity,
|
(Barangay barangay) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: barangay,
|
||||||
|
child: Text(
|
||||||
|
barangay.description!));
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
//// COUNTRY DROPDOWN
|
||||||
|
: SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ElevatedButton(
|
child: FormBuilderDropdown<Country>(
|
||||||
style: mainBtnStyle(
|
initialValue: null,
|
||||||
primary, Colors.transparent, second),
|
validator: FormBuilderValidators.required(
|
||||||
child: const Text(submit),
|
errorText: "This field is required"),
|
||||||
onPressed: () {
|
items: state.countries
|
||||||
|
.map<DropdownMenuItem<Country>>(
|
||||||
PersonalReference? personalReference;
|
(Country country) {
|
||||||
if (formKey.currentState!
|
return DropdownMenuItem<Country>(
|
||||||
.saveAndValidate()) {
|
value: country,
|
||||||
String lastname = formKey
|
child: FittedBox(
|
||||||
.currentState!.value['lastname'];
|
child: Text(country.name!)));
|
||||||
String firstname = formKey
|
}).toList(),
|
||||||
.currentState!.value['firstname'];
|
name: 'country',
|
||||||
String middlename = formKey
|
decoration: normalTextFieldStyle(
|
||||||
.currentState!
|
"Country*", "Country"),
|
||||||
.value['middlename'];
|
onChanged: (Country? value) {
|
||||||
String mobile = formKey
|
selectedCountry = value;
|
||||||
.currentState!.value['mobile'];
|
|
||||||
|
|
||||||
|
|
||||||
Region? region = selectedRegion;
|
|
||||||
Province? province = Province(
|
|
||||||
code: selectedProvince?.code,
|
|
||||||
description:
|
|
||||||
selectedProvince?.description,
|
|
||||||
region: region,
|
|
||||||
psgcCode:
|
|
||||||
selectedProvince?.psgcCode,
|
|
||||||
shortname:
|
|
||||||
selectedProvince?.shortname);
|
|
||||||
CityMunicipality? city =
|
|
||||||
CityMunicipality(
|
|
||||||
code: selectedMunicipality
|
|
||||||
?.code,
|
|
||||||
description:
|
|
||||||
selectedMunicipality
|
|
||||||
?.description,
|
|
||||||
province: province,
|
|
||||||
psgcCode: selectedMunicipality
|
|
||||||
?.psgcCode,
|
|
||||||
zipcode: selectedMunicipality
|
|
||||||
?.zipcode);
|
|
||||||
|
|
||||||
Address address = Address(
|
|
||||||
id: null,
|
|
||||||
addressCategory: selectedCategory,
|
|
||||||
country: selectedCountry,
|
|
||||||
barangay: selectedBarangay,
|
|
||||||
addressClass: null,
|
|
||||||
cityMunicipality: city);
|
|
||||||
|
|
||||||
if (selectedCountry != null) {
|
|
||||||
personalReference =
|
|
||||||
PersonalReference(
|
|
||||||
id: null,
|
|
||||||
address: Address(
|
|
||||||
id: null,
|
|
||||||
addressCategory:
|
|
||||||
selectedCategory,
|
|
||||||
country: selectedCountry,
|
|
||||||
barangay: null,
|
|
||||||
cityMunicipality: null,
|
|
||||||
addressClass: null),
|
|
||||||
lastName: lastname,
|
|
||||||
contactNo: mobile,
|
|
||||||
firstName: firstname,
|
|
||||||
middleName: middlename);
|
|
||||||
} else {
|
|
||||||
personalReference =
|
|
||||||
PersonalReference(
|
|
||||||
id: null,
|
|
||||||
address: address,
|
|
||||||
lastName: lastname,
|
|
||||||
contactNo: mobile,
|
|
||||||
firstName: firstname,
|
|
||||||
middleName: middlename);
|
|
||||||
}
|
|
||||||
final progress = ProgressHUD.of(context);
|
|
||||||
progress!.showWithText("Please wait...");
|
|
||||||
context.read<ReferencesBloc>().add(
|
|
||||||
AddReference(
|
|
||||||
profileId:
|
|
||||||
int.parse(profileId!),
|
|
||||||
reference: personalReference,
|
|
||||||
token: token!));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 20,
|
|
||||||
),
|
FormBuilderTextField(
|
||||||
],
|
name: "mobile",
|
||||||
)),
|
decoration: normalTextFieldStyle(
|
||||||
),
|
"Tel./Mobile *", "Tel./Mobile"),
|
||||||
);
|
validator: FormBuilderValidators.required(
|
||||||
}
|
errorText: "This field is required"),
|
||||||
return Container();
|
),
|
||||||
},
|
const Expanded(
|
||||||
);
|
child: SizedBox(),
|
||||||
}
|
),
|
||||||
return Container();
|
SizedBox(
|
||||||
},
|
width: double.infinity,
|
||||||
|
height: 60,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style:
|
||||||
|
mainBtnStyle(primary, Colors.transparent, second),
|
||||||
|
child: const Text(submit),
|
||||||
|
onPressed: () {
|
||||||
|
PersonalReference? personalReference;
|
||||||
|
if (formKey.currentState!.saveAndValidate()) {
|
||||||
|
String lastname =
|
||||||
|
formKey.currentState!.value['lastname'];
|
||||||
|
String firstname =
|
||||||
|
formKey.currentState!.value['firstname'];
|
||||||
|
String middlename =
|
||||||
|
formKey.currentState!.value['middlename'];
|
||||||
|
String mobile =
|
||||||
|
formKey.currentState!.value['mobile'];
|
||||||
|
|
||||||
|
Region? region = selectedRegion;
|
||||||
|
Province? province = Province(
|
||||||
|
code: selectedProvince?.code,
|
||||||
|
description: selectedProvince?.description,
|
||||||
|
region: region,
|
||||||
|
psgcCode: selectedProvince?.psgcCode,
|
||||||
|
shortname: selectedProvince?.shortname);
|
||||||
|
CityMunicipality? city = CityMunicipality(
|
||||||
|
code: selectedMunicipality?.code,
|
||||||
|
description:
|
||||||
|
selectedMunicipality?.description,
|
||||||
|
province: province,
|
||||||
|
psgcCode: selectedMunicipality?.psgcCode,
|
||||||
|
zipcode: selectedMunicipality?.zipcode);
|
||||||
|
|
||||||
|
Address address = Address(
|
||||||
|
id: null,
|
||||||
|
addressCategory: selectedCategory,
|
||||||
|
country: selectedCountry,
|
||||||
|
barangay: selectedBarangay,
|
||||||
|
addressClass: null,
|
||||||
|
cityMunicipality: city);
|
||||||
|
|
||||||
|
if (selectedCountry != null) {
|
||||||
|
personalReference = PersonalReference(
|
||||||
|
id: null,
|
||||||
|
address: Address(
|
||||||
|
id: null,
|
||||||
|
addressCategory: selectedCategory,
|
||||||
|
country: selectedCountry,
|
||||||
|
barangay: null,
|
||||||
|
cityMunicipality: null,
|
||||||
|
addressClass: null),
|
||||||
|
lastName: lastname,
|
||||||
|
contactNo: mobile,
|
||||||
|
firstName: firstname,
|
||||||
|
middleName: middlename);
|
||||||
|
} else {
|
||||||
|
personalReference = PersonalReference(
|
||||||
|
id: null,
|
||||||
|
address: address,
|
||||||
|
lastName: lastname,
|
||||||
|
contactNo: mobile,
|
||||||
|
firstName: firstname,
|
||||||
|
middleName: middlename);
|
||||||
|
}
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Please wait...");
|
||||||
|
context.read<ReferencesBloc>().add(AddReference(
|
||||||
|
profileId: widget.profileId,
|
||||||
|
reference: personalReference,
|
||||||
|
token: widget.token));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
|
|
|
@ -4,9 +4,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||||
import '../../../../bloc/profile/profile_bloc.dart';
|
|
||||||
import '../../../../bloc/profile/references/references_bloc.dart';
|
import '../../../../bloc/profile/references/references_bloc.dart';
|
||||||
import '../../../../bloc/user/user_bloc.dart';
|
|
||||||
import '../../../../model/location/address_category.dart';
|
import '../../../../model/location/address_category.dart';
|
||||||
import '../../../../model/location/barangay.dart';
|
import '../../../../model/location/barangay.dart';
|
||||||
import '../../../../model/location/city.dart';
|
import '../../../../model/location/city.dart';
|
||||||
|
@ -21,7 +19,9 @@ import '../../../../utils/location_utilities.dart';
|
||||||
import '../../../../utils/text_container.dart';
|
import '../../../../utils/text_container.dart';
|
||||||
|
|
||||||
class EditReferenceScreen extends StatefulWidget {
|
class EditReferenceScreen extends StatefulWidget {
|
||||||
const EditReferenceScreen({super.key});
|
final String token;
|
||||||
|
final int profileId;
|
||||||
|
const EditReferenceScreen({super.key,required this.profileId, required this.token});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<EditReferenceScreen> createState() => _EditReferenceScreenState();
|
State<EditReferenceScreen> createState() => _EditReferenceScreenState();
|
||||||
|
@ -29,8 +29,6 @@ class EditReferenceScreen extends StatefulWidget {
|
||||||
|
|
||||||
class _EditReferenceScreenState extends State<EditReferenceScreen> {
|
class _EditReferenceScreenState extends State<EditReferenceScreen> {
|
||||||
final formKey = GlobalKey<FormBuilderState>();
|
final formKey = GlobalKey<FormBuilderState>();
|
||||||
String? token;
|
|
||||||
String? profileId;
|
|
||||||
bool provinceCall = false;
|
bool provinceCall = false;
|
||||||
bool cityCall = false;
|
bool cityCall = false;
|
||||||
bool barangayCall = false;
|
bool barangayCall = false;
|
||||||
|
@ -48,14 +46,7 @@ class _EditReferenceScreenState extends State<EditReferenceScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<UserBloc, UserState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state is UserLoggedIn) {
|
|
||||||
token = state.userData!.user!.login!.token;
|
|
||||||
profileId = state.userData!.user!.login!.user!.profileId.toString();
|
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state is ProfileLoaded) {
|
|
||||||
return BlocBuilder<ReferencesBloc, ReferencesState>(
|
return BlocBuilder<ReferencesBloc, ReferencesState>(
|
||||||
buildWhen: (previous, current) => false,
|
buildWhen: (previous, current) => false,
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
@ -525,6 +516,10 @@ class _EditReferenceScreenState extends State<EditReferenceScreen> {
|
||||||
PersonalReference? personalReference;
|
PersonalReference? personalReference;
|
||||||
if (formKey.currentState!
|
if (formKey.currentState!
|
||||||
.saveAndValidate()) {
|
.saveAndValidate()) {
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Please wait...");
|
||||||
String lastname = formKey
|
String lastname = formKey
|
||||||
.currentState!.value['lastname'];
|
.currentState!.value['lastname'];
|
||||||
String firstname = formKey
|
String firstname = formKey
|
||||||
|
@ -607,9 +602,9 @@ class _EditReferenceScreenState extends State<EditReferenceScreen> {
|
||||||
context.read<ReferencesBloc>().add(
|
context.read<ReferencesBloc>().add(
|
||||||
EditReference(
|
EditReference(
|
||||||
profileId:
|
profileId:
|
||||||
int.parse(profileId!),
|
widget.profileId,
|
||||||
reference: personalReference,
|
reference: personalReference,
|
||||||
token: token!));
|
token: widget.token));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -624,14 +619,7 @@ class _EditReferenceScreenState extends State<EditReferenceScreen> {
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
);
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,25 +26,37 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
int? profileId;
|
int? profileId;
|
||||||
String? token;
|
String? token;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: context.watch<ReferencesBloc>().state is AddReferenceState?const Text("Add Personal Reference"):context.watch<ReferencesBloc>().state is EditReferenceState?const Text("Edit Personal Reference"):const Text("Personal References"),
|
title: context.watch<ReferencesBloc>().state is AddReferenceState
|
||||||
centerTitle: true,
|
? const Text("Add Personal Reference")
|
||||||
backgroundColor: primary,
|
: context.watch<ReferencesBloc>().state is EditReferenceState
|
||||||
////if state is adding or editing state show close button
|
? const Text("Edit Personal Reference")
|
||||||
actions: (context.watch<ReferencesBloc>().state is AddReferenceState || context.watch<ReferencesBloc>().state is EditReferenceState)?
|
: const Text("Personal References"),
|
||||||
[
|
centerTitle: true,
|
||||||
//// close button
|
backgroundColor: primary,
|
||||||
CloseLeading(onPressed: (){
|
////if state is adding or editing state show close button
|
||||||
context.read<ReferencesBloc>().add(GetReferences(profileId: profileId!, token: token!));
|
actions: (context.watch<ReferencesBloc>().state
|
||||||
}),
|
is AddReferenceState ||
|
||||||
]:
|
context.watch<ReferencesBloc>().state is EditReferenceState)
|
||||||
//// if state is loaded state show add button
|
? [
|
||||||
context.watch<ReferencesBloc>().state is ReferencesLoadedState?[
|
//// close button
|
||||||
AddLeading(onPressed: (){
|
CloseLeading(onPressed: () {
|
||||||
context.read<ReferencesBloc>().add(ShowAddReferenceForm());
|
context.read<ReferencesBloc>().add(
|
||||||
}),
|
GetReferences(profileId: profileId!, token: token!));
|
||||||
]:[]
|
}),
|
||||||
),
|
]
|
||||||
|
:
|
||||||
|
//// if state is loaded state show add button
|
||||||
|
context.watch<ReferencesBloc>().state is ReferencesLoadedState
|
||||||
|
? [
|
||||||
|
AddLeading(onPressed: () {
|
||||||
|
context
|
||||||
|
.read<ReferencesBloc>()
|
||||||
|
.add(ShowAddReferenceForm());
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
: []),
|
||||||
body: ProgressHUD(
|
body: ProgressHUD(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
backgroundColor: Colors.black87,
|
backgroundColor: Colors.black87,
|
||||||
|
@ -83,7 +95,7 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ReferencesBloc>().add(
|
context.read<ReferencesBloc>().add(
|
||||||
LoadReferences(
|
LoadReferences(
|
||||||
references: state.personalRefs));
|
));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Adding Failed",
|
errorAlert(context, "Adding Failed",
|
||||||
|
@ -92,7 +104,7 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ReferencesBloc>().add(
|
context.read<ReferencesBloc>().add(
|
||||||
LoadReferences(
|
LoadReferences(
|
||||||
references: state.personalRefs));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +116,7 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ReferencesBloc>().add(
|
context.read<ReferencesBloc>().add(
|
||||||
LoadReferences(
|
LoadReferences(
|
||||||
references: state.personalRefs));
|
));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Update Failed",
|
errorAlert(context, "Update Failed",
|
||||||
|
@ -113,7 +125,7 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ReferencesBloc>().add(
|
context.read<ReferencesBloc>().add(
|
||||||
LoadReferences(
|
LoadReferences(
|
||||||
references: state.personalRefs));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +139,7 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ReferencesBloc>().add(
|
context.read<ReferencesBloc>().add(
|
||||||
LoadReferences(
|
LoadReferences(
|
||||||
references: state.references));
|
));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Deletion Failed",
|
errorAlert(context, "Deletion Failed",
|
||||||
|
@ -135,7 +147,7 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<ReferencesBloc>().add(
|
context.read<ReferencesBloc>().add(
|
||||||
LoadReferences(
|
LoadReferences(
|
||||||
references: state.references));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,12 +224,14 @@ class ReferencesScreen extends StatelessWidget {
|
||||||
offset: const Offset(-10, -10),
|
offset: const Offset(-10, -10),
|
||||||
elevation: 3,
|
elevation: 3,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
|
|
||||||
////delete eligibilty-= = = = = = = = =>>
|
////delete eligibilty-= = = = = = = = =>>
|
||||||
if (value == 2) {
|
if (value == 2) {
|
||||||
final progress = ProgressHUD.of(context);
|
|
||||||
progress!.showWithText("Please wait...");
|
|
||||||
confirmAlert(context, () {
|
confirmAlert(context, () {
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Please wait...");
|
||||||
context
|
context
|
||||||
.read<
|
.read<
|
||||||
ReferencesBloc>()
|
ReferencesBloc>()
|
||||||
|
@ -236,6 +250,10 @@ progress!.showWithText("Please wait...");
|
||||||
}
|
}
|
||||||
if (value == 1) {
|
if (value == 1) {
|
||||||
////edit reference-= = = = = = = = =>>
|
////edit reference-= = = = = = = = =>>
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Please wait...");
|
||||||
context
|
context
|
||||||
.read<ReferencesBloc>()
|
.read<ReferencesBloc>()
|
||||||
.add(ShowEditReferenceForm(
|
.add(ShowEditReferenceForm(
|
||||||
|
@ -276,14 +294,16 @@ progress!.showWithText("Please wait...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state is AddReferenceState) {
|
if (state is AddReferenceState) {
|
||||||
return const AddReferenceScreen();
|
return AddReferenceScreen(profileId: profileId!, token: token!,);
|
||||||
}
|
}
|
||||||
if (state is EditReferenceState) {
|
if (state is EditReferenceState) {
|
||||||
return const EditReferenceScreen();
|
return EditReferenceScreen(profileId: profileId!,token: token!,);
|
||||||
}
|
}
|
||||||
if (state is ReferencesErrorState) {
|
if (state is ReferencesErrorState) {
|
||||||
return SomethingWentWrong(
|
return SomethingWentWrong(
|
||||||
message: state.message, onpressed: () {});
|
message: state.message, onpressed: () {
|
||||||
|
context.read<ReferencesBloc>().add(GetReferences(profileId: profileId!, token: token!));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,7 +24,9 @@ import 'package:unit2/utils/validators.dart';
|
||||||
import '../../../../model/utils/position.dart';
|
import '../../../../model/utils/position.dart';
|
||||||
|
|
||||||
class AddWorkHistoryScreen extends StatefulWidget {
|
class AddWorkHistoryScreen extends StatefulWidget {
|
||||||
const AddWorkHistoryScreen({super.key});
|
final int profileId;
|
||||||
|
final String token;
|
||||||
|
const AddWorkHistoryScreen({super.key, required this.profileId, required this.token});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddWorkHistoryScreen> createState() => _AddWorkHistoryScreenState();
|
State<AddWorkHistoryScreen> createState() => _AddWorkHistoryScreenState();
|
||||||
|
@ -65,14 +67,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<UserBloc, UserState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state is UserLoggedIn) {
|
|
||||||
profileId = state.userData!.user!.login!.user!.profileId;
|
|
||||||
token = state.userData!.user!.login!.token;
|
|
||||||
return BlocBuilder<ProfileBloc, ProfileState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state is ProfileLoaded) {
|
|
||||||
return BlocConsumer<WorkHistoryBloc, WorkHistoryState>(
|
return BlocConsumer<WorkHistoryBloc, WorkHistoryState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is AddWorkHistoryState) {
|
if (state is AddWorkHistoryState) {
|
||||||
|
@ -121,6 +116,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
positionFocusNode.unfocus();
|
positionFocusNode.unfocus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
////EMPTY WIDGET
|
||||||
emptyWidget: Container(
|
emptyWidget: Container(
|
||||||
decoration: box1(),
|
decoration: box1(),
|
||||||
height: 100,
|
height: 100,
|
||||||
|
@ -139,6 +135,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
////ADD POSITION DIALOG
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext
|
builder: (BuildContext
|
||||||
|
@ -638,12 +635,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: DateTimePicker(
|
child: DateTimePicker(
|
||||||
validator: (value) {
|
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
||||||
if (value == null) {
|
|
||||||
return "This field is required";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
use24HourFormat: false,
|
use24HourFormat: false,
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.date_range),
|
Icons.date_range),
|
||||||
|
@ -684,9 +676,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
.copyWith(),
|
.copyWith(),
|
||||||
)
|
)
|
||||||
: DateTimePicker(
|
: DateTimePicker(
|
||||||
validator: (val) {
|
validator: FormBuilderValidators.required(errorText: "This field is required"),
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller:
|
controller:
|
||||||
toDateController,
|
toDateController,
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1970),
|
||||||
|
@ -723,17 +713,12 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
style: mainBtnStyle(
|
style: mainBtnStyle(
|
||||||
primary, Colors.transparent, second),
|
primary, Colors.transparent, second),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print(selectedPosition?.title);
|
|
||||||
print(selectedStatus?.label);
|
|
||||||
print(selectedAgency?.name);
|
|
||||||
print(salary);
|
|
||||||
print(fromDateController.text);
|
|
||||||
print(toDateController.text);
|
|
||||||
|
|
||||||
print(salaryGrade);
|
|
||||||
print(salaryGradeStep);
|
|
||||||
print(isPrivate);
|
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
|
final progress =
|
||||||
|
ProgressHUD.of(context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Loading...");
|
||||||
WorkHistory workHistory = WorkHistory(
|
WorkHistory workHistory = WorkHistory(
|
||||||
position: selectedPosition,
|
position: selectedPosition,
|
||||||
id: null,
|
id: null,
|
||||||
|
@ -780,17 +765,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return const Center(
|
|
||||||
child: Text("Add Work History"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:app_popup_menu/app_popup_menu.dart';
|
import 'package:app_popup_menu/app_popup_menu.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
@ -15,6 +14,7 @@ import 'package:unit2/theme-data.dart/box_shadow.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:unit2/utils/text_container.dart';
|
import 'package:unit2/utils/text_container.dart';
|
||||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
|
import 'package:unit2/widgets/Leadings/close_leading.dart';
|
||||||
import 'package:unit2/widgets/empty_data.dart';
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
import 'package:unit2/widgets/error_state.dart';
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
|
@ -36,11 +36,15 @@ class WorkHistoryScreen extends StatelessWidget {
|
||||||
title: const Text(workHistoryScreenTitle),
|
title: const Text(workHistoryScreenTitle),
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
actions: [
|
actions: context.watch<WorkHistoryBloc>().state is WorkHistoryLoaded?[
|
||||||
AddLeading(onPressed: () {
|
AddLeading(onPressed: () {
|
||||||
context.read<WorkHistoryBloc>().add(ShowAddWorkHistoryForm());
|
context.read<WorkHistoryBloc>().add(ShowAddWorkHistoryForm());
|
||||||
})
|
})
|
||||||
],
|
]:(context.watch<WorkHistoryBloc>().state is AddWorkHistoryState || context.watch<WorkHistoryBloc>().state is EditWorkHistoryState)?[
|
||||||
|
CloseLeading(onPressed: (){
|
||||||
|
context.read<WorkHistoryBloc>().add(LoadWorkHistories());
|
||||||
|
})
|
||||||
|
]:[],
|
||||||
),
|
),
|
||||||
body:
|
body:
|
||||||
//UserBloc
|
//UserBloc
|
||||||
|
@ -68,7 +72,9 @@ class WorkHistoryScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
if (state is WorkHistoryLoaded ||
|
if (state is WorkHistoryLoaded ||
|
||||||
state is WorkHistoryErrorState ||
|
state is WorkHistoryErrorState ||
|
||||||
state is AddWorkHistoryState ||state is WorkHistoryAddedState || state is EditWorkHistoryState) {
|
state is AddWorkHistoryState ||
|
||||||
|
state is WorkHistoryAddedState ||
|
||||||
|
state is EditWorkHistoryState) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.dismiss();
|
progress!.dismiss();
|
||||||
}
|
}
|
||||||
|
@ -78,55 +84,59 @@ class WorkHistoryScreen extends StatelessWidget {
|
||||||
successAlert(context, "Deletion Successfull",
|
successAlert(context, "Deletion Successfull",
|
||||||
"Work has been deleted successfully", () {
|
"Work has been deleted successfully", () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<WorkHistoryBloc>().add(
|
context
|
||||||
LoadWorkHistories(
|
.read<WorkHistoryBloc>()
|
||||||
workHistories: state.workHistories));
|
.add(LoadWorkHistories());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Deletion Failed",
|
errorAlert(context, "Deletion Failed",
|
||||||
"Error deleting Work History", () {
|
"Error deleting Work History", () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<WorkHistoryBloc>().add(
|
context
|
||||||
LoadWorkHistories(
|
.read<WorkHistoryBloc>()
|
||||||
workHistories: state.workHistories));
|
.add(LoadWorkHistories());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
////ADDED STATE
|
////ADDED STATE
|
||||||
if(state is WorkHistoryAddedState){
|
if (state is WorkHistoryAddedState) {
|
||||||
if (state.response['success']) {
|
if (state.response['success']) {
|
||||||
successAlert(context, "Adding Successfull!",
|
successAlert(context, "Adding Successfull!",
|
||||||
state.response['message'], () {
|
state.response['message'], () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<WorkHistoryBloc>().add(LoadWorkHistories(
|
context
|
||||||
workHistories: state.workExperiences));
|
.read<WorkHistoryBloc>()
|
||||||
|
.add(LoadWorkHistories());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Adding Failed",
|
errorAlert(context, "Adding Failed",
|
||||||
"Something went wrong. Please try again.",
|
"Something went wrong. Please try again.",
|
||||||
() {
|
() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<WorkHistoryBloc>().add(LoadWorkHistories(
|
context
|
||||||
workHistories: state.workExperiences));
|
.read<WorkHistoryBloc>()
|
||||||
|
.add(LoadWorkHistories());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//// EDITED STATE
|
//// EDITED STATE
|
||||||
if(state is WorkHistoryEditedState){
|
if (state is WorkHistoryEditedState) {
|
||||||
if (state.response['success']) {
|
if (state.response['success']) {
|
||||||
successAlert(context, "Update Successfull!",
|
successAlert(context, "Update Successfull!",
|
||||||
state.response['message'], () {
|
state.response['message'], () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<WorkHistoryBloc>().add(LoadWorkHistories(
|
context
|
||||||
workHistories: state.workExperiences));
|
.read<WorkHistoryBloc>()
|
||||||
|
.add(LoadWorkHistories());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
errorAlert(context, "Update Failed",
|
errorAlert(context, "Update Failed",
|
||||||
"Something went wrong. Please try again.",
|
"Something went wrong. Please try again.",
|
||||||
() {
|
() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<WorkHistoryBloc>().add(LoadWorkHistories(
|
context
|
||||||
workHistories: state.workExperiences));
|
.read<WorkHistoryBloc>()
|
||||||
|
.add(LoadWorkHistories());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,31 +217,41 @@ class WorkHistoryScreen extends StatelessWidget {
|
||||||
offset: const Offset(-10, -10),
|
offset: const Offset(-10, -10),
|
||||||
elevation: 3,
|
elevation: 3,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
final progress =
|
|
||||||
ProgressHUD.of(context);
|
|
||||||
progress!
|
|
||||||
.showWithText("Loading...");
|
|
||||||
////delete workhistory-= = = = = = = = =>>
|
////delete workhistory-= = = = = = = = =>>
|
||||||
if (value == 2) {
|
if (value == 2) {
|
||||||
confirmAlert(context, () {
|
confirmAlert(context, () {
|
||||||
BlocProvider.of<WorkHistoryBloc>(
|
final progress =
|
||||||
|
ProgressHUD.of(context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Loading...");
|
||||||
|
BlocProvider.of<
|
||||||
|
WorkHistoryBloc>(
|
||||||
context)
|
context)
|
||||||
.add(DeleteWorkHistory(
|
.add(DeleteWorkHistory(
|
||||||
profileId:
|
profileId: profileId,
|
||||||
profileId,
|
token: token!,
|
||||||
token: token!,
|
workHistory:
|
||||||
workHistory: state
|
state.workExperiences[
|
||||||
.workExperiences[
|
index],
|
||||||
index],
|
));
|
||||||
workHistories: state
|
|
||||||
.workExperiences));
|
|
||||||
}, "Delete?",
|
}, "Delete?",
|
||||||
"Confirm Delete?");
|
"Confirm Delete?");
|
||||||
}
|
}
|
||||||
if (value == 1) {
|
if (value == 1) {
|
||||||
////edit eligibilty-= = = = = = = = =>>
|
////edit eligibilty-= = = = = = = = =>>
|
||||||
WorkHistory workHistory = state.workExperiences[index];
|
final progress =
|
||||||
context.read<WorkHistoryBloc>().add(ShowEditWorkHistoryForm(workHistory: workHistory));
|
ProgressHUD.of(context);
|
||||||
|
progress!.showWithText(
|
||||||
|
"Loading...");
|
||||||
|
WorkHistory workHistory =
|
||||||
|
state.workExperiences[
|
||||||
|
index];
|
||||||
|
context
|
||||||
|
.read<WorkHistoryBloc>()
|
||||||
|
.add(
|
||||||
|
ShowEditWorkHistoryForm(
|
||||||
|
workHistory:
|
||||||
|
workHistory));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
menuItems: [
|
menuItems: [
|
||||||
|
@ -269,14 +289,16 @@ class WorkHistoryScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state is AddWorkHistoryState) {
|
if (state is AddWorkHistoryState) {
|
||||||
return const AddWorkHistoryScreen();
|
return AddWorkHistoryScreen(profileId: profileId, token: token!,);
|
||||||
}
|
}
|
||||||
if(state is EditWorkHistoryState){
|
if (state is EditWorkHistoryState) {
|
||||||
return const EditWorkHistoryScreen();
|
return EditWorkHistoryScreen(profileId: profileId,token: token!,);
|
||||||
}
|
}
|
||||||
if (state is WorkHistoryErrorState) {
|
if (state is WorkHistoryErrorState) {
|
||||||
return SomethingWentWrong(
|
return SomethingWentWrong(
|
||||||
message: state.message, onpressed: () {});
|
message: state.message, onpressed: () {
|
||||||
|
context.read<WorkHistoryBloc>().add(GetWorkHistories(profileId: profileId,token: token!));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,7 +10,8 @@ class CoverImage extends StatelessWidget {
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl:
|
imageUrl:
|
||||||
'https://static.vecteezy.com/system/resources/thumbnails/008/074/253/small/tropical-forest-sunset-nature-background-with-coconut-trees-vector.jpg',
|
"https://live.staticflickr.com/7320/9052838885_af9b21c79b_b.jpg",
|
||||||
|
// 'https://static.vecteezy.com/system/resources/thumbnails/008/074/253/small/tropical-forest-sunset-nature-background-with-coconut-trees-vector.jpg',
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 220,
|
height: 220,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
|
|
|
@ -21,12 +21,15 @@ Widget getTile(
|
||||||
if (title.toLowerCase() == "logout") {
|
if (title.toLowerCase() == "logout") {
|
||||||
confirmAlert(context, () async{
|
confirmAlert(context, () async{
|
||||||
await CREDENTIALS!.clear();
|
await CREDENTIALS!.clear();
|
||||||
|
await CREDENTIALS!.deleteAll(['username','password','saved']);
|
||||||
Navigator.pushReplacementNamed (context,"/");
|
Navigator.pushReplacementNamed (context,"/");
|
||||||
|
|
||||||
},"Logout","Are You sure you want to logout?");
|
},"Logout","Are You sure you want to logout?");
|
||||||
}if(title.toLowerCase() == 'profile'){
|
}if(title.toLowerCase() == 'profile'){
|
||||||
ProfileArguments profileArguments = ProfileArguments(token: userData.user!.login!.token!, userID:userData.user!.login!.user!.profileId!);
|
ProfileArguments profileArguments = ProfileArguments(token: userData.user!.login!.token!, userID:userData.user!.login!.user!.profileId!);
|
||||||
Navigator.pushNamed(context, route,arguments: profileArguments);
|
Navigator.pushNamed(context, route,arguments: profileArguments);
|
||||||
|
}if(title.toLowerCase() == 'basic info'){
|
||||||
|
Navigator.pushNamed(context, '/basic-info');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,6 +36,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
bool showSuffixIcon = false;
|
bool showSuffixIcon = false;
|
||||||
bool _showPassword = true;
|
bool _showPassword = true;
|
||||||
String? password;
|
String? password;
|
||||||
|
String? username;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
|
@ -236,7 +237,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
TextStyle(color: Colors.white),
|
TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
password = "nav071394";
|
|
||||||
final progress =
|
final progress =
|
||||||
ProgressHUD.of(context);
|
ProgressHUD.of(context);
|
||||||
|
|
||||||
|
@ -244,20 +245,21 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
|
|
||||||
if (_formKey.currentState!
|
if (_formKey.currentState!
|
||||||
.saveAndValidate()) {
|
.saveAndValidate()) {
|
||||||
|
password = _formKey
|
||||||
|
.currentState!
|
||||||
|
.value['password'];
|
||||||
|
username = _formKey
|
||||||
|
.currentState!
|
||||||
|
.value['username'];
|
||||||
progress?.showWithText(
|
progress?.showWithText(
|
||||||
'Logging in...',
|
'Logging in...',
|
||||||
);
|
);
|
||||||
|
|
||||||
BlocProvider.of<UserBloc>(context)
|
BlocProvider.of<UserBloc>(context)
|
||||||
.add(UserLogin(
|
.add(UserLogin(
|
||||||
username: "rjvincentlopeplopez",
|
|
||||||
password: "shesthequ33n",
|
username:username,
|
||||||
// username: _formKey
|
password: password
|
||||||
// .currentState!
|
|
||||||
// .value['username'],
|
|
||||||
// password: _formKey
|
|
||||||
// .currentState!
|
|
||||||
// .value['password'])
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,11 +9,11 @@ class ContactService {
|
||||||
static final ContactService _instance = ContactService();
|
static final ContactService _instance = ContactService();
|
||||||
static ContactService get instance => _instance;
|
static ContactService get instance => _instance;
|
||||||
|
|
||||||
Future<List<ServiceProvider>> getServiceProvider(
|
Future<List<CommService>> getServiceProvider(
|
||||||
{required int serviceTypeId}) async {
|
{required int serviceTypeId}) async {
|
||||||
String path = Url.instance.getServiceType();
|
String path = Url.instance.getCommunicationProvider();
|
||||||
Map<String, String> params = {"service_type__id": serviceTypeId.toString()};
|
Map<String, String> params = {"service_type__id": serviceTypeId.toString()};
|
||||||
List<ServiceProvider> serviceProviders = [];
|
List<CommService> serviceProviders = [];
|
||||||
Map<String, String> headers = {
|
Map<String, String> headers = {
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,7 @@ class ContactService {
|
||||||
if (data['data'] != null) {
|
if (data['data'] != null) {
|
||||||
for (var element in data['data']) {
|
for (var element in data['data']) {
|
||||||
CommService commService = CommService.fromJson(element);
|
CommService commService = CommService.fromJson(element);
|
||||||
serviceProviders.add(commService.serviceProvider!);
|
serviceProviders.add(commService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class ContactService {
|
||||||
"_numbermail": contactInfo.numbermail,
|
"_numbermail": contactInfo.numbermail,
|
||||||
"_active": contactInfo.active,
|
"_active": contactInfo.active,
|
||||||
"_primary": contactInfo.primary,
|
"_primary": contactInfo.primary,
|
||||||
"_commServiceId": contactInfo.commService!.serviceProvider!.id!
|
"_commServiceId": contactInfo.commService!.id
|
||||||
};
|
};
|
||||||
Map<dynamic, dynamic> responseStatus = {};
|
Map<dynamic, dynamic> responseStatus = {};
|
||||||
try {
|
try {
|
||||||
|
@ -71,24 +71,38 @@ class ContactService {
|
||||||
}
|
}
|
||||||
|
|
||||||
//// add
|
//// add
|
||||||
// Future<Map<dynamic, dynamic>> update(
|
Future<Map<dynamic, dynamic>> add(
|
||||||
// {required int profileId,
|
{required int profileId,
|
||||||
// required String token,
|
required String token,
|
||||||
// required ContactInfo contactInfo}) async {
|
required ContactInfo contactInfo}) async {
|
||||||
// String path = "${Url.instance.contactPath()}$profileId/";
|
String path = "${Url.instance.contactPath()}$profileId/";
|
||||||
// String authToken = "Token $token";
|
String authToken = "Token $token";
|
||||||
// Map<String, String> headers = {
|
Map<String, String> headers = {
|
||||||
// 'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
// 'Authorization': authToken
|
'Authorization': authToken
|
||||||
// };
|
};
|
||||||
// Map body ={
|
Map<dynamic, dynamic> responseStatus = {};
|
||||||
// "personid": profileId,
|
Map body = {
|
||||||
// "_numbermail": contactInfo.numbermail,
|
"personid": profileId,
|
||||||
// "_active": contactInfo.active,
|
"_numbermail": contactInfo.numbermail,
|
||||||
// "_primary": contactInfo.primary,
|
"_active": contactInfo.active,
|
||||||
// "_commServiceId": contactInfo
|
"_primary": contactInfo.primary,
|
||||||
// }
|
"_commServiceId": contactInfo.commService!.id
|
||||||
// }
|
};
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.postRequest(path: path, headers: headers, body: body, param: {});
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
Map data = jsonDecode(response.body);
|
||||||
|
responseStatus = data;
|
||||||
|
} else {
|
||||||
|
responseStatus.addAll({'success': false});
|
||||||
|
}
|
||||||
|
return responseStatus;
|
||||||
|
} catch (e) {
|
||||||
|
throw e.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////delete
|
////delete
|
||||||
Future<bool> deleteContact(
|
Future<bool> deleteContact(
|
||||||
|
@ -116,7 +130,7 @@ class ContactService {
|
||||||
try {
|
try {
|
||||||
http.Response response = await Request.instance.deleteRequest(
|
http.Response response = await Request.instance.deleteRequest(
|
||||||
path: path, headers: headers, body: body, param: params);
|
path: path, headers: headers, body: body, param: params);
|
||||||
if (response.statusCode == 20) {
|
if (response.statusCode == 200) {
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
success = data['success'];
|
success = data['success'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ class Url {
|
||||||
|
|
||||||
String host() {
|
String host() {
|
||||||
// return '192.168.10.221:3003';
|
// return '192.168.10.221:3003';
|
||||||
// return 'agusandelnorte.gov.ph';
|
return 'agusandelnorte.gov.ph';
|
||||||
// return "192.168.10.219:3000";
|
// return "192.168.10.219:3000";
|
||||||
// return "devweb.agusandelnorte.gov.ph";
|
// return "devweb.agusandelnorte.gov.ph";
|
||||||
return 'devapi.agusandelnorte.gov.ph:3004';
|
// return 'devapi.agusandelnorte.gov.ph:3004';
|
||||||
}
|
}
|
||||||
|
|
||||||
String authentication() {
|
String authentication() {
|
||||||
|
@ -111,7 +111,7 @@ String getServiceTypes(){
|
||||||
String contactPath(){
|
String contactPath(){
|
||||||
return "/api/jobnet_app/profile/pds/basic/contact/";
|
return "/api/jobnet_app/profile/pds/basic/contact/";
|
||||||
}
|
}
|
||||||
String getServiceType(){
|
String getCommunicationProvider(){
|
||||||
return "/api/jobnet_app/comm_services/";
|
return "/api/jobnet_app/comm_services/";
|
||||||
}
|
}
|
||||||
String deleteContact (){
|
String deleteContact (){
|
||||||
|
|
|
@ -45,8 +45,8 @@ class UniTSplashScreen extends StatelessWidget {
|
||||||
height: 1,
|
height: 1,
|
||||||
color: Colors.black)),
|
color: Colors.black)),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5,),
|
const SizedBox(height: 150,),
|
||||||
SpinKitThreeBounce(color: Colors.black,size: 32,)
|
const SpinKitCircle(color: primary,size: 42,)
|
||||||
// Row(
|
// Row(
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
|
Loading…
Reference in New Issue