flutter upgrade to latest version
parent
01d454dcce
commit
749bd30fab
|
@ -26,6 +26,6 @@ subprojects {
|
|||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/bloc/rbac/rbac_bloc.dart';
|
||||
import 'package:unit2/sevices/roles/rbac_operations/assigned_area_services.dart';
|
||||
|
||||
import '../../../../model/profile/assigned_area.dart';
|
||||
import '../../../../model/profile/basic_information/primary-information.dart';
|
||||
import '../../../../sevices/roles/rbac_operations/role_assignment_services.dart';
|
||||
|
||||
part 'assign_area_event.dart';
|
||||
part 'assign_area_state.dart';
|
||||
|
||||
class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
|
||||
AssignAreaBloc() : super(AssignAreaInitial()) {
|
||||
String? fname;
|
||||
String? lname;
|
||||
String? fullname;
|
||||
Profile? profile;
|
||||
int id;
|
||||
List<UserAssignedArea> userAssignedAreas = [];
|
||||
on<GetAssignArea>((event, emit) async {
|
||||
emit(AssignAreaLoadingState());
|
||||
try {
|
||||
profile = await RbacRoleAssignmentServices.instance.searchUser(
|
||||
page: 1, name: event.firstname, lastname: event.lastname);
|
||||
if (profile != null && profile!.id != null) {
|
||||
fname = profile!.firstName;
|
||||
lname = profile!.lastName;
|
||||
fullname = profile!.lastName;
|
||||
fullname = "${fname!} ${lname!}";
|
||||
id = profile!.webuserId!;
|
||||
userAssignedAreas = await RbacAssignedAreaServices.instance.getAssignedArea(id: profile!.webuserId!);
|
||||
emit(AssignedAreaLoadedState(userAssignedAreas: userAssignedAreas, fullname: fullname!));
|
||||
} else {
|
||||
emit(UserNotExistError());
|
||||
}
|
||||
} catch (e) {
|
||||
emit(AssignAreaErorState(message: e.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
part of 'assign_area_bloc.dart';
|
||||
class AssignAreaEvent extends Equatable {
|
||||
const AssignAreaEvent();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class GetAssignArea extends AssignAreaEvent{
|
||||
final String firstname;
|
||||
final String lastname;
|
||||
const GetAssignArea({required this.firstname, required this.lastname});
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
part of 'assign_area_bloc.dart';
|
||||
|
||||
class AssignAreaState extends Equatable {
|
||||
const AssignAreaState();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class AssignedAreaLoadedState extends AssignAreaState{
|
||||
final List<UserAssignedArea> userAssignedAreas;
|
||||
final String fullname;
|
||||
const AssignedAreaLoadedState({required this.userAssignedAreas, required this.fullname});
|
||||
@override
|
||||
List<Object> get props => [userAssignedAreas,fullname];
|
||||
}
|
||||
class AssignAreaErorState extends AssignAreaState {
|
||||
final String message;
|
||||
const AssignAreaErorState({required this.message});
|
||||
}
|
||||
class AssignAreaLoadingState extends AssignAreaState{
|
||||
|
||||
}
|
||||
|
||||
class UserNotExistError extends AssignAreaState{
|
||||
|
||||
}
|
||||
class AssignAreaInitial extends AssignAreaState {}
|
|
@ -65,6 +65,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
|||
otherInputs: otherInputs!,
|
||||
passerId: uuid!,
|
||||
roleId: roleIdRoleName!.roleId,
|
||||
roleName: roleIdRoleName!.roleName,
|
||||
stationId: stationId,
|
||||
temp: event.temp));
|
||||
});
|
||||
|
@ -78,6 +79,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
|||
otherInputs: otherInputs!,
|
||||
passerId: uuid!,
|
||||
roleId: roleIdRoleName!.roleId,
|
||||
roleName: roleIdRoleName!.roleName,
|
||||
stationId: stationId,
|
||||
temp: null));
|
||||
});
|
||||
|
@ -123,6 +125,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
|||
otherInputs: otherInputs!,
|
||||
passerId: uuid!,
|
||||
roleId: roleIdRoleName!.roleId,
|
||||
roleName: roleIdRoleName!.roleName,
|
||||
stationId: stationId,
|
||||
temp: null));
|
||||
}
|
||||
|
@ -152,7 +155,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
|||
stationId: event.stationId,
|
||||
cpId: event.cpId,
|
||||
otherInputs: event.otherInputs,
|
||||
roleid: event.roleId);
|
||||
roleIdRoleName: roleIdRoleName!);
|
||||
if (success) {
|
||||
Fluttertoast.showToast(
|
||||
msg: "SUCCESSFULLY SAVED",
|
||||
|
|
|
@ -44,6 +44,7 @@ class PerformPostLogs extends PassCheckEvent {
|
|||
final int? stationId;
|
||||
final String? destination;
|
||||
final double? temp;
|
||||
final String roleName;
|
||||
final int roleId;
|
||||
const PerformPostLogs(
|
||||
{required this.checkerId,
|
||||
|
@ -52,6 +53,7 @@ class PerformPostLogs extends PassCheckEvent {
|
|||
required this.io,
|
||||
required this.otherInputs,
|
||||
required this.passerId,
|
||||
required this.roleName,
|
||||
required this.roleId,
|
||||
required this.stationId,
|
||||
required this.temp});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import '../../model/profile/basic_information/primary-information.dart';
|
||||
import '../../model/rbac/assigned_role.dart';
|
||||
import '../../model/rbac/rbac.dart';
|
||||
|
@ -21,27 +22,24 @@ class RoleAssignmentBloc
|
|||
List<RBAC> roles = [];
|
||||
on<GetAssignedRoles>((event, emit) async {
|
||||
emit(RoleAssignmentLoadingState());
|
||||
fname = event.firstname;
|
||||
lname = event.lastname;
|
||||
fullname = "${event.firstname} ${event.lastname}";
|
||||
try {
|
||||
profile = await RbacRoleAssignmentServices.instance.searchUser(
|
||||
page: 1, name: event.firstname, lastname: event.lastname);
|
||||
if (profile != null && profile?.id != null) {
|
||||
if (profile != null && profile?.id != null) {
|
||||
fname = profile!.firstName;
|
||||
lname = profile!.lastName;
|
||||
fullname = "${fname!} ${lname!}";
|
||||
assignedRoles = await RbacRoleAssignmentServices.instance
|
||||
.getAssignedRoles(
|
||||
firstname: event.firstname, lastname: event.lastname);
|
||||
.getAssignedRoles(firstname: fname!, lastname: lname!);
|
||||
|
||||
if (roles.isEmpty) {
|
||||
roles = await RbacRoleServices.instance.getRbacRoles();
|
||||
}
|
||||
if (roles.isEmpty) {
|
||||
roles = await RbacRoleServices.instance.getRbacRoles();
|
||||
}
|
||||
emit(AssignedRoleLoaded(
|
||||
assignedRoles: assignedRoles, fullname: fullname!, roles: roles));
|
||||
} else {
|
||||
emit(UserNotExistError());
|
||||
}
|
||||
|
||||
|
||||
} catch (e) {
|
||||
emit(RoleAssignmentErrorState(message: e.toString()));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
import 'package:unit2/model/rbac/rbac.dart';
|
||||
|
||||
import '../roles/pass_check/assign_role_area_type.dart';
|
||||
|
||||
class UserAssignedArea {
|
||||
final int id;
|
||||
final AssignedRole? assignedRole;
|
||||
final AssignRoleAreaType? assignedRoleAreaType;
|
||||
final dynamic assignedArea;
|
||||
|
||||
UserAssignedArea({
|
||||
required this.id,
|
||||
required this.assignedRole,
|
||||
required this.assignedRoleAreaType,
|
||||
required this.assignedArea,
|
||||
});
|
||||
|
||||
factory UserAssignedArea.fromJson(Map<String, dynamic> json) => UserAssignedArea(
|
||||
id: json["id"],
|
||||
assignedRole: json['assigned_role'] == null? null: AssignedRole.fromJson(json["assigned_role"]),
|
||||
assignedRoleAreaType: json['assigned_role_area_type'] == null? null : AssignRoleAreaType.fromJson(json["assigned_role_area_type"]),
|
||||
assignedArea: json["assigned_area"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"assigned_role": assignedRole?.toJson(),
|
||||
"assigned_role_area_type": assignedRoleAreaType?.toJson(),
|
||||
"assigned_area": assignedArea,
|
||||
};
|
||||
}
|
||||
|
||||
class AssignedRole {
|
||||
final int id;
|
||||
final RBAC? role;
|
||||
final CreatedBy? user;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
final CreatedBy? createdBy;
|
||||
final CreatedBy? updatedBy;
|
||||
|
||||
AssignedRole({
|
||||
required this.id,
|
||||
required this.role,
|
||||
required this.user,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.createdBy,
|
||||
required this.updatedBy,
|
||||
});
|
||||
|
||||
factory AssignedRole.fromJson(Map<String, dynamic> json) => AssignedRole(
|
||||
id: json["id"],
|
||||
role: RBAC.fromJson(json["role"]),
|
||||
user: CreatedBy.fromJson(json["user"]),
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
createdBy: CreatedBy.fromJson(json["created_by"]),
|
||||
updatedBy: CreatedBy.fromJson(json["updated_by"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"role": role?.toJson(),
|
||||
"user": user?.toJson(),
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
"created_by": createdBy?.toJson(),
|
||||
"updated_by": updatedBy?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:flutter/src/widgets/placeholder.dart';
|
||||
|
||||
class RbacAssignedAreaScreen extends StatelessWidget {
|
||||
const RbacAssignedAreaScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Text("dsadasdas"),);
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
|
|||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:unit2/bloc/rbac/rbac_operations/agency/agency_bloc.dart';
|
||||
import 'package:unit2/bloc/rbac/rbac_operations/assign_area/assign_area_bloc.dart';
|
||||
import 'package:unit2/bloc/rbac/rbac_operations/module/module_bloc.dart';
|
||||
import 'package:unit2/bloc/rbac/rbac_operations/module_objects/module_objects_bloc.dart';
|
||||
import 'package:unit2/bloc/rbac/rbac_operations/object/object_bloc.dart';
|
||||
|
@ -15,6 +16,7 @@ import 'package:unit2/bloc/rbac/rbac_operations/role_module/role_module_bloc.dar
|
|||
import 'package:unit2/bloc/rbac/rbac_operations/roles_under/roles_under_bloc.dart';
|
||||
import 'package:unit2/bloc/rbac/rbac_operations/station/station_bloc.dart';
|
||||
import 'package:unit2/bloc/role_assignment/role_assignment_bloc.dart';
|
||||
import 'package:unit2/screens/superadmin/assign_area/assign_area_screen.dart';
|
||||
import 'package:unit2/screens/superadmin/module/module_screen.dart';
|
||||
import 'package:unit2/screens/superadmin/object/object_screen.dart';
|
||||
import 'package:unit2/screens/superadmin/operation/operation_screen.dart';
|
||||
|
@ -49,6 +51,7 @@ class SuperAdminMenu extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final roleAssignmentKey = GlobalKey<FormBuilderState>();
|
||||
final areaKey = GlobalKey<FormBuilderState>();
|
||||
return AnimationConfiguration.staggeredGrid(
|
||||
position: index,
|
||||
columnCount: columnCount,
|
||||
|
@ -74,12 +77,9 @@ class SuperAdminMenu extends StatelessWidget {
|
|||
object.moduleName == 'superadmin'
|
||||
? CardLabel(
|
||||
icon: iconGenerator(name: object.object.name!),
|
||||
title:
|
||||
object.object.name!,
|
||||
title: object.object.name!,
|
||||
ontap: () {
|
||||
|
||||
if (object.object.name == 'Role') {
|
||||
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
|
@ -156,9 +156,7 @@ class SuperAdminMenu extends StatelessWidget {
|
|||
return BlocProvider(
|
||||
create: (context) =>
|
||||
AgencyBloc()..add(GetAgencies()),
|
||||
child: RbacAgencyScreen(
|
||||
|
||||
),
|
||||
child: const RbacAgencyScreen(),
|
||||
);
|
||||
}));
|
||||
}
|
||||
|
@ -198,31 +196,125 @@ class SuperAdminMenu extends StatelessWidget {
|
|||
);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
if (object.object.name == 'Station') {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => StationBloc()
|
||||
..add(const GetStations(agencyId: 1)),
|
||||
child: const RbacStationScreen(
|
||||
child: const RbacStationScreen(
|
||||
agencyId: 1,
|
||||
),
|
||||
);
|
||||
}));
|
||||
}
|
||||
if (object.object.name == 'Role Member') {
|
||||
Navigator.of(context).pop();
|
||||
if (object.object.name == 'Area') {
|
||||
Navigator.of(context).pop();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
const Expanded(child: Text("Search User")),
|
||||
IconButton(onPressed: (){
|
||||
Navigator.pop(context);
|
||||
}, icon: const Icon(Icons.close))
|
||||
const Expanded(
|
||||
child: Text("Search User")),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: const Icon(Icons.close))
|
||||
],
|
||||
),
|
||||
content: FormBuilder(
|
||||
key: areaKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
FormBuilderTextField(
|
||||
name: "firstname",
|
||||
validator:
|
||||
FormBuilderValidators.required(
|
||||
errorText:
|
||||
"This field is required"),
|
||||
decoration: normalTextFieldStyle(
|
||||
"First name", "first name"),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
FormBuilderTextField(
|
||||
validator:
|
||||
FormBuilderValidators.required(
|
||||
errorText:
|
||||
"This field is required"),
|
||||
name: "lastname",
|
||||
decoration: normalTextFieldStyle(
|
||||
"Last name", "last tname"),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
SizedBox(
|
||||
height: 60,
|
||||
width: double.maxFinite,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
if (areaKey.currentState!
|
||||
.saveAndValidate()) {
|
||||
String fname =
|
||||
areaKey
|
||||
.currentState!
|
||||
.value['firstname'];
|
||||
String lname = areaKey
|
||||
.currentState!
|
||||
.value['lastname'];
|
||||
Navigator.of(context).pop();
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder:
|
||||
(BuildContext
|
||||
context) {
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
AssignAreaBloc()
|
||||
..add(
|
||||
GetAssignArea(
|
||||
firstname:
|
||||
fname,
|
||||
lastname:
|
||||
lname),
|
||||
),
|
||||
child:
|
||||
const RbacAssignedAreaScreen(),
|
||||
);
|
||||
}));
|
||||
}
|
||||
},
|
||||
style: mainBtnStyle(primary,
|
||||
Colors.transparent, second),
|
||||
child: const Text("Submit"),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
);
|
||||
});
|
||||
}
|
||||
if (object.object.name == 'Role Member') {
|
||||
Navigator.of(context).pop();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
const Expanded(
|
||||
child: Text("Search User")),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: const Icon(Icons.close))
|
||||
],
|
||||
),
|
||||
content: FormBuilder(
|
||||
|
@ -262,7 +354,6 @@ class SuperAdminMenu extends StatelessWidget {
|
|||
if (roleAssignmentKey
|
||||
.currentState!
|
||||
.saveAndValidate()) {
|
||||
|
||||
String fname =
|
||||
roleAssignmentKey
|
||||
.currentState!
|
||||
|
@ -271,19 +362,27 @@ class SuperAdminMenu extends StatelessWidget {
|
|||
roleAssignmentKey
|
||||
.currentState!
|
||||
.value['lastname'];
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder:
|
||||
(BuildContext
|
||||
context) {
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
RoleAssignmentBloc()
|
||||
..add(GetAssignedRoles(
|
||||
create: (context) =>
|
||||
RoleAssignmentBloc()
|
||||
..add(
|
||||
GetAssignedRoles(
|
||||
firstname:
|
||||
fname,
|
||||
lastname:
|
||||
lname),),child:RbacRoleAssignment(id:id,name: fname,lname: lname,) ,);
|
||||
lname),
|
||||
),
|
||||
child: RbacRoleAssignment(
|
||||
id: id,
|
||||
name: fname,
|
||||
lname: lname,
|
||||
),
|
||||
);
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -20,8 +20,10 @@ class _MainScreenState extends State<MainScreen> {
|
|||
List<Role> roles = [];
|
||||
List<DisplayCard> cards = [];
|
||||
int? userId;
|
||||
DateTime? ctime;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
setState(() {
|
||||
cards.clear();
|
||||
cards=[];
|
||||
|
@ -52,34 +54,49 @@ class _MainScreenState extends State<MainScreen> {
|
|||
}
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: primary,
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
ZoomDrawer.of(context)!.toggle();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.menu,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
title: const Text(
|
||||
unit2ModuleScreen,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
color: Colors.white,
|
||||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
DateTime now = DateTime.now();
|
||||
if (ctime == null || now.difference(ctime!) > const Duration(seconds: 2)) {
|
||||
//add duration of press gap
|
||||
ctime = now;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Press Again to Exit',textAlign: TextAlign.center,))
|
||||
);
|
||||
return Future.value(false);
|
||||
}
|
||||
|
||||
return Future.value(true);
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: primary,
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
ZoomDrawer.of(context)!.toggle();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.menu,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
title: const Text(
|
||||
unit2ModuleScreen,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: state.userData!.user!.login!.user!.roles!.isNotEmpty
|
||||
? DashBoard(
|
||||
estPersonAssignedArea: state.estPersonAssignedArea,
|
||||
userId: userId!,
|
||||
cards: cards,
|
||||
)
|
||||
: const NoModule(),
|
||||
),
|
||||
body: state.userData!.user!.login!.user!.roles!.isNotEmpty
|
||||
? DashBoard(
|
||||
estPersonAssignedArea: state.estPersonAssignedArea,
|
||||
userId: userId!,
|
||||
cards: cards,
|
||||
)
|
||||
: const NoModule(),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
|
|
|
@ -37,10 +37,22 @@ class _UniT2LoginState extends State<UniT2Login> {
|
|||
bool _showPassword = true;
|
||||
String? password;
|
||||
String? username;
|
||||
DateTime? ctime;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: pressAgainToExit,
|
||||
onWillPop: () {
|
||||
DateTime now = DateTime.now();
|
||||
if (ctime == null || now.difference(ctime!) > const Duration(seconds: 2)) {
|
||||
ctime = now;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Press Again to Exit',textAlign: TextAlign.center,))
|
||||
);
|
||||
return Future.value(false);
|
||||
}
|
||||
|
||||
return Future.value(true);
|
||||
},
|
||||
child: Scaffold(
|
||||
body: ProgressHUD(
|
||||
backgroundColor: Colors.black87,
|
||||
|
|
|
@ -172,7 +172,7 @@ class PassCheckServices {
|
|||
double? temp,
|
||||
int? stationId,
|
||||
String? cpId,
|
||||
required int roleid}) async {
|
||||
required RoleIdRoleName roleIdRoleName}) async {
|
||||
String path = Url.instance.postLogs();
|
||||
bool success;
|
||||
Map<String, String> headers = {
|
||||
|
@ -182,7 +182,7 @@ class PassCheckServices {
|
|||
};
|
||||
Map body;
|
||||
if (otherInputs) {
|
||||
if (roleid == 41 || roleid == 13 || roleid == 17 || roleid == 22) {
|
||||
if (roleIdRoleName.roleName.toLowerCase() == "security guard" || roleIdRoleName.roleName.toLowerCase() == "qr code scanner") {
|
||||
if (io == "i") {
|
||||
body = {
|
||||
"station_id": stationId,
|
||||
|
@ -220,7 +220,7 @@ class PassCheckServices {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (roleid == 41 || roleid == 13 || roleid == 17 || roleid == 22) {
|
||||
if (roleIdRoleName.roleName.toLowerCase() == "security guard" || roleIdRoleName.roleName.toLowerCase() == "qr code scanner") {
|
||||
body = {
|
||||
"station_id": stationId,
|
||||
"passer": passerId,
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:unit2/model/profile/assigned_area.dart';
|
||||
import 'package:unit2/utils/urls.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../../utils/request.dart';
|
||||
|
||||
class RbacAssignedAreaServices {
|
||||
static final RbacAssignedAreaServices _instance = RbacAssignedAreaServices();
|
||||
static RbacAssignedAreaServices get instance => _instance;
|
||||
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||
Future<List<UserAssignedArea>> getAssignedArea({required int id}) async {
|
||||
List<UserAssignedArea> userAssignedAreas = [];
|
||||
String path = Url.instance.getAssignAreas();
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret
|
||||
};
|
||||
Map<String, String> param = {
|
||||
"assigned_role__user__id": id.toString(),
|
||||
};
|
||||
try {
|
||||
http.Response response = await Request.instance
|
||||
.getRequest(param: param, path: path, headers: headers);
|
||||
if (response.statusCode == 200) {
|
||||
Map data = jsonDecode(response.body);
|
||||
if (data['data'] != null) {
|
||||
for (var assignedArea in data['data']) {
|
||||
UserAssignedArea newArea = UserAssignedArea.fromJson(assignedArea);
|
||||
userAssignedAreas.add(newArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
throw e.toString();
|
||||
}
|
||||
return userAssignedAreas;
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ class Request {
|
|||
Map<String, String>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await get(Uri.https(host, path!, param), headers: headers)
|
||||
response = await get(Uri.http(host, path!, param), headers: headers)
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
// Fluttertoast.showToast(
|
||||
|
@ -61,7 +61,7 @@ class Request {
|
|||
Map<String, String>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await post(Uri.https(host, path!, param),
|
||||
response = await post(Uri.http(host, path!, param),
|
||||
headers: headers, body: jsonEncode(body))
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
|
@ -104,7 +104,7 @@ class Request {
|
|||
required Map<String, dynamic>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await put(Uri.https(host, path, param),
|
||||
response = await put(Uri.http(host, path, param),
|
||||
headers: headers, body: jsonEncode(body));
|
||||
} on TimeoutException catch (_) {
|
||||
// Fluttertoast.showToast(
|
||||
|
@ -188,7 +188,7 @@ class Request {
|
|||
required Map<String, dynamic>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await delete(Uri.https(host, path, param),
|
||||
response = await delete(Uri.http(host, path, param),
|
||||
headers: headers, body: jsonEncode(body))
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
|
|
|
@ -5,8 +5,8 @@ class Url {
|
|||
|
||||
String host() {
|
||||
// return '192.168.10.183:3000';
|
||||
return 'agusandelnorte.gov.ph';
|
||||
// return "192.168.10.219:3000";
|
||||
// return 'agusandelnorte.gov.ph';
|
||||
return "192.168.10.219:3000";
|
||||
// return "192.168.10.241";
|
||||
// return "192.168.10.221:3004";
|
||||
// return "playweb.agusandelnorte.gov.ph";
|
||||
|
@ -14,8 +14,8 @@ class Url {
|
|||
}
|
||||
|
||||
String prefixHost() {
|
||||
return "https";
|
||||
// return "http";
|
||||
// return "https";
|
||||
return "http";
|
||||
}
|
||||
|
||||
String authentication() {
|
||||
|
@ -26,7 +26,6 @@ class Url {
|
|||
return 'api/jobnet_app/profile/pds/';
|
||||
}
|
||||
|
||||
|
||||
String latestApk() {
|
||||
return "/api/system_app/apk_version/latest";
|
||||
}
|
||||
|
@ -320,6 +319,10 @@ class Url {
|
|||
return "/api/hrms_app/position_title/";
|
||||
}
|
||||
|
||||
String getAssignedAreas() {
|
||||
return "/api/account/auth/assigned_role_area";
|
||||
}
|
||||
|
||||
//// location utils path
|
||||
String getCounties() {
|
||||
return "/api/jobnet_app/countries/";
|
||||
|
|
74
pubspec.lock
74
pubspec.lock
|
@ -69,10 +69,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
|
||||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.10.0"
|
||||
version: "2.11.0"
|
||||
audioplayers:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -277,10 +277,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
|
||||
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
version: "1.3.0"
|
||||
checked_yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -309,10 +309,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
|
||||
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.0"
|
||||
version: "1.17.2"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -369,14 +369,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
device_frame:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_frame
|
||||
sha256: afe76182aec178d171953d9b4a50a43c57c7cf3c77d8b09a48bf30c8fa04dd9d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
device_info:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -409,14 +401,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
device_preview:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: device_preview
|
||||
sha256: "2f097bf31b929e15e6756dbe0ec1bcb63952ab9ed51c25dc5a2c722d2b21fdaf"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
dio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -685,14 +669,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.6.1"
|
||||
freezed_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: freezed_annotation
|
||||
sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -801,10 +777,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91"
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.17.0"
|
||||
version: "0.18.1"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -889,26 +865,26 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
|
||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.13"
|
||||
version: "0.12.16"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
|
||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "0.5.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
|
||||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.9.1"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1001,10 +977,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
|
||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
version: "1.8.3"
|
||||
path_drawing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1430,10 +1406,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
|
||||
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
version: "1.10.0"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1574,10 +1550,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
|
||||
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.16"
|
||||
version: "0.6.0"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1690,6 +1666,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.4-beta"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1731,5 +1715,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">2.19.0 <3.0.0"
|
||||
dart: ">=3.1.0-185.0.dev <4.0.0"
|
||||
flutter: ">=3.7.0"
|
||||
|
|
10
pubspec.yaml
10
pubspec.yaml
|
@ -38,10 +38,9 @@ dependencies:
|
|||
flutter_custom_clippers: ^2.0.0
|
||||
flutter_svg: ^1.1.6
|
||||
flutter_form_builder: ^7.7.0
|
||||
form_builder_validators: ^8.4.0
|
||||
form_builder_validators: any
|
||||
fluttericon: ^2.0.0
|
||||
fluttertoast: ^8.1.1
|
||||
device_preview: ^1.1.0
|
||||
flutter_zoom_drawer: ^3.0.3
|
||||
cached_network_image: ^3.2.3
|
||||
auto_size_text: ^3.0.0
|
||||
|
@ -50,7 +49,7 @@ dependencies:
|
|||
toggle_switch: ^2.0.1
|
||||
convex_bottom_bar: ^3.1.0+1
|
||||
azlistview: ^2.0.0
|
||||
intl: ^0.17.0
|
||||
intl: ^0.18.1
|
||||
date_time_picker: ^2.1.0
|
||||
flutter_progress_hud: ^2.0.2
|
||||
barcode_scan2: ^4.2.1
|
||||
|
@ -85,7 +84,7 @@ dependencies:
|
|||
flutter_speed_dial: ^6.2.0
|
||||
im_stepper: ^1.0.1+1
|
||||
shared_preferences: ^2.0.20
|
||||
multiselect: ^0.1.0
|
||||
multiselect: any
|
||||
multi_select_flutter: ^4.1.3
|
||||
flutter_custom_selector: ^0.0.3
|
||||
flutter_staggered_animations: ^1.1.1
|
||||
|
@ -98,6 +97,9 @@ dependencies:
|
|||
url_launcher: ^6.1.11
|
||||
url_launcher_android: ^6.0.38
|
||||
share_plus: ^7.1.0
|
||||
|
||||
dependency_overrides:
|
||||
intl: ^0.18.0
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue