Fixed conflicts

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
cyzoox 2023-10-09 09:46:27 +08:00
commit 0b031dd545
77 changed files with 4651 additions and 3092 deletions

View File

@ -51,10 +51,13 @@ class LearningDevelopmentBloc
attachmentCategories =
await AttachmentServices.instance.getCategories();
}
List<LearningDevelopement> learnings = await LearningDevelopmentServices
if(learningsAndDevelopments.isEmpty){
List<LearningDevelopement> learnings = await LearningDevelopmentServices
.instance
.getLearningDevelopments(event.profileId, event.token);
learningsAndDevelopments = learnings;
}
emit(LearningDevelopmentLoadedState(
learningsAndDevelopment: learningsAndDevelopments,attachmentCategory: attachmentCategories));
} catch (e) {

View File

@ -64,6 +64,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
primaryBasicInformation: globalCurrentProfile!));
} else {
currentProfileInformation = event.primaryBasicInformation;
globalCurrentProfile = currentProfileInformation;
emit(BasicInformationProfileLoaded(
primaryBasicInformation: currentProfileInformation!));
}
@ -108,7 +109,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
0, ProfileOtherInfo(id: null, name: "NONE", description: null));
}
emit(BasicInformationEditingState(
primaryInformation: currentProfileInformation!,
primaryInformation: globalCurrentProfile!,
extensions: nameExtensions,
sexes: sexes,
bloodTypes: bloodType,

View File

@ -13,9 +13,12 @@ class GetAgencies extends AgencyEvent{
class AddAgency extends AgencyEvent{
final Agency agency;
const AddAgency({required this.agency});
List<Object> get props => [agency
];
}
class GetEstPointPersonAgencies extends AgencyEvent{
final List<AssignedArea>? assignedAreas;
const GetEstPointPersonAgencies({required this.assignedAreas});
}

View File

@ -60,7 +60,7 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
}
});
on<AddAssignArea>((event, emit) async {
// try {
try {
emit(AssignAreaLoadingState());
Map<dynamic, dynamic> response = await RbacAssignedAreaServices.instance
.add(
@ -77,11 +77,6 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
break;
}
}
// newAssignArea = userAssignedAreas.firstWhere((var element) {
// return element.assignedRole?.role?.id == event.roleId &&
// element.assignedRole?.user?.id == event.userId;
// });
if (newAssignArea?.assignedArea != null) {
userAssignedAreas.removeWhere((element) =>
element.assignedRole!.role!.id == event.roleId &&
@ -120,8 +115,8 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
newAreas.add(newArea);
}
}
newAssignArea?.assignedArea = newAreas;
userAssignedAreas.add(newAssignArea!);
newAssignArea.assignedArea = newAreas;
userAssignedAreas.add(newAssignArea);
//// purok
}
if (event.areaTypeId == 2) {
@ -149,8 +144,8 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
newAreas.add(newArea);
}
}
newAssignArea?.assignedArea = newAreas;
userAssignedAreas.add(newAssignArea!);
newAssignArea.assignedArea = newAreas;
userAssignedAreas.add(newAssignArea);
}
////statiom
if (event.areaTypeId == 4) {
@ -200,8 +195,8 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
newAreas.add(newArea);
}
}
newAssignArea?.assignedArea = newAreas;
userAssignedAreas.add(newAssignArea!);
newAssignArea.assignedArea = newAreas;
userAssignedAreas.add(newAssignArea);
}
////agency
if (event.areaTypeId == 3) {
@ -231,16 +226,16 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
newAreas.add(newArea);
}
}
newAssignArea?.assignedArea = newAreas;
userAssignedAreas.add(newAssignArea!);
newAssignArea.assignedArea = newAreas;
userAssignedAreas.add(newAssignArea);
}
emit(AssignAreaAddedState(response: response));
} else {
emit(AssignAreaAddedState(response: response));
}
// } catch (e) {
// emit(AssignAreaErorState(message: e.toString()));
// }
} catch (e) {
emit(AssignAreaErorState(message: e.toString()));
}
});
on<LoadAssignedAreas>((event, emit) async {
emit(AssignedAreaLoadedState(

View File

@ -66,7 +66,7 @@ class ModuleObjectsBloc extends Bloc<ModuleObjectsEvent, ModuleObjectsState> {
emit(ModuleObjectLoadingState());
try {
bool success = await RbacModuleObjectsServices.instance
.deleteRbacModuleObject(moduleObjectId: event.moduleObjectId);
.delete(moduleObjectId: event.moduleObjectId);
if (success) {
moduleObjects
.removeWhere((element) => element.id == event.moduleObjectId);

View File

@ -0,0 +1,82 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/rbac/permission.dart';
import 'package:unit2/model/rbac/permission_assignment.dart';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/sevices/roles/rbac_operations/permission_assignment_services.dart';
import 'package:unit2/sevices/roles/rbac_operations/permission_service.dart';
import 'package:unit2/sevices/roles/rbac_operations/role_services.dart';
part 'permission_assignment_event.dart';
part 'permission_assignment_state.dart';
class PermissionAssignmentBloc
extends Bloc<PermissionAssignmentEvent, PermissionAssignmentState> {
PermissionAssignmentBloc() : super(PermissionAssignmentInitial()) {
List<PermissionAssignment> permissionAssignments = [];
List<RBACPermission> permissions = [];
List<RBAC> roles = [];
on<GetPermissionAssignments>((event, emit) async {
try {
emit(PermissionAssignmentLoadingScreen());
if (permissionAssignments.isEmpty) {
permissionAssignments = await RbacPermissionAssignmentServices
.instance
.getPermissionAssignment();
}
if (permissions.isEmpty) {
permissions =
await RbacPermissionServices.instance.getRbacPermission();
}
if (roles.isEmpty) {
roles = await RbacRoleServices.instance.getRbacRoles();
}
emit(PermissionAssignmentLoadedState(
permissionAssignments: permissionAssignments,
permissions: permissions,
roles: roles));
} catch (e) {
emit(PermissionAssignmentErrorState(message: e.toString()));
}
});
on<AddPersmissionAssignment>((event, emit) async {
try {
emit(PermissionAssignmentLoadingScreen());
Map<dynamic, dynamic> statusResponse =
await RbacPermissionAssignmentServices.instance
.addPermissionAssignment(
assignerId: event.assignerId,
opsId: event.opsId,
roleId: event.roleId);
if (statusResponse['success']) {
if (statusResponse['data'] != null) {
for (var rbac in statusResponse['data']) {
PermissionAssignment permissionAssignment =
PermissionAssignment.fromJson(rbac);
permissionAssignments.add(permissionAssignment);
}
}
emit(PermissionAssignmentAddedState(status: statusResponse));
} else {
emit(PermissionAssignmentAddedState(status: statusResponse));
}
} catch (e) {
emit(PermissionAssignmentErrorState(message: e.toString()));
}
});
on<DeletePermissionAssignment>((event, emit) async {
try {
emit(PermissionAssignmentLoadingScreen());
bool success = await RbacPermissionAssignmentServices.instance
.deletePermissionAssignment(id: event.id);
if (success) {
permissionAssignments
.removeWhere((element) => element.id == event.id);
}
emit(PermissionAssignmentDeletedState(success: success));
} catch (e) {
emit(PermissionAssignmentErrorState(message: e.toString()));
}
});
}
}

View File

@ -0,0 +1,28 @@
part of 'permission_assignment_bloc.dart';
class PermissionAssignmentEvent extends Equatable {
const PermissionAssignmentEvent();
@override
List<Object> get props => [];
}
class GetPermissionAssignments extends PermissionAssignmentEvent{
}
class DeletePermissionAssignment extends PermissionAssignmentEvent{
final int id;
const DeletePermissionAssignment({required this.id});
@override
List<Object> get props => [id];
}
class AddPersmissionAssignment extends PermissionAssignmentEvent{
final int assignerId;
final List<int> opsId;
final int roleId;
const AddPersmissionAssignment({required this.assignerId, required this.opsId, required this.roleId});
@override
List<Object> get props => [assignerId,opsId,roleId];
}

View File

@ -0,0 +1,45 @@
part of 'permission_assignment_bloc.dart';
class PermissionAssignmentState extends Equatable {
const PermissionAssignmentState();
@override
List<Object> get props => [];
}
class PermissionAssignmentInitial extends PermissionAssignmentState {}
class PermissionAssignmentLoadingScreen extends PermissionAssignmentState {}
class PermissionAssignmentLoadedState extends PermissionAssignmentState {
final List<PermissionAssignment> permissionAssignments;
final List<RBACPermission> permissions;
final List<RBAC> roles;
const PermissionAssignmentLoadedState(
{required this.permissionAssignments,
required this.permissions,
required this.roles});
@override
List<Object> get props => [permissionAssignments, permissions, roles];
}
class PermissionAssignmentErrorState extends PermissionAssignmentState {
final String message;
const PermissionAssignmentErrorState({required this.message});
@override
List<Object> get props => [message];
}
class PermissionAssignmentDeletedState extends PermissionAssignmentState {
final bool success;
const PermissionAssignmentDeletedState({required this.success});
@override
List<Object> get props => [success];
}
class PermissionAssignmentAddedState extends PermissionAssignmentState {
final Map<dynamic, dynamic> status;
const PermissionAssignmentAddedState({required this.status});
@override
List<Object> get props => [status];
}

View File

@ -11,7 +11,7 @@ part 'role_module_state.dart';
class RoleModuleBloc extends Bloc<RoleModuleEvent, RoleModuleState> {
RoleModuleBloc() : super(RoleModuleInitial()) {
List<RoleModules> roleModules = [];
List<RBAC> roles = [];
List<RBAC> roles = [];
List<RBAC> modules = [];
on<GetRoleModules>((event, emit) async {
emit(RoleModuleLoadingState());
@ -19,18 +19,19 @@ class RoleModuleBloc extends Bloc<RoleModuleEvent, RoleModuleState> {
if (roleModules.isEmpty) {
roleModules = await RbacRoleModuleServices.instance.getRoleModules();
}
if (modules.isEmpty) {
if (modules.isEmpty) {
modules = await RbacModuleServices.instance.getRbacModule();
}
if (roles.isEmpty) {
if (roles.isEmpty) {
roles = await RbacRoleServices.instance.getRbacRoles();
}
emit(RoleModuleLoadedState(roleModules: roleModules,modules: modules,roles: roles));
emit(RoleModuleLoadedState(
roleModules: roleModules, modules: modules, roles: roles));
} catch (e) {
emit(RoleModuleErrorState(message: e.toString()));
}
});
on<AddRoleModule>((event, emit) async {
on<AddRoleModule>((event, emit) async {
try {
emit(RoleModuleLoadingState());
Map<dynamic, dynamic> statusResponse =
@ -40,9 +41,12 @@ class RoleModuleBloc extends Bloc<RoleModuleEvent, RoleModuleState> {
moduleIds: event.moduleIds);
if (statusResponse['success']) {
List<int?> ids = roleModules.map((e) => e.id).toList();
statusResponse['data'].forEach((var roleMod) {
RoleModules newRoleModule = RoleModules.fromJson(roleMod);
roleModules.add(newRoleModule);
if (!ids.contains(newRoleModule.id)) {
roleModules.add(newRoleModule);
}
emit(RoleModuleAddedState(response: statusResponse));
});
} else {

View File

@ -36,11 +36,14 @@ class RolesUnderBloc extends Bloc<RolesUnderEvent, RolesUnderState> {
.add(roleId: event.roleId, rolesId: event.roleUnderIds);
if (statusResponse['success']) {
List<int> ids = rolesUnder.map((e) => e.id).toList();
statusResponse['data'].forEach((var roleMod) {
RolesUnder newRoleUnder = RolesUnder.fromJson(roleMod);
rolesUnder.add(newRoleUnder);
emit(RoleUnderAddedState(response: statusResponse));
if (!ids.contains(newRoleUnder.id)) {
rolesUnder.add(newRoleUnder);
}
});
emit(RoleUnderAddedState(response: statusResponse));
} else {
emit(RoleUnderAddedState(response: statusResponse));
}

View File

@ -40,9 +40,13 @@ class UserBloc extends Bloc<UserEvent, UserState> {
final String? saved = CREDENTIALS?.get('saved');
username = CREDENTIALS?.get('username');
password = CREDENTIALS?.get('password');
print(username);
print(password);
if (saved != null) {
if(apkVersion != _versionInfo!.id ){
emit(VersionLoaded(
versionInfo: _versionInfo,
apkVersion: _apkVersion,
username: event.username,
password: event.password));
}else if (saved != null) {
save = true;
add(UserLogin(username: username, password: password));
} else {

View File

@ -1,6 +1,6 @@
class VersionInfo {
VersionInfo({
this.version,
this.id,
this.versionInfo,
this.dateReleased,
this.development,
@ -11,7 +11,7 @@ class VersionInfo {
this.x8664DownloadUrl,
});
String? version;
String? id;
String? versionInfo;
DateTime? dateReleased;
bool? development;
@ -22,7 +22,7 @@ class VersionInfo {
String? x8664DownloadUrl;
factory VersionInfo.fromJson(Map<String, dynamic> json) => VersionInfo(
version: json["version"],
id: json["id"],
versionInfo: json["version_info"],
dateReleased: DateTime.parse(json["date_released"]),
development: json["development"],
@ -34,7 +34,7 @@ class VersionInfo {
);
Map<String, dynamic> toJson() => {
"version": version,
"version": id,
"version_info": versionInfo,
"date_released":
"${dateReleased!.year.toString().padLeft(4, '0')}-${dateReleased!.month.toString().padLeft(2, '0')}-${dateReleased!.day.toString().padLeft(2, '0')}",

View File

@ -51,38 +51,4 @@ class AssignedRole {
};
}
class CreatedBy {
final int id;
final String username;
final String firstName;
final String lastName;
final String email;
final bool isActive;
CreatedBy({
required this.id,
required this.username,
required this.firstName,
required this.lastName,
required this.email,
required this.isActive,
});
factory CreatedBy.fromJson(Map<String, dynamic> json) => CreatedBy(
id: json["id"],
username: json["username"],
firstName: json["first_name"],
lastName: json["last_name"],
email: json["email"],
isActive: json["is_active"],
);
Map<String, dynamic> toJson() => {
"id": id,
"username": username,
"first_name": firstName,
"last_name": lastName,
"email": email,
"is_active": isActive,
};
}

View File

@ -0,0 +1,174 @@
// To parse this JSON data, do
//
// final permissionAssignment = permissionAssignmentFromJson(jsonString);
import 'package:meta/meta.dart';
import 'package:unit2/model/rbac/permission.dart';
import 'dart:convert';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/model/rbac/user.dart';
PermissionAssignment permissionAssignmentFromJson(String str) => PermissionAssignment.fromJson(json.decode(str));
String permissionAssignmentToJson(PermissionAssignment data) => json.encode(data.toJson());
class PermissionAssignment {
final int? id;
final RBAC? role;
final RBACPermission? permission;
final DateTime? createdAt;
final DateTime? updatedAt;
final User? createdBy;
final User? updatedBy;
PermissionAssignment({
required this.id,
required this.role,
required this.permission,
required this.createdAt,
required this.updatedAt,
required this.createdBy,
required this.updatedBy,
});
factory PermissionAssignment.fromJson(Map<String, dynamic> json) => PermissionAssignment(
id: json["id"],
role: json["role"] == null? null: RBAC.fromJson(json["role"]),
permission:json["permission"] == null?null: RBACPermission.fromJson(json["permission"]),
createdAt: json['created_at'] == null?null: DateTime.parse(json["created_at"]),
updatedAt:json['updated_at'] == null?null: DateTime.parse(json["updated_at"]),
createdBy:json["created_by"] == null?null: User.fromJson(json["created_by"]),
updatedBy: json["updated_by"] == null? null:User.fromJson(json["created_by"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"role": role?.toJson(),
"permission": permission?.toJson(),
"created_at": createdAt?.toIso8601String(),
"updated_at": updatedAt,
"created_by": createdBy?.toJson(),
"updated_by": updatedBy,
};
}
class CreatedBy {
final int id;
final String username;
final String firstName;
final String lastName;
final String email;
final bool isActive;
CreatedBy({
required this.id,
required this.username,
required this.firstName,
required this.lastName,
required this.email,
required this.isActive,
});
factory CreatedBy.fromJson(Map<String, dynamic> json) => CreatedBy(
id: json["id"],
username: json["username"],
firstName: json["first_name"],
lastName: json["last_name"],
email: json["email"],
isActive: json["is_active"],
);
Map<String, dynamic> toJson() => {
"id": id,
"username": username,
"first_name": firstName,
"last_name": lastName,
"email": email,
"is_active": isActive,
};
}
class Permission {
final int id;
final Role object;
final Role operation;
final DateTime createdAt;
final dynamic updatedAt;
final CreatedBy createdBy;
final dynamic updatedBy;
Permission({
required this.id,
required this.object,
required this.operation,
required this.createdAt,
required this.updatedAt,
required this.createdBy,
required this.updatedBy,
});
factory Permission.fromJson(Map<String, dynamic> json) => Permission(
id: json["id"],
object: Role.fromJson(json["object"]),
operation: Role.fromJson(json["operation"]),
createdAt: DateTime.parse(json["created_at"]),
updatedAt: json["updated_at"],
createdBy: CreatedBy.fromJson(json["created_by"]),
updatedBy: json["updated_by"],
);
Map<String, dynamic> toJson() => {
"id": id,
"object": object.toJson(),
"operation": operation.toJson(),
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt,
"created_by": createdBy.toJson(),
"updated_by": updatedBy,
};
}
class Role {
final int id;
final String name;
final String slug;
final String shorthand;
final DateTime createdAt;
final dynamic updatedAt;
final CreatedBy createdBy;
final dynamic updatedBy;
Role({
required this.id,
required this.name,
required this.slug,
required this.shorthand,
required this.createdAt,
required this.updatedAt,
required this.createdBy,
required this.updatedBy,
});
factory Role.fromJson(Map<String, dynamic> json) => Role(
id: json["id"],
name: json["name"],
slug: json["slug"],
shorthand: json["shorthand"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: json["updated_at"],
createdBy: CreatedBy.fromJson(json["created_by"]),
updatedBy: json["updated_by"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"slug": slug,
"shorthand": shorthand,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt,
"created_by": createdBy.toJson(),
"updated_by": updatedBy,
};
}

View File

@ -0,0 +1,35 @@
class User {
final int id;
final String? username;
final String? firstName;
final String? lastName;
final String? email;
final bool? isActive;
User({
required this.id,
required this.username,
required this.firstName,
required this.lastName,
required this.email,
required this.isActive,
});
factory User.fromJson(Map<String, dynamic> json) => User(
id: json["id"],
username: json["username"],
firstName: json["first_name"],
lastName: json["last_name"],
email: json["email"],
isActive: json["is_active"],
);
Map<String, dynamic> toJson() => {
"id": id,
"username": username,
"first_name": firstName,
"last_name": lastName,
"email": email,
"is_active": isActive,
};
}

View File

@ -23,9 +23,9 @@ import '../../../../utils/alerts.dart';
class CitizenShipScreen extends StatefulWidget {
final int profileId;
final String token;
final List<Citizenship> citizenships;
const CitizenShipScreen(
{super.key, required this.profileId, required this.token});
{super.key, required this.profileId, required this.token , required this.citizenships});
@override
State<CitizenShipScreen> createState() => _CitizenShipScreenState();
@ -421,7 +421,9 @@ class _CitizenShipScreenState extends State<CitizenShipScreen> {
if (state is CitizenshipErrorState) {
return Scaffold(
body: SomethingWentWrong(
message: state.message, onpressed: () {}));
message: state.message, onpressed: () {
context.read<CitizenshipBloc>().add(GetCitizenship(citizenship: widget.citizenships));
}));
}
return Container();
},

View File

@ -10,6 +10,7 @@ import 'package:unit2/sevices/profile/contact_services.dart';
import 'package:unit2/theme-data.dart/btn-style.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/global_context.dart';
import 'package:unit2/utils/text_container.dart';
import '../../../../../theme-data.dart/colors.dart';
@ -84,7 +85,7 @@ class _AddContactInformationScreenState
serviceTypeId:
selectedServiceType!.id!);
} catch (e) {
context
NavigationService.navigatorKey.currentContext!
.read<ContactBloc>()
.add(CallErrorEvent(message: e.toString()));
}
@ -129,6 +130,7 @@ class _AddContactInformationScreenState
? selectedServiceType?.id == 2
//// Landline
? FormBuilderTextField(
keyboardType: TextInputType.number,
controller: numberMailController,
inputFormatters: [landLineFormatter],
name: 'number-mail',
@ -150,7 +152,7 @@ class _AddContactInformationScreenState
errorText: "This field is required"),
decoration: normalTextFieldStyle(
"Mobile number *",
"+63 (9xx) xxx - xxxx"),
"+63 (9xx) xxx - xxxx").copyWith(helperText: "Please input your mobile number excluding the 0"),
)
: selectedServiceType!.id == 4
////Social Media
@ -167,6 +169,7 @@ class _AddContactInformationScreenState
: selectedServiceType!.id == 3
////Email Address
? FormBuilderTextField(
keyboardType: TextInputType.emailAddress,
controller: numberMailController,
name: 'number-mail',
validator: FormBuilderValidators

View File

@ -37,7 +37,7 @@ class _EditContactInformationScreenState
var mobileFormatter = MaskTextInputFormatter(
mask: "+63 (###) ###-####",
filter: {"#": RegExp(r"^[1-9][0-9]*$")},
filter: {"#": RegExp(r'^[0-9][0-9]*$')},
type: MaskAutoCompletionType.lazy,
initialText: "0");
@ -149,6 +149,7 @@ class _EditContactInformationScreenState
? selectedServiceType?.id == 2
//// Landline
? FormBuilderTextField(
keyboardType: TextInputType.number,
controller: numberMailController,
name: 'number-mail',
inputFormatters: [landLineFormatter],
@ -162,6 +163,7 @@ class _EditContactInformationScreenState
selectedServiceType!.id == 19
//// Mobile number
? FormBuilderTextField(
keyboardType: TextInputType.number,
controller: numberMailController,
name: 'number-mail',
inputFormatters: [mobileFormatter],
@ -172,10 +174,12 @@ class _EditContactInformationScreenState
decoration: normalTextFieldStyle(
"Mobile number *",
"+63 (9xx) xxx - xxxx"),
)
: selectedServiceType!.id == 4
////Social Media
? FormBuilderTextField(
controller: numberMailController,
name: 'number-mail',
validator:
@ -188,6 +192,7 @@ class _EditContactInformationScreenState
: selectedServiceType!.id == 3
////Email Address
? FormBuilderTextField(
keyboardType: TextInputType.emailAddress,
controller:
numberMailController,
name: 'number-mail',

View File

@ -1,10 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import '../../../../../bloc/profile/family/family_bloc.dart';
import '../../../../../theme-data.dart/btn-style.dart';
import '../../../../../theme-data.dart/colors.dart';
import '../../../../../theme-data.dart/form-style.dart';
@ -26,6 +22,7 @@ class AddMobileNumber extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderTextField(
keyboardType: TextInputType.number,
name: 'number_mail',
inputFormatters: [mobileFormatter],
validator: FormBuilderValidators.required(

View File

@ -349,7 +349,8 @@ class _SpouseAlertState extends State<SpouseAlert> {
],
itemHeight: 100,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: widget.positions
.map((PositionTitle position) =>
SearchFieldListItem(

View File

@ -383,7 +383,8 @@ class _SpouseEditAlertState extends State<SpouseEditAlert> {
suggestionDirection:
SuggestionDirection.down,
itemHeight: 100,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: widget.positions
.map((PositionTitle position) =>
SearchFieldListItem(

View File

@ -128,7 +128,8 @@ class _AddEducationScreenState extends State<AddEducationScreen> {
return SearchField(
inputFormatters: [UpperCaseTextFormatter()],
itemHeight: 70,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.schools
.map((School school) =>
SearchFieldListItem(school.name!,
@ -190,7 +191,8 @@ class _AddEducationScreenState extends State<AddEducationScreen> {
UpperCaseTextFormatter()
],
itemHeight: 100,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.programs
.map((Course program) =>
SearchFieldListItem(

View File

@ -165,7 +165,8 @@ class _EditEducationScreenState extends State<EditEducationScreen> {
},
controller: currentSchoolController,
itemHeight: 70,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.schools
.map((School school) =>
SearchFieldListItem(school.name!,
@ -230,7 +231,8 @@ class _EditEducationScreenState extends State<EditEducationScreen> {
SuggestionAction.unfocus,
controller: currentProgramController,
itemHeight: 70,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.programs
.map((Course program) =>
SearchFieldListItem(

View File

@ -45,7 +45,7 @@ class LearningAndDevelopmentScreen extends StatelessWidget {
AttachmentCategory? selectedAttachmentCategory;
List<AttachmentCategory> attachmentCategories = [];
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(
title: context.watch<LearningDevelopmentBloc>().state
is LearningDevelopmentAddingState

View File

@ -267,7 +267,7 @@ class _EditLearningAndDevelopmentScreenState
controller: currentTopicController,
focusNode: topicFocusNode,
itemHeight: 100,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.topics
.map((LearningDevelopmentType
topic) =>

View File

@ -92,7 +92,7 @@ class _AddVoluntaryWorkScreenState extends State<AddVoluntaryWorkScreen> {
return SearchField(
inputFormatters: [UpperCaseTextFormatter()],
itemHeight: 70,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.positions
.map((PositionTitle position) =>
SearchFieldListItem(position.title!,

View File

@ -128,7 +128,7 @@ class _EditVoluntaryWorkScreenState extends State<EditVoluntaryWorkScreen> {
inputFormatters: [UpperCaseTextFormatter()],
controller: positionController,
itemHeight: 70,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.positions
.map((PositionTitle position) =>
SearchFieldListItem(position.title!,

View File

@ -98,7 +98,7 @@ class _AddWorkHistoryScreenState extends State<AddWorkHistoryScreen> {
return SearchField(
inputFormatters: [UpperCaseTextFormatter()],
itemHeight: 70,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.agencyPositions
.map((PositionTitle position) =>
SearchFieldListItem(position.title!,

View File

@ -121,7 +121,7 @@ class _EditWorkHistoryScreenState extends State<EditWorkHistoryScreen> {
inputFormatters: [UpperCaseTextFormatter()],
controller: oldPositionController,
itemHeight: 100,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.agencyPositions
.map((PositionTitle position) =>
SearchFieldListItem(position.title!,

View File

@ -48,360 +48,378 @@ import '../unit2/homepage.dart/components/menu.dart';
import 'components/main_menu.dart';
import 'components/submenu.dart';
class ProfileInfo extends StatelessWidget {
class ProfileInfo extends StatefulWidget {
const ProfileInfo({super.key});
@override
State<ProfileInfo> createState() => _ProfileInfoState();
}
class _ProfileInfoState extends State<ProfileInfo> {
@override
Widget build(BuildContext context) {
int? profileId;
String? token;
Profile profile;
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
centerTitle: true,
title: const Text('Profile'),
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
if (state is UserLoggedIn) {
profileId = state.userData!.user!.login!.user!.profileId;
token = state.userData!.user!.login!.token!;
if (globalCurrentProfile == null) {
profile = state.userData!.employeeInfo!.profile!;
} else {
profile = globalCurrentProfile!;
return WillPopScope(
onWillPop: () async{
setState(() {
});
return true;
},
child: Scaffold(
appBar: AppBar(
backgroundColor: primary,
centerTitle: true,
title: const Text('Profile'),
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
if (state is UserLoggedIn) {
profileId = state.userData!.user!.login!.user!.profileId;
token = state.userData!.user!.login!.token!;
if (globalCurrentProfile == null) {
profile = state.userData!.employeeInfo!.profile!;
globalCurrentProfile = profile;
} else {
profile = globalCurrentProfile!;
}
return BlocConsumer<ProfileBloc, ProfileState>(
listener: (
context,
state,
) {
if (state is ProfileLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is ProfileLoaded ||
state is ProfileErrorState ||
state is BasicInformationEditingState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is ProfileLoaded) {
return Container(
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 12),
child: ListView(
children: [
Text(
"View and Update your Profile Information",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge,
),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
Elusive.address_book,
color: primary,
),
title: Text(
"Basic Information",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(Icons.person, "Primary", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider<ProfileBloc>.value(
value: ProfileBloc()
..add(GetPrimaryBasicInfo(
primaryBasicInformation: profile)),
child: PrimaryInfo(
token: token!,
profileId: profileId!,
),
);
}));
}),
subMenu(Icons.home, "Addresses", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => AddressBloc()
..add(GetAddress(
addresses: state.profileInformation
.basicInfo.addresses)),
child: const AddressScreen(),
);
}));
}),
subMenu(Icons.contact_mail, "Identifications",
() {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => IdentificationBloc()
..add(GetIdentifications(
identificationInformation: state
.profileInformation
.basicInfo
.identifications)),
child: const IdentificationsScreen(),
);
}));
}),
subMenu(Icons.contact_phone, "Contact Info",
() {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => ContactBloc()
..add(GetContacts(
contactInformations: state
.profileInformation
.basicInfo
.contactInformation)),
child: const ContactInformationScreen(),
);
}));
}),
subMenu(Icons.flag, "Citizenships", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => CitizenshipBloc()
..add(GetCitizenship(
citizenship: state
.profileInformation
.basicInfo
.citizenships)),
child: CitizenShipScreen(
citizenships: state
.profileInformation
.basicInfo
.citizenships,
profileId: profileId!, token: token!),
);
}));
}),
]),
const Divider(),
MainMenu(
icon: Elusive.group,
title: "Family",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => FamilyBloc()
..add(GetFamilies(
profileId: profileId!, token: token!)),
child: const FamilyBackgroundScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.graduation_cap,
title: "Education",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => EducationBloc()
..add(GetEducationalBackground(
profileId: profileId!, token: token!)),
child: const EducationScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Icons.stars,
title: "Eligibility",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => EligibilityBloc()
..add(GetEligibilities(
profileId: profileId!, token: token!)),
child: const EligibiltyScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.shopping_bag,
title: "Work History",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => WorkHistoryBloc()
..add(GetWorkHistories(
profileId: profileId!, token: token!)),
child: const WorkHistoryScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.walking,
title: "Voluntary Work & Civic Services",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => VoluntaryWorkBloc()
..add(GetVoluntarWorks(
profileId: profileId!, token: token!)),
child: const VolunataryWorkScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Elusive.lightbulb,
title: "Learning & Development",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => LearningDevelopmentBloc()
..add(GetLearningDevelopments(
profileId: profileId!, token: token!)),
child: const LearningAndDevelopmentScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Brandico.codepen,
title: "Personal References",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => ReferencesBloc()
..add(GetReferences(
profileId: profileId!, token: token!)),
child: const ReferencesScreen(),
);
}));
},
),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
Icons.info,
color: primary,
),
title: Text(
"Other Information",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(
Icons.fitness_center, "Skills & Hobbies",
() {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => HoobiesBloc()
..add(GetSkillsHobbies(
profileId: profileId!,
token: token!)),
child: const SkillHobbiesScreen(),
);
}));
}),
subMenu(FontAwesome5.certificate,
"Organization Memberships", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) =>
OrganizationMembershipBloc()
..add(GetOrganizationMembership(
profileId: profileId!,
token: token!)),
child: const OrgMembershipsScreen(),
);
}));
}),
subMenu(Entypo.doc_text,
"Non-Academic Recognitions", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) =>
NonAcademicRecognitionBloc()
..add(GetNonAcademicRecognition(
profileId: profileId!,
token: token!)),
child:
const NonAcademicRecognitionScreen(),
);
}));
}),
]),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
FontAwesome5.laptop_house,
color: primary,
),
title: Text(
"Assets",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(ModernPictograms.home,
"Real Property Tax", () {}),
]),
],
),
);
}
if (state is ProfileLoading) {
return const LoadingScreen();
}
if (state is ProfileErrorState) {
return SomethingWentWrong(
message: state.mesage,
onpressed: () {
BlocProvider.of<ProfileBloc>(context).add(
LoadProfile(token: token!, userID: profileId!));
});
}
return Container();
},
);
}
print(profile.lastName);
return BlocConsumer<ProfileBloc, ProfileState>(
listener: (
context,
state,
) {
if (state is ProfileLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is ProfileLoaded ||
state is ProfileErrorState ||
state is BasicInformationEditingState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is ProfileLoaded) {
return Container(
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 12),
child: ListView(
children: [
Text(
"View and Update your Profile Information",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge,
),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
Elusive.address_book,
color: primary,
),
title: Text(
"Basic Information",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(Icons.person, "Primary", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider<ProfileBloc>.value(
value: ProfileBloc()
..add(GetPrimaryBasicInfo(
primaryBasicInformation: profile)),
child: PrimaryInfo(
token: token!,
profileId: profileId!,
),
);
}));
}),
subMenu(Icons.home, "Addresses", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => AddressBloc()
..add(GetAddress(
addresses: state.profileInformation
.basicInfo.addresses)),
child: const AddressScreen(),
);
}));
}),
subMenu(Icons.contact_mail, "Identifications",
() {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => IdentificationBloc()
..add(GetIdentifications(
identificationInformation: state
.profileInformation
.basicInfo
.identifications)),
child: const IdentificationsScreen(),
);
}));
}),
subMenu(Icons.contact_phone, "Contact Info",
() {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => ContactBloc()
..add(GetContacts(
contactInformations: state
.profileInformation
.basicInfo
.contactInformation)),
child: const ContactInformationScreen(),
);
}));
}),
subMenu(Icons.flag, "Citizenships", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => CitizenshipBloc()
..add(GetCitizenship(
citizenship: state
.profileInformation
.basicInfo
.citizenships)),
child: CitizenShipScreen(
profileId: profileId!, token: token!),
);
}));
}),
]),
const Divider(),
MainMenu(
icon: Elusive.group,
title: "Family",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => FamilyBloc()
..add(GetFamilies(
profileId: profileId!, token: token!)),
child: const FamilyBackgroundScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.graduation_cap,
title: "Education",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => EducationBloc()
..add(GetEducationalBackground(
profileId: profileId!, token: token!)),
child: const EducationScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Icons.stars,
title: "Eligibility",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => EligibilityBloc()
..add(GetEligibilities(
profileId: profileId!, token: token!)),
child: const EligibiltyScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.shopping_bag,
title: "Work History",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => WorkHistoryBloc()
..add(GetWorkHistories(
profileId: profileId!, token: token!)),
child: const WorkHistoryScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: FontAwesome5.walking,
title: "Voluntary Work & Civic Services",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => VoluntaryWorkBloc()
..add(GetVoluntarWorks(
profileId: profileId!, token: token!)),
child: const VolunataryWorkScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Elusive.lightbulb,
title: "Learning & Development",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => LearningDevelopmentBloc()
..add(GetLearningDevelopments(
profileId: profileId!, token: token!)),
child: const LearningAndDevelopmentScreen(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Brandico.codepen,
title: "Personal References",
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => ReferencesBloc()
..add(GetReferences(
profileId: profileId!, token: token!)),
child: const ReferencesScreen(),
);
}));
},
),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
Icons.info,
color: primary,
),
title: Text(
"Other Information",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(
Icons.fitness_center, "Skills & Hobbies",
() {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) => HoobiesBloc()
..add(GetSkillsHobbies(
profileId: profileId!,
token: token!)),
child: const SkillHobbiesScreen(),
);
}));
}),
subMenu(FontAwesome5.certificate,
"Organization Memberships", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) =>
OrganizationMembershipBloc()
..add(GetOrganizationMembership(
profileId: profileId!,
token: token!)),
child: const OrgMembershipsScreen(),
);
}));
}),
subMenu(Entypo.doc_text,
"Non-Academic Recognitions", () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) =>
NonAcademicRecognitionBloc()
..add(GetNonAcademicRecognition(
profileId: profileId!,
token: token!)),
child:
const NonAcademicRecognitionScreen(),
);
}));
}),
]),
ExpandableGroup(
collapsedIcon:
const Icon(Icons.keyboard_arrow_down),
expandedIcon: const Icon(Icons.keyboard_arrow_up),
header: const ListTile(
leading: Icon(
FontAwesome5.laptop_house,
color: primary,
),
title: Text(
"Assets",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
items: [
subMenu(ModernPictograms.home,
"Real Property Tax", () {}),
]),
],
),
);
}
if (state is ProfileLoading) {
return const LoadingScreen();
}
if (state is ProfileErrorState) {
return SomethingWentWrong(
message: state.mesage,
onpressed: () {
BlocProvider.of<ProfileBloc>(context).add(
LoadProfile(token: token!, userID: profileId!));
});
}
return Container();
},
);
}
return Container();
}),
));
return Container();
}),
)),
);
}
}

View File

@ -5,6 +5,7 @@ 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:search_page/search_page.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';
@ -28,6 +29,7 @@ class RbacAgencyScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final formKey = GlobalKey<FormBuilderState>();
List<Agency> agencies = [];
List<Category> agencyCategory = [];
Category? selectedAgencyCategory;
bool? isPrivate;
@ -38,7 +40,37 @@ class RbacAgencyScreen extends StatelessWidget {
centerTitle: true,
backgroundColor: primary,
title: const Text("Agencies"),
actions: [
actions: context.watch<AgencyBloc>().state is AgencyLoadingState || context.watch<AgencyBloc>().state is AgencyErrorState || context.watch<AgencyBloc>().state is AgencyAddesState?[]:[
IconButton(
onPressed: () {
showSearch(
context: context,
delegate: SearchPage(
barTheme: ThemeData(cardColor: primary),
builder: (Agency rbac) {
return Column(
children: [
ListTile(
title: Text(rbac.name!),
),
const Divider(),
],
);
},
filter: (Agency rbac) {
return [rbac.name];
},
failure: const Center(
child: Text("No Agency found :("),
),
items: agencies,
searchLabel: "Search Agency",
suggestion: const Center(
child: Text("Search agency by name"),
)),
);
},
icon: const Icon(Icons.search)),
AddLeading(onPressed: () {
parent = context;
showDialog(
@ -220,6 +252,7 @@ class RbacAgencyScreen extends StatelessWidget {
builder: (context, state) {
final parent = context;
if (state is AgenciesLoaded) {
agencies = state.agencies;
agencyCategory = state.agencyCategory;
if (state.agencies.isNotEmpty) {
return ListView.builder(
@ -262,7 +295,7 @@ class RbacAgencyScreen extends StatelessWidget {
});
} else {
return const EmptyData(
message: "No Object available. Please click + to add.");
message: "No Agency available. Please click + to add.");
}
}if (state is AgencyErrorState) {
return SomethingWentWrong(

View File

@ -82,7 +82,7 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
areaType = null;
return AlertDialog(
title: const Text("Add New Role"),
title: const Text("Add New Assigned area"),
content: FormBuilder(
key: formKey,
child: StatefulBuilder(builder: (context, setState) {
@ -1005,7 +1005,7 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
if (state is AssignedAreaDeletedState) {
if (state.success) {
successAlert(context, "Delete Successfull!",
"Role Module Deleted Successfully", () {
"Assign Area Deleted Successfully", () {
Navigator.of(context).pop();
context
.read<AssignAreaBloc>()
@ -1013,7 +1013,7 @@ class _RbacAssignedAreaScreenState extends State<RbacAssignedAreaScreen> {
});
} else {
errorAlert(
context, "Delete Failed", "Role Module Delete Failed",
context, "Delete Failed", "Assign Area Deletion Failed",
() {
Navigator.of(context).pop();
context

View File

@ -5,7 +5,9 @@ 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:form_builder_validators/form_builder_validators.dart';
import 'package:search_page/search_page.dart';
import 'package:unit2/bloc/rbac/rbac_operations/module/module_bloc.dart';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/error_state.dart';
@ -23,83 +25,283 @@ class RbacModuleScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final formKey = GlobalKey<FormBuilderState>();
final bloc = BlocProvider.of<ModuleBloc>(context);
List<RBAC> modules = [];
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: primary,
title: const Text("Module Screen"),
actions: [
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Module"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderTextField(
name: "object_name",
decoration: normalTextFieldStyle(
"Module name *", "Module 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<ModuleBloc>().add(
AddRbacModule(
id: id,
name: name,
shorthand: short,
slug: slug));
Navigator.pop(context);
}
},
child: const Text("Add"))),
],
),
),
);
});
})
],
actions:
context.watch<ModuleBloc>().state is ModuleLoadingState ||
context.watch<ModuleBloc>().state is ModuleErrorState ||
context.watch<ModuleBloc>().state is ModuleAddedState ||
context.watch<ModuleBloc>().state is ModuleDeletedState ||
context.watch<ModuleBloc>().state is ModuleAddedState ||
context.watch<ModuleBloc>().state is ModuleUpdatedState
? []
: [
IconButton(
onPressed: () {
showSearch(
context: context,
delegate: SearchPage(
barTheme: ThemeData(cardColor: Colors.white),
builder: (RBAC rbac) {
return Column(
children: [
Container(
width: screenWidth,
decoration: box1(),
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
child: Row(
children: [
const SizedBox(
width: 12,
),
Expanded(
child: Text(rbac.name!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight:
FontWeight.w500,
color: primary)),
),
AppPopupMenu<int>(
offset: const Offset(-10, -10),
elevation: 3,
onSelected: (value) {
if (value == 2) {
showDialog(
context: context,
builder: (BuildContext
context) {
return AlertDialog(
title: const Text(
"Update Module"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize:
MainAxisSize
.min,
children: [
FormBuilderTextField(
initialValue:
rbac.name,
name:
"object_name",
decoration: normalTextFieldStyle(
"Module name *",
"Module name "),
validator: FormBuilderValidators
.required(
errorText:
"This field is required"),
),
const SizedBox(
height: 8,
),
FormBuilderTextField(
initialValue:
rbac.slug,
name: "slug",
decoration:
normalTextFieldStyle(
"Slug ",
"Slug"),
),
const SizedBox(
height: 8,
),
FormBuilderTextField(
initialValue:
rbac.shorthand,
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()) {
Navigator.pop(context);
String
name =
formKey.currentState!.value['object_name'];
String?
slug =
formKey.currentState!.value['slug'];
String?
short =
formKey.currentState!.value['shorthand'];
////Update
bloc.add(UpdateRbacModule(
moduleId: rbac.id!,
name: name,
slug: slug,
short: short,
createdBy: rbac.createdBy?.id,
updatedBy: id));
Navigator.pop(context);
}
},
child: const Text("Update"))),
],
),
),
);
});
}
if (value == 1) {
////delete
Navigator.pop(context);
confirmAlert(context, () {
context
.read<ModuleBloc>()
.add(DeleteRbacModule(
moduleId:
rbac.id!));
}, "Delete?",
"Confirm Delete?");
}
},
menuItems: [
popMenuItem(
text: "Update",
value: 2,
icon: Icons.edit),
popMenuItem(
text: "Remove",
value: 1,
icon: Icons.delete),
],
icon: const Icon(
Icons.more_vert,
color: Colors.grey,
),
tooltip: "Options",
),
],
),
),
const SizedBox(
height: 5,
)
],
);
},
filter: (RBAC rbac) {
return [rbac.name];
},
failure: const Center(
child: Text("No Module found :("),
),
items: modules,
searchLabel: "Search Module",
suggestion: const Center(
child: Text("Search module by name"),
)),
);
},
icon: const Icon(Icons.search)),
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Module"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderTextField(
name: "object_name",
decoration: normalTextFieldStyle(
"Module name *", "Module 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<ModuleBloc>().add(
AddRbacModule(
id: id,
name: name,
shorthand: short,
slug: slug));
Navigator.pop(context);
}
},
child: const Text("Add"))),
],
),
),
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
@ -162,7 +364,7 @@ class RbacModuleScreen extends StatelessWidget {
context.read<ModuleBloc>().add(GetModule());
});
} else {
errorAlert(context, "Delete Failed", "Module Delete Failed",
errorAlert(context, "Delete Failed", "Module Deletion Failed",
() {
Navigator.of(context).pop();
context.read<ModuleBloc>().add(GetModule());
@ -174,6 +376,7 @@ class RbacModuleScreen extends StatelessWidget {
final parent = context;
if (state is ModuleLoaded) {
if (state.module.isNotEmpty) {
modules = state.module;
return ListView.builder(
padding:
const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
@ -190,18 +393,22 @@ class RbacModuleScreen extends StatelessWidget {
children: [
Expanded(
child: Row(
children: [
CircleAvatar(child: Text('${index+1}'),),
const SizedBox(width: 12,),
Text(state.module[index].name!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight: FontWeight.w500,
color: primary)),
],
)),
children: [
CircleAvatar(
child: Text('${index + 1}'),
),
const SizedBox(
width: 12,
),
Text(state.module[index].name!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight: FontWeight.w500,
color: primary)),
],
)),
AppPopupMenu<int>(
offset: const Offset(-10, -10),
elevation: 3,
@ -211,7 +418,8 @@ class RbacModuleScreen extends StatelessWidget {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Update Module"),
title:
const Text("Update Module"),
content: FormBuilder(
key: formKey,
child: Column(
@ -355,7 +563,7 @@ class RbacModuleScreen extends StatelessWidget {
});
} else {
return const EmptyData(
message: "No Role available. Please click + to add.");
message: "No Module available. Please click + to add.");
}
}
if (state is ModuleErrorState) {

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
@ -33,106 +32,121 @@ class RbacModuleObjectsScreen extends StatelessWidget {
List<ValueItem> selectedValueItemObjects = [];
final formKey = GlobalKey<FormBuilderState>();
return Scaffold(
appBar: AppBar(
centerTitle: true,
elevation: 0,
backgroundColor: primary,
title: const Text("Module Object Screen"),
actions: [
AddLeading(onPressed: () {
showDialog(
context: NavigationService.navigatorKey.currentState!.context,
builder: (BuildContext context) {
valueItemObjects = objects.map((e) {
return ValueItem(label: e.name!, value: e.name);
}).toList();
return AlertDialog(
title: const Text("Add New Module Object"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "module",
decoration:
normalTextFieldStyle("Module", "Module"),
items: modules.isEmpty
? []
: modules.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? object) {
selectedModule = object;
},
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemObjects = selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Objects",
padding: const EdgeInsets.all(8),
options: valueItemObjects,
selectionType: SelectionType.multi,
chipConfig:
const ChipConfig(wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle: const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(
primary, Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemObjects.isNotEmpty) {
int assignerId = id;
int moduleId = selectedModule!.id!;
List<int> objectId = [];
for (var object in objects) {
selectedValueItemObjects
.forEach((element) {
if (element.label.toLowerCase() ==
object.name?.toLowerCase()) {
objectId.add(object.id!);
actions: context.watch<ModuleObjectsBloc>().state
is ModuleObjectLoadingState ||
context.watch<ModuleObjectsBloc>().state
is ModuleObjectsErrorState ||
context.watch<ModuleObjectsBloc>().state
is ModuleObjectAddedState ||
context.watch<ModuleObjectsBloc>().state
is ModuleObjectDeletedState
? []
: [
AddLeading(onPressed: () {
showDialog(
context:
NavigationService.navigatorKey.currentState!.context,
builder: (BuildContext context) {
valueItemObjects = objects.map((e) {
return ValueItem(label: e.name!, value: e.name);
}).toList();
return AlertDialog(
title: const Text("Add New Module Object"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "module",
decoration: normalTextFieldStyle(
"Module", "Module"),
items: modules.isEmpty
? []
: modules.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? object) {
selectedModule = object;
},
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemObjects =
selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Objects",
padding: const EdgeInsets.all(8),
options: valueItemObjects,
selectionType: SelectionType.multi,
chipConfig: const ChipConfig(
wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle:
const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(primary,
Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemObjects
.isNotEmpty) {
int assignerId = id;
int moduleId = selectedModule!.id!;
List<int> objectId = [];
for (var object in objects) {
selectedValueItemObjects
.forEach((element) {
if (element.label
.toLowerCase() ==
object.name
?.toLowerCase()) {
objectId.add(object.id!);
}
});
}
Navigator.of(context).pop();
parent
.read<ModuleObjectsBloc>()
.add(AddRbacModuleObjects(
assignerId: assignerId,
moduleId: moduleId,
objectsId: objectId));
}
});
}
Navigator.of(context).pop();
parent.read<ModuleObjectsBloc>().add(
AddRbacModuleObjects(
assignerId: assignerId,
moduleId: moduleId,
objectsId: objectId));
}
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
@ -140,7 +154,6 @@ class RbacModuleObjectsScreen extends StatelessWidget {
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<ModuleObjectsBloc, ModuleObjectsState>(
listener: (context, state) {
if (state is ModuleObjectLoadingState) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
@ -157,13 +170,13 @@ class RbacModuleObjectsScreen extends StatelessWidget {
if (state is ModuleObjectDeletedState) {
if (state.success) {
successAlert(
context, "Delete Successfull!", "Role Deleted Successfully",
context, "Delete Successfull!", "Module Object Deleted Successfully",
() {
Navigator.of(context).pop();
context.read<ModuleObjectsBloc>().add(GetModuleObjects());
});
} else {
errorAlert(context, "Delete Failed", "Role Delete Failed", () {
errorAlert(context, "Delete Failed", "Module Object Deletion Failed", () {
Navigator.of(context).pop();
context.read<ModuleObjectsBloc>().add(GetModuleObjects());
});
@ -270,20 +283,23 @@ class RbacModuleObjectsScreen extends StatelessWidget {
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(color: primary,fontWeight: FontWeight.bold),
.copyWith(
color: primary, fontWeight: FontWeight.bold),
),
);
},
);
} else {
return const EmptyData(
message: "No Role available. Please click + to add.");
message:
"No Module Object available. Please click + to add.");
}
}
if (state is ModuleObjectsErrorState) {
return SomethingWentWrong(
message: state.message, onpressed: () {
parent.read<ModuleObjectsBloc>().add(GetModuleObjects());
message: state.message,
onpressed: () {
parent.read<ModuleObjectsBloc>().add(GetModuleObjects());
});
}
return Container();

View File

@ -5,7 +5,9 @@ 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:form_builder_validators/form_builder_validators.dart';
import 'package:search_page/search_page.dart';
import 'package:unit2/bloc/rbac/rbac_operations/object/object_bloc.dart';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart';
import 'package:unit2/widgets/error_state.dart';
import '../../../theme-data.dart/box_shadow.dart';
@ -24,83 +26,274 @@ class RbacObjectScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final formKey = GlobalKey<FormBuilderState>();
final bloc = BlocProvider.of<ObjectBloc>(context);
List<RBAC> objects = [];
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: primary,
title: const Text("Objects Screen"),
actions: [
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Object"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderTextField(
name: "object_name",
decoration: normalTextFieldStyle(
"Object name *", "Object 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<ObjectBloc>().add(
AddRbacObject(
id: id,
name: name,
shorthand: short,
slug: slug));
Navigator.pop(context);
}
},
child: const Text("Add"))),
],
),
),
);
});
})
],
actions:
context.watch<ObjectBloc>().state is ObjectLoadingState ||
context.watch<ObjectBloc>().state is ObjectAddedState ||
context.watch<ObjectBloc>().state is ObjectErrorState ||
context.watch<ObjectBloc>().state is ObjectDeletedState ||
context.watch<ObjectBloc>().state is ObjectUpdatedState
? []
: [
IconButton(
onPressed: () {
showSearch(
context: context,
delegate: SearchPage(
barTheme: ThemeData(cardColor: Colors.white),
builder: (RBAC rbac) {
return Column(
children: [
Container(
width: screenWidth,
decoration: box1(),
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
child: Row(
children: [
Expanded(
child: Text(rbac.name!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight:
FontWeight.w500,
color: primary)),
),
AppPopupMenu<int>(
offset: const Offset(-10, -10),
elevation: 3,
onSelected: (value) {
if (value == 2) {
showDialog(
context: context,
builder: (BuildContext
context) {
return AlertDialog(
title: const Text(
"Update Object"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize:
MainAxisSize
.min,
children: [
FormBuilderTextField(
initialValue:
rbac.name,
name:
"object_name",
decoration: normalTextFieldStyle(
"Object name *",
"Object name "),
validator: FormBuilderValidators
.required(
errorText:
"This field is required"),
),
const SizedBox(
height: 8,
),
FormBuilderTextField(
initialValue:
rbac.slug,
name: "slug",
decoration:
normalTextFieldStyle(
"Slug ",
"Slug"),
),
const SizedBox(
height: 8,
),
FormBuilderTextField(
initialValue:
rbac.shorthand,
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()) {
Navigator.pop(context);
String
name =
formKey.currentState!.value['object_name'];
String?
slug =
formKey.currentState!.value['slug'];
String?
short =
formKey.currentState!.value['shorthand'];
bloc.add(UpdateRbacObject(
objectId: rbac.id!,
name: name,
slug: slug,
short: short,
createdBy: rbac.createdBy?.id,
updatedBy: id));
Navigator.pop(context);
}
},
child: const Text("Update"))),
],
),
),
);
});
}
if (value == 1) {
confirmAlert(context, () {
Navigator.pop(context);
bloc.add(DeleteRbacObject(
objectId: rbac.id!));
}, "Delete?",
"Confirm Delete?");
}
},
menuItems: [
popMenuItem(
text: "Update",
value: 2,
icon: Icons.edit),
popMenuItem(
text: "Remove",
value: 1,
icon: Icons.delete),
],
icon: const Icon(
Icons.more_vert,
color: Colors.grey,
),
tooltip: "Options",
),
],
),
),
const SizedBox(
height: 5,
)
],
);
},
filter: (RBAC rbac) {
return [rbac.name];
},
failure: const Center(
child: Text("No Role found :("),
),
items: objects,
searchLabel: "Search Object",
suggestion: const Center(
child: Text("Search object by name"),
)),
);
},
icon: const Icon(Icons.search)),
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Object"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderTextField(
name: "object_name",
decoration: normalTextFieldStyle(
"Object name *", "Object 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<ObjectBloc>().add(
AddRbacObject(
id: id,
name: name,
shorthand: short,
slug: slug));
Navigator.pop(context);
}
},
child: const Text("Add"))),
],
),
),
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
@ -162,7 +355,7 @@ class RbacObjectScreen extends StatelessWidget {
context.read<ObjectBloc>().add(GetObjects());
});
} else {
errorAlert(context, "Delete Failed", "Object Delete Failed",
errorAlert(context, "Delete Failed", "Object Deletion Failed",
() {
Navigator.of(context).pop();
context.read<ObjectBloc>().add(GetObjects());
@ -174,6 +367,7 @@ class RbacObjectScreen extends StatelessWidget {
final parent = context;
if (state is ObjectLoaded) {
if (state.objects.isNotEmpty) {
objects = state.objects;
return ListView.builder(
padding:
const EdgeInsets.symmetric(vertical: 8, horizontal: 10),

View File

@ -5,7 +5,9 @@ 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:form_builder_validators/form_builder_validators.dart';
import 'package:search_page/search_page.dart';
import 'package:unit2/bloc/rbac/rbac_operations/operation/operation_bloc.dart';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart';
import 'package:unit2/widgets/error_state.dart';
import '../../../theme-data.dart/box_shadow.dart';
@ -24,82 +26,276 @@ class RbacOperationScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final formKey = GlobalKey<FormBuilderState>();
final bloc = BlocProvider.of<OperationBloc>(context);
List<RBAC> operations = [];
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
title: const Text("Operations Screen"),
actions: [
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Operation"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderTextField(
name: "object_name",
decoration: normalTextFieldStyle(
"Operation name *", "Operation name "),
validator: FormBuilderValidators.required(
errorText: "This field is required"),
centerTitle: true,
actions: context.watch<OperationBloc>().state
is OperationLoadingState ||
context.watch<OperationBloc>().state is OperationErrorState ||
context.watch<OperationBloc>().state is OperationAddedState ||
context.watch<OperationBloc>().state is OperationDeletedState ||
context.watch<OperationBloc>().state is OperationUpdatedState
? []
: [
IconButton(
onPressed: () {
showSearch(
context: context,
delegate: SearchPage(
barTheme: ThemeData(cardColor: Colors.white),
builder: (RBAC rbac) {
return Column(
children: [
Container(
width: screenWidth,
decoration: box1(),
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
child: Row(
children: [
Expanded(
child: Text(rbac.name!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight:
FontWeight.w500,
color: primary)),
),
AppPopupMenu<int>(
offset: const Offset(-10, -10),
elevation: 3,
onSelected: (value) {
if (value == 2) {
showDialog(
context: context,
builder:
(BuildContext context) {
return AlertDialog(
title: const Text(
"Update Operation"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize:
MainAxisSize.min,
children: [
FormBuilderTextField(
initialValue:
rbac.name,
name:
"object_name",
decoration: normalTextFieldStyle(
"Operation name *",
"Operation name "),
validator: FormBuilderValidators
.required(
errorText:
"This field is required"),
),
const SizedBox(
height: 8,
),
FormBuilderTextField(
initialValue:
rbac.slug,
name: "slug",
decoration:
normalTextFieldStyle(
"Slug ",
"Slug"),
),
const SizedBox(
height: 8,
),
FormBuilderTextField(
initialValue: rbac
.shorthand,
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()) {
Navigator.pop(context);
String
name =
formKey.currentState!.value['object_name'];
String?
slug =
formKey.currentState!.value['slug'];
String?
short =
formKey.currentState!.value['shorthand'];
bloc.add(UpdateRbacOperation(
operationId: rbac.id!,
name: name,
slug: slug,
short: short,
createdBy: rbac.createdBy?.id,
updatedBy: id));
Navigator.pop(context);
}
},
child: const Text(
"Update"))),
],
),
),
);
});
}
if (value == 1) {
confirmAlert(context, () {
Navigator.pop(context);
context
.read<OperationBloc>()
.add(DeleteRbacOperation(
operationId: rbac.id!));
}, "Delete?", "Confirm Delete?");
}
},
menuItems: [
popMenuItem(
text: "Update",
value: 2,
icon: Icons.edit),
popMenuItem(
text: "Remove",
value: 1,
icon: Icons.delete),
],
icon: const Icon(
Icons.more_vert,
color: Colors.grey,
),
tooltip: "Options",
),
],
),
),
const SizedBox(
height: 5,
)
],
);
},
filter: (RBAC rbac) {
return [rbac.name];
},
failure: const Center(
child: Text("No Operation found :("),
),
items: operations,
searchLabel: "Search Operation",
suggestion: const Center(
child: Text("Search operation by name"),
)),
);
},
icon: const Icon(Icons.search)),
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Operation"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderTextField(
name: "object_name",
decoration: normalTextFieldStyle(
"Operation name *", "Operation 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<OperationBloc>().add(
AddRbacOperation(
id: id,
name: name,
shorthand: short,
slug: slug));
Navigator.pop(context);
}
},
child: const Text("Add"))),
],
),
),
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<OperationBloc>().add(
AddRbacOperation(
id: id,
name: name,
shorthand: short,
slug: slug));
Navigator.pop(context);
}
},
child: const Text("Add"))),
],
),
),
);
});
})
],
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
@ -162,8 +358,8 @@ class RbacOperationScreen extends StatelessWidget {
context.read<OperationBloc>().add(GetOperations());
});
} else {
errorAlert(context, "Delete Failed", "Operation Delete Failed",
() {
errorAlert(
context, "Delete Failed", "Operation Deletion Failed", () {
Navigator.of(context).pop();
context.read<OperationBloc>().add(GetOperations());
});
@ -174,6 +370,7 @@ class RbacOperationScreen extends StatelessWidget {
final parent = context;
if (state is OperationsLoaded) {
if (state.operations.isNotEmpty) {
operations = state.operations;
return ListView.builder(
padding:
const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
@ -190,18 +387,22 @@ class RbacOperationScreen extends StatelessWidget {
children: [
Expanded(
child: Row(
children: [
CircleAvatar(child: Text('${index+1}'),),
const SizedBox(width: 12,),
Text(state.operations[index].name!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight: FontWeight.w500,
color: primary)),
],
)),
children: [
CircleAvatar(
child: Text('${index + 1}'),
),
const SizedBox(
width: 12,
),
Text(state.operations[index].name!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight: FontWeight.w500,
color: primary)),
],
)),
AppPopupMenu<int>(
offset: const Offset(-10, -10),
elevation: 3,
@ -211,7 +412,8 @@ class RbacOperationScreen extends StatelessWidget {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Update Operation"),
title: const Text(
"Update Operation"),
content: FormBuilder(
key: formKey,
child: Column(
@ -355,7 +557,7 @@ class RbacOperationScreen extends StatelessWidget {
});
} else {
return const EmptyData(
message: "No Role available. Please click + to add.");
message: "No Operation available. Please click + to add.");
}
}
if (state is OperationErrorState) {

View File

@ -7,7 +7,9 @@ import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:multi_dropdown/multiselect_dropdown.dart';
import 'package:search_page/search_page.dart';
import 'package:unit2/bloc/rbac/rbac_operations/permission/permission_bloc.dart';
import 'package:unit2/model/rbac/permission.dart';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart';
import 'package:unit2/theme-data.dart/btn-style.dart';
@ -32,6 +34,8 @@ class RbacPermissionScreen extends StatelessWidget {
List<RBAC> operations = [];
List<ValueItem> valueItemOperations = [];
List<ValueItem> selectedValueItemOperations = [];
List<RBACPermission> permissions = [];
final bloc = BlocProvider.of<PermissionBloc>(context);
final formKey = GlobalKey<FormBuilderState>();
BuildContext? parent;
return Scaffold(
@ -39,105 +43,189 @@ class RbacPermissionScreen extends StatelessWidget {
centerTitle: true,
backgroundColor: primary,
title: const Text("Permissions Screen"),
actions: [
AddLeading(onPressed: () {
showDialog(
context: NavigationService.navigatorKey.currentState!.context,
builder: (BuildContext context) {
valueItemOperations = operations.map((e) {
return ValueItem(label: e.name!, value: e.name);
}).toList();
return AlertDialog(
title: const Text("Add Permission"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "object",
decoration:
normalTextFieldStyle("Permission", "Permission"),
items: objects.isEmpty
? []
: objects.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? object) {
selectedObject = object;
},
actions: context.watch<PermissionBloc>().state is PermissonLoadingState ||
context.watch<PermissionBloc>().state is PermissionErrorState ||
context.watch<PermissionBloc>().state is PermissionDeletedState ||
context.watch<PermissionBloc>().state is PermissionAddedState
? []
: [
IconButton(
onPressed: () {
showSearch(
context: context,
delegate: SearchPage(
barTheme: ThemeData(cardColor: Colors.white),
builder: (RBACPermission rbac) {
return Column(
children: [
Container(
width: screenWidth,
decoration: box1(),
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
child: Row(
children: [
Expanded(
child: Text(
"${rbac.object?.name} - ${rbac.operation?.name}",
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight:
FontWeight.w500,
color: primary)),
),
AppPopupMenu<int>(
offset: const Offset(-10, -10),
elevation: 3,
onSelected: (value) {
if (value == 1) {
confirmAlert(context, () {
Navigator.pop(context);
bloc.add(DeleteRbacPermission(
permissionId: rbac.id!));
}, "Delete?", "Confirm Delete?");
}
},
menuItems: [
popMenuItem(
text: "Remove",
value: 1,
icon: Icons.delete),
],
icon: const Icon(
Icons.more_vert,
color: Colors.grey,
),
tooltip: "Options",
),
],
),
),
const SizedBox(
height: 5,
)
],
);
},
filter: (RBACPermission rbac) {
return [
rbac.object!.name! + rbac.operation!.name!
];
},
failure: const Center(
child: Text("No permission found :("),
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemOperations = selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Operations",
padding: const EdgeInsets.all(8),
options: valueItemOperations,
selectionType: SelectionType.multi,
chipConfig:
const ChipConfig(wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle: const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(
primary, Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemOperations
.isNotEmpty) {
int assignerId = id;
int objectId = selectedObject!.id!;
items: permissions,
searchLabel: "Search Permission",
suggestion: const Center(
child: Text("Search permission by name"),
)),
);
},
icon: const Icon(Icons.search)),
AddLeading(onPressed: () {
showDialog(
context:
NavigationService.navigatorKey.currentState!.context,
builder: (BuildContext context) {
valueItemOperations = operations.map((e) {
return ValueItem(label: e.name!, value: e.name);
}).toList();
return AlertDialog(
title: const Text("Add Permission"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "object",
decoration: normalTextFieldStyle(
"Permission", "Permission"),
items: objects.isEmpty
? []
: objects.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? object) {
selectedObject = object;
},
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemOperations =
selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Operations",
padding: const EdgeInsets.all(8),
options: valueItemOperations,
selectionType: SelectionType.multi,
chipConfig: const ChipConfig(
wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle:
const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(primary,
Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemOperations
.isNotEmpty) {
int assignerId = id;
int objectId = selectedObject!.id!;
List<int> opIds = [];
for (var operation in operations) {
selectedValueItemOperations
.forEach((element) {
if (element.label.toLowerCase() ==
operation.name?.toLowerCase()) {
opIds.add(operation.id!);
List<int> opIds = [];
for (var operation in operations) {
selectedValueItemOperations
.forEach((element) {
if (element.label
.toLowerCase() ==
operation.name
?.toLowerCase()) {
opIds.add(operation.id!);
}
});
}
Navigator.pop(context);
parent!.read<PermissionBloc>().add(
AddRbacPermission(
assignerId: assignerId,
objectId: objectId,
operationIds: opIds));
}
});
}
opIds.forEach((element) {
print(element);
});
Navigator.pop(context);
parent!.read<PermissionBloc>().add(
AddRbacPermission(
assignerId: assignerId,
objectId: objectId,
operationIds: opIds));
}
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
@ -181,8 +269,8 @@ class RbacPermissionScreen extends StatelessWidget {
context.read<PermissionBloc>().add(GetPermissions());
});
} else {
errorAlert(context, "Delete Failed", "Permission Delete Failed",
() {
errorAlert(
context, "Delete Failed", "Permission Deletion Failed", () {
Navigator.of(context).pop();
context.read<PermissionBloc>().add(GetPermissions());
});
@ -195,6 +283,7 @@ class RbacPermissionScreen extends StatelessWidget {
objects = state.objects;
operations = state.operations;
if (state.permissions.isNotEmpty) {
permissions = state.permissions;
return ListView.builder(
padding:
const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
@ -211,41 +300,39 @@ class RbacPermissionScreen extends StatelessWidget {
children: [
Expanded(
child: Row(
children: [
CircleAvatar(
children: [
CircleAvatar(
child: Text('${index + 1}'),
),
const SizedBox(
width: 12,
),
Flexible(
child: Text(
"${state.permissions[index].object?.name} - ${state.permissions[index].operation?.name}",
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight: FontWeight.w500,
color: primary)),
),
],
)),
Flexible(
child: Text(
"${state.permissions[index].object?.name} - ${state.permissions[index].operation?.name}",
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight: FontWeight.w500,
color: primary)),
),
],
)),
AppPopupMenu<int>(
offset: const Offset(-10, -10),
elevation: 3,
onSelected: (value) {
if (value == 1) {
if (value == 1) {
confirmAlert(context, () {
context.read<PermissionBloc>().add(
DeleteRbacPermission(
permissionId: state.permissions[index].id!));
context.read<PermissionBloc>().add(
DeleteRbacPermission(
permissionId: state
.permissions[index].id!));
}, "Delete?", "Confirm Delete?");
}
},
menuItems: [
popMenuItem(
text: "Remove",
value: 1,
@ -273,8 +360,9 @@ class RbacPermissionScreen extends StatelessWidget {
}
if (state is PermissionErrorState) {
return SomethingWentWrong(
message: state.message, onpressed: () {
parent!.read<PermissionBloc>().add(GetPermissions());
message: state.message,
onpressed: () {
parent!.read<PermissionBloc>().add(GetPermissions());
});
}
return Container();

View File

@ -0,0 +1,325 @@
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:form_builder_validators/form_builder_validators.dart';
import 'package:group_list_view/group_list_view.dart';
import 'package:multi_dropdown/multiselect_dropdown.dart';
import 'package:unit2/bloc/rbac/rbac_operations/permission_assignment/permission_assignment_bloc.dart';
import 'package:unit2/model/rbac/permission.dart';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/theme-data.dart/btn-style.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/alerts.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart';
class RbacPermissionAssignmentScreen extends StatelessWidget {
final int id;
const RbacPermissionAssignmentScreen({super.key, required this.id});
@override
Widget build(BuildContext context) {
final parent = context;
Map<String, List<Content>> permissionAssignments = {};
List<RBACPermission> permissions = [];
List<ValueItem> valueItemPermission = [];
List<ValueItem> selectedValueItemPermission = [];
List<RBAC> roles = [];
RBAC? selectedRole;
final formKey = GlobalKey<FormBuilderState>();
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: primary,
title: const Text("Permission Assignment"),
actions: context.watch<PermissionAssignmentBloc>().state
is PermissionAssignmentLoadingScreen ||
context.watch<PermissionAssignmentBloc>().state
is PermissionAssignmentErrorState ||
context.watch<PermissionAssignmentBloc>().state
is PermissionAssignmentAddedState ||
context.watch<PermissionAssignmentBloc>().state
is PermissionAssignmentDeletedState
? []
: [
AddLeading(onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
valueItemPermission = permissions.map((e) {
return ValueItem(
label: "${e.object!.name} - ${e.operation!.name}",
value: e.id.toString());
}).toList();
return AlertDialog(
title: const Text("Add Permission"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "role",
decoration:
normalTextFieldStyle("Role", "Role"),
items: roles.isEmpty
? []
: roles.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? role) {
selectedRole = role;
},
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemPermission =
selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Operations",
padding: const EdgeInsets.all(8),
options: valueItemPermission,
selectionType: SelectionType.multi,
chipConfig: const ChipConfig(
wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle:
const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(primary,
Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemPermission
.isNotEmpty) {
int assignerId = id;
int roleId = selectedRole!.id!;
List<int> opIds =
selectedValueItemPermission
.map((e) {
return int.parse(e.value!);
}).toList();
Navigator.pop(context);
parent
.read<
PermissionAssignmentBloc>()
.add(AddPersmissionAssignment(
assignerId: assignerId,
opsId: opIds,
roleId: roleId));
}
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child:
BlocConsumer<PermissionAssignmentBloc, PermissionAssignmentState>(
listener: (context, state) {
if (state is PermissionAssignmentLoadingScreen) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is PermissionAssignmentErrorState ||
state is PermissionAssignmentLoadedState ||
state is PermissionAssignmentAddedState) {
final progress = ProgressHUD.of(context);
progress!.dismiss();
}
if (state is PermissionAssignmentDeletedState) {
if (state.success) {
successAlert(context, "Delete Successfull!",
"Permission Assignment Deleted Successfully", () {
Navigator.of(context).pop();
context
.read<PermissionAssignmentBloc>()
.add(GetPermissionAssignments());
});
} else {
errorAlert(context, "Delete Failed",
"Permission Assignment Deletion Failed", () {
Navigator.of(context).pop();
context
.read<PermissionAssignmentBloc>()
.add(GetPermissionAssignments());
});
}
}
if (state is PermissionAssignmentAddedState) {
if (state.status['success']) {
successAlert(context, "Add Successfull!",
"Permission Assignment Added Successfully", () {
Navigator.of(context).pop();
context
.read<PermissionAssignmentBloc>()
.add(GetPermissionAssignments());
});
} else {
errorAlert(context, "Adding Failed",
"Permission Assignment Adding Failed", () {
Navigator.of(context).pop();
context
.read<PermissionAssignmentBloc>()
.add(GetPermissionAssignments());
});
}
}
},
builder: (context, state) {
if (state is PermissionAssignmentLoadedState) {
if (state.permissionAssignments.isNotEmpty) {
permissions = state.permissions;
roles = state.roles;
permissionAssignments = {};
for (var permissionAssignment in state.permissionAssignments) {
if (!permissionAssignments.keys.contains(
permissionAssignment.role!.name!.toLowerCase())) {
permissionAssignments.addAll(
{permissionAssignment.role!.name!.toLowerCase(): []});
permissionAssignments[
permissionAssignment.role!.name!.toLowerCase()]!
.add(Content(
id: permissionAssignment.id!,
name:
"${permissionAssignment.permission!.object!.name} - ${permissionAssignment.permission!.operation!.name} "));
} else {
permissionAssignments[
permissionAssignment.role!.name!.toLowerCase()]!
.add(Content(
id: permissionAssignment.id!,
name:
"${permissionAssignment.permission!.object!.name} - ${permissionAssignment.permission!.operation!.name} "));
}
}
return GroupListView(
sectionsCount: permissionAssignments.keys.toList().length,
countOfItemInSection: (int section) {
return permissionAssignments.values
.toList()[section]
.length;
},
itemBuilder: (BuildContext context, IndexPath index) {
return ListTile(
dense: true,
trailing: IconButton(
color: Colors.grey.shade600,
icon: const Icon(Icons.delete),
onPressed: () {
confirmAlert(context, () {
context.read<PermissionAssignmentBloc>().add(
DeletePermissionAssignment(
id: permissionAssignments.values
.toList()[index.section][index.index]
.id));
}, "Delete?", "Confirm Delete?");
},
),
title: Row(
children: [
CircleAvatar(
child: Text("${index.index + 1}",
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(color: Colors.white))),
const SizedBox(
width: 20,
),
Expanded(
child: Text(
permissionAssignments.values
.toList()[index.section][index.index]
.name
.toUpperCase(),
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(color: primary),
),
),
],
),
);
},
separatorBuilder: (context, index) {
return const Divider();
},
groupHeaderBuilder: (BuildContext context, int section) {
return ListTile(
tileColor: Colors.white,
title: Text(
permissionAssignments.keys
.toList()[section]
.toUpperCase(),
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
color: primary, fontWeight: FontWeight.bold),
),
);
},
);
} else {
const EmptyData(
message:
"Permission Assignment available. Please click + to add",
);
}
}
if (state is PermissionAssignmentErrorState) {
return SomethingWentWrong(
message: state.message,
onpressed: () {
context
.read<PermissionAssignmentBloc>()
.add(GetPermissionAssignments());
});
}
return Container();
},
),
),
);
}
}
class Content {
final int id;
final String name;
const Content({required this.id, required this.name});
}

View File

@ -25,6 +25,7 @@ class RbacRoleScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bloc = BlocProvider.of<RoleBloc>(context);
final formKey = GlobalKey<FormBuilderState>();
List<RBAC> roles = [];
return Scaffold(
@ -32,102 +33,274 @@ class RbacRoleScreen extends StatelessWidget {
centerTitle: true,
backgroundColor: primary,
title: const Text("Role Screen"),
actions: [
IconButton(
onPressed: () {
showSearch(
context: context,
delegate: SearchPage(
barTheme: ThemeData(cardColor: primary),
builder: (RBAC rbac) {
return ListTile(
title: Text(rbac.name!),
);
},
filter: (RBAC rbac) {
return [rbac.name];
},
failure: const Center(
child: Text("No Role found :("),
),
items: roles,
searchLabel: "Search Role",
suggestion: const Center(
child: Text("Search role by name"),
)),
);
},
icon: const Icon(Icons.search)),
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Role"),
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"))),
],
),
),
);
});
})
],
actions:
context.watch<RoleBloc>().state is RoleLoadingState ||
context.watch<RoleBloc>().state is RoleErrorState ||
context.watch<RoleBloc>().state is RoleDeletedState? ||
context.watch<RoleBloc>().state is RoleAddedState? ||
context.watch<RoleBloc>().state is RoleUpdatedState
? []
: [
IconButton(
onPressed: () {
showSearch(
context: context,
delegate: SearchPage(
barTheme: ThemeData(cardColor: Colors.white),
builder: (RBAC rbac) {
return Column(
children: [
Container(
width: screenWidth,
decoration: box1(),
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
child: Row(
children: [
Expanded(
child: Row(
children: [
Flexible(
child: Text(rbac.name!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight:
FontWeight
.w500,
color: primary)),
),
],
)),
AppPopupMenu<int>(
offset: const Offset(-10, -10),
elevation: 3,
onSelected: (value) {
if (value == 2) {
showDialog(
context: context,
builder: (BuildContext
context) {
return AlertDialog(
title: const Text(
"Update Role"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize:
MainAxisSize
.min,
children: [
FormBuilderTextField(
initialValue:
rbac.name,
name:
"object_name",
decoration: normalTextFieldStyle(
"Role name *",
"Role name "),
validator: FormBuilderValidators
.required(
errorText:
"This field is required"),
),
const SizedBox(
height: 8,
),
FormBuilderTextField(
initialValue:
rbac.slug,
name: "slug",
decoration:
normalTextFieldStyle(
"Slug ",
"Slug"),
),
const SizedBox(
height: 8,
),
FormBuilderTextField(
initialValue:
rbac.shorthand,
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()) {
Navigator.pop(context);
String
name =
formKey.currentState!.value['object_name'];
String?
slug =
formKey.currentState!.value['slug'];
String?
short =
formKey.currentState!.value['shorthand'];
bloc.add(UpdateRbacRole(
roleId: rbac.id!,
name: name,
slug: slug,
short: short,
createdBy: rbac.createdBy?.id,
updatedBy: id));
Navigator.pop(context);
}
},
child: const Text("Update"))),
],
),
),
);
});
}
if (value == 1) {
confirmAlert(context, () {
Navigator.pop(context);
bloc
.add(DeleteRbacRole(
roleId: rbac.id!));
}, "Delete?",
"Confirm Delete?");
}
},
menuItems: [
popMenuItem(
text: "Update",
value: 2,
icon: Icons.edit),
popMenuItem(
text: "Remove",
value: 1,
icon: Icons.delete),
],
icon: const Icon(
Icons.more_vert,
color: Colors.grey,
),
tooltip: "Options",
),
],
),
),
const SizedBox(
height: 5,
)
],
);
},
filter: (RBAC rbac) {
return [rbac.name];
},
failure: const Center(
child: Text("No Role found :("),
),
items: roles,
searchLabel: "Search Role",
suggestion: const Center(
child: Text("Search role by name"),
)),
);
},
icon: const Icon(Icons.search)),
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Role"),
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),

View File

@ -36,7 +36,7 @@ class RbacRoleAssignment extends StatelessWidget {
centerTitle: true,
backgroundColor: primary,
title: const Text("User Roles Screens"),
actions: [
actions: context.watch<RoleAssignmentBloc>().state is RoleAssignmentLoadingState || context.watch<RoleAssignmentBloc>().state is RoleAssignmentErrorState || context.watch<RoleAssignmentBloc>().state is UserNotExistError || context.watch<RoleAssignmentBloc>().state is RoleAddedState? []: [
AddLeading(onPressed: () {
BuildContext parent = context;
showDialog(
@ -131,13 +131,13 @@ class RbacRoleAssignment extends StatelessWidget {
if (state is AssignedRoleDeletedState) {
if (state.success) {
successAlert(context, "Delete Successfull!",
"Role Module Deleted Successfully", () {
"Role Deleted Successfully", () {
Navigator.of(context).pop();
context.read<RoleAssignmentBloc>().add(LoadAssignedRole());
});
} else {
errorAlert(
context, "Delete Failed", "Role Module Delete Failed", () {
context, "Delete Failed", "Role Deletion Failed", () {
Navigator.of(context).pop();
context.read<RoleAssignmentBloc>().add(LoadAssignedRole());
});

View File

@ -36,7 +36,7 @@ class RbacRoleExtendScreen extends StatelessWidget {
elevation: 0,
backgroundColor: primary,
title: const Text("Role Extend"),
actions: [
actions: context.watch<RoleExtendBloc>().state is RoleExtendLoadingState || context.watch<RoleExtendBloc>().state is RoleExtendErrorState || context.watch<RoleExtendBloc>().state is RoleExtendAddedState || context.watch<RoleExtendBloc>().state is RoleExtendDeletedState? []:[
AddLeading(onPressed: () {
showDialog(
context: NavigationService.navigatorKey.currentState!.context,
@ -49,6 +49,7 @@ class RbacRoleExtendScreen extends StatelessWidget {
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(

View File

@ -34,100 +34,114 @@ class RbacRoleModuleScreen extends StatelessWidget {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
title: const Text("Role Modules Screen"),
actions: [
AddLeading(onPressed: () {
showDialog(
context: NavigationService.navigatorKey.currentState!.context,
builder: (BuildContext context) {
valueItemModules = modules.map((e) {
return ValueItem(label: e.name!, value: e.name);
}).toList();
return AlertDialog(
title: const Text("Add Role Module"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "role",
decoration: normalTextFieldStyle("Role", "Role"),
items: roles.isEmpty
? []
: roles.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? role) {
selectedRole = role;
},
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemModules = selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Modules",
padding: const EdgeInsets.all(8),
options: valueItemModules,
selectionType: SelectionType.multi,
chipConfig:
const ChipConfig(wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle: const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(
primary, Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemModules.isNotEmpty) {
int assignerId = id;
int roleId = selectedRole!.id!;
List<int> modulesId = [];
for (var module in modules) {
selectedValueItemModules
.forEach((element) {
if (element.label.toLowerCase() ==
module.name?.toLowerCase()) {
modulesId.add(module.id!);
title: const Text("Role Module Screen" ),
centerTitle: true,
actions: context.watch<RoleModuleBloc>().state
is RoleModuleLoadingState ||
context.watch<RoleModuleBloc>().state is RoleModuleErrorState ||
context.watch<RoleModuleBloc>().state is RoleModuleAddedState ||
context.watch<RoleModuleBloc>().state is RoleModuleDeletedState
? []
: [
AddLeading(onPressed: () {
showDialog(
context:
NavigationService.navigatorKey.currentState!.context,
builder: (BuildContext context) {
valueItemModules = modules.map((e) {
return ValueItem(label: e.name!, value: e.name);
}).toList();
return AlertDialog(
title: const Text("Add Role Module"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "role",
decoration:
normalTextFieldStyle("Role", "Role"),
items: roles.isEmpty
? []
: roles.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? role) {
selectedRole = role;
},
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemModules =
selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Modules",
padding: const EdgeInsets.all(8),
options: valueItemModules,
selectionType: SelectionType.multi,
chipConfig: const ChipConfig(
wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle:
const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(primary,
Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemModules
.isNotEmpty) {
int assignerId = id;
int roleId = selectedRole!.id!;
List<int> modulesId = [];
for (var module in modules) {
selectedValueItemModules
.forEach((element) {
if (element.label
.toLowerCase() ==
module.name
?.toLowerCase()) {
modulesId.add(module.id!);
}
});
}
Navigator.of(context).pop();
parent.read<RoleModuleBloc>().add(
AddRoleModule(
assignerId: assignerId,
roleId: roleId,
moduleIds: modulesId));
}
});
}
Navigator.of(context).pop();
parent.read<RoleModuleBloc>().add(
AddRoleModule(
assignerId: assignerId,
roleId: roleId,
moduleIds: modulesId));
}
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
@ -156,7 +170,7 @@ class RbacRoleModuleScreen extends StatelessWidget {
});
} else {
errorAlert(
context, "Delete Failed", "Role Module Delete Failed", () {
context, "Delete Failed", "Role Module Deletion Failed", () {
Navigator.of(context).pop();
context.read<RoleModuleBloc>().add(GetRoleModules());
});
@ -258,20 +272,22 @@ class RbacRoleModuleScreen extends StatelessWidget {
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(color: primary,fontWeight: FontWeight.bold),
.copyWith(
color: primary, fontWeight: FontWeight.bold),
),
);
},
);
} else {
return const EmptyData(
message: "No Role available. Please click + to add.");
message: "No Role Module available. Please click + to add.");
}
}
if (state is RoleModuleErrorState) {
return SomethingWentWrong(
message: state.message, onpressed: () {
context.read<RoleModuleBloc>().add(GetRoleModules());
message: state.message,
onpressed: () {
context.read<RoleModuleBloc>().add(GetRoleModules());
});
}
return Container();

View File

@ -0,0 +1,307 @@
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:form_builder_validators/form_builder_validators.dart';
import 'package:group_list_view/group_list_view.dart';
import 'package:multi_dropdown/multiselect_dropdown.dart';
import 'package:unit2/bloc/rbac/rbac_operations/roles_under/roles_under_bloc.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/error_state.dart';
import '../../../model/rbac/rbac.dart';
import '../../../theme-data.dart/btn-style.dart';
import '../../../theme-data.dart/colors.dart';
import '../../../theme-data.dart/form-style.dart';
import '../../../utils/alerts.dart';
import '../../../utils/global_context.dart';
import '../../../widgets/empty_data.dart';
class RbacRoleUnderScreen extends StatelessWidget {
final int id;
const RbacRoleUnderScreen({super.key, required this.id});
@override
Widget build(BuildContext context) {
final parent = context;
Map<String, List<Content>> rolesUnder = {};
List<RBAC> roles = [];
RBAC? selectedRole;
List<ValueItem> valueItemRoles = [];
List<ValueItem> selectedValueItemRoles = [];
final formKey = GlobalKey<FormBuilderState>();
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: primary,
title: const Text("Assignable Roles"),
actions: context.watch<RolesUnderBloc>().state
is RoleUnderLoadingState? ||
context.watch<RolesUnderBloc>().state is RoleUnderErrorState ||
context.watch<RolesUnderBloc>().state
is RoleUnderDeletedState ||
context.watch<RolesUnderBloc>().state is RoleUnderAddedState
? []
: [
AddLeading(onPressed: () {
showDialog(
context:
NavigationService.navigatorKey.currentState!.context,
builder: (BuildContext context) {
valueItemRoles = roles.map((e) {
return ValueItem(label: e.name!, value: e.name);
}).toList();
return AlertDialog(
title: const Text("Add Role Under"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "role",
decoration: normalTextFieldStyle(
"Main Role", "Main Role"),
items: roles.isEmpty
? []
: roles.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? role) {
selectedRole = role;
},
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemRoles = selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Roles Under",
padding: const EdgeInsets.all(8),
options: valueItemRoles,
selectionType: SelectionType.multi,
chipConfig: const ChipConfig(
wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle:
const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(primary,
Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemRoles
.isNotEmpty) {
int assignerId = id;
int roleId = selectedRole!.id!;
List<int> rolesId = [];
for (var role in roles) {
selectedValueItemRoles
.forEach((element) {
if (element.label
.toLowerCase() ==
role.name?.toLowerCase()) {
rolesId.add(role.id!);
}
});
}
Navigator.of(context).pop();
parent.read<RolesUnderBloc>().add(
AddRoleUnder(
roleId: roleId,
roleUnderIds: rolesId));
}
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<RolesUnderBloc, RolesUnderState>(
listener: (context, state) {
if (state is RoleUnderLoadingState) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is RoleUnderLoadedState ||
state is RoleUnderErrorState ||
state is RoleUnderDeletedState ||
state is RoleUnderAddedState) {
final progress = ProgressHUD.of(context);
progress!.dismiss();
}
////Deleted State
if (state is RoleUnderDeletedState) {
if (state.success) {
successAlert(
context, "Delete Successfull!", "Role Deleted Successfully",
() {
Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
} else {
errorAlert(
context, "Delete Failed", "Role Module Delete Failed", () {
Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
}
}
////Added State
if (state is RoleUnderAddedState) {
if (state.response['success']) {
successAlert(
context, "Adding Successfull!", state.response['message'],
() {
Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
} else {
errorAlert(context, "Adding Failed", state.response['message'],
() {
Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
}
}
},
builder: (context, state) {
if (state is RoleUnderLoadedState) {
rolesUnder = {};
roles = state.roles;
if (state.rolesUnder.isNotEmpty) {
for (var roleUnder in state.rolesUnder) {
if (!rolesUnder.keys
.contains(roleUnder.roleUnderMain.name!.toLowerCase())) {
rolesUnder.addAll(
{roleUnder.roleUnderMain.name!.toLowerCase(): []});
rolesUnder[roleUnder.roleUnderMain.name!.toLowerCase()]!
.add(Content(
id: roleUnder.id,
name: roleUnder.roleUnderChild.name!));
} else {
rolesUnder[roleUnder.roleUnderMain.name!.toLowerCase()]!
.add(Content(
id: roleUnder.id,
name: roleUnder.roleUnderChild.name!));
}
}
}
if (state.rolesUnder.isNotEmpty) {
return GroupListView(
sectionsCount: rolesUnder.keys.toList().length,
countOfItemInSection: (int section) {
return rolesUnder.values.toList()[section].length;
},
itemBuilder: (BuildContext context, IndexPath index) {
return ListTile(
trailing: IconButton(
color: Colors.grey.shade500,
icon: const Icon(Icons.delete),
onPressed: () {
confirmAlert(context,(){
context.read<RolesUnderBloc>().add(DeleteRoleUnder(roleUnderId:rolesUnder.values .toList()[index.section][index.index].id));
}, "Delete", "Delete Role?");
},
),
title: Row(
children: [
CircleAvatar(
child: Text("${index.index + 1}",
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(color: Colors.white))),
const SizedBox(
width: 20,
),
Expanded(
child: Text(
rolesUnder.values
.toList()[index.section][index.index]
.name
.toUpperCase(),
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(
fontWeight: FontWeight.w500,
color: primary)),
),
],
),
);
},
separatorBuilder: (context, index) {
return const Divider();
},
groupHeaderBuilder: (BuildContext context, int section) {
return ListTile(
tileColor: Colors.white,
dense: true,
title: Text(
rolesUnder.keys.toList()[section].toUpperCase(),
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
color: primary, fontWeight: FontWeight.bold),
),
);
},
);
} else {
return const EmptyData(
message: "No Role available. Please click + to add.");
}
}
if (state is RoleUnderErrorState) {
return SomethingWentWrong(
message: state.message,
onpressed: () {
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
}
return Container();
},
),
),
);
}
}
class Content {
final int id;
final String name;
const Content({required this.id, required this.name});
}

View File

@ -1,296 +0,0 @@
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:form_builder_validators/form_builder_validators.dart';
import 'package:group_list_view/group_list_view.dart';
import 'package:multi_dropdown/multiselect_dropdown.dart';
import 'package:unit2/bloc/rbac/rbac_operations/roles_under/roles_under_bloc.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/error_state.dart';
import '../../../model/rbac/rbac.dart';
import '../../../theme-data.dart/btn-style.dart';
import '../../../theme-data.dart/colors.dart';
import '../../../theme-data.dart/form-style.dart';
import '../../../utils/alerts.dart';
import '../../../utils/global_context.dart';
import '../../../widgets/empty_data.dart';
class RbacRoleUnderScreen extends StatelessWidget {
final int id;
const RbacRoleUnderScreen({super.key, required this.id});
@override
Widget build(BuildContext context) {
final parent = context;
Map<String, List<Content>> rolesUnder = {};
List<RBAC> roles = [];
RBAC? selectedRole;
List<ValueItem> valueItemRoles = [];
List<ValueItem> selectedValueItemRoles = [];
final formKey = GlobalKey<FormBuilderState>();
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: primary,
title: const Text("Assignable Roles"),
actions: [
AddLeading(onPressed: () {
showDialog(
context: NavigationService.navigatorKey.currentState!.context,
builder: (BuildContext context) {
valueItemRoles = roles.map((e) {
return ValueItem(label: e.name!, value: e.name);
}).toList();
return AlertDialog(
title: const Text("Add Role Under"),
content: FormBuilder(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FormBuilderDropdown<RBAC>(
validator: FormBuilderValidators.required(
errorText: "This field is required"),
name: "role",
decoration: normalTextFieldStyle(
"Main Role", "Main Role"),
items: roles.isEmpty
? []
: roles.map((e) {
return DropdownMenuItem(
value: e, child: Text(e.name!));
}).toList(),
onChanged: (RBAC? role) {
selectedRole = role;
},
),
const SizedBox(
height: 12,
),
MultiSelectDropDown(
onOptionSelected:
(List<ValueItem> selectedOptions) {
selectedValueItemRoles = selectedOptions;
},
borderColor: Colors.grey,
borderWidth: 1,
borderRadius: 5,
hint: "Roles Under",
padding: const EdgeInsets.all(8),
options: valueItemRoles,
selectionType: SelectionType.multi,
chipConfig:
const ChipConfig(wrapType: WrapType.wrap),
dropdownHeight: 300,
optionTextStyle: const TextStyle(fontSize: 16),
selectedOptionIcon:
const Icon(Icons.check_circle),
),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.maxFinite,
child: ElevatedButton(
style: mainBtnStyle(
primary, Colors.transparent, second),
onPressed: () {
if (formKey.currentState!
.saveAndValidate() &&
selectedValueItemRoles.isNotEmpty) {
int assignerId = id;
int roleId = selectedRole!.id!;
List<int> rolesId = [];
for (var role in roles) {
selectedValueItemRoles
.forEach((element) {
if (element.label.toLowerCase() ==
role.name?.toLowerCase()) {
rolesId.add(role.id!);
}
});
}
Navigator.of(context).pop();
parent.read<RolesUnderBloc>().add(
AddRoleUnder(
roleId: roleId,
roleUnderIds: rolesId));
}
},
child: const Text("Submit")),
)
],
)),
);
});
})
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<RolesUnderBloc, RolesUnderState>(
listener: (context, state) {
if (state is RoleUnderLoadingState) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is RoleUnderLoadedState ||
state is RoleUnderErrorState ||
state is RoleUnderDeletedState ||
state is RoleUnderAddedState) {
final progress = ProgressHUD.of(context);
progress!.dismiss();
}
////Deleted State
if (state is RoleUnderDeletedState) {
if (state.success) {
successAlert(context, "Delete Successfull!",
"Role Deleted Successfully", () {
Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
} else {
errorAlert(
context, "Delete Failed", "Role Module Delete Failed", () {
Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
}
}
////Added State
if (state is RoleUnderAddedState) {
if (state.response['success']) {
successAlert(
context, "Adding Successfull!", state.response['message'],
() {
Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
} else {
errorAlert(context, "Adding Failed", state.response['message'],
() {
Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
}
}
},
builder: (context, state) {
if (state is RoleUnderLoadedState) {
rolesUnder = {};
roles = state.roles;
if (state.rolesUnder.isNotEmpty) {
for (var roleUnder in state.rolesUnder) {
if (!rolesUnder.keys
.contains(roleUnder.roleUnderMain.name!.toLowerCase())) {
rolesUnder.addAll(
{roleUnder.roleUnderMain.name!.toLowerCase(): []});
rolesUnder[roleUnder.roleUnderMain.name!.toLowerCase()]!
.add(Content(
id: roleUnder.id,
name: roleUnder.roleUnderChild.name!));
} else {
rolesUnder[roleUnder.roleUnderMain.name!.toLowerCase()]!
.add(Content(
id: roleUnder.id,
name: roleUnder.roleUnderChild.name!));
}
}
}
if (state.rolesUnder.isNotEmpty) {
return GroupListView(
sectionsCount: rolesUnder.keys.toList().length,
countOfItemInSection: (int section) {
return rolesUnder.values.toList()[section].length;
},
itemBuilder: (BuildContext context, IndexPath index) {
return ListTile(
trailing: IconButton(
color: Colors.grey.shade500,
icon: const Icon(Icons.delete),
onPressed: () {
context.read<RolesUnderBloc>().add(DeleteRoleUnder(
roleUnderId: rolesUnder.values
.toList()[index.section][index.index]
.id));
},
),
title: Row(
children: [
CircleAvatar(
child: Text("${index.index + 1}",
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(color: Colors.white))),
const SizedBox(
width: 20,
),
Expanded(
child: Text(
rolesUnder.values
.toList()[index.section][index.index]
.name
.toUpperCase(),
style: Theme.of(context)
.textTheme
.labelLarge!
.copyWith(
fontWeight: FontWeight.w500,
color: primary)
),
),
],
),
);
},
separatorBuilder: (context, index) {
return const Divider();
},
groupHeaderBuilder: (BuildContext context, int section) {
return ListTile(
tileColor: Colors.white,
dense: true,
title: Text(
rolesUnder.keys.toList()[section].toUpperCase(),
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(color: primary,fontWeight: FontWeight.bold),
),
);
},
);
} else {
return const EmptyData(
message: "No Role available. Please click + to add.");
}
}
if (state is RoleUnderErrorState) {
return SomethingWentWrong(
message: state.message, onpressed: () {
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
}
return Container();
},
),
),
);
}
}
class Content {
final int id;
final String name;
const Content({required this.id, required this.name});
}

View File

@ -5,7 +5,6 @@ import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:searchfield/searchfield.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role/role_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/station/station_bloc.dart';
import 'package:unit2/model/rbac/rbac_station.dart';
import 'package:unit2/model/utils/agency.dart';
@ -62,435 +61,469 @@ class _RbacStationScreenState extends State<RbacStationScreen> {
centerTitle: true,
backgroundColor: primary,
title: const Text("Station Screen"),
actions: [
AddLeading(onPressed: () {
BuildContext parent = context;
mainParentStations = [];
mainParent = stations.isEmpty ? true : false;
for (RbacStation station in stations) {
if (station.hierarchyOrderNo == 1) {
mainParentStations.add(station);
}
}
actions: context.watch<StationBloc>().state is StationLoadingState ||
context.watch<StationBloc>().state is StationErrorState ||
context.watch<StationBloc>().state is RbacStationAddedState ||
context.watch<StationBloc>().state is FilterStationState
? []
: [
AddLeading(onPressed: () {
BuildContext parent = context;
mainParentStations = [];
mainParent = stations.isEmpty ? true : false;
for (RbacStation station in stations) {
if (station.hierarchyOrderNo == 1) {
mainParentStations.add(station);
}
}
/////Add new tation
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Station"),
content: SingleChildScrollView(
child: FormBuilder(
key: formKey,
child: StatefulBuilder(builder: (context, setState) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
////is main parent
FormBuilderSwitch(
initialValue: mainParent,
activeColor: second,
onChanged: (value) {
setState(() {
mainParent = !mainParent;
});
},
decoration: normalTextFieldStyle(
"is Main Parent?", 'is Main Parent?'),
name: 'main-parent',
title: Text(mainParent ? "YES" : "NO"),
validator: FormBuilderValidators.required(
errorText: "This field is required"),
),
SizedBox(
height: mainParent ? 0 : 8,
),
//// selected main parent
SizedBox(
child: mainParent == true
? const SizedBox.shrink()
: FormBuilderDropdown<RbacStation>(
decoration: normalTextFieldStyle(
"Main Parent Station",
"Main Parent Station"),
name: "parent-stations",
items: mainParentStations.isEmpty
? []
: mainParentStations.map((e) {
return DropdownMenuItem(
value: e,
child: Text(e.stationName!),
);
}).toList(),
onChanged: (RbacStation? e) {
setState(() {
selectedMainParentStation = e;
parentStations = [];
for (RbacStation station
in stations) {
if (station.mainParentStation ==
selectedMainParentStation!
.id) {
parentStations.add(station);
}
}
parentStations.add(
selectedMainParentStation!);
});
},
validator:
FormBuilderValidators.required(
errorText:
"This field is required"),
),
),
SizedBox(
height: mainParent ? 0 : 8,
),
////parent station
SizedBox(
child: mainParent == true
? const SizedBox.shrink()
: FormBuilderDropdown<RbacStation>(
decoration: normalTextFieldStyle(
"Parent Station", "Parent Station"),
name: "parent-stations",
onChanged: (RbacStation? e) {
setState(() {
selectedParentStation = e;
});
},
items: parentStations.isEmpty
? []
: parentStations.map((e) {
return DropdownMenuItem(
value: e,
child: Text(e.stationName!),
);
}).toList(),
validator:
FormBuilderValidators.required(
errorText:
"This field is required"),
),
),
const SizedBox(
height: 12,
),
////Station Type
SearchField(
itemHeight: 50,
suggestionsDecoration: box1(),
suggestions: stationTypes
.map((StationType stationType) =>
SearchFieldListItem(
stationType.typeName!,
item: stationType,
child: Padding(
padding:
const EdgeInsets.symmetric(
horizontal: 10),
child: ListTile(
title: Text(
stationType.typeName!,
overflow: TextOverflow.visible,
)),
)))
.toList(),
validator: (station) {
if (station!.isEmpty) {
return "This field is required";
}
return null;
},
focusNode: stationTypeFocusNode,
searchInputDecoration:
normalTextFieldStyle("Station Type *", "")
.copyWith(
suffixIcon: GestureDetector(
onTap: () => stationTypeFocusNode.unfocus(),
child: const Icon(Icons.arrow_drop_down),
)),
onSuggestionTap: (position) {
setState(() {
selectedStationType = position.item!;
stationTypeFocusNode.unfocus();
});
},
emptyWidget: EmptyWidget(
title: "Add StationType",
controller: addStationTypeController,
onpressed: () {
setState(() {
StationType stationType = StationType(
id: null,
typeName:
addStationTypeController.text,
color: null,
order: null,
isActive: null,
group: null);
stationTypes.add(stationType);
Navigator.pop(context);
});
}),
),
const SizedBox(
height: 12,
),
////Position title
FormBuilderDropdown(
decoration: normalTextFieldStyle(
"Head Position", "Head Position"),
name: "head-position",
items: positions.map((e) {
return DropdownMenuItem(
value: e,
child: Text(e.title!),
);
}).toList(),
onChanged: (title) {
selectedPositiontitle = title;
},
),
const SizedBox(
height: 12,
),
////is within parent
FormBuilderSwitch(
initialValue: true,
activeColor: second,
onChanged: (value) {
setState(() {
isWithinParent = value!;
});
},
decoration: normalTextFieldStyle(
"Location of the station within this parent?",
'Location of the station within this parent?'),
name: 'isWithinParent',
title: Text(isWithinParent ? "YES" : "NO"),
),
const SizedBox(
height: 12,
),
Row(
//// Station Name
children: [
Flexible(
child: FormBuilderTextField(
validator:
FormBuilderValidators.required(
errorText:
"This Field is required"),
decoration: normalTextFieldStyle(
"Station name", "Station name"),
name: "station-name"),
),
const SizedBox(
width: 12,
),
//// Acronym
Flexible(
child: FormBuilderTextField(
validator:
FormBuilderValidators.required(
errorText:
"This Field is required"),
decoration: normalTextFieldStyle(
"Acronym", "Acronym"),
name: "acronym"),
),
],
),
const SizedBox(
height: 12,
),
FormBuilderTextField(
////Description
decoration: normalTextFieldStyle(
"Station description",
"Station description"),
name: "station-description"),
const SizedBox(
height: 12,
),
Row(
children: [
Flexible(
////Code
child: FormBuilderTextField(
decoration: normalTextFieldStyle(
"Code", "Code"),
name: "code"),
),
const SizedBox(
width: 12,
),
Flexible(
//// Full Code
child: FormBuilderTextField(
decoration: normalTextFieldStyle(
"Full Code", "Full Code"),
name: "fullcode"),
),
],
),
const SizedBox(
height: 12,
),
////is Hospital
FormBuilderSwitch(
initialValue: isHospital,
activeColor: second,
onChanged: (value) {
setState(() {
isHospital = !isHospital;
});
},
decoration:
normalTextFieldStyle("Is Hospital", ''),
name: 'isHospital',
title: Text(isHospital == true ? "YES" : "NO"),
),
const SizedBox(
height: 20,
),
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: mainBtnStyle(
primary, Colors.transparent, second),
onPressed: () {
RbacStation? newStation;
if (formKey.currentState!
.saveAndValidate()) {
String? stationName = formKey
.currentState!
.value['station-name'];
String? acronym = formKey
.currentState!.value['acronym'];
String? code = formKey
.currentState!.value['code'];
String? fullcode = formKey
.currentState!.value['fullcode'];
String? description = formKey
.currentState!
.value['station-description'];
newStation = RbacStation(
id: null,
stationName: stationName,
stationType: selectedStationType,
hierarchyOrderNo: mainParent
? 1
: selectedParentStation!
.hierarchyOrderNo! +
1,
headPosition:
selectedPositiontitle?.title,
governmentAgency:
GovernmentAgency(
agencyid:
selectedAgencyId,
agencyname: null,
agencycatid: null,
privateEntity: null,
contactinfoid: null),
acronym: acronym,
parentStation: mainParent
? null
: selectedParentStation!.id!,
code: code,
fullcode: fullcode,
childStationInfo: null,
islocationUnderParent:
isWithinParent,
mainParentStation: mainParent
? null
: selectedMainParentStation!
.id!,
description: description,
ishospital: isHospital,
isactive: true,
sellingStation: null);
Navigator.pop(context);
rbacStationBloc.add(AddRbacStation(
station: newStation));
}
/////Add new tation
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Add New Station"),
content: SingleChildScrollView(
child: FormBuilder(
key: formKey,
child:
StatefulBuilder(builder: (context, setState) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
////is main parent
FormBuilderSwitch(
initialValue: mainParent,
activeColor: second,
onChanged: (value) {
setState(() {
mainParent = !mainParent;
});
},
child: const Text("Add"))),
],
);
}),
),
),
);
});
}),
////Filter
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text(
"Select agency to filter stations",
textAlign: TextAlign.center,
),
content: SizedBox(
child: // //// Filter Agencies
Padding(
padding: const EdgeInsets.all(8),
child: SearchField(
inputFormatters: [UpperCaseTextFormatter()],
itemHeight: 100,
focusNode: agencyFocusNode,
suggestions: agencies
.map((Agency agency) =>
SearchFieldListItem(agency.name!,
item: agency,
child: ListTile(
title: Text(
agency.name!,
overflow: TextOverflow.visible,
),
)))
.toList(),
searchInputDecoration:
normalTextFieldStyle("Filter", "").copyWith(
suffixIcon: IconButton(
icon: const Icon(Icons.arrow_drop_down),
onPressed: () {
agencyFocusNode.unfocus();
},
)),
onSuggestionTap: (agency) {
agencyFocusNode.unfocus();
selectedAgencyId = agency.item!.id!;
print(selectedAgencyId);
Navigator.pop(context);
rbacStationBloc.add(FilterStation(
agencyId: selectedAgencyId));
},
validator: (agency) {
if (agency!.isEmpty) {
return "This field is required";
}
return null;
},
emptyWidget: const Center(
child: Text("No result found..."),
)),
decoration: normalTextFieldStyle(
"is Main Parent?", 'is Main Parent?'),
name: 'main-parent',
title: Text(mainParent ? "YES" : "NO"),
validator: FormBuilderValidators.required(
errorText: "This field is required"),
),
SizedBox(
height: mainParent ? 0 : 8,
),
//// selected main parent
SizedBox(
child: mainParent == true
? const SizedBox.shrink()
: FormBuilderDropdown<RbacStation>(
decoration: normalTextFieldStyle(
"Main Parent Station",
"Main Parent Station"),
name: "parent-stations",
items: mainParentStations.isEmpty
? []
: mainParentStations.map((e) {
return DropdownMenuItem(
value: e,
child: Text(
e.stationName!),
);
}).toList(),
onChanged: (RbacStation? e) {
setState(() {
selectedMainParentStation = e;
parentStations = [];
for (RbacStation station
in stations) {
if (station
.mainParentStation ==
selectedMainParentStation!
.id) {
parentStations
.add(station);
}
}
parentStations.add(
selectedMainParentStation!);
});
},
validator: FormBuilderValidators
.required(
errorText:
"This field is required"),
),
),
SizedBox(
height: mainParent ? 0 : 8,
),
////parent station
SizedBox(
child: mainParent == true
? const SizedBox.shrink()
: FormBuilderDropdown<RbacStation>(
decoration: normalTextFieldStyle(
"Parent Station",
"Parent Station"),
name: "parent-stations",
onChanged: (RbacStation? e) {
setState(() {
selectedParentStation = e;
});
},
items: parentStations.isEmpty
? []
: parentStations.map((e) {
return DropdownMenuItem(
value: e,
child: Text(
e.stationName!),
);
}).toList(),
validator: FormBuilderValidators
.required(
errorText:
"This field is required"),
),
),
const SizedBox(
height: 12,
),
////Station Type
SearchField(
itemHeight: 50,
suggestionsDecoration:
searchFieldDecoration(),
suggestions: stationTypes
.map((StationType stationType) =>
SearchFieldListItem(
stationType.typeName!,
item: stationType,
child: Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10),
child: ListTile(
title: Text(
stationType.typeName!,
overflow:
TextOverflow.visible,
)),
)))
.toList(),
validator: (station) {
if (station!.isEmpty) {
return "This field is required";
}
return null;
},
focusNode: stationTypeFocusNode,
searchInputDecoration:
normalTextFieldStyle(
"Station Type *", "")
.copyWith(
suffixIcon: GestureDetector(
onTap: () =>
stationTypeFocusNode.unfocus(),
child:
const Icon(Icons.arrow_drop_down),
)),
onSuggestionTap: (position) {
setState(() {
selectedStationType = position.item!;
stationTypeFocusNode.unfocus();
});
},
emptyWidget: EmptyWidget(
title: "Add StationType",
controller: addStationTypeController,
onpressed: () {
setState(() {
StationType stationType =
StationType(
id: null,
typeName:
addStationTypeController
.text,
color: null,
order: null,
isActive: null,
group: null);
stationTypes.add(stationType);
Navigator.pop(context);
});
}),
),
const SizedBox(
height: 12,
),
////Position title
FormBuilderDropdown(
decoration: normalTextFieldStyle(
"Head Position", "Head Position"),
name: "head-position",
items: positions.map((e) {
return DropdownMenuItem(
value: e,
child: Text(e.title!),
);
}).toList(),
onChanged: (title) {
selectedPositiontitle = title;
},
),
const SizedBox(
height: 12,
),
////is within parent
FormBuilderSwitch(
initialValue: true,
activeColor: second,
onChanged: (value) {
setState(() {
isWithinParent = value!;
});
},
decoration: normalTextFieldStyle(
"Location of the station within this parent?",
'Location of the station within this parent?'),
name: 'isWithinParent',
title:
Text(isWithinParent ? "YES" : "NO"),
),
const SizedBox(
height: 12,
),
Row(
//// Station Name
children: [
Flexible(
child: FormBuilderTextField(
validator: FormBuilderValidators
.required(
errorText:
"This Field is required"),
decoration: normalTextFieldStyle(
"Station name",
"Station name"),
name: "station-name"),
),
const SizedBox(
width: 12,
),
//// Acronym
Flexible(
child: FormBuilderTextField(
validator: FormBuilderValidators
.required(
errorText:
"This Field is required"),
decoration: normalTextFieldStyle(
"Acronym", "Acronym"),
name: "acronym"),
),
],
),
const SizedBox(
height: 12,
),
FormBuilderTextField(
////Description
decoration: normalTextFieldStyle(
"Station description",
"Station description"),
name: "station-description"),
const SizedBox(
height: 12,
),
Row(
children: [
Flexible(
////Code
child: FormBuilderTextField(
decoration: normalTextFieldStyle(
"Code", "Code"),
name: "code"),
),
const SizedBox(
width: 12,
),
Flexible(
//// Full Code
child: FormBuilderTextField(
decoration: normalTextFieldStyle(
"Full Code", "Full Code"),
name: "fullcode"),
),
],
),
const SizedBox(
height: 12,
),
////is Hospital
FormBuilderSwitch(
initialValue: isHospital,
activeColor: second,
onChanged: (value) {
setState(() {
isHospital = !isHospital;
});
},
decoration: normalTextFieldStyle(
"Is Hospital", ''),
name: 'isHospital',
title: Text(
isHospital == true ? "YES" : "NO"),
),
const SizedBox(
height: 20,
),
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: mainBtnStyle(primary,
Colors.transparent, second),
onPressed: () {
RbacStation? newStation;
if (formKey.currentState!
.saveAndValidate()) {
String? stationName = formKey
.currentState!
.value['station-name'];
String? acronym = formKey
.currentState!
.value['acronym'];
String? code = formKey
.currentState!
.value['code'];
String? fullcode = formKey
.currentState!
.value['fullcode'];
String? description =
formKey.currentState!.value[
'station-description'];
newStation = RbacStation(
id: null,
stationName: stationName,
stationType:
selectedStationType,
hierarchyOrderNo: mainParent
? 1
: selectedParentStation!
.hierarchyOrderNo! +
1,
headPosition:
selectedPositiontitle
?.title,
governmentAgency:
GovernmentAgency(
agencyid:
selectedAgencyId,
agencyname: null,
agencycatid: null,
privateEntity: null,
contactinfoid:
null),
acronym: acronym,
parentStation:
mainParent
? null
: selectedParentStation!
.id!,
code: code,
fullcode: fullcode,
childStationInfo: null,
islocationUnderParent:
isWithinParent,
mainParentStation: mainParent
? null
: selectedMainParentStation!
.id!,
description: description,
ishospital: isHospital,
isactive: true,
sellingStation: null);
Navigator.pop(context);
rbacStationBloc.add(
AddRbacStation(
station: newStation));
}
},
child: const Text("Add"))),
],
);
}),
),
),
),
);
});
},
icon: const Icon(Icons.filter_list))
],
);
});
}),
////Filter
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text(
"Select agency to filter stations",
textAlign: TextAlign.center,
),
content: SizedBox(
child: // //// Filter Agencies
Padding(
padding: const EdgeInsets.all(8),
child: SearchField(
inputFormatters: [
UpperCaseTextFormatter()
],
itemHeight: 100,
focusNode: agencyFocusNode,
suggestions: agencies
.map((Agency agency) =>
SearchFieldListItem(agency.name!,
item: agency,
child: ListTile(
title: Text(
agency.name!,
overflow:
TextOverflow.visible,
),
)))
.toList(),
searchInputDecoration:
normalTextFieldStyle("Filter", "")
.copyWith(
suffixIcon: IconButton(
icon: const Icon(Icons.arrow_drop_down),
onPressed: () {
agencyFocusNode.unfocus();
},
)),
onSuggestionTap: (agency) {
agencyFocusNode.unfocus();
selectedAgencyId = agency.item!.id!;
print(selectedAgencyId);
Navigator.pop(context);
rbacStationBloc.add(FilterStation(
agencyId: selectedAgencyId));
},
validator: (agency) {
if (agency!.isEmpty) {
return "This field is required";
}
return null;
},
emptyWidget: const Center(
child: Text("No result found..."),
)),
),
),
);
});
},
icon: const Icon(Icons.filter_list))
],
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
@ -642,7 +675,7 @@ class _RbacStationScreenState extends State<RbacStationScreen> {
boxShadow: []),
padding:
const EdgeInsets
.only(
.only(
left: 30),
child: Row(
children: [
@ -651,7 +684,8 @@ class _RbacStationScreenState extends State<RbacStationScreen> {
children: [
Padding(
padding:
const EdgeInsets.all(
const EdgeInsets
.all(
6),
child:
Text(
@ -719,7 +753,7 @@ class _RbacStationScreenState extends State<RbacStationScreen> {
box1()
.copyWith(boxShadow: []),
padding: const EdgeInsets
.only(
.only(
left:
50),
child:
@ -872,7 +906,9 @@ class _RbacStationScreenState extends State<RbacStationScreen> {
return SomethingWentWrong(
message: state.message,
onpressed: () {
context.read<StationBloc>().add(GetStations(agencyId: selectedAgencyId));
context
.read<StationBloc>()
.add(GetStations(agencyId: selectedAgencyId));
});
}

View File

@ -6,7 +6,6 @@ import 'package:flutter_svg/svg.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:intl/intl.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:signature/signature.dart';
import 'package:unit2/model/login_data/user_info/user_data.dart';
import 'package:unit2/screens/unit2/basic-info/components/qr_image.dart';
import 'package:unit2/theme-data.dart/btn-style.dart';
@ -46,45 +45,45 @@ class BasicInfo extends StatelessWidget {
alignment: Alignment.center,
children: [
const CoverImage(),
// Positioned(
// top: blockSizeVertical * 15.5,
// child: Stack(
// alignment: Alignment.center,
// children: [
// CachedNetworkImage(
// imageUrl: fileUrl,
// imageBuilder: (context, imageProvider) =>
// Container(
// width: 160,
// height: 160,
// decoration: BoxDecoration(
// border: Border.all(
// color: Colors.black26, width: 3),
// shape: BoxShape.circle,
// image: DecorationImage(
// image: imageProvider,
// fit: BoxFit.cover),
// ),
// ),
// placeholder: (context, url) =>
// const CircularProgressIndicator(),
// errorWidget: (context, url, error) =>
// Container(
// width: 160,
// height: 160,
// decoration: BoxDecoration(
// border: Border.all(
// color: Colors.white, width: 3),
// shape: BoxShape.circle,
// ),
// child: SvgPicture.asset(
// 'assets/svgs/male.svg',
// ),
// ),
// ),
// ],
// ),
// ),
Positioned(
top: blockSizeVertical * 15.5,
child: Stack(
alignment: Alignment.center,
children: [
CachedNetworkImage(
imageUrl: fileUrl,
imageBuilder: (context, imageProvider) =>
Container(
width: 160,
height: 160,
decoration: BoxDecoration(
border: Border.all(
color: Colors.black26, width: 3),
shape: BoxShape.circle,
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover),
),
),
placeholder: (context, url) =>
const CircularProgressIndicator(),
errorWidget: (context, url, error) =>
Container(
width: 160,
height: 160,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white, width: 3),
shape: BoxShape.circle,
),
child: SvgPicture.asset(
'assets/svgs/male.svg',
),
),
),
],
),
),
Positioned(
top: 10,
left: 20,
@ -137,13 +136,14 @@ class BuildInformation extends StatelessWidget {
@override
Widget build(BuildContext context) {
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
globalFistname = globalFistname ?? userData.user!.login!.user!.firstName!.toUpperCase();
globalLastname =globalLastname ?? userData.user!.login!.user!.lastName!.toUpperCase();
globalMiddleName = globalMiddleName == null
? (userData.employeeInfo == null
globalFistname =
globalFistname ?? userData.employeeInfo!.profile!.firstName!.toUpperCase();
globalLastname =
globalLastname ?? userData.employeeInfo!.profile!.lastName!.toUpperCase();
globalMiddleName = globalMiddleName ??
(userData.employeeInfo == null
? ''
: userData.employeeInfo!.profile?.middleName?.toUpperCase())
: '';
: userData.employeeInfo!.profile?.middleName?.toUpperCase());
globalSex = globalSex ?? userData.employeeInfo!.profile!.sex!.toUpperCase();
globalBday = globalBday ?? userData.employeeInfo!.profile!.birthdate;
final uuid = userData.employeeInfo!.uuid;

View File

@ -10,6 +10,7 @@ import 'package:unit2/bloc/rbac/rbac_operations/module_objects/module_objects_bl
import 'package:unit2/bloc/rbac/rbac_operations/object/object_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/operation/operation_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/permission/permission_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/permission_assignment/permission_assignment_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role/role_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role_extend/role_extend_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role_module/role_module_bloc.dart';
@ -21,10 +22,11 @@ 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';
import 'package:unit2/screens/superadmin/permission/permission_screen.dart';
import 'package:unit2/screens/superadmin/permission_assignment/permission_assignment_screen.dart';
import 'package:unit2/screens/superadmin/role/role_screen.dart';
import 'package:unit2/screens/superadmin/role_assignment.dart/role_assignment_screen.dart';
import 'package:unit2/screens/superadmin/role_extend/role_extend_screen.dart';
import 'package:unit2/screens/superadmin/roles_under/roles_under_screen.dart';
import 'package:unit2/screens/superadmin/roles_under/assignable_roles.dart';
import 'package:unit2/screens/superadmin/stations/stations_screen.dart';
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
import 'package:unit2/theme-data.dart/btn-style.dart';
@ -77,7 +79,7 @@ class SuperAdminMenu extends StatelessWidget {
object.moduleName == 'superadmin'
? CardLabel(
icon: iconGenerator(name: object.object.name!),
title: object.object.name!,
title: object.object.name!.toLowerCase() == 'role based access control'? 'RBAC': object.object.name!,
ontap: () {
if (object.object.name == 'Role') {
Navigator.push(context, MaterialPageRoute(
@ -196,7 +198,21 @@ class SuperAdminMenu extends StatelessWidget {
);
}));
}
if(object.object.name == 'Role Based Access Control'){
Navigator.pushNamed(context, '/rbac');
}
if(object.object.name == 'Permission Assignment'){
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return BlocProvider(
create: (context) =>
PermissionAssignmentBloc()..add(GetPermissionAssignments()),
child: RbacPermissionAssignmentScreen(
id: id,
),
);
}));
}
if (object.object.name == 'Station') {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {

View File

@ -18,9 +18,9 @@ class _MenuScreenState extends State<MenuScreen> {
@override
Widget build(BuildContext context) {
final String firstName =globalFistname??
widget.userData!.user!.login!.user!.firstName!.toUpperCase();
widget.userData!.employeeInfo!.profile!.firstName!.toUpperCase();
final String lastname = globalLastname??
widget.userData!.user!.login!.user!.lastName!.toUpperCase();
widget.userData!.employeeInfo!.profile!.lastName!.toUpperCase();
return Drawer(
child: SizedBox(
height: screenHeight,

View File

@ -1,6 +1,8 @@
import 'dart:async';
import 'dart:io';
import 'package:better_open_file/better_open_file.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:easy_app_installer/easy_app_installer.dart';
import 'package:flutter/material.dart';
@ -9,20 +11,19 @@ import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_svg/svg.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:unit2/model/login_data/version_info.dart';
import 'package:unit2/screens/unit2/login/components/showAlert.dart';
import 'package:unit2/theme-data.dart/btn-style.dart';
import '../../../../bloc/user/user_bloc.dart';
import '../../../../theme-data.dart/colors.dart';
import '../../../../utils/cpu_architecture.dart';
import '../../../../utils/text_container.dart';
import '../../../../widgets/wave.dart';
class Update extends StatefulWidget {
final String apkVersion;
final String currenVersion;
final VersionInfo versionInfo;
const Update(
{super.key, required this.apkVersion, required this.currenVersion});
{super.key, required this.apkVersion, required this.versionInfo});
@override
State<Update> createState() => _UpdateState();
@ -74,14 +75,14 @@ class _UpdateState extends State<Update> {
],
),
const SizedBox(
height: 10,
height: 25,
),
RichText(
textAlign: TextAlign.justify,
text: TextSpan(
text: 'Your app version ',
style: const TextStyle(
fontSize: 16,
fontSize: 14,
color: Colors.black,
),
children: <TextSpan>[
@ -95,7 +96,7 @@ class _UpdateState extends State<Update> {
" did not match with the latest version ",
style: TextStyle(color: Colors.black)),
TextSpan(
text: widget.currenVersion.toString(),
text: widget.versionInfo.versionInfo,
style: const TextStyle(
color: primary,
fontWeight: FontWeight.bold)),
@ -105,12 +106,12 @@ class _UpdateState extends State<Update> {
style: TextStyle(color: Colors.black)),
])),
const SizedBox(
height: 12.0,
height: 25,
),
Container(
child: downloading
? FittedBox(
child: Text(
child: Text(
'Downloading application $progressRating%',
textAlign: TextAlign.center,
style: Theme.of(context)
@ -130,17 +131,22 @@ class _UpdateState extends State<Update> {
icon: const Icon(Icons.download),
style: mainBtnStyle(
primary, Colors.transparent, second),
onPressed: () async {
final progress = ProgressHUD.of(context);
progress?.showWithText(
'Please wait...',
);
setState(() {
downloading = true;
progressRating = '0';
});
await openFile();
},
onPressed: () async {
setState(() {
downloading = true;
progressRating = '0';
});
try {
await openFile();
} catch (e) {
showAlert(context, () {
setState(() {
downloading = false;
progressRating = '0';
});
});
}
},
label: const Text(
"Download Latest App Version.")),
),
@ -168,9 +174,9 @@ class _UpdateState extends State<Update> {
Future<void> openFile() async {
try {
final filePath = await downloadFile();
await openAPK(filePath);
await OpenFile.open(filePath);
} catch (e) {
print(e.toString());
throw e.toString();
}
}
@ -181,16 +187,36 @@ class _UpdateState extends State<Update> {
}
}
Future<String> downloadFile() async {
final progress = ProgressHUD.of(context);
Future<String> getCPUArchitecture() async {
String downloadURL = "";
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
AndroidDeviceInfo androidDeviceInfo = await deviceInfoPlugin.androidInfo;
try{
List<String> cpuArchitecture = androidDeviceInfo.supportedAbis;
if (cpuArchitecture.first == 'arm64-v8a') {
downloadURL = widget.versionInfo.arm64v8aDownloadUrl!;
}
else if (cpuArchitecture.first == 'armeabi-v7a') {
downloadURL = widget.versionInfo.armeabiv7aDownloadUrl!;
} else {
downloadURL = widget.versionInfo.x8664DownloadUrl!;
}
print(downloadURL);
}catch(e){
throw e.toString();
}
return downloadURL;
}
Future<String?> downloadFile() async {
final appStorage = await getApplicationDocumentsDirectory();
String? appDir;
try {
String url = await getCPUArchitecture();
final response = await dio.download(url, '${appStorage.path}/uniT.apk',
deleteOnError: true,
options: Options(
receiveTimeout: 20000,
sendTimeout: 20000,
receiveDataWhenStatusError: true,
responseType: ResponseType.bytes,
followRedirects: false,
@ -202,47 +228,24 @@ class _UpdateState extends State<Update> {
downloading = true;
});
if (progressRating == '100') {
final progress = ProgressHUD.of(context);
progress!.dismiss();
setState(() {
downloading = false;
isDownloaded = true;
});
}
appDir = '${appStorage.path}/uniT.apk';
});
} on TimeoutException catch (_) {
progress!.dismiss();
showAlert(context, () {
setState(() {
downloading = false;
});
});
throw TimeoutException(timeoutError);
} on SocketException catch (_) {
progress!.dismiss();
showAlert(context, () {
setState(() {
downloading = false;
});
});
throw const SocketException(timeoutError);
} on DioError catch (_) {
progress!.dismiss();
showAlert(context, () {
setState(() {
downloading = false;
});
});
throw TimeoutException(timeoutError);
} catch (_) {
progress!.dismiss();
showAlert(context, () {
setState(() {
downloading = false;
});
});
throw TimeoutException(timeoutError);
} on TimeoutException catch (e) {
throw e.toString();
} on SocketException catch (e) {
throw e.toString();
} on Error catch (e) {
throw e.toString();
} catch (e) {
throw e.toString();
}
return '${appStorage.path}/uniT.apk';
return appDir!;
}
}

View File

@ -108,7 +108,7 @@ class _UniT2LoginState extends State<UniT2Login> {
}, builder: (context, state) {
if (state is VersionLoaded) {
return Builder(builder: (context) {
if (state.versionInfo?.version != state.apkVersion) {
if (state.versionInfo?.id == state.apkVersion) {
return SizedBox(
child: SingleChildScrollView(
child: Stack(
@ -355,7 +355,7 @@ class _UniT2LoginState extends State<UniT2Login> {
//New update available
return Update(
apkVersion: state.apkVersion!,
currenVersion: state.versionInfo!.version!,
versionInfo: state.versionInfo!,
);
}
});

View File

@ -171,7 +171,7 @@ class EstPointPersonStationScreen extends StatelessWidget {
////Station Type
SearchField(
itemHeight: 50,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: stationTypes
.map((StationType stationType) =>
SearchFieldListItem(

View File

@ -1,5 +1,6 @@
import 'package:assets_audio_player/assets_audio_player.dart';
import 'package:audioplayers/audioplayers.dart';
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:cool_alert/cool_alert.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@ -35,13 +36,13 @@ class _QRCodeScannerState extends State<QRCodeScanner> {
player = AudioPlayer();
super.initState();
}
@override
void dispose() {
player?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -73,83 +74,86 @@ class _QRCodeScannerState extends State<QRCodeScanner> {
progress!.dismiss();
}
if (state is ScanSuccess) {
Future.delayed(const Duration(seconds: 1), () async{
await player?.play(AssetSource("success.mp3"));
Future.delayed(const Duration(seconds: 1), () async {
await player?.play(AssetSource("success.mp3"));
});
context.read<PassCheckBloc>().add(ScanQr(token: state.token));
}
if (state is QRInvalid) {
Future.delayed(const Duration(seconds: 1), ()async {
Future.delayed(const Duration(seconds: 1), () async {
await player?.play(AssetSource("invalid.mp3"));
});
context.read<PassCheckBloc>().add(ScanQr(token: state.token));
}
if (state is ScanFailed) {
Future.delayed(const Duration(seconds: 1), ()async {
await player?.play(AssetSource("fail.mp3"));
Future.delayed(const Duration(seconds: 1), () async {
await player?.play(AssetSource("fail.mp3"));
});
context.read<PassCheckBloc>().add(ScanQr(token: state.token));
}
if (state is IncomingScanState) {
CoolAlert.show(
barrierDismissible: false,
context: context,
type: CoolAlertType.loading,
text: "Enter Temperature",
widget: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: FormBuilder(
key: formKey,
child: Column(
children: [
const SizedBox(
height: 24,
AwesomeDialog(
dismissOnBackKeyPress: false,
context: context,
dialogType: DialogType.info,
dismissOnTouchOutside: false,
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
child: FormBuilder(
key: formKey,
child: Column(
children: [
const Text("Enter Temperature",style: TextStyle(color: Colors.black),),
const SizedBox(
height: 24,
),
FormBuilderTextField(
keyboardType: TextInputType.number,
name: "temp",
decoration:
normalTextFieldStyle("Temperature", ""),
validator: numericRequired),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.infinity,
child: ElevatedButton(
style: mainBtnStyle(
primary, Colors.transparent, second),
child: const Text(submit),
onPressed: () {
if (formKey.currentState!.saveAndValidate()) {
double temperature = double.parse(
formKey.currentState!.value['temp']);
context.read<PassCheckBloc>().add(
PerformIncomingPostLog(
temp: temperature));
Navigator.of(context).pop();
}
},
),
FormBuilderTextField(
keyboardType: TextInputType.number,
name: "temp",
decoration:
normalTextFieldStyle("Temperature", ""),
validator: numericRequired),
const SizedBox(
height: 12,
),
SizedBox(
height: 50,
width: double.infinity,
child: ElevatedButton(
style: mainBtnStyle(
primary, Colors.transparent, second),
child: const Text(submit),
onPressed: () {
if (formKey.currentState!.saveAndValidate()) {
double temperature = double.parse(
formKey.currentState!.value['temp']);
context.read<PassCheckBloc>().add(
PerformIncomingPostLog(
temp: temperature));
Navigator.of(context).pop();
}
},
),
)
],
)),
));
)
],
)),
),
).show();
}
if (state is OutGoingScanState) {
CoolAlert.show(
barrierDismissible: false,
context: context,
type: CoolAlertType.loading,
text: "Enter Destination",
widget: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
AwesomeDialog(
dismissOnBackKeyPress: false,
context: context,
dialogType: DialogType.info,
dismissOnTouchOutside: false,
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24,vertical: 24),
child: FormBuilder(
key: formKey,
child: Column(
children: [
const Text("Enter Destination"),
const SizedBox(
height: 24,
),
@ -185,7 +189,8 @@ class _QRCodeScannerState extends State<QRCodeScanner> {
)
],
)),
));
)).show();
}
},
builder: (context, state) {
@ -302,28 +307,56 @@ class _QRCodeScannerState extends State<QRCodeScanner> {
children: [
SelectedState(
//TODO add api data
title: state.roleIdRoleName.roleName.toLowerCase() == "41" ||
state.roleIdRoleName.roleName.toLowerCase() == 'qr code scanner' ||
state.roleIdRoleName.roleName.toLowerCase() == 'office/branch chief' ||
state.roleIdRoleName.roleName.toLowerCase() == 'registration in-charge'
title: state.roleIdRoleName.roleName
.toLowerCase() ==
"41" ||
state.roleIdRoleName.roleName
.toLowerCase() ==
'qr code scanner' ||
state.roleIdRoleName.roleName
.toLowerCase() ==
'office/branch chief' ||
state.roleIdRoleName.roleName
.toLowerCase() ==
'registration in-charge'
? state.assignedArea.stationName
: state.roleIdRoleName.roleName.toLowerCase() == 'barangay chairperson'
: state.roleIdRoleName.roleName
.toLowerCase() ==
'barangay chairperson'
? state.assignedArea.brgydesc
: state.roleIdRoleName.roleName.toLowerCase() == 'purok president'
: state.roleIdRoleName.roleName
.toLowerCase() ==
'purok president'
? state.assignedArea.purokdesc
: state.roleIdRoleName.roleName.toLowerCase() == 'establishment point-person'
: state.roleIdRoleName.roleName
.toLowerCase() ==
'establishment point-person'
? "Agency"
: "",
subtitle: state.roleIdRoleName.roleName.toLowerCase() == "41" ||
state.roleIdRoleName.roleName.toLowerCase() == 'qr code scanner' ||
state.roleIdRoleName.roleName.toLowerCase() == 'office/branch chief' ||
state.roleIdRoleName.roleName.toLowerCase() == 'registration in-charge'
subtitle: state.roleIdRoleName.roleName
.toLowerCase() ==
"41" ||
state.roleIdRoleName.roleName
.toLowerCase() ==
'qr code scanner' ||
state.roleIdRoleName.roleName
.toLowerCase() ==
'office/branch chief' ||
state.roleIdRoleName.roleName
.toLowerCase() ==
'registration in-charge'
? "Station"
: state.roleIdRoleName.roleName.toLowerCase() == 'barangay chairperson'
: state.roleIdRoleName.roleName
.toLowerCase() ==
'barangay chairperson'
? "Barangay"
: state.roleIdRoleName.roleName.toLowerCase() == 'purok president'
: state.roleIdRoleName.roleName
.toLowerCase() ==
'purok president'
? "Purok"
: state.roleIdRoleName.roleName.toLowerCase() == 'establishment point-person'
: state.roleIdRoleName.roleName
.toLowerCase() ==
'establishment point-person'
? "Agency"
: "",
),

View File

@ -222,7 +222,7 @@ class _RBACScreenState extends State<RBACScreen> {
builder: (context, setState) {
return SearchField(
itemHeight: 40,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.role
.map((RBAC role) =>
SearchFieldListItem(
@ -305,7 +305,7 @@ class _RBACScreenState extends State<RBACScreen> {
builder: (context, setState) {
return SearchField(
itemHeight: 40,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.modules
.map((RBAC module) =>
SearchFieldListItem(
@ -602,7 +602,7 @@ class _RBACScreenState extends State<RBACScreen> {
),
SearchField(
itemHeight: 40,
suggestionsDecoration: box1(),
suggestionsDecoration: searchFieldDecoration(),
suggestions: state.objects
.map((RBAC object) => SearchFieldListItem(object.name!,
item: object,

View File

@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:unit2/screens/profile/components/other_information/org_membership/add_modal.dart';
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import 'package:unit2/utils/urls.dart';
@ -10,17 +9,15 @@ import 'package:http/http.dart' as http;
class AgencyServices {
static final AgencyServices _instance = AgencyServices();
static AgencyServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientSecret
};
String path = Url.instance.agencies();
Future<List<Agency>> getAgencies() async {
List<Agency> agencies = [];
String path = Url.instance.agencies();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.getRequest(path: path, headers: headers, param: {});
@ -38,34 +35,30 @@ class AgencyServices {
}
return agencies;
}
Future<Map<dynamic,dynamic>>add({required Agency agency})async{
Map<dynamic, dynamic> statusResponse = {};
String path = Url.instance.postAgencies();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Future<Map<dynamic, dynamic>> add({required Agency agency}) async {
Map<dynamic, dynamic> statusResponse = {};
Map body = {
"name":agency.name,
"category_id":agency.category!.id,
"private_entity":agency.privateEntity,
"contact_info":null,
"name": agency.name,
"category_id": agency.category!.id,
"private_entity": agency.privateEntity,
"contact_info": null,
};
try{
http.Response response = await Request.instance.postRequest(param: {},path: path, body: body,headers: headers);
if(response.statusCode == 201){
try {
http.Response response = await Request.instance
.postRequest(param: {}, path: path, body: body, headers: headers);
if (response.statusCode == 201) {
Map data = jsonDecode(response.body);
statusResponse = data;
} else {
Map data = jsonDecode(response.body);
statusResponse = data;
}else{
Map data = jsonDecode(response.body);
String message = data['message'];
statusResponse.addAll({'message': message});
statusResponse.addAll(
{'success': false},
);
}
}catch(e){
} catch (e) {
throw e.toString();
}
return statusResponse;

View File

@ -1,24 +1,22 @@
import 'dart:convert';
import 'package:unit2/model/profile/assigned_area.dart';
import 'package:unit2/utils/global.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";
String path = Url.instance.getAssignAreas();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientSecret
};
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(),
};
@ -39,20 +37,18 @@ class RbacAssignedAreaServices {
}
return userAssignedAreas;
}
Future<bool> deleteAssignedArea({required int areaId}) async {
Future<bool> deleteAssignedArea({required int areaId}) async {
bool success = false;
String path = "${Url.instance.getAssignAreas()}$areaId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
http.Response response = await Request.instance.deleteRequest(
path: "${path + areaId.toString()}/",
headers: headers,
body: {},
param: {});
if (response.statusCode == 200) {
success = true;
}else{
} else {
success = false;
}
} catch (e) {
@ -60,28 +56,30 @@ class RbacAssignedAreaServices {
}
return success;
}
Future<Map<dynamic, dynamic>> add ({required int userId, required int roleId, required int areaTypeId, required String areaId}) async{
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<dynamic, dynamic>? responseStatus = {};
Future<Map<dynamic, dynamic>> add(
{required int userId,
required int roleId,
required int areaTypeId,
required String areaId}) async {
Map<dynamic, dynamic>? responseStatus = {};
Map body = {
"user_id":userId,
"role_id":roleId,
"assigned_areas": [{"areatypeid":areaTypeId,"areaid":areaId}]
"user_id": userId,
"role_id": roleId,
"assigned_areas": [
{"areatypeid": areaTypeId, "areaid": areaId}
]
};
try{
http.Response response = await Request.instance.postRequest(path: path, headers: headers, body: body, param: {});
if(response.statusCode == 201){
Map data = jsonDecode(response.body);
try {
http.Response response = await Request.instance
.postRequest(path: path, headers: headers, body: body, param: {});
if (response.statusCode == 201) {
Map data = jsonDecode(response.body);
responseStatus = data;
} else {
responseStatus.addAll({'success': false});
}
}catch(e){
} catch (e) {
throw e.toString();
}
return responseStatus;

View File

@ -1,7 +1,6 @@
import 'dart:convert';
import 'package:unit2/model/login_data/user_info/module.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/utils/global.dart';
import '../../../model/rbac/rbac_rbac.dart';
import '../../../utils/request.dart';
import '../../../utils/urls.dart';
@ -10,16 +9,14 @@ class RbacModuleObjectsServices {
static final RbacModuleObjectsServices _instance =
RbacModuleObjectsServices();
static RbacModuleObjectsServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<ModuleObjects>> getModuleObjects() async {
List<ModuleObjects> moduleObjects = [];
String path = Url.instance.getModuleObjects();
Map<String, String> headers = {
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
'X-Client-Secret':xClientSecret
};
String path = Url.instance.getModuleObjects();
Future<List<ModuleObjects>> getModuleObjects() async {
List<ModuleObjects> moduleObjects = [];
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
@ -38,19 +35,12 @@ class RbacModuleObjectsServices {
return moduleObjects;
}
////Add
Future<Map<dynamic, dynamic>> add({
required int assignerId,
required int? moduleId,
required List<int> objectsId,
}) async {
String path = Url.instance.getModuleObjects();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map body = {
"module_id": moduleId,
"objects": objectsId,
@ -76,17 +66,11 @@ class RbacModuleObjectsServices {
return statusResponse;
}
Future<bool> deleteRbacModuleObject({required int moduleObjectId}) async {
Future<bool> delete({required int moduleObjectId}) async {
bool success = false;
String path = "${Url.instance.getModuleObjects()}$moduleObjectId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
.deleteRequest(path: "${path+moduleObjectId.toString()}/", headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -1,24 +1,21 @@
import 'dart:convert';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import '../../../utils/urls.dart';
class RbacModuleServices {
static final RbacModuleServices _instance = RbacModuleServices();
static RbacModuleServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<RBAC>> getRbacModule() async {
List<RBAC> modules = [];
String path = Url.instance.getModules();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
'X-Client-Key':xClientKey,
'X-Client-Secret':xClientSecret
};
Future<List<RBAC>> getRbacModule() async {
List<RBAC> modules = [];
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
@ -43,13 +40,7 @@ class RbacModuleServices {
required String? slug,
required String? short,
required int id}) async {
String path = Url.instance.getModules();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String? newSlug = slug?.replaceAll(" ", "-");
Map body = {
"name": name,
@ -88,13 +79,7 @@ class RbacModuleServices {
required int? createdBy,
required int updatedBy,
}) async {
String path = "${Url.instance.getModules()}$moduleId/";
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String? newSlug = slug?.replaceAll(" ", "-");
Map body = {
"name": name,
@ -106,7 +91,7 @@ class RbacModuleServices {
};
try {
http.Response response = await Request.instance
.putRequest(path: path, body: body, headers: headers, param: {});
.putRequest(path: "${path+moduleId.toString()}/", body: body, headers: headers, param: {});
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
statusResponse = data;
@ -126,15 +111,9 @@ class RbacModuleServices {
Future<bool> deleteRbacModule({required int moduleId}) async {
bool success = false;
String path = "${Url.instance.getModules()}$moduleId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
.deleteRequest(path: '${path+moduleId.toString()}/', headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -1,24 +1,21 @@
import 'dart:convert';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import '../../../utils/urls.dart';
class RbacObjectServices {
static final RbacObjectServices _instance = RbacObjectServices();
static RbacObjectServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<RBAC>> getRbacObjects() async {
List<RBAC> objects = [];
String path = Url.instance.getObject();
Map<String, String> headers = {
String path = Url.instance.getObject();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
'X-Client-Secret': xClientSecret
};
Future<List<RBAC>> getRbacObjects() async {
List<RBAC> objects = [];
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
@ -43,13 +40,7 @@ class RbacObjectServices {
required String? slug,
required String? short,
required int id}) async {
String path = Url.instance.getObject();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String? newSlug = slug?.replaceAll(" ", "-");
Map body = {
"name": name,
@ -67,7 +58,7 @@ class RbacObjectServices {
} else {
Map data = jsonDecode(response.body);
String message = data['message'];
statusResponse.addAll({'message': "Error Adding Object"});
statusResponse.addAll({'message': message});
statusResponse.addAll(
{'success': false},
);
@ -87,13 +78,8 @@ class RbacObjectServices {
required int? createdBy,
required int updatedBy,
}) async {
String path = "${Url.instance.getObject()}$objectId/";
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String? newSlug = slug?.replaceAll(" ", "-");
Map body = {
"name": name,
@ -104,14 +90,14 @@ class RbacObjectServices {
};
try {
http.Response response = await Request.instance
.putRequest(path: path, body: body, headers: headers, param: {});
.putRequest(path: "${path+objectId.toString()}/", body: body, headers: headers, param: {});
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
statusResponse = data;
} else {
Map data = jsonDecode(response.body);
String message = data['message'];
statusResponse.addAll({'message': "Error Updating Object"});
statusResponse.addAll({'message': message});
statusResponse.addAll(
{'success': false},
);
@ -124,15 +110,9 @@ class RbacObjectServices {
Future<bool> deleteRbacRole({required int objectId}) async {
bool success = false;
String path = "${Url.instance.getObject()}$objectId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
.deleteRequest(path: "${path+objectId.toString()}/", headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -1,24 +1,21 @@
import 'dart:convert';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import '../../../utils/urls.dart';
class RbacOperationServices {
static final RbacOperationServices _instance = RbacOperationServices();
static RbacOperationServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<RBAC>> getRbacOperations() async {
List<RBAC> roles = [];
String path = Url.instance.getOperations();
Map<String, String> headers = {
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
'X-Client-Secret': xClientSecret
};
Future<List<RBAC>> getRbacOperations() async {
List<RBAC> roles = [];
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
@ -43,13 +40,7 @@ class RbacOperationServices {
required String? slug,
required String? short,
required int id}) async {
String path = Url.instance.getOperations();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String? newSlug = slug?.replaceAll(" ", "-");
Map body = {
"name": name,
@ -87,13 +78,7 @@ class RbacOperationServices {
required int? createdBy,
required int updatedBy,
}) async {
String path = "${Url.instance.getRbacOperations()}$operationId/";
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String? newSlug = slug?.replaceAll(" ", "-");
Map body = {
"name": name,
@ -104,7 +89,7 @@ class RbacOperationServices {
};
try {
http.Response response = await Request.instance
.putRequest(path: path, body: body, headers: headers, param: {});
.putRequest(path: '${path+operationId.toString()}/', body: body, headers: headers, param: {});
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
statusResponse = data;
@ -124,15 +109,9 @@ class RbacOperationServices {
Future<bool> delete({required int operation}) async {
bool success = false;
String path = "${Url.instance.getRbacOperations()}$operation/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
.deleteRequest(path: '${path+operation.toString()}/', headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -0,0 +1,83 @@
import 'dart:convert';
import 'package:unit2/model/rbac/permission_assignment.dart';
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import 'package:unit2/utils/urls.dart';
import 'package:http/http.dart' as http;
class RbacPermissionAssignmentServices {
static final RbacPermissionAssignmentServices _instance =
RbacPermissionAssignmentServices();
static RbacPermissionAssignmentServices get instance => _instance;
String path = Url.instance.getPermissionAssignment();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientSecret
};
Future<List<PermissionAssignment>> getPermissionAssignment() async {
List<PermissionAssignment> permissionAssignments = [];
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
if (data['data'] != null) {
for (var rbac in data['data']) {
PermissionAssignment permissionAssignment =
PermissionAssignment.fromJson(rbac);
permissionAssignments.add(permissionAssignment);
}
}
}
} catch (e) {
e.toString();
}
return permissionAssignments;
}
Future<bool> deletePermissionAssignment({required int id}) async {
bool success = false;
try {
http.Response response = await Request.instance
.deleteRequest(path: "${path+id.toString()}/", headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}
} catch (e) {
throw e.toString();
}
return success;
}
Future<Map<dynamic, dynamic>> addPermissionAssignment(
{required int assignerId,
required List<int> opsId,
required int roleId}) async {
Map<dynamic, dynamic> statusResponse = {};
Map body = {
"role_id": roleId,
"permissions": opsId,
"assigner_user_id": assignerId
};
try {
http.Response response = await Request.instance
.postRequest(param: {}, path: path, body: body, headers: headers);
if (response.statusCode == 201) {
Map data = jsonDecode(response.body);
statusResponse = data;
} else {
Map data = jsonDecode(response.body);
String message = data['message'];
statusResponse.addAll({'message': message});
statusResponse.addAll(
{'success': false},
);
}
} catch (e) {
throw e.toString();
}
return statusResponse;
}
}

View File

@ -1,25 +1,21 @@
import 'dart:convert';
import 'package:unit2/model/rbac/permission.dart';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import '../../../utils/urls.dart';
class RbacPermissionServices {
static final RbacPermissionServices _instance = RbacPermissionServices();
static RbacPermissionServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
String path = Url.instance.getPersmissions();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key':xClientKey,
'X-Client-Secret': xClientSecret
};
Future<List<RBACPermission>> getRbacPermission() async {
List<RBACPermission> permissions = [];
String path = Url.instance.getPersmissions();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
@ -46,13 +42,7 @@ class RbacPermissionServices {
required int? objectId,
required List<int> operationsId,
}) async {
String path = Url.instance.getPersmissions();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map body = {
"object_id": objectId,
"operations": operationsId,
@ -80,15 +70,9 @@ class RbacPermissionServices {
Future<bool> deletePermission ({required int permissionId}) async {
bool success = false;
String path = "${Url.instance.getPersmissions()}$permissionId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
.deleteRequest(path: "${path+permissionId.toString()}/", headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -1,30 +1,27 @@
import 'dart:convert';
import 'package:unit2/model/rbac/assigned_role.dart';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import 'package:unit2/utils/urls.dart';
import 'package:http/http.dart' as http;
import '../../../model/profile/basic_information/primary-information.dart';
class RbacRoleAssignmentServices {
static final RbacRoleAssignmentServices _instance =
RbacRoleAssignmentServices();
static RbacRoleAssignmentServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<AssignedRole>> getAssignedRoles(
{required String firstname, required String lastname}) async {
List<AssignedRole> assignedRoles = [];
String path = Url.instance.getRoleAssignment();
String path = Url.instance.getRoleAssignment();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
'X-Client-Secret': xClientSecret
};
Future<List<AssignedRole>> getAssignedRoles(
{required String firstname, required String lastname}) async {
List<AssignedRole> assignedRoles = [];
Map<String, String> param = {
"user__first_name__icontains": firstname,
"user__last_name__icontains": lastname
@ -49,15 +46,9 @@ class RbacRoleAssignmentServices {
Future<bool> deleteAssignedRole({required int roleId}) async {
bool success = false;
String path = "${Url.instance.getRoleAssignment()}$roleId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
.deleteRequest(path: '${path+roleId.toString()}/', headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}
@ -72,13 +63,7 @@ class RbacRoleAssignmentServices {
required int? assignerId,
required List<int> roles,
}) async {
String path = Url.instance.getRoleAssignment();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map body = {
"user_id": userId,
"roles": roles,

View File

@ -1,26 +1,23 @@
import 'dart:convert';
import 'package:unit2/model/rbac/role_extend.dart';
import 'package:unit2/model/rbac/role_under.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/utils/global.dart';
import '../../../utils/request.dart';
import '../../../utils/urls.dart';
class RbacRoleExtendServices {
static final RbacRoleExtendServices _instance = RbacRoleExtendServices();
static RbacRoleExtendServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
String path = Url.instance.getRoleExtend();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientSecret
};
Future<List<RolesExtend>> getRolesExtend() async {
List<RolesExtend> rolesextend = [];
String path = Url.instance.getRoleExtend();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
// try {
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
if (response.statusCode == 200) {
@ -32,9 +29,9 @@ class RbacRoleExtendServices {
}
}
}
// } catch (e) {
// throw e.toString();
// }
} catch (e) {
throw e.toString();
}
return rolesextend;
}
@ -43,13 +40,7 @@ class RbacRoleExtendServices {
required int? roleId,
required List<int> rolesExtendsId,
}) async {
String path = Url.instance.getRoleExtend();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map body = {
"role_main_id": roleId,
"roles_extend": rolesExtendsId,
@ -76,15 +67,12 @@ class RbacRoleExtendServices {
Future<bool> delete({required int roleExtendId}) async {
bool success = false;
String path = "${Url.instance.getRoleExtend()}$roleExtendId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
http.Response response = await Request.instance.deleteRequest(
path: '${path + roleExtendId.toString()}/',
headers: headers,
body: {},
param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -1,9 +1,8 @@
import 'dart:convert';
import 'package:unit2/model/login_data/user_info/module.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/model/rbac/role_module.dart';
import '../../../model/rbac/rbac_rbac.dart';
import 'package:unit2/utils/global.dart';
import '../../../utils/request.dart';
import '../../../utils/urls.dart';
@ -11,17 +10,14 @@ class RbacRoleModuleServices {
static final RbacRoleModuleServices _instance =
RbacRoleModuleServices();
static RbacRoleModuleServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<RoleModules>> getRoleModules() async {
List<RoleModules> roleModules = [];
String path = Url.instance.getRoleModules();
Map<String, String> headers = {
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
'X-Client-Secret': xClientSecret
};
Future<List<RoleModules>> getRoleModules() async {
List<RoleModules> roleModules = [];
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
@ -46,13 +42,7 @@ class RbacRoleModuleServices {
required int? roleId,
required List<int> moduleIds,
}) async {
String path = Url.instance.getRoleModules();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map body = {
"role_id": roleId,
"modules": moduleIds,
@ -80,15 +70,9 @@ class RbacRoleModuleServices {
Future<bool> deleteRbacRoleModule({required int moduleObjectId}) async {
bool success = false;
String path = "${Url.instance.getRoleModules()}$moduleObjectId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
.deleteRequest(path: "${path+moduleObjectId.toString()}/", headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -1,25 +1,21 @@
import 'dart:convert';
import 'package:unit2/model/rbac/rbac.dart';
import 'package:unit2/sevices/profile/education_services.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import '../../../utils/urls.dart';
class RbacRoleServices {
static final RbacRoleServices _instance = RbacRoleServices();
static RbacRoleServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
String path = Url.instance.getRbacRoles();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientSecret
};
Future<List<RBAC>> getRbacRoles() async {
List<RBAC> roles = [];
String path = Url.instance.getRbacRoles();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
@ -45,13 +41,7 @@ class RbacRoleServices {
required String? slug,
required String? short,
required int id}) async {
String path = Url.instance.getRbacRoles();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String? newSlug = slug?.replaceAll(" ", "-");
Map body = {
"name": name,
@ -67,7 +57,7 @@ class RbacRoleServices {
Map data = jsonDecode(response.body);
statusResponse = data;
} else {
Map data = jsonDecode(response.body);
Map data = jsonDecode(response.body);
String message = data['message'];
statusResponse.addAll({'message': message});
statusResponse.addAll(
@ -89,13 +79,7 @@ class RbacRoleServices {
required int? createdBy,
required int updatedBy,
}) async {
String path = "${Url.instance.getRbacRoles()}$roleId/";
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String? newSlug = slug?.replaceAll(" ", "-");
Map body = {
"name": name,
@ -105,8 +89,11 @@ class RbacRoleServices {
"updated_by_id": updatedBy
};
try {
http.Response response = await Request.instance
.putRequest(path: path, body: body, headers: headers, param: {});
http.Response response = await Request.instance.putRequest(
path: "${path + roleId.toString()}/",
body: body,
headers: headers,
param: {});
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
statusResponse = data;
@ -126,15 +113,12 @@ class RbacRoleServices {
Future<bool> deleteRbacRole({required int roleId}) async {
bool success = false;
String path = "${Url.instance.getRbacRoles()}$roleId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
http.Response response = await Request.instance.deleteRequest(
path: "${path + roleId.toString()}/",
headers: headers,
body: {},
param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -2,23 +2,21 @@ import 'dart:convert';
import 'package:unit2/model/rbac/role_under.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/utils/global.dart';
import '../../../utils/request.dart';
import '../../../utils/urls.dart';
class RbacRoleUnderServices {
static final RbacRoleUnderServices _instance = RbacRoleUnderServices();
static RbacRoleUnderServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<RolesUnder>> getRolesUnder() async {
List<RolesUnder> rolesUnder = [];
String path = Url.instance.getRolesUnder();
String path = Url.instance.getRolesUnder();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
'X-Client-Secret': xClientSecret
};
Future<List<RolesUnder>> getRolesUnder() async {
List<RolesUnder> rolesUnder = [];
try {
http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers);
@ -42,13 +40,8 @@ class RbacRoleUnderServices {
required int? roleId,
required List<int> rolesId,
}) async {
String path = Url.instance.getRolesUnder();
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map body = {
"role_main_id": roleId,
"roles_under": rolesId,
@ -76,15 +69,9 @@ class RbacRoleUnderServices {
Future<bool> deleteRbacRoleUnder({required int roleUnderId}) async {
bool success = false;
String path = "${Url.instance.getRolesUnder ()}$roleUnderId/";
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {});
.deleteRequest(path: "${path+roleUnderId.toString()}/", headers: headers, body: {}, param: {});
if (response.statusCode == 200) {
success = true;
}

View File

@ -1,27 +1,24 @@
import 'dart:convert';
import 'package:unit2/model/utils/position.dart';
import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/request.dart';
import 'package:unit2/utils/urls.dart';
import 'package:http/http.dart' as http;
import '../../../model/rbac/rbac_station.dart';
import '../../../model/rbac/station_type.dart';
import '../../../model/roles/pass_check/station_assign_area.dart';
class RbacStationServices {
static final RbacStationServices _instance = RbacStationServices();
static RbacStationServices get instance => _instance;
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<RbacStation>> getStations({required String agencyId}) async {
List<RbacStation> stations = [];
String path = Url.instance.getStation();
Map<String, String> param = {"government_agency_id": agencyId.toString()};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
'X-Client-Secret': xClientSecret
};
Future<List<RbacStation>> getStations({required String agencyId}) async {
List<RbacStation> stations = [];
Map<String, String> param = {"government_agency_id": agencyId.toString()};
try {
http.Response response = await Request.instance
.getRequest(param: param, path: path, headers: headers);
@ -42,9 +39,6 @@ class RbacStationServices {
Future<List<StationType>> getStationTypes() async {
String path = Url.instance.getStationType();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
};
List<StationType> stationTypes = [];
try {
@ -67,11 +61,7 @@ class RbacStationServices {
Future<List<PositionTitle>> getPositionTitle() async {
String path = Url.instance.getPositionTitle();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
};
List<PositionTitle> positions = [];
try {
http.Response response = await Request.instance
.getRequest(path: path, param: {}, headers: headers);
@ -93,13 +83,7 @@ class RbacStationServices {
Future<Map<dynamic, dynamic>> addStation(
{required RbacStation station}) async {
Map<dynamic, dynamic> statusResponse = {};
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
String path = Url.instance.postStation();
try {
Map body = {
"station_name": station.stationName,

View File

@ -1,8 +1,15 @@
import 'package:flutter/material.dart';
import 'package:searchfield/searchfield.dart';
BoxDecoration box1(){
return const BoxDecoration(
boxShadow: [BoxShadow(color: Colors.black12,spreadRadius: 5,blurRadius: 5)] ,
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(3)));
}
SuggestionDecoration searchFieldDecoration(){
return SuggestionDecoration(
boxShadow:const [BoxShadow(color: Colors.black12,spreadRadius: 5,blurRadius: 5)] ,
color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(3)));
}

View File

@ -13,7 +13,7 @@ Future<String> getCPUArchitecture() async {
try {
Response response = await dio.get(apkUrl,
options: Options(
receiveTimeout: 20000,
receiveTimeout:const Duration(seconds: 25),
receiveDataWhenStatusError: true,
responseType: ResponseType.json,
followRedirects: false,
@ -37,8 +37,8 @@ Future<String> getCPUArchitecture() async {
throw TimeoutException("Connection timeout");
} on SocketException catch (_) {
throw const SocketException("Connection timeout");
} on DioError catch (_) {
throw DioErrorType.connectTimeout;
} on DioException catch (e) {
throw e.toString();
}
return downloadURL;
}

View File

@ -3,7 +3,8 @@ import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
var mobileFormatter = MaskTextInputFormatter(
mask: "+63 (###) ###-####",
filter: {"#": RegExp(r"^[1-9][0-9]*$")},
filter: {"#": RegExp(r'^[0-9][0-9]*$')
},
type: MaskAutoCompletionType.lazy,
initialText: "0");

View File

@ -10,7 +10,6 @@ double safeAreaHorizontal = 0;
double safeAreaVertical = 0;
double safeBlockHorizontal = 0;
double safeBlockVertical = 0;
const xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
const xClientSecret = "unitcYqAN7GGalyz";
String? globalFistname;
@ -20,6 +19,18 @@ const xClientSecret = "unitcYqAN7GGalyz";
String? globalSex;
Profile? globalCurrentProfile;
const String urlDownloadArmeabiv7aAPK =
"https://agusandelnorte.gov.ph/media/public/transparency/downloadables/UniT-App/v1.0.1/beta/unit_app_v1_0_1_beta_armeabi-v7a-release.apk?download";
const String urlDownloadX8664APK =
"https://agusandelnorte.gov.ph/media/public/transparency/downloadables/UniT-App/v1.0.1/beta/unit_app_v1_0_1_beta_x86_64-release.apk?download";
const String urlDownloadarm64v8aAPK =
"https://agusandelnorte.gov.ph/media/public/transparency/downloadables/UniT-App/v1.0.1/beta/unit_app_v1_0_1_beta_arm64-v8a-release.apk?download";
//// hive boxes
Box? CREDENTIALS;
Box? SOS;

View File

@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:http/http.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/utils/urls.dart';
@ -19,7 +18,7 @@ class Request {
Map<String, String>? param}) async {
Response response;
try {
response = await get(Uri.http(host, path!, param), headers: headers)
response = await get(Uri.https(host, path!, param), headers: headers)
.timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) {
// Fluttertoast.showToast(
@ -61,7 +60,7 @@ class Request {
Map<String, String>? param}) async {
Response response;
try {
response = await post(Uri.http(host, path!, param),
response = await post(Uri.https(host, path!, param),
headers: headers, body: jsonEncode(body))
.timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) {
@ -104,7 +103,7 @@ class Request {
required Map<String, dynamic>? param}) async {
Response response;
try {
response = await put(Uri.http(host, path, param),
response = await put(Uri.https(host, path, param),
headers: headers, body: jsonEncode(body));
} on TimeoutException catch (_) {
// Fluttertoast.showToast(
@ -188,7 +187,7 @@ class Request {
required Map<String, dynamic>? param}) async {
Response response;
try {
response = await delete(Uri.http(host, path, param),
response = await delete(Uri.https(host, path, param),
headers: headers, body: jsonEncode(body))
.timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) {

View File

@ -281,7 +281,7 @@ class Url {
}
String agencies() {
return "/api/jobnet_app/agencies/";
return "/api/jobnet_app/agencies/";
}
String postAgencies() {
@ -309,7 +309,10 @@ class Url {
}
String getRoleAssignment() {
return "api/account/auth/role_assignment/";
return "/api/account/auth/role_assignment/";
}
String getPermissionAssignment(){
return "/api/account/auth/permission_assignment/";
}
String getStationType() {
@ -334,7 +337,7 @@ class Url {
}
String getProvinces() {
return "api/web_app/location/province/";
return "/api/web_app/location/province/";
}
String getCities() {

View File

@ -21,18 +21,10 @@ packages:
dependency: "direct main"
description:
name: animate_do
sha256: "9aeacc1a7238f971c039bdf45d13c628be554a242e0251c4ddda09d19a1a923f"
sha256: "91b3e0306ba2096c7a7e1ee1ba96f491e25e92034c215f4bf8de6a7251c4bef1"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
animated_splash_screen:
dependency: "direct main"
description:
name: animated_splash_screen
sha256: f45634db6ec4e8cf034c53e03f3bd83898a16fe3c9286bf5510b6831dfcf2124
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "3.1.2"
app_popup_menu:
dependency: "direct main"
description:
@ -85,58 +77,58 @@ packages:
dependency: "direct main"
description:
name: audioplayers
sha256: "61583554386721772f9309f509e17712865b38565a903c761f96b1115a979282"
sha256: "8e94499b5c123df14cf17c16639de5ff3373e57e537f727e367487fbb7491363"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
version: "5.1.0"
audioplayers_android:
dependency: transitive
description:
name: audioplayers_android
sha256: dbdc9b7f2aa2440314c638aa55aadd45c7705e8340d5eddf2e3fb8da32d4ae2c
sha256: "1c12b60cc10a3b8617ca3f88b927e7e03768f470d9b4f747efd3d58a8a07ee1b"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "4.0.1"
audioplayers_darwin:
dependency: transitive
description:
name: audioplayers_darwin
sha256: "6aea96df1d12f7ad5a71d88c6d1b22a216211a9564219920124c16768e456e9d"
sha256: "2fb6133ffcf28fb3f9d3e11f8a3ef190e5fedb2b7b95ea865b56a21d1163e670"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
version: "5.0.1"
audioplayers_linux:
dependency: transitive
description:
name: audioplayers_linux
sha256: "396b62ac62c92dd26c3bc5106583747f57a8b325ebd2b41e5576f840cfc61338"
sha256: cca3f272c7186dd2e0025b8864e1413ac5e081d74b17e28b02ceb2df4c110235
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "3.0.0"
audioplayers_platform_interface:
dependency: transitive
description:
name: audioplayers_platform_interface
sha256: f7daaed4659143094151ecf6bacd927d29ab8acffba98c110c59f0b81ae51143
sha256: "47eae55e99ced11589998cf27e4eaabf5b475a7bd8bea7516ee6c2536a2e1abf"
url: "https://pub.dev"
source: hosted
version: "5.0.1"
version: "6.0.0"
audioplayers_web:
dependency: transitive
description:
name: audioplayers_web
sha256: ec84fd46eed1577148ed4113f5998a36a18da4fce7170c37ce3e21b631393339
sha256: "9f155590c6ba9ba469df637f4729264e4234dc3941ece4690dad63ffac19b5af"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "4.0.0"
audioplayers_windows:
dependency: transitive
description:
name: audioplayers_windows
sha256: "1d3aaac98a192b8488167711ba1e67d8b96333e8d0572ede4e2912e5bbce69a3"
sha256: "8813b712ba919bb324bde5e3ba97edc81bface945953a54a3dea70b5608bcc70"
url: "https://pub.dev"
source: hosted
version: "2.0.2"
version: "3.0.0"
auto_size_text:
dependency: "direct main"
description:
@ -165,10 +157,10 @@ packages:
dependency: "direct main"
description:
name: badges
sha256: "6e7f3ec561ec08f47f912cfe349d4a1707afdc8dda271e17b046aa6d42c89e77"
sha256: a7b6bbd60dce418df0db3058b53f9d083c22cdb5132a052145dc267494df0b84
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.1.2"
barcode_scan2:
dependency: "direct main"
description:
@ -177,6 +169,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.2.4"
better_open_file:
dependency: "direct main"
description:
name: better_open_file
sha256: aa67d9bc38160401e48023833f93c789b4e2b1c0eb8b6643bd5816d0c1c65dbd
url: "https://pub.dev"
source: hosted
version: "3.6.4"
bloc:
dependency: transitive
description:
@ -341,10 +341,10 @@ packages:
dependency: "direct main"
description:
name: cool_alert
sha256: "48a0b6c04914b6dc7e8d7eaccf2adf21bace6533a3eda0aeb412e0d7a03dc00a"
sha256: "080a6c3503a4cded8f626cdead23f17ea40ff066ff50847d71a7a264032ab092"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "2.0.1"
cross_file:
dependency: transitive
description:
@ -394,13 +394,13 @@ packages:
source: hosted
version: "2.0.1"
device_info_plus:
dependency: transitive
dependency: "direct main"
description:
name: device_info_plus
sha256: f52ab3b76b36ede4d135aab80194df8925b553686f0fa12226b4e2d658e45903
sha256: "86add5ef97215562d2e090535b0a16f197902b10c369c558a100e74ea06e8659"
url: "https://pub.dev"
source: hosted
version: "8.2.2"
version: "9.0.3"
device_info_plus_platform_interface:
dependency: transitive
description:
@ -413,10 +413,10 @@ packages:
dependency: "direct main"
description:
name: dio
sha256: "7d328c4d898a61efc3cd93655a0955858e29a0aa647f0f9e02d59b3bb275e2e8"
sha256: "417e2a6f9d83ab396ec38ff4ea5da6c254da71e4db765ad737a42af6930140b7"
url: "https://pub.dev"
source: hosted
version: "4.0.6"
version: "5.3.3"
easy_app_installer:
dependency: "direct main"
description:
@ -477,10 +477,10 @@ packages:
dependency: "direct main"
description:
name: file_picker
sha256: "9d6e95ec73abbd31ec54d0e0df8a961017e165aba1395e462e5b31ea0c165daf"
sha256: be325344c1f3070354a1d84a231a1ba75ea85d413774ec4bdf444c023342e030
url: "https://pub.dev"
source: hosted
version: "5.3.1"
version: "5.5.0"
file_utils:
dependency: transitive
description:
@ -562,10 +562,10 @@ packages:
dependency: "direct main"
description:
name: flutter_form_builder
sha256: "9551c7379adc01a3a3a1100057396407c9534ea8adc937d14a0edd96fcd9e1dc"
sha256: "8973beed34b6d951d36bf688b52e9e3040b47b763c35c320bd6f4c2f6b13f3a2"
url: "https://pub.dev"
source: hosted
version: "7.8.0"
version: "9.1.1"
flutter_lints:
dependency: "direct dev"
description:
@ -607,10 +607,10 @@ packages:
dependency: "direct main"
description:
name: flutter_speed_dial
sha256: "41d7ad0bc224248637b3a5e0b9083e912a75445bdb450cf82b8ed06d7af7c61d"
sha256: "698a037274a66dbae8697c265440e6acb6ab6cae9ac5f95c749e7944d8f28d41"
url: "https://pub.dev"
source: hosted
version: "6.2.0"
version: "7.0.0"
flutter_spinkit:
dependency: "direct main"
description:
@ -631,10 +631,10 @@ packages:
dependency: "direct main"
description:
name: flutter_svg
sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2"
sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338"
url: "https://pub.dev"
source: hosted
version: "1.1.6"
version: "2.0.7"
flutter_test:
dependency: "direct dev"
description: flutter
@ -673,10 +673,10 @@ packages:
dependency: "direct main"
description:
name: form_builder_validators
sha256: f2d90439c56345c23ad8d0c2912e4002cd02563d816f4387c9495051c10d3321
sha256: "19aa5282b7cede82d0025ab031a98d0554b84aa2ba40f12013471a3b3e22bf02"
url: "https://pub.dev"
source: hosted
version: "8.6.1"
version: "9.1.0"
frontend_server_client:
dependency: transitive
description:
@ -737,18 +737,18 @@ packages:
dependency: "direct dev"
description:
name: hive_generator
sha256: "81fd20125cb2ce8fd23623d7744ffbaf653aae93706c9bd3bf7019ea0ace3938"
sha256: "06cb8f58ace74de61f63500564931f9505368f45f98958bd7a6c35ba24159db4"
url: "https://pub.dev"
source: hosted
version: "1.1.3"
version: "2.0.1"
http:
dependency: transitive
description:
name: http
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
url: "https://pub.dev"
source: hosted
version: "0.13.6"
version: "1.1.0"
http_multi_server:
dependency: transitive
description:
@ -777,10 +777,10 @@ packages:
dependency: transitive
description:
name: image
sha256: "8e9d133755c3e84c73288363e6343157c383a0c6c56fc51afcc5d4d7180306d6"
sha256: a72242c9a0ffb65d03de1b7113bc4e189686fc07c7147b8b41811d0dd0e0d9bf
url: "https://pub.dev"
source: hosted
version: "3.3.0"
version: "4.0.17"
intl:
dependency: "direct main"
description:
@ -825,26 +825,26 @@ packages:
dependency: "direct main"
description:
name: location
sha256: "9051959f6f2ccadd887b28b66e9cbbcc25b6838e37cf9e894c421ccc0ebf80b5"
sha256: "06be54f682c9073cbfec3899eb9bc8ed90faa0e17735c9d9fa7fe426f5be1dd1"
url: "https://pub.dev"
source: hosted
version: "4.4.0"
version: "5.0.3"
location_platform_interface:
dependency: transitive
description:
name: location_platform_interface
sha256: "62eeaf1658e92e4459b727f55a3c328eccbac8ba043fa6d262ac5286ad48384c"
sha256: "8aa1d34eeecc979d7c9fe372931d84f6d2ebbd52226a54fe1620de6fdc0753b1"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
version: "3.1.2"
location_web:
dependency: transitive
description:
name: location_web
sha256: "6c08c408a040534c0269c4ff9fe17eebb5a36dea16512fbaf116b9c8bc21545b"
sha256: ec484c66e8a4ff1ee5d044c203f4b6b71e3a0556a97b739a5bc9616de672412b
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "4.2.0"
logging:
dependency: transitive
description:
@ -857,10 +857,10 @@ packages:
dependency: transitive
description:
name: lottie
sha256: "893da7a0022ec2fcaa616f34529a081f617e86cc501105b856e5a3184c58c7c2"
sha256: b8bdd54b488c54068c57d41ae85d02808da09e2bee8b8dd1f59f441e7efa60cd
url: "https://pub.dev"
source: hosted
version: "1.4.3"
version: "2.6.0"
mask_text_input_formatter:
dependency: "direct main"
description:
@ -905,18 +905,18 @@ packages:
dependency: "direct main"
description:
name: modal_progress_hud_nsn
sha256: "408b9bcce97567de94637de932260e50be48db1842edc761aeea61670e5ec30c"
sha256: "0b0d95e5ce3e1884390624fbe79fcf90d7de10abe05d26c0e276c25e7130e3e0"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "0.4.0"
multi_dropdown:
dependency: "direct main"
description:
name: multi_dropdown
sha256: "65b8f505b251c5173e8eff64c09cd37460d8f8be906c2069a03815ad2641dcd1"
sha256: "2db9b41ae543a9277defc2b5ba95622acb72ed0fb49d6dead357a1639371bee3"
url: "https://pub.dev"
source: hosted
version: "1.0.9"
version: "2.1.0"
multi_select_flutter:
dependency: "direct main"
description:
@ -969,10 +969,10 @@ packages:
dependency: "direct main"
description:
name: package_info_plus
sha256: "10259b111176fba5c505b102e3a5b022b51dd97e30522e906d6922c745584745"
sha256: "6ff267fcd9d48cb61c8df74a82680e8b82e940231bb5f68356672fde0397334a"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
version: "4.1.0"
package_info_plus_platform_interface:
dependency: transitive
description:
@ -981,14 +981,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.1"
page_transition:
dependency: transitive
description:
name: page_transition
sha256: dee976b1f23de9bbef5cd512fe567e9f6278caee11f5eaca9a2115c19dc49ef6
url: "https://pub.dev"
source: hosted
version: "2.1.0"
path:
dependency: transitive
description:
@ -1065,18 +1057,18 @@ packages:
dependency: "direct main"
description:
name: permission_handler
sha256: "63e5216aae014a72fe9579ccd027323395ce7a98271d9defa9d57320d001af81"
sha256: ad65ba9af42a3d067203641de3fd9f547ded1410bad3b84400c2b4899faede70
url: "https://pub.dev"
source: hosted
version: "10.4.3"
version: "11.0.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: d74e77a5ecd38649905db0a7d05ef16bed42ff263b9efb73ed794317c5764ec3
sha256: f2543a236584a5e8be79076f858022f100ce690e31530e6fa4c32ac94f276d3a
url: "https://pub.dev"
source: hosted
version: "10.3.4"
version: "11.0.3"
permission_handler_apple:
dependency: transitive
description:
@ -1089,10 +1081,10 @@ packages:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: "7c6b1500385dd1d2ca61bb89e2488ca178e274a69144d26bbd65e33eae7c02a9"
sha256: f2343e9fa9c22ae4fd92d4732755bfe452214e7189afcc097380950cf567b4b2
url: "https://pub.dev"
source: hosted
version: "3.11.3"
version: "3.11.5"
permission_handler_windows:
dependency: transitive
description:
@ -1105,10 +1097,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4"
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
url: "https://pub.dev"
source: hosted
version: "5.1.0"
version: "5.4.0"
platform:
dependency: transitive
description:
@ -1241,18 +1233,18 @@ packages:
dependency: transitive
description:
name: rive
sha256: f3b8af0898c987d68019e91d92257edd902c28c816e49de033a7272e86bd5425
sha256: f2117a96a189758bc79bf7933865625c7a44a420ae537d2a8f6c492900136a71
url: "https://pub.dev"
source: hosted
version: "0.11.4"
version: "0.11.17"
rive_common:
dependency: transitive
description:
name: rive_common
sha256: f6687f9d70e6fd3888a9b0e9c0b307966d2ce74cf00cfb01dce906c3bbada52f
sha256: e41f12917cb58e0c9376836490ebaa431e12744da0c67e19dad8d4bee9fedd46
url: "https://pub.dev"
source: hosted
version: "0.1.0"
version: "0.2.7"
rxdart:
dependency: transitive
description:
@ -1289,10 +1281,10 @@ packages:
dependency: "direct main"
description:
name: searchfield
sha256: "62b6653d7194de5a7ea724124846b996d0d211cd3eeeec2e5ca84423650f66f8"
sha256: ea1eccae9f6d07dbbfef0bf341dd93b22df453b939461c5473a0be6186f2d720
url: "https://pub.dev"
source: hosted
version: "0.7.8"
version: "0.8.4"
share_plus:
dependency: "direct main"
description:
@ -1385,10 +1377,10 @@ packages:
dependency: "direct main"
description:
name: signature
sha256: ad23383717dfa926204695ef6928ff513a77387be1b4a8c685099ce3ec35e5f8
sha256: d95143b8e310b395ea0be59a46bb69fa24106cb6ec79815fc56fd320268e24e6
url: "https://pub.dev"
source: hosted
version: "5.3.0"
version: "5.4.0"
simple_chips_input:
dependency: "direct main"
description:
@ -1486,58 +1478,66 @@ packages:
dependency: transitive
description:
name: syncfusion_flutter_core
sha256: "8db8f55c77f56968681447d3837c10f27a9e861e238a898fda116c7531def979"
sha256: aea119c8117953fa5decf4a313b431e556b0959cd35ff88f8fbdc0eda9bedb06
url: "https://pub.dev"
source: hosted
version: "21.2.10"
version: "23.1.36"
syncfusion_flutter_pdf:
dependency: transitive
description:
name: syncfusion_flutter_pdf
sha256: a42186922a416c2c9634a8f221aee261101babc2d30b1a1e908a7f034e743046
sha256: "76a50a1d580714c078e2827adbd8b00d5f5c606879d07c44c5d99f0e864edda1"
url: "https://pub.dev"
source: hosted
version: "21.2.4"
version: "23.1.36"
syncfusion_flutter_pdfviewer:
dependency: "direct main"
description:
name: syncfusion_flutter_pdfviewer
sha256: "2dc016f251c675f8e4923135c485356473b4d89c677670164292159cd1dd4f45"
sha256: e5eaabd0a31fff16caead0d6d66d4c9946de7e46c89da7736de23cd4b2e6f676
url: "https://pub.dev"
source: hosted
version: "21.2.3"
version: "23.1.36"
syncfusion_flutter_signaturepad:
dependency: transitive
description:
name: syncfusion_flutter_signaturepad
sha256: ea6b218d127e0315b3309ee072a1d304c76aa7c497a196b3474f9c6b38c01f82
url: "https://pub.dev"
source: hosted
version: "23.1.36"
syncfusion_pdfviewer_macos:
dependency: transitive
description:
name: syncfusion_pdfviewer_macos
sha256: "8cc925cae532c0fa17e849165796d962107f45b86e66ee334dcaabf6b7305c82"
sha256: "6f928bee1f786b8d1939d3c4142c5cc2de2c13d19262d302878935a2bc33850c"
url: "https://pub.dev"
source: hosted
version: "21.2.10"
version: "23.1.36"
syncfusion_pdfviewer_platform_interface:
dependency: transitive
description:
name: syncfusion_pdfviewer_platform_interface
sha256: "08039ecdb8f79454fb367c6bf5a833846a666039415d2b5d76a7e59a5b3ff710"
sha256: "0251864fb82e2bd92a1b17e8562fe342e78cd530e26b0d2f54e94a441ccb4584"
url: "https://pub.dev"
source: hosted
version: "21.2.10"
version: "23.1.36"
syncfusion_pdfviewer_web:
dependency: transitive
description:
name: syncfusion_pdfviewer_web
sha256: "8e5ed0d313a1aa3869e4f2e8d079bc9bfa37ce79d91be7bb328e456f37b7995f"
sha256: eb224f52e86326dbf08ea12978c3db0b4e376866a84d4fcb131fc06ec93cbe20
url: "https://pub.dev"
source: hosted
version: "21.2.10"
version: "23.1.36"
syncfusion_pdfviewer_windows:
dependency: transitive
description:
name: syncfusion_pdfviewer_windows
sha256: "3e93f281135fb0562f7e6c343d2db741cf3cbd78c5b04884eef9af414408bc77"
sha256: aca74797a97512f4d3ca2be0ed49193fae7e5fd29a9b1b1139429d39c9216bf9
url: "https://pub.dev"
source: hosted
version: "21.2.10"
version: "23.1.36"
synchronized:
dependency: transitive
description:
@ -1598,12 +1598,12 @@ packages:
dependency: "direct main"
description:
name: url_launcher
sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3
sha256: "47e208a6711459d813ba18af120d9663c20bdf6985d6ad39fe165d2538378d27"
url: "https://pub.dev"
source: hosted
version: "6.1.11"
version: "6.1.14"
url_launcher_android:
dependency: "direct main"
dependency: transitive
description:
name: url_launcher_android
sha256: b04af59516ab45762b2ca6da40fa830d72d0f6045cd97744450b73493fa76330
@ -1666,6 +1666,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.7"
vector_graphics:
dependency: transitive
description:
name: vector_graphics
sha256: "670f6e07aca990b4a2bcdc08a784193c4ccdd1932620244c3a86bb72a0eac67f"
url: "https://pub.dev"
source: hosted
version: "1.1.7"
vector_graphics_codec:
dependency: transitive
description:
name: vector_graphics_codec
sha256: "7451721781d967db9933b63f5733b1c4533022c0ba373a01bdd79d1a5457f69f"
url: "https://pub.dev"
source: hosted
version: "1.1.7"
vector_graphics_compiler:
dependency: transitive
description:
name: vector_graphics_compiler
sha256: "80a13c613c8bde758b1464a1755a7b3a8f2b6cec61fbf0f5a53c94c30f03ba2e"
url: "https://pub.dev"
source: hosted
version: "1.1.7"
vector_math:
dependency: transitive
description:
@ -1702,10 +1726,18 @@ packages:
dependency: transitive
description:
name: win32
sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c"
sha256: f2add6fa510d3ae152903412227bda57d0d5a8da61d2c39c1fb022c9429a41c0
url: "https://pub.dev"
source: hosted
version: "4.1.4"
version: "5.0.6"
win32_registry:
dependency: transitive
description:
name: win32_registry
sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9
url: "https://pub.dev"
source: hosted
version: "1.1.1"
xdg_directories:
dependency: transitive
description:
@ -1718,10 +1750,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5"
sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84"
url: "https://pub.dev"
source: hosted
version: "6.2.2"
version: "6.3.0"
yaml:
dependency: transitive
description:
@ -1731,5 +1763,10 @@ packages:
source: hosted
version: "3.1.2"
sdks:
<<<<<<< HEAD
dart: ">=3.1.0-185.0.dev <4.0.0"
flutter: ">=3.7.0"
=======
dart: ">=3.1.0 <4.0.0"
flutter: ">=3.10.0"
>>>>>>> develop

View File

@ -36,15 +36,15 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
flutter_custom_clippers: ^2.0.0
flutter_svg: ^1.1.6
flutter_form_builder: ^7.7.0
form_builder_validators: any
flutter_svg: ^2.0.7
flutter_form_builder: ^9.1.1
form_builder_validators: ^9.1.0
fluttericon: ^2.0.0
fluttertoast: ^8.1.1
flutter_zoom_drawer: ^3.0.3
cached_network_image: ^3.2.3
auto_size_text: ^3.0.0
animate_do: ^3.0.2
animate_do: ^3.1.2
flutter_spinkit: ^5.1.0
toggle_switch: ^2.0.1
convex_bottom_bar: ^3.1.0+1
@ -54,34 +54,34 @@ dependencies:
flutter_progress_hud: ^2.0.2
barcode_scan2: ^4.2.1
qr_flutter: ^4.0.0
signature: ^5.3.0
signature: ^5.4.0
awesome_dialog: ^3.0.2
system_info2: ^2.0.4
flutter_bloc: ^8.0.0
equatable: ^2.0.5
package_info_plus: ^3.0.2
package_info_plus: 4.1.0
easy_app_installer: ^1.0.0
path_provider: ^2.0.14
dio: ^4.0.6
cool_alert: ^1.1.0
permission_handler: ^10.2.0
dio: ^5.3.3
cool_alert: ^2.0.1
permission_handler: ^11.0.0
expandable_group: ^0.0.8
badges: ^3.0.2
badges: ^3.1.2
app_popup_menu: ^1.0.0
modal_progress_hud_nsn: ^0.3.0
searchfield: ^0.7.5
modal_progress_hud_nsn: ^0.4.0
searchfield: ^0.8.4
filter_list: ^1.0.2
simple_chips_input: ^1.0.0
hive: ^2.0.5
hive_flutter: ^1.1.0
mask_text_input_formatter: ^2.4.0
location: ^4.3.0
location: ^5.0.3
platform_device_id: ^1.0.1
multi_dropdown: ^1.0.9
multi_dropdown: ^2.1.0
searchable_paginated_dropdown: ^1.2.0
audioplayers: ^4.1.0
audioplayers: ^5.1.0
assets_audio_player: ^3.0.6
flutter_speed_dial: ^6.2.0
flutter_speed_dial: ^7.0.0
im_stepper: ^1.0.1+1
shared_preferences: ^2.0.20
multiselect: any
@ -90,16 +90,17 @@ dependencies:
flutter_staggered_animations: ^1.1.1
group_list_view: ^1.1.1
search_page: ^2.3.0
file_picker: ^5.3.1
file_picker: ^5.5.0
expandable: ^5.0.1
flutter_simple_treeview: ^3.0.2
syncfusion_flutter_pdfviewer: ^21.2.3
url_launcher: ^6.1.11
url_launcher_android: ^6.0.38
syncfusion_flutter_pdfviewer: ^23.1.36
url_launcher: ^6.1.14
share_plus: ^7.1.0
animated_splash_screen: ^1.3.0
sqflite: ^2.3.0
device_info_plus: ^9.0.3
better_open_file: ^3.6.4
dependency_overrides:
intl: ^0.18.0
@ -116,7 +117,7 @@ dev_dependencies:
# rules and activating additional ones.
flutter_lints: ^2.0.0
build_runner: ^2.1.7
hive_generator: ^1.1.2
hive_generator: ^2.0.1
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

View File

@ -7,7 +7,7 @@
#include "generated_plugin_registrant.h"
#include <audioplayers_windows/audioplayers_windows_plugin.h>
#include <modal_progress_hud_nsn/modal_progress_hud_nsn_plugin.h>
#include <modal_progress_hud_nsn/modal_progress_hud_nsn_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <platform_device_id_windows/platform_device_id_windows_plugin.h>
#include <rive_common/rive_plugin.h>
@ -18,8 +18,8 @@
void RegisterPlugins(flutter::PluginRegistry* registry) {
AudioplayersWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
ModalProgressHudNsnPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ModalProgressHudNsnPlugin"));
ModalProgressHudNsnPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ModalProgressHudNsnPluginCApi"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
PlatformDeviceIdWindowsPluginRegisterWithRegistrar(