commit before tree view
parent
58c8435f9e
commit
5a56eb0adf
|
@ -1,5 +1,6 @@
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
||||||
import 'package:unit2/model/utils/agency.dart';
|
import 'package:unit2/model/utils/agency.dart';
|
||||||
import 'package:unit2/utils/profile_utilities.dart';
|
import 'package:unit2/utils/profile_utilities.dart';
|
||||||
import '../../../../model/utils/category.dart';
|
import '../../../../model/utils/category.dart';
|
||||||
|
@ -27,6 +28,11 @@ class AgencyBloc extends Bloc<AgencyEvent, AgencyState> {
|
||||||
emit(AgencyErrorState(message: e.toString()));
|
emit(AgencyErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
on<GetEstPointPersonAgencies>((event,emit)async{
|
||||||
|
if (agencyCategory.isEmpty) {
|
||||||
|
agencyCategory = await ProfileUtilities.instance.agencyCategory();
|
||||||
|
}
|
||||||
|
});
|
||||||
on<AddAgency>((event, emit) async {
|
on<AddAgency>((event, emit) async {
|
||||||
emit(AgencyLoadingState());
|
emit(AgencyLoadingState());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -14,3 +14,8 @@ class AddAgency extends AgencyEvent{
|
||||||
final Agency agency;
|
final Agency agency;
|
||||||
const AddAgency({required this.agency});
|
const AddAgency({required this.agency});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GetEstPointPersonAgencies extends AgencyEvent{
|
||||||
|
final List<AssignedArea>? assignedAreas;
|
||||||
|
const GetEstPointPersonAgencies({required this.assignedAreas});
|
||||||
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class StationBloc extends Bloc<StationEvent, StationState> {
|
||||||
emit(StationLoadingState());
|
emit(StationLoadingState());
|
||||||
try {
|
try {
|
||||||
stations = await RbacStationServices.instance
|
stations = await RbacStationServices.instance
|
||||||
.getStations(agencyId: event.agencyId);
|
.getStations(agencyId: event.agencyId.toString());
|
||||||
|
|
||||||
if (agencies.isEmpty) {
|
if (agencies.isEmpty) {
|
||||||
List<Agency> newAgencies =
|
List<Agency> newAgencies =
|
||||||
|
@ -31,7 +31,7 @@ class StationBloc extends Bloc<StationEvent, StationState> {
|
||||||
// emit(StationLoadingState());
|
// emit(StationLoadingState());
|
||||||
try {
|
try {
|
||||||
stations = await RbacStationServices.instance
|
stations = await RbacStationServices.instance
|
||||||
.getStations(agencyId: event.agencyId);
|
.getStations(agencyId: event.agencyId.toString());
|
||||||
|
|
||||||
if (agencies.isEmpty) {
|
if (agencies.isEmpty) {
|
||||||
List<Agency> newAgencies =
|
List<Agency> newAgencies =
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
||||||
|
import 'package:unit2/model/utils/agency.dart';
|
||||||
|
import 'package:unit2/model/utils/category.dart';
|
||||||
|
|
||||||
|
import '../../../../../utils/profile_utilities.dart';
|
||||||
|
|
||||||
|
part 'assign_area_agency_event.dart';
|
||||||
|
part 'assign_area_agency_state.dart';
|
||||||
|
|
||||||
|
class AssignAreaAgencyBloc
|
||||||
|
extends Bloc<AssignAreaAgencyEvent, AssignAreaAgencyState> {
|
||||||
|
AssignAreaAgencyBloc() : super(AssignAreaAgencyInitial()) {
|
||||||
|
List<AssignedArea>? agencies = [];
|
||||||
|
List<Category> agencyCategory = [];
|
||||||
|
on<EstPointPersonGetAgencies>((event, emit) async {
|
||||||
|
emit(EstPointPersonAgencyLoadingState());
|
||||||
|
try {
|
||||||
|
if (agencyCategory.isEmpty) {
|
||||||
|
agencyCategory = await ProfileUtilities.instance.agencyCategory();
|
||||||
|
}
|
||||||
|
agencies = event.assignedAreas;
|
||||||
|
emit(EstPointPersonAgenciesLoaded(
|
||||||
|
agencies: agencies, agencyCategory: agencyCategory));
|
||||||
|
} catch (e) {
|
||||||
|
emit(EstPointAgencyErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
part of 'assign_area_agency_bloc.dart';
|
||||||
|
|
||||||
|
abstract class AssignAreaAgencyEvent extends Equatable {
|
||||||
|
const AssignAreaAgencyEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class EstPointPersonGetAgencies extends AssignAreaAgencyEvent {
|
||||||
|
final List<AssignedArea>? assignedAreas;
|
||||||
|
const EstPointPersonGetAgencies({required this.assignedAreas});
|
||||||
|
}
|
||||||
|
|
||||||
|
class EstPointPersonAddAgency extends AssignAreaAgencyEvent {
|
||||||
|
final Agency agency;
|
||||||
|
const EstPointPersonAddAgency({required this.agency});
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
part of 'assign_area_agency_bloc.dart';
|
||||||
|
|
||||||
|
abstract class AssignAreaAgencyState extends Equatable {
|
||||||
|
const AssignAreaAgencyState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
|
||||||
|
get message => null;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AssignAreaAgencyInitial extends AssignAreaAgencyState {}
|
||||||
|
class EstPointPersonAgenciesLoaded extends AssignAreaAgencyState {
|
||||||
|
final List<AssignedArea>? agencies;
|
||||||
|
final List<Category> agencyCategory;
|
||||||
|
const EstPointPersonAgenciesLoaded({required this.agencies, required this.agencyCategory});
|
||||||
|
}
|
||||||
|
|
||||||
|
class EstPointAgencyErrorState extends AssignAreaAgencyState {
|
||||||
|
final String message;
|
||||||
|
const EstPointAgencyErrorState({required this.message});
|
||||||
|
}
|
||||||
|
|
||||||
|
class EstPointPersonAgencyLoadingState extends AssignAreaAgencyState {}
|
||||||
|
|
||||||
|
class EstPointPersonAgencyAddesState extends AssignAreaAgencyState {
|
||||||
|
final Map<dynamic, dynamic> response;
|
||||||
|
const EstPointPersonAgencyAddesState({required this.response});
|
||||||
|
}
|
||||||
|
|
||||||
|
class EstPointPersonAgencyDeletedState extends AssignAreaAgencyState {
|
||||||
|
final bool success;
|
||||||
|
const EstPointPersonAgencyDeletedState({required this.success});
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/rbac/rbac_station.dart';
|
||||||
|
import '../../../../../model/utils/agency.dart';
|
||||||
|
import '../../../../../sevices/roles/rbac_operations/station_services.dart';
|
||||||
|
import '../../../../../utils/profile_utilities.dart';
|
||||||
|
|
||||||
|
part 'est_point_person_station_event.dart';
|
||||||
|
part 'est_point_person_station_state.dart';
|
||||||
|
|
||||||
|
class EstPointPersonStationBloc extends Bloc<EstPointPersonStationEvent, EstPointPersonStationState> {
|
||||||
|
EstPointPersonStationBloc() : super(EstPointPersonStationInitial()) {
|
||||||
|
List<RbacStation> stations = [];
|
||||||
|
List<AssignedArea> assignAreas = [];
|
||||||
|
|
||||||
|
on<EstPointPersonGetStations>((event, emit) async {
|
||||||
|
emit(EstPersonStationLoadingState());
|
||||||
|
try {
|
||||||
|
if(stations.isEmpty){
|
||||||
|
stations = await RbacStationServices.instance
|
||||||
|
.getStations(agencyId: event.agencyId);
|
||||||
|
}
|
||||||
|
assignAreas = event.assignedAreas;
|
||||||
|
emit(EstPersonStationLoadedState(stations: stations, assignedAreas: assignAreas));
|
||||||
|
} catch (e) {
|
||||||
|
emit(EstPersonStationErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
part of 'est_point_person_station_bloc.dart';
|
||||||
|
|
||||||
|
abstract class EstPointPersonStationEvent extends Equatable {
|
||||||
|
const EstPointPersonStationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
class EstPointPersonGetStations extends EstPointPersonStationEvent {
|
||||||
|
final String agencyId;
|
||||||
|
final List<AssignedArea> assignedAreas;
|
||||||
|
const EstPointPersonGetStations({required this.agencyId, required this.assignedAreas});
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
part of 'est_point_person_station_bloc.dart';
|
||||||
|
|
||||||
|
abstract class EstPointPersonStationState extends Equatable {
|
||||||
|
const EstPointPersonStationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class EstPointPersonStationInitial extends EstPointPersonStationState {}
|
||||||
|
|
||||||
|
class EstPersonStationLoadedState extends EstPointPersonStationState {
|
||||||
|
final List<AssignedArea> assignedAreas;
|
||||||
|
final List<RbacStation> stations;
|
||||||
|
const EstPersonStationLoadedState({required this.stations, required this.assignedAreas});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assignedAreas,stations];
|
||||||
|
}
|
||||||
|
|
||||||
|
class EstPersonStationLoadingState extends EstPointPersonStationState {}
|
||||||
|
|
||||||
|
class EstPersonStationErrorState extends EstPointPersonStationState {
|
||||||
|
final String message;
|
||||||
|
const EstPersonStationErrorState({required this.message});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [message];
|
||||||
|
}
|
|
@ -4,6 +4,8 @@ import 'package:barcode_scan2/barcode_scan2.dart';
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/role.dart';
|
||||||
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
||||||
import 'package:unit2/model/login_data/version_info.dart';
|
import 'package:unit2/model/login_data/version_info.dart';
|
||||||
import 'package:unit2/screens/unit2/login/functions/get_app_version.dart';
|
import 'package:unit2/screens/unit2/login/functions/get_app_version.dart';
|
||||||
|
@ -22,6 +24,7 @@ class UserBloc extends Bloc<UserEvent, UserState> {
|
||||||
String? _apkVersion;
|
String? _apkVersion;
|
||||||
bool save = false;
|
bool save = false;
|
||||||
String? uuid;
|
String? uuid;
|
||||||
|
List<AssignedArea> establishmentPointPersonAssignedAreas = [];
|
||||||
UserBloc() : super(UserInitial()) {
|
UserBloc() : super(UserInitial()) {
|
||||||
//// this event is called when opening the app to check if
|
//// this event is called when opening the app to check if
|
||||||
//// there is new app version
|
//// there is new app version
|
||||||
|
@ -69,13 +72,24 @@ class UserBloc extends Bloc<UserEvent, UserState> {
|
||||||
.webLogin(username: event.username, password: event.password);
|
.webLogin(username: event.username, password: event.password);
|
||||||
if (response['status'] == true) {
|
if (response['status'] == true) {
|
||||||
UserData userData = UserData.fromJson(response['data']);
|
UserData userData = UserData.fromJson(response['data']);
|
||||||
|
Role? estPointPerson = userData.user?.login?.user?.roles?.firstWhere(
|
||||||
|
(element) =>
|
||||||
|
element?.name?.toLowerCase() == "establishment point-person",
|
||||||
|
);
|
||||||
|
if (estPointPerson != null) {
|
||||||
|
estPointPerson.assignedArea!.forEach((element) {
|
||||||
|
establishmentPointPersonAssignedAreas.add(element!);
|
||||||
|
});
|
||||||
|
}
|
||||||
emit(UserLoggedIn(
|
emit(UserLoggedIn(
|
||||||
|
estPersonAssignedArea: establishmentPointPersonAssignedAreas,
|
||||||
userData: userData,
|
userData: userData,
|
||||||
success: true,
|
success: true,
|
||||||
message: response['message'],
|
message: response['message'],
|
||||||
savedCredentials: save));
|
savedCredentials: save));
|
||||||
} else {
|
} else {
|
||||||
emit(UserLoggedIn(
|
emit(UserLoggedIn(
|
||||||
|
estPersonAssignedArea: establishmentPointPersonAssignedAreas,
|
||||||
userData: null,
|
userData: null,
|
||||||
success: false,
|
success: false,
|
||||||
message: response['message'],
|
message: response['message'],
|
||||||
|
@ -85,39 +99,47 @@ class UserBloc extends Bloc<UserEvent, UserState> {
|
||||||
emit(InternetTimeout(message: timeoutError));
|
emit(InternetTimeout(message: timeoutError));
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
emit(InternetTimeout(message: timeoutError));
|
emit(InternetTimeout(message: timeoutError));
|
||||||
}on Error catch(e){
|
} on Error catch (e) {
|
||||||
emit(LoginErrorState(message: e.toString()));
|
emit(LoginErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
on<UuidLogin>((event, emit) async {
|
on<UuidLogin>((event, emit) async {
|
||||||
try {
|
try {
|
||||||
Map<dynamic,dynamic> response = await AuthService.instance
|
Map<dynamic, dynamic> response = await AuthService.instance
|
||||||
.qrLogin(uuid: event.uuid, password: event.password);
|
.qrLogin(uuid: event.uuid, password: event.password);
|
||||||
if (response['status'] == true) {
|
if (response['status'] == true) {
|
||||||
UserData userData = UserData.fromJson(response['data']);
|
UserData userData = UserData.fromJson(response['data']);
|
||||||
emit(UserLoggedIn(
|
emit(UserLoggedIn(
|
||||||
|
estPersonAssignedArea: establishmentPointPersonAssignedAreas,
|
||||||
userData: userData,
|
userData: userData,
|
||||||
success: true,
|
success: true,
|
||||||
message: response['message'],
|
message: response['message'],
|
||||||
savedCredentials: save));
|
savedCredentials: save));
|
||||||
} else {
|
} else {
|
||||||
emit(UserLoggedIn(
|
emit(UserLoggedIn(
|
||||||
|
estPersonAssignedArea: establishmentPointPersonAssignedAreas,
|
||||||
userData: null,
|
userData: null,
|
||||||
success: false,
|
success: false,
|
||||||
message: response['message'],
|
message: response['message'],
|
||||||
savedCredentials: save));
|
savedCredentials: save));
|
||||||
}
|
}
|
||||||
emit(UserLoggedIn(userData: _userData, savedCredentials: save));
|
emit(UserLoggedIn(
|
||||||
|
estPersonAssignedArea: establishmentPointPersonAssignedAreas,
|
||||||
|
userData: _userData,
|
||||||
|
savedCredentials: save));
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
emit(InternetTimeout(message: timeoutError));
|
emit(InternetTimeout(message: timeoutError));
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
emit(InternetTimeout(message: timeoutError));
|
emit(InternetTimeout(message: timeoutError));
|
||||||
} on Error catch(e){
|
} on Error catch (e) {
|
||||||
emit(LoginErrorState(message: e.toString()));
|
emit(LoginErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
on<LoadLoggedInUser>((event, emit) {
|
on<LoadLoggedInUser>((event, emit) {
|
||||||
emit(UserLoggedIn(userData: _userData, savedCredentials: save));
|
emit(UserLoggedIn(
|
||||||
|
estPersonAssignedArea: establishmentPointPersonAssignedAreas,
|
||||||
|
userData: _userData,
|
||||||
|
savedCredentials: save));
|
||||||
});
|
});
|
||||||
on<GetUuid>((event, emit) async {
|
on<GetUuid>((event, emit) async {
|
||||||
ScanResult result = await QRCodeBarCodeScanner.instance.scanner();
|
ScanResult result = await QRCodeBarCodeScanner.instance.scanner();
|
||||||
|
@ -125,7 +147,8 @@ emit(LoginErrorState(message: e.toString()));
|
||||||
uuid = result.rawContent.toString();
|
uuid = result.rawContent.toString();
|
||||||
emit(UuidLoaded(uuid: uuid!));
|
emit(UuidLoaded(uuid: uuid!));
|
||||||
}
|
}
|
||||||
});on<LoadUuid>((event,emit){
|
});
|
||||||
|
on<LoadUuid>((event, emit) {
|
||||||
emit(UuidLoaded(uuid: uuid!));
|
emit(UuidLoaded(uuid: uuid!));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,12 @@ class UserError extends UserState {
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
class UserLoggedIn extends UserState{
|
class UserLoggedIn extends UserState{
|
||||||
|
final List<AssignedArea>? estPersonAssignedArea;
|
||||||
final UserData? userData;
|
final UserData? userData;
|
||||||
final String? message;
|
final String? message;
|
||||||
final bool? success;
|
final bool? success;
|
||||||
final bool? savedCredentials;
|
final bool? savedCredentials;
|
||||||
UserLoggedIn({this.userData,this.message,this.success,this.savedCredentials});
|
UserLoggedIn({this.userData,this.message,this.success,this.savedCredentials, required this.estPersonAssignedArea});
|
||||||
}
|
}
|
||||||
|
|
||||||
class VersionLoaded extends UserState {
|
class VersionLoaded extends UserState {
|
||||||
|
|
|
@ -19,7 +19,6 @@ class Agency {
|
||||||
category: json["category"] == null ? null : Category.fromJson(json["category"]),
|
category: json["category"] == null ? null : Category.fromJson(json["category"]),
|
||||||
privateEntity: json["private_entity"],
|
privateEntity: json["private_entity"],
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
"name": name,
|
"name": name,
|
||||||
|
|
|
@ -25,8 +25,8 @@ import '../../../widgets/Leadings/add_leading.dart';
|
||||||
import '../../../widgets/empty_data.dart';
|
import '../../../widgets/empty_data.dart';
|
||||||
|
|
||||||
class RbacAgencyScreen extends StatelessWidget {
|
class RbacAgencyScreen extends StatelessWidget {
|
||||||
final int id;
|
|
||||||
const RbacAgencyScreen({super.key, required this.id});
|
const RbacAgencyScreen();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -1,17 +1,30 @@
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
||||||
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard_icon_generator.dart';
|
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard_icon_generator.dart';
|
||||||
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart';
|
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart';
|
||||||
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
|
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/form-style.dart';
|
||||||
|
import '../../../../../bloc/rbac/rbac_operations/agency/agency_bloc.dart';
|
||||||
|
import '../../../../../bloc/role/pass_check/est_point_person/assign_area/assign_area_agency_bloc.dart';
|
||||||
|
import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_station/est_point_person_station_bloc.dart';
|
||||||
|
import '../../../../superadmin/agency.dart/agency_screen.dart';
|
||||||
|
import '../../../roles/establishment_point_person/est_point_person_agecies.dart';
|
||||||
|
import '../../../roles/establishment_point_person/est_point_person_station.dart';
|
||||||
import './shared_card_label.dart';
|
import './shared_card_label.dart';
|
||||||
|
|
||||||
class DashBoard extends StatefulWidget {
|
class DashBoard extends StatefulWidget {
|
||||||
|
final List<AssignedArea>? estPersonAssignedArea;
|
||||||
final List<DisplayCard> cards;
|
final List<DisplayCard> cards;
|
||||||
final int userId;
|
final int userId;
|
||||||
const DashBoard({super.key, required this.cards, required this.userId});
|
const DashBoard(
|
||||||
|
{super.key,
|
||||||
|
required this.cards,
|
||||||
|
required this.userId,
|
||||||
|
required this.estPersonAssignedArea});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<DashBoard> createState() => _DashBoardState();
|
State<DashBoard> createState() => _DashBoardState();
|
||||||
|
@ -70,70 +83,98 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
////unit2 module operations
|
////unit2 module operations
|
||||||
Container(child: unit2Cards.isEmpty?const SizedBox():Text(
|
Container(
|
||||||
|
child: unit2Cards.isEmpty
|
||||||
|
? const SizedBox()
|
||||||
|
: Text(
|
||||||
"Unit2 module operations",
|
"Unit2 module operations",
|
||||||
style: Theme.of(context).textTheme.displaySmall!.copyWith(
|
style: Theme.of(context)
|
||||||
fontSize: 16, color: primary, fontWeight: FontWeight.w300),
|
.textTheme
|
||||||
),),
|
.displaySmall!
|
||||||
SizedBox(
|
.copyWith(
|
||||||
height: unit2Cards.isEmpty?0: 8,
|
fontSize: 16,
|
||||||
|
color: primary,
|
||||||
|
fontWeight: FontWeight.w300),
|
||||||
),
|
),
|
||||||
Container(child: unit2Cards.isEmpty?const SizedBox():GridView.count(
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: unit2Cards.isEmpty ? 0 : 8,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: unit2Cards.isEmpty
|
||||||
|
? const SizedBox()
|
||||||
|
: GridView.count(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
crossAxisCount: 4,
|
crossAxisCount: 4,
|
||||||
crossAxisSpacing: 8,
|
crossAxisSpacing: 8,
|
||||||
mainAxisSpacing: 10,
|
mainAxisSpacing: 10,
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 5, horizontal: 5),
|
||||||
children: unit2Cards.length > 3
|
children: unit2Cards.length > 3
|
||||||
? tempUnit2Cards.map((
|
? tempUnit2Cards.map((
|
||||||
e,
|
e,
|
||||||
) {
|
) {
|
||||||
int index = tempUnit2Cards.indexOf(e);
|
int index = tempUnit2Cards.indexOf(e);
|
||||||
//// if unit2 cards is less then 3
|
//// if unit2 cards is greater then 3
|
||||||
return Container(
|
return Container(
|
||||||
child: index == 3
|
child: index == 3
|
||||||
? CardLabel(
|
? CardLabel(
|
||||||
icon: FontAwesome5.chevron_circle_right,
|
icon: FontAwesome5
|
||||||
|
.chevron_circle_right,
|
||||||
title: "See More",
|
title: "See More",
|
||||||
ontap: () {
|
ontap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder:
|
||||||
|
(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text(
|
title: const Text(
|
||||||
"Unit2 Admin Module Operations",
|
"Unit2 Admin Module Operations",
|
||||||
textAlign: TextAlign.center,
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
),
|
),
|
||||||
content: Column(
|
content: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize:
|
||||||
|
MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 200,
|
height: 300,
|
||||||
width: double.maxFinite,
|
width: double
|
||||||
child: GridView.count(
|
.maxFinite,
|
||||||
shrinkWrap: true,
|
child:
|
||||||
crossAxisCount: 3,
|
GridView.count(
|
||||||
crossAxisSpacing: 8,
|
shrinkWrap:
|
||||||
mainAxisSpacing: 10,
|
true,
|
||||||
|
crossAxisCount:
|
||||||
|
3,
|
||||||
|
crossAxisSpacing:
|
||||||
|
8,
|
||||||
|
mainAxisSpacing:
|
||||||
|
10,
|
||||||
physics:
|
physics:
|
||||||
const BouncingScrollPhysics(),
|
const BouncingScrollPhysics(),
|
||||||
padding:
|
padding: const EdgeInsets
|
||||||
const EdgeInsets
|
|
||||||
.symmetric(
|
.symmetric(
|
||||||
vertical: 5,
|
vertical:
|
||||||
horizontal: 5),
|
5,
|
||||||
|
horizontal:
|
||||||
|
5),
|
||||||
children:
|
children:
|
||||||
unit2Cards.map((
|
unit2Cards
|
||||||
|
.map((
|
||||||
e,
|
e,
|
||||||
) {
|
) {
|
||||||
int index = unit2Cards
|
int index =
|
||||||
|
unit2Cards
|
||||||
.indexOf(e);
|
.indexOf(e);
|
||||||
//// if unit2 cards is less then 3
|
//// if unit2 cards is less then 3
|
||||||
return AnimationConfiguration
|
return AnimationConfiguration
|
||||||
.staggeredGrid(
|
.staggeredGrid(
|
||||||
position: index,
|
position:
|
||||||
columnCount: 3,
|
index,
|
||||||
|
columnCount:
|
||||||
|
3,
|
||||||
child:
|
child:
|
||||||
ScaleAnimation(
|
ScaleAnimation(
|
||||||
child:
|
child:
|
||||||
|
@ -155,10 +196,50 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
if (e.object.name!.toLowerCase() == 'role based access control') {
|
if (e.object.name!.toLowerCase() == 'role based access control') {
|
||||||
Navigator.pushNamed(context, '/rbac');
|
Navigator.pushNamed(context, '/rbac');
|
||||||
}
|
}
|
||||||
|
if (e.object.name!.toLowerCase() == 'agency') {
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) => AssignAreaAgencyBloc()..add((EstPointPersonGetAgencies(assignedAreas: widget.estPersonAssignedArea))),
|
||||||
|
child: const EstPorintPersonAgencyScreen(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (e.object.name == 'Station') {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text("Select Agency"),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
DropdownButtonFormField(
|
||||||
|
isDense: true,
|
||||||
|
decoration: normalTextFieldStyle("select agency", "select agency"),
|
||||||
|
isExpanded: true,
|
||||||
|
items: widget.estPersonAssignedArea!.map((e) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: FittedBox(child: Text(e.areaName!)),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (value) {
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) => EstPointPersonStationBloc()..add( EstPointPersonGetStations(agencyId: value!.areaid!,assignedAreas: widget.estPersonAssignedArea!)),
|
||||||
|
child: const EstPointPersonStationScreen(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
: Container(
|
: Container(
|
||||||
color:
|
color: Colors.black,
|
||||||
Colors.black,
|
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -171,40 +252,69 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
: (e.roleName == 'superadmin' ||
|
: (e.roleName == 'superadmin' ||
|
||||||
e.roleName == 'qr code scanner' ||
|
e.roleName ==
|
||||||
e.roleName == 'security guard' ||
|
'qr code scanner' ||
|
||||||
|
e.roleName ==
|
||||||
|
'security guard' ||
|
||||||
e.roleName ==
|
e.roleName ==
|
||||||
'establishment point-person' ||
|
'establishment point-person' ||
|
||||||
e.roleName ==
|
e.roleName ==
|
||||||
'registration in-charge') &&
|
'registration in-charge') &&
|
||||||
e.moduleName == 'unit2'
|
e.moduleName == 'unit2'
|
||||||
? CardLabel(
|
? CardLabel(
|
||||||
icon:
|
icon: iconGenerator(
|
||||||
iconGenerator(name: e.object.name!),
|
name: e.object.name!),
|
||||||
title: e.object.name!.toLowerCase() ==
|
title: e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
'role based access control'
|
'role based access control'
|
||||||
? "RBAC"
|
? "RBAC"
|
||||||
: e.object.name!.toLowerCase() ==
|
: e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
"person basic information"
|
"person basic information"
|
||||||
? "Basic Info"
|
? "Basic Info"
|
||||||
: e.object.name!,
|
: e.object.name!,
|
||||||
ontap: () {
|
ontap: () {
|
||||||
if (e.object.name!.toLowerCase() ==
|
if (e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
'pass check') {
|
'pass check') {
|
||||||
PassCheckArguments
|
PassCheckArguments
|
||||||
passCheckArguments =
|
passCheckArguments =
|
||||||
PassCheckArguments(
|
PassCheckArguments(
|
||||||
roleId: 10,
|
roleId: 10,
|
||||||
userId: widget.userId);
|
userId:
|
||||||
|
widget.userId);
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, '/pass-check',
|
context, '/pass-check',
|
||||||
arguments: passCheckArguments);
|
arguments:
|
||||||
|
passCheckArguments);
|
||||||
}
|
}
|
||||||
if (e.object.name!.toLowerCase() ==
|
if (e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
'role based access control') {
|
'role based access control') {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, '/rbac');
|
context, '/rbac');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
|
'agency') {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder:
|
||||||
|
(BuildContext
|
||||||
|
context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
AssignAreaAgencyBloc()
|
||||||
|
..add((EstPointPersonGetAgencies(
|
||||||
|
assignedAreas:
|
||||||
|
widget
|
||||||
|
.estPersonAssignedArea))),
|
||||||
|
child:
|
||||||
|
const EstPorintPersonAgencyScreen(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
}
|
||||||
})
|
})
|
||||||
: Container(
|
: Container(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
|
@ -216,62 +326,103 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
////if unit2 cards is greater than 3
|
////if unit2 cards is greater than 3
|
||||||
return Container(
|
return Container(
|
||||||
child: (e.roleName == 'superadmin' ||
|
child: (e.roleName == 'superadmin' ||
|
||||||
e.roleName == 'qr code scanner' ||
|
e.roleName ==
|
||||||
e.roleName == 'security guard' ||
|
'qr code scanner' ||
|
||||||
|
e.roleName ==
|
||||||
|
'security guard' ||
|
||||||
e.roleName ==
|
e.roleName ==
|
||||||
'establishment point-person' ||
|
'establishment point-person' ||
|
||||||
e.roleName ==
|
e.roleName ==
|
||||||
'registration in-charge') &&
|
'registration in-charge') &&
|
||||||
e.moduleName == 'unit2'
|
e.moduleName == 'unit2'
|
||||||
? CardLabel(
|
? CardLabel(
|
||||||
icon: iconGenerator(name: e.object.name!),
|
icon: iconGenerator(
|
||||||
title: e.object.name!.toLowerCase() ==
|
name: e.object.name!),
|
||||||
|
title: e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
'role based access control'
|
'role based access control'
|
||||||
? "RBAC"
|
? "RBAC"
|
||||||
: e.object.name!.toLowerCase() ==
|
: e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
"person basic information"
|
"person basic information"
|
||||||
? "Basic Info"
|
? "Basic Info"
|
||||||
: e.object.name!,
|
: e.object.name!,
|
||||||
ontap: () {
|
ontap: () {
|
||||||
if (e.object.name!.toLowerCase() ==
|
if (e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
'pass check') {
|
'pass check') {
|
||||||
PassCheckArguments passCheckArguments =
|
PassCheckArguments
|
||||||
|
passCheckArguments =
|
||||||
PassCheckArguments(
|
PassCheckArguments(
|
||||||
roleId: 10,
|
roleId: 10,
|
||||||
userId: widget.userId);
|
userId: widget.userId);
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, '/pass-check',
|
context, '/pass-check',
|
||||||
arguments: passCheckArguments);
|
arguments:
|
||||||
|
passCheckArguments);
|
||||||
}
|
}
|
||||||
if (e.object.name!.toLowerCase() ==
|
if (e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
'role based access control') {
|
'role based access control') {
|
||||||
Navigator.pushNamed(context, '/rbac');
|
Navigator.pushNamed(
|
||||||
|
context, '/rbac');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.object.name!
|
||||||
|
.toLowerCase() ==
|
||||||
|
'agency') {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder:
|
||||||
|
(BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
AssignAreaAgencyBloc()
|
||||||
|
..add((EstPointPersonGetAgencies(
|
||||||
|
assignedAreas: widget
|
||||||
|
.estPersonAssignedArea))),
|
||||||
|
child:
|
||||||
|
const EstPorintPersonAgencyScreen(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
: Container(
|
: Container(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
));
|
));
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),),
|
|
||||||
SizedBox(
|
|
||||||
height: unit2Cards.isEmpty?0:24,
|
|
||||||
),
|
),
|
||||||
Container(child: superadminCards.isEmpty?const SizedBox(): Text(
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: unit2Cards.isEmpty ? 0 : 24,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: superadminCards.isEmpty
|
||||||
|
? const SizedBox()
|
||||||
|
: Text(
|
||||||
"Superadmin module operations",
|
"Superadmin module operations",
|
||||||
style: Theme.of(context).textTheme.displaySmall!.copyWith(
|
style: Theme.of(context)
|
||||||
fontSize: 16, color: primary, fontWeight: FontWeight.w300),
|
.textTheme
|
||||||
),),
|
.displaySmall!
|
||||||
SizedBox(
|
.copyWith(
|
||||||
height: superadminCards.isEmpty? 0: 8,
|
fontSize: 16,
|
||||||
|
color: primary,
|
||||||
|
fontWeight: FontWeight.w300),
|
||||||
),
|
),
|
||||||
Container(child: superadminCards.isEmpty?const SizedBox():GridView.count(
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: superadminCards.isEmpty ? 0 : 8,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: superadminCards.isEmpty
|
||||||
|
? const SizedBox()
|
||||||
|
: GridView.count(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
crossAxisCount: 4,
|
crossAxisCount: 4,
|
||||||
crossAxisSpacing: 8,
|
crossAxisSpacing: 8,
|
||||||
mainAxisSpacing: 10,
|
mainAxisSpacing: 10,
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(
|
||||||
const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
vertical: 5, horizontal: 5),
|
||||||
children: superadminCards.length > 3
|
children: superadminCards.length > 3
|
||||||
//// in superadmincards lenght is greaterthan 3
|
//// in superadmincards lenght is greaterthan 3
|
||||||
? tempSuperAdminCards.map((e) {
|
? tempSuperAdminCards.map((e) {
|
||||||
|
@ -279,16 +430,19 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
return Container(
|
return Container(
|
||||||
child: index == 3
|
child: index == 3
|
||||||
? CardLabel(
|
? CardLabel(
|
||||||
icon: FontAwesome5.chevron_circle_right,
|
icon: FontAwesome5
|
||||||
|
.chevron_circle_right,
|
||||||
title: "See More",
|
title: "See More",
|
||||||
ontap: () {
|
ontap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder:
|
||||||
|
(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text(
|
title: const Text(
|
||||||
"Super Admin Module Operations",
|
"Super Admin Module Operations",
|
||||||
textAlign: TextAlign.center,
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
),
|
),
|
||||||
content: Column(
|
content: Column(
|
||||||
mainAxisSize:
|
mainAxisSize:
|
||||||
|
@ -296,29 +450,40 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 480,
|
height: 480,
|
||||||
width: double.maxFinite,
|
width: double
|
||||||
child: GridView.count(
|
.maxFinite,
|
||||||
shrinkWrap: true,
|
child: GridView
|
||||||
crossAxisCount: 3,
|
.count(
|
||||||
crossAxisSpacing: 8,
|
shrinkWrap:
|
||||||
mainAxisSpacing: 10,
|
true,
|
||||||
|
crossAxisCount:
|
||||||
|
3,
|
||||||
|
crossAxisSpacing:
|
||||||
|
8,
|
||||||
|
mainAxisSpacing:
|
||||||
|
10,
|
||||||
physics:
|
physics:
|
||||||
const BouncingScrollPhysics(),
|
const BouncingScrollPhysics(),
|
||||||
padding:
|
padding: const EdgeInsets
|
||||||
const EdgeInsets
|
|
||||||
.symmetric(
|
.symmetric(
|
||||||
vertical: 5,
|
vertical: 5,
|
||||||
horizontal: 5),
|
horizontal:
|
||||||
|
5),
|
||||||
children:
|
children:
|
||||||
superadminCards
|
superadminCards
|
||||||
.map((e) {
|
.map(
|
||||||
|
(e) {
|
||||||
int index =
|
int index =
|
||||||
superadminCards
|
superadminCards
|
||||||
.indexOf(e);
|
.indexOf(
|
||||||
|
e);
|
||||||
return SuperAdminMenu(
|
return SuperAdminMenu(
|
||||||
id: widget.userId,
|
id: widget
|
||||||
columnCount: 3,
|
.userId,
|
||||||
index: index,
|
columnCount:
|
||||||
|
3,
|
||||||
|
index:
|
||||||
|
index,
|
||||||
object: e,
|
object: e,
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
|
@ -342,16 +507,19 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
return Container(
|
return Container(
|
||||||
child: index == 3
|
child: index == 3
|
||||||
? CardLabel(
|
? CardLabel(
|
||||||
icon: FontAwesome5.chevron_circle_right,
|
icon: FontAwesome5
|
||||||
|
.chevron_circle_right,
|
||||||
title: "See More",
|
title: "See More",
|
||||||
ontap: () {
|
ontap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder:
|
||||||
|
(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text(
|
title: const Text(
|
||||||
"Super Admin Module Operations",
|
"Super Admin Module Operations",
|
||||||
textAlign: TextAlign.center,
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
),
|
),
|
||||||
content: Column(
|
content: Column(
|
||||||
mainAxisSize:
|
mainAxisSize:
|
||||||
|
@ -359,26 +527,36 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 480,
|
height: 480,
|
||||||
width: double.maxFinite,
|
width: double
|
||||||
child: GridView.count(
|
.maxFinite,
|
||||||
shrinkWrap: true,
|
child: GridView
|
||||||
crossAxisCount: 3,
|
.count(
|
||||||
crossAxisSpacing: 8,
|
shrinkWrap:
|
||||||
mainAxisSpacing: 10,
|
true,
|
||||||
|
crossAxisCount:
|
||||||
|
3,
|
||||||
|
crossAxisSpacing:
|
||||||
|
8,
|
||||||
|
mainAxisSpacing:
|
||||||
|
10,
|
||||||
physics:
|
physics:
|
||||||
const BouncingScrollPhysics(),
|
const BouncingScrollPhysics(),
|
||||||
padding:
|
padding: const EdgeInsets
|
||||||
const EdgeInsets
|
|
||||||
.symmetric(
|
.symmetric(
|
||||||
vertical: 5,
|
vertical: 5,
|
||||||
horizontal: 5),
|
horizontal:
|
||||||
|
5),
|
||||||
children:
|
children:
|
||||||
superadminCards
|
superadminCards
|
||||||
.map((e) {
|
.map(
|
||||||
|
(e) {
|
||||||
return SuperAdminMenu(
|
return SuperAdminMenu(
|
||||||
id: widget.userId,
|
id: widget
|
||||||
columnCount: 4,
|
.userId,
|
||||||
index: index,
|
columnCount:
|
||||||
|
4,
|
||||||
|
index:
|
||||||
|
index,
|
||||||
object: e,
|
object: e,
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
|
@ -399,21 +577,34 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
Container(child: rpassCards.isEmpty?const SizedBox(): Text(
|
Container(
|
||||||
|
child: rpassCards.isEmpty
|
||||||
|
? const SizedBox()
|
||||||
|
: Text(
|
||||||
"RPAss module operations",
|
"RPAss module operations",
|
||||||
style: Theme.of(context).textTheme.displaySmall!.copyWith(
|
style: Theme.of(context)
|
||||||
fontSize: 16, color: primary, fontWeight: FontWeight.w300),
|
.textTheme
|
||||||
),)
|
.displaySmall!
|
||||||
, SizedBox(
|
.copyWith(
|
||||||
height:rpassCards.isEmpty?0: 8,
|
fontSize: 16,
|
||||||
|
color: primary,
|
||||||
|
fontWeight: FontWeight.w300),
|
||||||
),
|
),
|
||||||
Container(child: rpassCards.isEmpty?const SizedBox():GridView.count(
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: rpassCards.isEmpty ? 0 : 8,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: rpassCards.isEmpty
|
||||||
|
? const SizedBox()
|
||||||
|
: GridView.count(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
crossAxisCount: 4,
|
crossAxisCount: 4,
|
||||||
crossAxisSpacing: 8,
|
crossAxisSpacing: 8,
|
||||||
mainAxisSpacing: 10,
|
mainAxisSpacing: 10,
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 5, horizontal: 5),
|
||||||
children: rpassCards.map((e) {
|
children: rpassCards.map((e) {
|
||||||
return Container(
|
return Container(
|
||||||
child: (e.roleName == 'field surveyor') &&
|
child: (e.roleName == 'field surveyor') &&
|
||||||
|
@ -428,15 +619,25 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
));
|
));
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
Container(child: docSmsCards.isEmpty?const SizedBox(): Text(
|
Container(
|
||||||
|
child: docSmsCards.isEmpty
|
||||||
|
? const SizedBox()
|
||||||
|
: Text(
|
||||||
"DocSMS module operations",
|
"DocSMS module operations",
|
||||||
style: Theme.of(context).textTheme.displaySmall!.copyWith(
|
style: Theme.of(context)
|
||||||
fontSize: 16, color: primary, fontWeight: FontWeight.w300),
|
.textTheme
|
||||||
),),
|
.displaySmall!
|
||||||
|
.copyWith(
|
||||||
|
fontSize: 16,
|
||||||
|
color: primary,
|
||||||
|
fontWeight: FontWeight.w300),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
|
@ -456,9 +657,7 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
title: e.object.name == "Document"
|
title: e.object.name == "Document"
|
||||||
? "Process Server"
|
? "Process Server"
|
||||||
: e.object.name!,
|
: e.object.name!,
|
||||||
ontap: () {
|
ontap: () {})
|
||||||
|
|
||||||
})
|
|
||||||
: Container(
|
: Container(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
));
|
));
|
||||||
|
|
|
@ -157,7 +157,7 @@ class SuperAdminMenu extends StatelessWidget {
|
||||||
create: (context) =>
|
create: (context) =>
|
||||||
AgencyBloc()..add(GetAgencies()),
|
AgencyBloc()..add(GetAgencies()),
|
||||||
child: RbacAgencyScreen(
|
child: RbacAgencyScreen(
|
||||||
id: id,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -74,6 +74,7 @@ class _MainScreenState extends State<MainScreen> {
|
||||||
),
|
),
|
||||||
body: state.userData!.user!.login!.user!.roles!.isNotEmpty
|
body: state.userData!.user!.login!.user!.roles!.isNotEmpty
|
||||||
? DashBoard(
|
? DashBoard(
|
||||||
|
estPersonAssignedArea: state.estPersonAssignedArea,
|
||||||
userId: userId!,
|
userId: userId!,
|
||||||
cards: cards,
|
cards: cards,
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,248 @@
|
||||||
|
import 'package:app_popup_menu/app_popup_menu.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:fluttericon/font_awesome_icons.dart';
|
||||||
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
|
import 'package:searchfield/searchfield.dart';
|
||||||
|
import 'package:unit2/bloc/rbac/rbac_operations/agency/agency_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/rbac/rbac_operations/object/object_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/role/pass_check/est_point_person/assign_area/assign_area_agency_bloc.dart';
|
||||||
|
import 'package:unit2/model/utils/category.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
import '../../../../model/utils/agency.dart';
|
||||||
|
import '../../../../theme-data.dart/box_shadow.dart';
|
||||||
|
import '../../../../theme-data.dart/btn-style.dart';
|
||||||
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
|
import '../../../../theme-data.dart/form-style.dart';
|
||||||
|
import '../../../../utils/global.dart';
|
||||||
|
import '../../../../utils/global_context.dart';
|
||||||
|
import '../../../../widgets/Leadings/add_leading.dart';
|
||||||
|
import '../../../../widgets/empty_data.dart';
|
||||||
|
|
||||||
|
class EstPorintPersonAgencyScreen extends StatelessWidget {
|
||||||
|
const EstPorintPersonAgencyScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final formKey = GlobalKey<FormBuilderState>();
|
||||||
|
List<Category> agencyCategory = [];
|
||||||
|
Category? selectedAgencyCategory;
|
||||||
|
bool? isPrivate;
|
||||||
|
final agencyCategoryFocusNode = FocusNode();
|
||||||
|
BuildContext parent;
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("Agencies"),
|
||||||
|
actions: [
|
||||||
|
AddLeading(onPressed: () {
|
||||||
|
parent = context;
|
||||||
|
showDialog(
|
||||||
|
context: NavigationService.navigatorKey.currentContext!,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text("Add Agency"),
|
||||||
|
content: FormBuilder(
|
||||||
|
key: formKey,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
FormBuilderTextField(
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
name: "name",
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Agency name ", "Agency name"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SearchField(
|
||||||
|
focusNode: agencyCategoryFocusNode,
|
||||||
|
itemHeight: 80,
|
||||||
|
suggestions: agencyCategory
|
||||||
|
.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 ...")),
|
||||||
|
),
|
||||||
|
onSuggestionTap: (agencyCategory) {
|
||||||
|
selectedAgencyCategory = agencyCategory.item;
|
||||||
|
agencyCategoryFocusNode.unfocus();
|
||||||
|
},
|
||||||
|
searchInputDecoration:
|
||||||
|
normalTextFieldStyle("Category *", "")
|
||||||
|
.copyWith(
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_drop_down),
|
||||||
|
onPressed: () {
|
||||||
|
agencyCategoryFocusNode.unfocus();
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return "This field is required";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
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) {
|
||||||
|
if (value.toString() == "YES") {
|
||||||
|
isPrivate = true;
|
||||||
|
} else {
|
||||||
|
isPrivate = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
name: 'isPrivate',
|
||||||
|
validator: FormBuilderValidators.required(),
|
||||||
|
options: ["YES", "NO"]
|
||||||
|
.map((lang) =>
|
||||||
|
FormBuilderFieldOption(value: lang))
|
||||||
|
.toList(growable: false),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
width: double.maxFinite,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: mainBtnStyle(
|
||||||
|
primary, Colors.transparent, second),
|
||||||
|
onPressed: () {
|
||||||
|
if (formKey.currentState!
|
||||||
|
.saveAndValidate()) {
|
||||||
|
String name =
|
||||||
|
formKey.currentState!.value['name'];
|
||||||
|
parent.read<AssignAreaAgencyBloc>().add(
|
||||||
|
EstPointPersonAddAgency(
|
||||||
|
agency: Agency(
|
||||||
|
category:
|
||||||
|
selectedAgencyCategory,
|
||||||
|
id: null,
|
||||||
|
name: name,
|
||||||
|
privateEntity: isPrivate)));
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text("Add")),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: ProgressHUD(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
backgroundColor: Colors.black87,
|
||||||
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
|
child: BlocConsumer<AssignAreaAgencyBloc, AssignAreaAgencyState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state is EstPointPersonAgencyLoadingState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Please wait...");
|
||||||
|
}
|
||||||
|
if (state is EstPointPersonAgenciesLoaded ||
|
||||||
|
state is EstPointPersonAgencyAddesState ||
|
||||||
|
state is EstPointAgencyErrorState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.dismiss();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
final parent = context;
|
||||||
|
if (state is EstPointPersonAgenciesLoaded) {
|
||||||
|
agencyCategory = state.agencyCategory;
|
||||||
|
if (state.agencies != null && state.agencies!.isNotEmpty) {
|
||||||
|
return ListView.builder(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
|
||||||
|
itemCount: state.agencies!.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: screenWidth,
|
||||||
|
decoration: box1(),
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12, vertical: 8),
|
||||||
|
child: Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
CircleAvatar(
|
||||||
|
child: Text('${index + 1}'),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(state.agencies![index].areaName!,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: primary)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return const EmptyData(
|
||||||
|
message: "No Object available. Please click + to add.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state is EstPointAgencyErrorState) {
|
||||||
|
return SomethingWentWrong(
|
||||||
|
message: state.message,
|
||||||
|
onpressed: () {
|
||||||
|
context.read<ObjectBloc>().add(GetObjects());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,536 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:searchfield/searchfield.dart';
|
||||||
|
import 'package:unit2/bloc/rbac/rbac_operations/role/role_bloc.dart';
|
||||||
|
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
||||||
|
import 'package:unit2/model/rbac/rbac_station.dart';
|
||||||
|
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
import '../../../../bloc/role/pass_check/est_point_person/est_point_person_station/est_point_person_station_bloc.dart';
|
||||||
|
import '../../../../model/utils/agency.dart';
|
||||||
|
import '../../../../theme-data.dart/box_shadow.dart';
|
||||||
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
|
import '../../../../theme-data.dart/form-style.dart';
|
||||||
|
import '../../../../utils/formatters.dart';
|
||||||
|
import '../../../../utils/global.dart';
|
||||||
|
import '../../../../widgets/empty_data.dart';
|
||||||
|
|
||||||
|
class EstPointPersonStationScreen extends StatelessWidget {
|
||||||
|
const EstPointPersonStationScreen({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final agencyFocusNode = FocusNode();
|
||||||
|
List<RbacStation> stations = [];
|
||||||
|
final formKey = GlobalKey<FormBuilderState>();
|
||||||
|
Agency selectedAgency;
|
||||||
|
List<Map<dynamic, dynamic>> hierarchy = [];
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("Station Screen"),
|
||||||
|
actions: [
|
||||||
|
AddLeading(onPressed: () {
|
||||||
|
BuildContext parent = context;
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// builder: (BuildContext context) {
|
||||||
|
// return AlertDialog(
|
||||||
|
// title: const Text("Add New Station"),
|
||||||
|
// content: FormBuilder(
|
||||||
|
// key: formKey,
|
||||||
|
// child: Column(
|
||||||
|
// mainAxisSize: MainAxisSize.min,
|
||||||
|
// children: [
|
||||||
|
// FormBuilderTextField(
|
||||||
|
// name: "object_name",
|
||||||
|
// decoration: normalTextFieldStyle(
|
||||||
|
// "Role name *", "Role name "),
|
||||||
|
// validator: FormBuilderValidators.required(
|
||||||
|
// errorText: "This field is required"),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 8,
|
||||||
|
// ),
|
||||||
|
// FormBuilderTextField(
|
||||||
|
// name: "slug",
|
||||||
|
// decoration: normalTextFieldStyle("Slug ", "Slug"),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 8,
|
||||||
|
// ),
|
||||||
|
// FormBuilderTextField(
|
||||||
|
// validator: FormBuilderValidators.maxLength(50,
|
||||||
|
// errorText: "Max characters only 50"),
|
||||||
|
// name: "shorthand",
|
||||||
|
// decoration:
|
||||||
|
// normalTextFieldStyle("Shorthand ", "Shorthand"),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// width: double.infinity,
|
||||||
|
// height: 50,
|
||||||
|
// child: ElevatedButton(
|
||||||
|
// style: mainBtnStyle(
|
||||||
|
// primary, Colors.transparent, second),
|
||||||
|
// onPressed: () {
|
||||||
|
// if (formKey.currentState!
|
||||||
|
// .saveAndValidate()) {
|
||||||
|
// String name = formKey
|
||||||
|
// .currentState!.value['object_name'];
|
||||||
|
// String? slug =
|
||||||
|
// formKey.currentState!.value['slug'];
|
||||||
|
// String? short = formKey
|
||||||
|
// .currentState!.value['shorthand'];
|
||||||
|
// parent.read<RoleBloc>().add(AddRbacRole(
|
||||||
|
// id: id,
|
||||||
|
// name: name,
|
||||||
|
// shorthand: short,
|
||||||
|
// slug: slug));
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// child: const Text("Add"))),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// });
|
||||||
|
})
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: ProgressHUD(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
backgroundColor: Colors.black87,
|
||||||
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
|
child:
|
||||||
|
BlocConsumer<EstPointPersonStationBloc, EstPointPersonStationState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state is EstPersonStationLoadingState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Please wait...");
|
||||||
|
}
|
||||||
|
if (state is EstPersonStationLoadedState ||
|
||||||
|
state is EstPersonStationErrorState) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.dismiss();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
final parent = context;
|
||||||
|
if (state is EstPersonStationLoadedState) {
|
||||||
|
stations = state.stations;
|
||||||
|
int max = 0;
|
||||||
|
for (RbacStation station in stations) {
|
||||||
|
if (station.hierarchyOrderNo != null) {
|
||||||
|
if (max < station.hierarchyOrderNo!) {
|
||||||
|
max = station.hierarchyOrderNo!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 1; i <= max; i++) {
|
||||||
|
hierarchy.add({i: []});
|
||||||
|
}
|
||||||
|
for (var station in stations) {
|
||||||
|
if (station.hierarchyOrderNo != null) {
|
||||||
|
for (int i = 0; i <= max; i++) {
|
||||||
|
if (station.hierarchyOrderNo == i + 1) {
|
||||||
|
hierarchy[i][i + 1].add(station);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hierarchy[0][1].isNotEmpty) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: SearchField(
|
||||||
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
|
itemHeight: 70,
|
||||||
|
focusNode: agencyFocusNode,
|
||||||
|
suggestions: state.assignedAreas
|
||||||
|
.map((AssignedArea agency) =>
|
||||||
|
SearchFieldListItem(agency.areaName!,
|
||||||
|
item: agency,
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(
|
||||||
|
agency.areaName!,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
|
),
|
||||||
|
)))
|
||||||
|
.toList(),
|
||||||
|
searchInputDecoration:
|
||||||
|
normalTextFieldStyle("Filter", "").copyWith(
|
||||||
|
prefixIcon: const Icon(Icons.filter_list),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_drop_down),
|
||||||
|
onPressed: () {
|
||||||
|
agencyFocusNode.unfocus();
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
onSuggestionTap: (agency) {
|
||||||
|
agencyFocusNode.unfocus();
|
||||||
|
},
|
||||||
|
validator: (agency) {
|
||||||
|
if (agency!.isEmpty) {
|
||||||
|
return "This field is required";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
emptyWidget: const Center(
|
||||||
|
child: Text("No result found..."),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8, horizontal: 10),
|
||||||
|
itemCount: hierarchy[0][1].length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
List<RbacStation> second = [];
|
||||||
|
for (var rbacStation in hierarchy[1][2]) {
|
||||||
|
if (rbacStation.parentStation ==
|
||||||
|
hierarchy[0][1][index].id) {
|
||||||
|
second.add(rbacStation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: screenWidth,
|
||||||
|
decoration: box1(),
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12, vertical: 8),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const CircleAvatar(
|
||||||
|
child: Text('1'),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
hierarchy[0][1][index]
|
||||||
|
.stationName!,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w500,
|
||||||
|
color: primary)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
////SECOND
|
||||||
|
SizedBox(
|
||||||
|
child: second.isNotEmpty
|
||||||
|
? Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: second.map((e) {
|
||||||
|
List<RbacStation> childs = [];
|
||||||
|
if (max >= 3) {
|
||||||
|
for (RbacStation station
|
||||||
|
in hierarchy[2][3]) {
|
||||||
|
if (station.parentStation ==
|
||||||
|
e.id) {
|
||||||
|
childs.add(station);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
childs = [];
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
width: screenWidth,
|
||||||
|
decoration: box1(),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets
|
||||||
|
.only(
|
||||||
|
left: 30),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const CircleAvatar(
|
||||||
|
child: Text(
|
||||||
|
'2'),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
e
|
||||||
|
.stationName!,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: primary)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
////THIRD
|
||||||
|
SizedBox(
|
||||||
|
child: childs.isNotEmpty
|
||||||
|
? Column(
|
||||||
|
mainAxisSize:
|
||||||
|
MainAxisSize
|
||||||
|
.min,
|
||||||
|
children: childs
|
||||||
|
.map((e) {
|
||||||
|
List<RbacStation>
|
||||||
|
childs = [];
|
||||||
|
if (max >= 4) {
|
||||||
|
for (RbacStation station
|
||||||
|
in hierarchy[3][4]) {
|
||||||
|
if (station.parentStation ==
|
||||||
|
e.id) {
|
||||||
|
childs.add(station);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
childs = [];
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width:
|
||||||
|
screenWidth,
|
||||||
|
decoration:
|
||||||
|
box1(),
|
||||||
|
padding: const EdgeInsets
|
||||||
|
.only(
|
||||||
|
left:
|
||||||
|
50),
|
||||||
|
child:
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const CircleAvatar(
|
||||||
|
child: Text('3'),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(e.stationName!, style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500, color: primary)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
////Fourth
|
||||||
|
SizedBox(
|
||||||
|
child: childs.isNotEmpty
|
||||||
|
? Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: childs.map((e) {
|
||||||
|
List<RbacStation> childs = [];
|
||||||
|
if (max > 4) {
|
||||||
|
for (RbacStation station in hierarchy[4][5]) {
|
||||||
|
if (station.parentStation == e.id) {
|
||||||
|
childs.add(station);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
childs = [];
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: screenWidth,
|
||||||
|
decoration: box1(),
|
||||||
|
padding: const EdgeInsets.only(left: 80),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const CircleAvatar(
|
||||||
|
child: Text('4'),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(e.stationName!, style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500, color: primary)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
////Fifth
|
||||||
|
SizedBox(
|
||||||
|
child: childs.isNotEmpty
|
||||||
|
? Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: childs.map((e) {
|
||||||
|
List<RbacStation> childs = [];
|
||||||
|
if (max > 5) {
|
||||||
|
for (RbacStation station in hierarchy[5][6]) {
|
||||||
|
if (station.parentStation == e.id) {
|
||||||
|
childs.add(station);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
childs = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: screenWidth,
|
||||||
|
decoration: box1(),
|
||||||
|
padding: const EdgeInsets.only(left: 80),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const CircleAvatar(
|
||||||
|
child: Text('5'),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(e.stationName!, style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500, color: primary)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
)
|
||||||
|
: const SizedBox()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
)
|
||||||
|
: const SizedBox()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
)
|
||||||
|
: const SizedBox
|
||||||
|
.shrink()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
)
|
||||||
|
: const SizedBox()),
|
||||||
|
const Divider(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: SearchField(
|
||||||
|
inputFormatters: [UpperCaseTextFormatter()],
|
||||||
|
itemHeight: 70,
|
||||||
|
focusNode: agencyFocusNode,
|
||||||
|
suggestions: state.assignedAreas
|
||||||
|
.map((AssignedArea agency) =>
|
||||||
|
SearchFieldListItem(agency.areaName!,
|
||||||
|
item: agency,
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(
|
||||||
|
agency.areaName!,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
|
),
|
||||||
|
)))
|
||||||
|
.toList(),
|
||||||
|
searchInputDecoration:
|
||||||
|
normalTextFieldStyle("Filter", "").copyWith(
|
||||||
|
prefixIcon: const Icon(Icons.filter_list),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_drop_down),
|
||||||
|
onPressed: () {
|
||||||
|
agencyFocusNode.unfocus();
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
onSuggestionTap: (agency) {
|
||||||
|
agencyFocusNode.unfocus();
|
||||||
|
},
|
||||||
|
validator: (agency) {
|
||||||
|
if (agency!.isEmpty) {
|
||||||
|
return "This field is required";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
emptyWidget: const Center(
|
||||||
|
child: Text("No result found..."),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
const EmptyData(
|
||||||
|
message:
|
||||||
|
"No Station available. Please click + to add."),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state is EstPersonStationErrorState) {
|
||||||
|
return SomethingWentWrong(
|
||||||
|
message: state.message,
|
||||||
|
onpressed: () {
|
||||||
|
context.read<RoleBloc>().add(GetRoles());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,6 @@ import 'dart:convert';
|
||||||
import 'package:unit2/utils/request.dart';
|
import 'package:unit2/utils/request.dart';
|
||||||
import 'package:unit2/utils/urls.dart';
|
import 'package:unit2/utils/urls.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import '../../../model/rbac/rbac_station.dart';
|
import '../../../model/rbac/rbac_station.dart';
|
||||||
import '../../../model/roles/pass_check/station_assign_area.dart';
|
import '../../../model/roles/pass_check/station_assign_area.dart';
|
||||||
class RbacStationServices{
|
class RbacStationServices{
|
||||||
|
@ -11,7 +10,7 @@ class RbacStationServices{
|
||||||
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||||
String xClientKeySecret = "unitcYqAN7GGalyz";
|
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||||
|
|
||||||
Future<List<RbacStation>> getStations({required int agencyId})async{
|
Future<List<RbacStation>> getStations({required String agencyId})async{
|
||||||
List<RbacStation> stations = [];
|
List<RbacStation> stations = [];
|
||||||
String path = Url.instance.getStation();
|
String path = Url.instance.getStation();
|
||||||
Map<String,String> param = {"government_agency_id":agencyId.toString()};
|
Map<String,String> param = {"government_agency_id":agencyId.toString()};
|
||||||
|
|
16
pubspec.lock
16
pubspec.lock
|
@ -417,6 +417,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.5"
|
version: "2.0.5"
|
||||||
|
expandable:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: expandable
|
||||||
|
sha256: "9604d612d4d1146dafa96c6d8eec9c2ff0994658d6d09fed720ab788c7f5afc2"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.1"
|
||||||
expandable_group:
|
expandable_group:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -571,6 +579,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.2"
|
||||||
|
flutter_simple_treeview:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_simple_treeview
|
||||||
|
sha256: ad4978d2668dd078d3a09966832da111bef9102dd636e572c50c80133b7ff4d9
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.2"
|
||||||
flutter_spinkit:
|
flutter_spinkit:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -87,6 +87,9 @@ dependencies:
|
||||||
group_list_view: ^1.1.1
|
group_list_view: ^1.1.1
|
||||||
search_page: ^2.3.0
|
search_page: ^2.3.0
|
||||||
file_picker: ^5.3.1
|
file_picker: ^5.3.1
|
||||||
|
expandable: ^5.0.1
|
||||||
|
flutter_simple_treeview: ^3.0.2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
Loading…
Reference in New Issue