role area assignment done. just need testing
parent
6a42e52d87
commit
b46022c167
|
@ -1,8 +1,10 @@
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:unit2/model/location/barangay.dart';
|
import 'package:unit2/model/location/purok2.dart';
|
||||||
import 'package:unit2/model/rbac/assigned_role.dart';
|
import 'package:unit2/model/rbac/assigned_role.dart';
|
||||||
import 'package:unit2/model/rbac/rbac.dart';
|
import 'package:unit2/model/rbac/rbac.dart';
|
||||||
|
import 'package:unit2/model/rbac/rbac_station.dart';
|
||||||
|
import 'package:unit2/model/utils/agency.dart';
|
||||||
import 'package:unit2/sevices/roles/rbac_operations/assigned_area_services.dart';
|
import 'package:unit2/sevices/roles/rbac_operations/assigned_area_services.dart';
|
||||||
import '../../../../model/location/barangay2.dart';
|
import '../../../../model/location/barangay2.dart';
|
||||||
import '../../../../model/profile/assigned_area.dart';
|
import '../../../../model/profile/assigned_area.dart';
|
||||||
|
@ -99,12 +101,115 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
|
||||||
//// purok
|
//// purok
|
||||||
}
|
}
|
||||||
if (event.areaTypeId == 2) {
|
if (event.areaTypeId == 2) {
|
||||||
//// station
|
List<dynamic> newAreas = [];
|
||||||
|
for (var area in response['data']) {
|
||||||
|
for (var assignedArea in area['assigned_area']) {
|
||||||
|
var newArea = {};
|
||||||
|
newArea.addAll({"id": assignedArea['id']});
|
||||||
|
newArea.addAll({'isactive': assignedArea['isactive']});
|
||||||
|
Purok2 newPurok = Purok2.fromJson(assignedArea['area']);
|
||||||
|
newArea.addAll({
|
||||||
|
'area': {
|
||||||
|
"purokid": newPurok.purokid,
|
||||||
|
"purokdesc": newPurok.purokdesc,
|
||||||
|
"brgy": {
|
||||||
|
"brgycode": newPurok.brgy?.brgycode,
|
||||||
|
"brgydesc": newPurok.brgy?.brgydesc,
|
||||||
|
"citymuncode": newPurok.brgy?.citymuncode,
|
||||||
|
},
|
||||||
|
"purok_leader": newPurok.purokLeader,
|
||||||
|
"writelock": newPurok.writelock,
|
||||||
|
"recordsignature": newPurok.recordsignature
|
||||||
|
}
|
||||||
|
});
|
||||||
|
newAreas.add(newArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newAssignArea.assignedArea = newAreas;
|
||||||
|
userAssignedAreas.add(newAssignArea);
|
||||||
}
|
}
|
||||||
|
////statiom
|
||||||
if (event.areaTypeId == 4) {
|
if (event.areaTypeId == 4) {
|
||||||
////agency
|
List<dynamic> newAreas = [];
|
||||||
|
for (var area in response['data']) {
|
||||||
|
for (var assignedArea in area['assigned_area']) {
|
||||||
|
var newArea = {};
|
||||||
|
newArea.addAll({"id": assignedArea['id']});
|
||||||
|
newArea.addAll({'isactive': assignedArea['isactive']});
|
||||||
|
RbacStation newStation =
|
||||||
|
RbacStation.fromJson(assignedArea['area']);
|
||||||
|
newArea.addAll({
|
||||||
|
"area": {
|
||||||
|
"id": newStation.id,
|
||||||
|
"station_name": newStation.stationName,
|
||||||
|
"station_type": {
|
||||||
|
"id": newStation.stationType?.id,
|
||||||
|
"type_name": newStation.stationType?.typeName,
|
||||||
|
"color": newStation.stationType?.color,
|
||||||
|
"order": newStation.stationType?.order,
|
||||||
|
"is_active": newStation.stationType?.isActive,
|
||||||
|
"group": null
|
||||||
|
},
|
||||||
|
"hierarchy_order_no": newStation.hierarchyOrderNo,
|
||||||
|
"head_position": newStation.headPosition,
|
||||||
|
"government_agency": {
|
||||||
|
"agencyid": newStation.governmentAgency?.agencycatid,
|
||||||
|
"agencyname": newStation.governmentAgency?.agencyname,
|
||||||
|
"agencycatid": newStation.governmentAgency?.agencycatid,
|
||||||
|
"private_entity":
|
||||||
|
newStation.governmentAgency?.privateEntity,
|
||||||
|
"contactinfoid": newStation.governmentAgency?.contactinfoid
|
||||||
|
},
|
||||||
|
"acronym": newStation.acronym,
|
||||||
|
"parent_station": newStation.parentStation,
|
||||||
|
"code": newStation.code,
|
||||||
|
"fullcode": newStation.fullcode,
|
||||||
|
"child_station_info": newStation.childStationInfo,
|
||||||
|
"islocation_under_parent": newStation.islocationUnderParent,
|
||||||
|
"main_parent_station": newStation.mainParentStation,
|
||||||
|
"description": newStation.description,
|
||||||
|
"ishospital": newStation.ishospital,
|
||||||
|
"isactive": newStation.isactive,
|
||||||
|
"selling_station": newStation.sellingStation
|
||||||
|
}
|
||||||
|
});
|
||||||
|
newAreas.add(newArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newAssignArea.assignedArea = newAreas;
|
||||||
|
userAssignedAreas.add(newAssignArea);
|
||||||
|
}
|
||||||
|
////agency
|
||||||
|
if (event.areaTypeId == 3) {
|
||||||
|
List<dynamic> newAreas = [];
|
||||||
|
for (var area in response['data']) {
|
||||||
|
for (var assignedArea in area['assigned_area']) {
|
||||||
|
var newArea = {};
|
||||||
|
newArea.addAll({"id": assignedArea['id']});
|
||||||
|
newArea.addAll({'isactive': assignedArea['isactive']});
|
||||||
|
Agency newAgency = Agency.fromJson(assignedArea['area']);
|
||||||
|
newArea.addAll({
|
||||||
|
"area": {
|
||||||
|
"id": newAgency.id,
|
||||||
|
"name": newAgency.name,
|
||||||
|
"category": {
|
||||||
|
"id": newAgency.category?.id,
|
||||||
|
"industry_class": {
|
||||||
|
"id": newAgency.category?.industryClass?.id,
|
||||||
|
"name": newAgency.category?.industryClass?.name,
|
||||||
|
"description":
|
||||||
|
newAgency.category?.industryClass?.description
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"private_entity": newAgency.privateEntity,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
newAreas.add(newArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newAssignArea.assignedArea = newAreas;
|
||||||
|
userAssignedAreas.add(newAssignArea);
|
||||||
}
|
}
|
||||||
if (event.areaTypeId == 3) {}
|
|
||||||
emit(AssignAreaAddedState(response: response));
|
emit(AssignAreaAddedState(response: response));
|
||||||
} else {
|
} else {
|
||||||
emit(AssignAreaAddedState(response: response));
|
emit(AssignAreaAddedState(response: response));
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
|
||||||
|
|
||||||
|
import 'package:unit2/model/location/barangay2.dart';
|
||||||
|
|
||||||
|
class Purok2 {
|
||||||
|
final String purokid;
|
||||||
|
final String purokdesc;
|
||||||
|
final Barangay2? brgy;
|
||||||
|
final dynamic purokLeader;
|
||||||
|
final bool writelock;
|
||||||
|
final dynamic recordsignature;
|
||||||
|
|
||||||
|
Purok2({
|
||||||
|
required this.purokid,
|
||||||
|
required this.purokdesc,
|
||||||
|
required this.brgy,
|
||||||
|
required this.purokLeader,
|
||||||
|
required this.writelock,
|
||||||
|
required this.recordsignature,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Purok2.fromJson(Map<String, dynamic> json) => Purok2(
|
||||||
|
purokid: json["purokid"],
|
||||||
|
purokdesc: json["purokdesc"],
|
||||||
|
brgy: json['brgy'] == null?null: Barangay2.fromJson(json["brgy"]),
|
||||||
|
purokLeader: json["purok_leader"],
|
||||||
|
writelock: json["writelock"],
|
||||||
|
recordsignature: json["recordsignature"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"purokid": purokid,
|
||||||
|
"purokdesc": purokdesc,
|
||||||
|
"brgy": brgy?.toJson(),
|
||||||
|
"purok_leader": purokLeader,
|
||||||
|
"writelock": writelock,
|
||||||
|
"recordsignature": recordsignature,
|
||||||
|
};
|
||||||
|
}
|
|
@ -31,7 +31,11 @@ import 'package:unit2/widgets/empty_data.dart';
|
||||||
import 'package:unit2/widgets/error_state.dart';
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
class RbacAssignedAreaScreen extends StatefulWidget {
|
class RbacAssignedAreaScreen extends StatefulWidget {
|
||||||
const RbacAssignedAreaScreen({super.key});
|
final int id;
|
||||||
|
final String fname;
|
||||||
|
final String lname;
|
||||||
|
const RbacAssignedAreaScreen(
|
||||||
|
{super.key, required this.fname, required this.id, required this.lname});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<RbacAssignedAreaScreen> createState() => _RbacAssignedAreaScreenState();
|
State<RbacAssignedAreaScreen> createState() => _RbacAssignedAreaScreenState();
|
||||||
|
@ -246,63 +250,79 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
areaType == "agency"
|
areaType == "agency"
|
||||||
? SearchField(
|
? SizedBox(
|
||||||
inputFormatters: [
|
height: 70,
|
||||||
UpperCaseTextFormatter()
|
child: ModalProgressHUD(
|
||||||
],
|
color: Colors.transparent,
|
||||||
focusNode: agencyFocusNode,
|
inAsyncCall: agencyAsyncCall,
|
||||||
itemHeight: 100,
|
child: SearchField(
|
||||||
suggestions: agencies
|
inputFormatters: [
|
||||||
.map((Agency agency) =>
|
UpperCaseTextFormatter()
|
||||||
SearchFieldListItem(agency.name!,
|
],
|
||||||
item: agency,
|
focusNode: agencyFocusNode,
|
||||||
child: ListTile(
|
itemHeight: 100,
|
||||||
title: AutoSizeText(
|
suggestions: agencies
|
||||||
agency.name!
|
.map((Agency agency) =>
|
||||||
.toUpperCase(),
|
SearchFieldListItem(
|
||||||
minFontSize: 12,
|
agency.name!,
|
||||||
),
|
item: agency,
|
||||||
subtitle: Text(agency
|
child: ListTile(
|
||||||
.privateEntity ==
|
title: AutoSizeText(
|
||||||
true
|
agency.name!
|
||||||
? "Private"
|
.toUpperCase(),
|
||||||
: agency.privateEntity ==
|
minFontSize: 12,
|
||||||
false
|
),
|
||||||
? "Government"
|
subtitle: Text(agency
|
||||||
: ""),
|
.privateEntity ==
|
||||||
)))
|
true
|
||||||
.toList(),
|
? "Private"
|
||||||
validator: FormBuilderValidators.required(
|
: agency.privateEntity ==
|
||||||
errorText: "This field is required"),
|
false
|
||||||
searchInputDecoration:
|
? "Government"
|
||||||
normalTextFieldStyle("Agency *", "")
|
: ""),
|
||||||
.copyWith(
|
)))
|
||||||
suffixIcon: GestureDetector(
|
.toList(),
|
||||||
onTap: () => agencyFocusNode.unfocus(),
|
validator:
|
||||||
child: const Icon(
|
FormBuilderValidators.required(
|
||||||
Icons.arrow_drop_down,
|
errorText:
|
||||||
),
|
"This field is required"),
|
||||||
)),
|
searchInputDecoration:
|
||||||
////agency suggestion tap
|
normalTextFieldStyle(
|
||||||
onSuggestionTap: (agency) {
|
"Agency *", "")
|
||||||
setState(() {
|
.copyWith(
|
||||||
areaId = agency.item!.id.toString();
|
suffixIcon:
|
||||||
agencyFocusNode.unfocus();
|
GestureDetector(
|
||||||
});
|
onTap: () =>
|
||||||
},
|
agencyFocusNode.unfocus(),
|
||||||
emptyWidget:
|
child: const Icon(
|
||||||
const Text("No Result Found.."))
|
Icons.arrow_drop_down,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
////agency suggestion tap
|
||||||
|
onSuggestionTap: (agency) {
|
||||||
|
setState(() {
|
||||||
|
areaId =
|
||||||
|
agency.item!.id.toString();
|
||||||
|
|
||||||
|
agencyFocusNode.unfocus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
emptyWidget: const Text(
|
||||||
|
"No Result Found..")),
|
||||||
|
),
|
||||||
|
)
|
||||||
//// station ------------------------------------------------
|
//// station ------------------------------------------------
|
||||||
: areaType == "station"
|
: areaType == "station"
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
height: 200,
|
height: 140,
|
||||||
child: Flexible(
|
child: Flexible(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 100,
|
height: 75,
|
||||||
child: ModalProgressHUD(
|
child: ModalProgressHUD(
|
||||||
|
color: Colors.transparent,
|
||||||
inAsyncCall:
|
inAsyncCall:
|
||||||
agencyAsyncCall,
|
agencyAsyncCall,
|
||||||
child: SearchField(
|
child: SearchField(
|
||||||
|
@ -313,7 +333,7 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
],
|
],
|
||||||
focusNode:
|
focusNode:
|
||||||
agencyFocusNode,
|
agencyFocusNode,
|
||||||
itemHeight: 100,
|
itemHeight: 75,
|
||||||
suggestions: agencies
|
suggestions: agencies
|
||||||
.map((Agency
|
.map((Agency
|
||||||
agency) =>
|
agency) =>
|
||||||
|
@ -367,28 +387,34 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
stationAsyncCall =
|
stationAsyncCall =
|
||||||
true;
|
true;
|
||||||
});
|
});
|
||||||
stations = await RbacStationServices
|
try {
|
||||||
.instance
|
stations = await RbacStationServices
|
||||||
.getStations(
|
.instance
|
||||||
agencyId: agency
|
.getStations(
|
||||||
.item!
|
agencyId: agency
|
||||||
.id
|
.item!
|
||||||
.toString());
|
.id
|
||||||
agencyFocusNode
|
.toString());
|
||||||
.unfocus();
|
agencyFocusNode
|
||||||
setState(() {
|
.unfocus();
|
||||||
stationAsyncCall =
|
setState(() {
|
||||||
false;
|
stationAsyncCall =
|
||||||
});
|
false;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
bloc.add(
|
||||||
|
CallErrorState(
|
||||||
|
message: e
|
||||||
|
.toString()));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
emptyWidget: const Text(
|
emptyWidget: const Text(
|
||||||
"No Result Found..")),
|
"No Result Found..")),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
///Stations
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 75,
|
height: 75,
|
||||||
|
@ -415,7 +441,8 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged:
|
onChanged:
|
||||||
(RbacStation? e) {
|
(RbacStation? e) {
|
||||||
areaId = e!.code;
|
areaId =
|
||||||
|
e!.id.toString();
|
||||||
},
|
},
|
||||||
validator:
|
validator:
|
||||||
FormBuilderValidators
|
FormBuilderValidators
|
||||||
|
@ -433,7 +460,7 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
//// barangay ------------------------------------------------------------
|
//// barangay ------------------------------------------------------------
|
||||||
: areaType == 'barangay'
|
: areaType == 'barangay'
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
height: 300,
|
height: 180,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
//// PROVINCE DROPDOWN
|
//// PROVINCE DROPDOWN
|
||||||
|
@ -458,32 +485,36 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
// value: selectedProvince,
|
// value: selectedProvince,
|
||||||
onChanged: (Province?
|
onChanged: (Province?
|
||||||
province) async {
|
province) async {
|
||||||
setState(() {
|
try {
|
||||||
cityAsyncCall =
|
setState(() {
|
||||||
true;
|
cityAsyncCall =
|
||||||
});
|
true;
|
||||||
cities = await LocationUtils
|
});
|
||||||
.instance
|
cities = await LocationUtils
|
||||||
.getCities(
|
.instance
|
||||||
code: provinces[
|
.getCities(
|
||||||
0]
|
code: provinces[0]
|
||||||
.code!);
|
.code!);
|
||||||
setState(() {
|
setState(() {
|
||||||
cityAsyncCall =
|
cityAsyncCall =
|
||||||
false;
|
false;
|
||||||
barangayAsyncCall =
|
barangayAsyncCall =
|
||||||
true;
|
true;
|
||||||
});
|
});
|
||||||
barangays = await LocationUtils
|
barangays = await LocationUtils
|
||||||
.instance
|
.instance
|
||||||
.getBarangay(
|
.getBarangay(
|
||||||
code: cities[
|
code: cities[0]
|
||||||
0]
|
.code!);
|
||||||
.code!);
|
setState(() {
|
||||||
setState(() {
|
barangayAsyncCall =
|
||||||
barangayAsyncCall =
|
false;
|
||||||
false;
|
});
|
||||||
});
|
} catch (e) {
|
||||||
|
bloc.add(CallErrorState(
|
||||||
|
message: e
|
||||||
|
.toString()));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
items: provinces
|
items: provinces
|
||||||
.isEmpty
|
.isEmpty
|
||||||
|
@ -509,6 +540,7 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
//// CITIES DROPDOWN
|
//// CITIES DROPDOWN
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
|
@ -528,21 +560,28 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
onChanged:
|
onChanged:
|
||||||
(CityMunicipality?
|
(CityMunicipality?
|
||||||
city) async {
|
city) async {
|
||||||
setState(() {
|
try {
|
||||||
selectedMunicipality =
|
setState(() {
|
||||||
city;
|
selectedMunicipality =
|
||||||
barangayAsyncCall =
|
city;
|
||||||
true;
|
barangayAsyncCall =
|
||||||
});
|
true;
|
||||||
barangays = await LocationUtils
|
});
|
||||||
.instance
|
barangays = await LocationUtils
|
||||||
.getBarangay(
|
.instance
|
||||||
code: selectedMunicipality!
|
.getBarangay(
|
||||||
.code!);
|
code: selectedMunicipality!
|
||||||
setState(() {
|
.code!);
|
||||||
barangayAsyncCall =
|
setState(() {
|
||||||
false;
|
barangayAsyncCall =
|
||||||
});
|
false;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
bloc.add(
|
||||||
|
CallErrorState(
|
||||||
|
message: e
|
||||||
|
.toString()));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
decoration:
|
decoration:
|
||||||
normalTextFieldStyle(
|
normalTextFieldStyle(
|
||||||
|
@ -566,6 +605,7 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
////Barangay
|
////Barangay
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
|
@ -615,7 +655,7 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
: //// Purok ------------------------------------------------------------
|
: //// Purok ------------------------------------------------------------
|
||||||
areaType == 'purok'
|
areaType == 'purok'
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
height: 300,
|
height: 200,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
//// PROVINCE DROPDOWN
|
//// PROVINCE DROPDOWN
|
||||||
|
@ -643,42 +683,52 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
onChanged:
|
onChanged:
|
||||||
(Province?
|
(Province?
|
||||||
province) async {
|
province) async {
|
||||||
setState(() {
|
try {
|
||||||
province;
|
setState(
|
||||||
cityAsyncCall =
|
() {
|
||||||
true;
|
province;
|
||||||
});
|
cityAsyncCall =
|
||||||
cities = await LocationUtils
|
true;
|
||||||
.instance
|
});
|
||||||
.getCities(
|
cities = await LocationUtils
|
||||||
code:
|
.instance
|
||||||
provinces[0].code!);
|
.getCities(
|
||||||
setState(() {
|
code:
|
||||||
cityAsyncCall =
|
provinces[0].code!);
|
||||||
false;
|
setState(
|
||||||
barangayAsyncCall =
|
() {
|
||||||
true;
|
cityAsyncCall =
|
||||||
});
|
false;
|
||||||
barangays = await LocationUtils
|
barangayAsyncCall =
|
||||||
.instance
|
true;
|
||||||
.getBarangay(
|
});
|
||||||
code:
|
barangays = await LocationUtils
|
||||||
cities[0].code!);
|
.instance
|
||||||
setState(() {
|
.getBarangay(
|
||||||
barangayAsyncCall =
|
code:
|
||||||
false;
|
cities[0].code!);
|
||||||
purokAsyncCall =
|
setState(
|
||||||
true;
|
() {
|
||||||
});
|
barangayAsyncCall =
|
||||||
puroks = await LocationUtils
|
false;
|
||||||
.instance
|
purokAsyncCall =
|
||||||
.getPurok(
|
true;
|
||||||
barangay:
|
});
|
||||||
barangays[0].code!);
|
puroks = await LocationUtils
|
||||||
setState(() {
|
.instance
|
||||||
purokAsyncCall =
|
.getPurok(
|
||||||
false;
|
barangay:
|
||||||
});
|
barangays[0].code!);
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
purokAsyncCall =
|
||||||
|
false;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
bloc.add(CallErrorState(
|
||||||
|
message:
|
||||||
|
e.toString()));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
items: provinces
|
items: provinces
|
||||||
.isEmpty
|
.isEmpty
|
||||||
|
@ -701,6 +751,9 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
//// CITIES DROPDOWN
|
//// CITIES DROPDOWN
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -720,33 +773,39 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
onChanged:
|
onChanged:
|
||||||
(CityMunicipality?
|
(CityMunicipality?
|
||||||
city) async {
|
city) async {
|
||||||
setState(() {
|
try {
|
||||||
selectedMunicipality =
|
setState(() {
|
||||||
city;
|
selectedMunicipality =
|
||||||
barangayAsyncCall =
|
city;
|
||||||
true;
|
barangayAsyncCall =
|
||||||
});
|
true;
|
||||||
barangays = await LocationUtils
|
});
|
||||||
.instance
|
barangays = await LocationUtils
|
||||||
.getBarangay(
|
.instance
|
||||||
code: selectedMunicipality!
|
.getBarangay(
|
||||||
.code!);
|
code:
|
||||||
setState(() {
|
selectedMunicipality!.code!);
|
||||||
barangayAsyncCall =
|
setState(() {
|
||||||
false;
|
barangayAsyncCall =
|
||||||
purokAsyncCall =
|
false;
|
||||||
true;
|
purokAsyncCall =
|
||||||
});
|
true;
|
||||||
puroks = await LocationUtils
|
});
|
||||||
.instance
|
puroks = await LocationUtils
|
||||||
.getPurok(
|
.instance
|
||||||
barangay:
|
.getPurok(
|
||||||
barangays[0].code!);
|
barangay:
|
||||||
|
barangays[0].code!);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
purokAsyncCall =
|
purokAsyncCall =
|
||||||
false;
|
false;
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
bloc.add(CallErrorState(
|
||||||
|
message: e
|
||||||
|
.toString()));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
decoration: normalTextFieldStyle(
|
decoration: normalTextFieldStyle(
|
||||||
|
@ -772,6 +831,9 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
////Barangay
|
////Barangay
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
|
@ -789,20 +851,25 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
areaId =
|
areaId =
|
||||||
baragay!
|
baragay!
|
||||||
.code;
|
.code;
|
||||||
|
try {
|
||||||
setState(() {
|
setState(() {
|
||||||
purokAsyncCall =
|
purokAsyncCall =
|
||||||
true;
|
true;
|
||||||
});
|
});
|
||||||
puroks = await LocationUtils
|
puroks = await LocationUtils
|
||||||
.instance
|
.instance
|
||||||
.getPurok(
|
.getPurok(
|
||||||
barangay:
|
barangay:
|
||||||
barangays[0].code!);
|
barangays[0].code!);
|
||||||
setState(() {
|
setState(() {
|
||||||
purokAsyncCall =
|
purokAsyncCall =
|
||||||
false;
|
false;
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
bloc.add(CallErrorState(
|
||||||
|
message: e
|
||||||
|
.toString()));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
decoration:
|
decoration:
|
||||||
normalTextFieldStyle(
|
normalTextFieldStyle(
|
||||||
|
@ -1123,7 +1190,13 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
|
||||||
}
|
}
|
||||||
if (state is AssignAreaErorState) {
|
if (state is AssignAreaErorState) {
|
||||||
return SomethingWentWrong(
|
return SomethingWentWrong(
|
||||||
message: state.message, onpressed: () {});
|
message: state.message,
|
||||||
|
onpressed: () {
|
||||||
|
context.read<AssignAreaBloc>().add(GetAssignArea(
|
||||||
|
firstname: widget.fname,
|
||||||
|
lastname: widget.lname,
|
||||||
|
));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (state is UserNotExistError) {
|
if (state is UserNotExistError) {
|
||||||
return const Center(
|
return const Center(
|
||||||
|
|
|
@ -286,7 +286,7 @@ class SuperAdminMenu extends StatelessWidget {
|
||||||
lname),
|
lname),
|
||||||
),
|
),
|
||||||
child:
|
child:
|
||||||
const RbacAssignedAreaScreen(),
|
RbacAssignedAreaScreen(lname: lname,fname: fname,id: id,),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue