test superadmin operations

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
PGAN-MIS 2023-08-22 14:22:08 +08:00
parent 7cc0ab1f56
commit 690af305d6
25 changed files with 94 additions and 62 deletions

View File

@ -8,7 +8,7 @@
<uses-permission android:name="android.permission.INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" /> <uses-permission android:name="android.permission.DELETE_PACKAGES" />
<application <application
android:label="unit2" android:label="uniT App"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<provider <provider

View File

@ -40,7 +40,7 @@ class AgencyBloc extends Bloc<AgencyEvent, AgencyState> {
await AgencyServices.instance.add(agency: event.agency); await AgencyServices.instance.add(agency: event.agency);
if (statusResponse['success']) { if (statusResponse['success']) {
Agency newAgency = Agency.fromJson(statusResponse['data']); Agency newAgency = Agency.fromJson(statusResponse['data']);
agencies.add(newAgency); agencies.insert(0,newAgency);
emit(AgencyAddesState(response: statusResponse)); emit(AgencyAddesState(response: statusResponse));
} else { } else {
emit(AgencyAddesState(response: statusResponse)); emit(AgencyAddesState(response: statusResponse));

View File

@ -1,6 +1,5 @@
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/model/login_data/user_info/module.dart';
import 'package:unit2/model/rbac/rbac_rbac.dart'; import 'package:unit2/model/rbac/rbac_rbac.dart';
import 'package:unit2/sevices/roles/rbac_operations/module_objects_services.dart'; import 'package:unit2/sevices/roles/rbac_operations/module_objects_services.dart';
import 'package:unit2/sevices/roles/rbac_operations/object_services.dart'; import 'package:unit2/sevices/roles/rbac_operations/object_services.dart';
@ -15,6 +14,7 @@ class ModuleObjectsBloc extends Bloc<ModuleObjectsEvent, ModuleObjectsState> {
List<ModuleObjects> moduleObjects = []; List<ModuleObjects> moduleObjects = [];
List<RBAC> objects = []; List<RBAC> objects = [];
List<RBAC> modules = []; List<RBAC> modules = [];
List<int> ids = [];
on<GetModuleObjects>((event, emit) async { on<GetModuleObjects>((event, emit) async {
emit(ModuleObjectLoadingState()); emit(ModuleObjectLoadingState());
try { try {
@ -28,8 +28,12 @@ class ModuleObjectsBloc extends Bloc<ModuleObjectsEvent, ModuleObjectsState> {
if (modules.isEmpty) { if (modules.isEmpty) {
modules = await RbacModuleServices.instance.getRbacModule(); modules = await RbacModuleServices.instance.getRbacModule();
} }
ids =[];
for(var mo in moduleObjects){
ids.add(mo.id);
}
emit(ModuleObjectLoadedState( emit(ModuleObjectLoadedState(
moduleObjects: moduleObjects, objecs: objects, modules: modules)); moduleObjects: moduleObjects, objecs: objects, modules: modules,ids: ids));
} catch (e) { } catch (e) {
emit(ModuleObjectsErrorState(message: e.toString())); emit(ModuleObjectsErrorState(message: e.toString()));
} }
@ -46,7 +50,9 @@ class ModuleObjectsBloc extends Bloc<ModuleObjectsEvent, ModuleObjectsState> {
if (statusResponse['success']) { if (statusResponse['success']) {
statusResponse['data'].forEach((var permission) { statusResponse['data'].forEach((var permission) {
ModuleObjects newModuleObject = ModuleObjects.fromJson(permission); ModuleObjects newModuleObject = ModuleObjects.fromJson(permission);
moduleObjects.add(newModuleObject); if(!ids.contains(newModuleObject.id)){
moduleObjects.add(newModuleObject);
}
emit(ModuleObjectAddedState(response: statusResponse)); emit(ModuleObjectAddedState(response: statusResponse));
}); });
} else { } else {

View File

@ -13,10 +13,11 @@ class ModuleObjectLoadedState extends ModuleObjectsState {
final List<ModuleObjects> moduleObjects; final List<ModuleObjects> moduleObjects;
final List<RBAC> objecs; final List<RBAC> objecs;
final List<RBAC> modules; final List<RBAC> modules;
final List<int> ids;
const ModuleObjectLoadedState( const ModuleObjectLoadedState(
{required this.moduleObjects, {required this.moduleObjects,
required this.modules, required this.modules,
required this.objecs}); required this.objecs,required this.ids});
} }
class ModuleObjectsErrorState extends ModuleObjectsState { class ModuleObjectsErrorState extends ModuleObjectsState {

View File

@ -1,7 +1,5 @@
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/roles/rbac_services.dart';
import '../../model/profile/basic_information/primary-information.dart'; import '../../model/profile/basic_information/primary-information.dart';
import '../../model/rbac/assigned_role.dart'; import '../../model/rbac/assigned_role.dart';
import '../../model/rbac/rbac.dart'; import '../../model/rbac/rbac.dart';

View File

@ -82,7 +82,7 @@ class AddMobile extends StatelessWidget {
validator: mobileNumberValidator, validator: mobileNumberValidator,
maxLength: 11, maxLength: 11,
decoration: decoration:
normalTextFieldStyle(mobile1, "09000000000")), normalTextFieldStyle(mobile1, "sfdfsdfsd")),
const SizedBox( const SizedBox(
height: 12, height: 12,
), ),

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:unit2/bloc/sos/sos_bloc.dart'; import 'package:unit2/bloc/sos/sos_bloc.dart';
import 'package:unit2/screens/sos/components/request_sos.dart'; import 'package:unit2/screens/sos/components/request_sos.dart';
import 'package:unit2/theme-data.dart/text-styles.dart'; import 'package:unit2/theme-data.dart/text-styles.dart';
@ -69,20 +70,23 @@ class AddMobile extends StatelessWidget {
children: [ children: [
//// Mobile number 1 //// Mobile number 1
FormBuilderTextField( FormBuilderTextField(
keyboardType: const TextInputType.numberWithOptions(),
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
name: 'mobile1', name: 'mobile1',
validator: mobileNumberValidator, validator: mobileNumberValidator,
maxLength: 11, maxLength: 11,
decoration: decoration:
normalTextFieldStyle(mobile1, "09")), normalTextFieldStyle(mobile1, "+639000000000")),
//// Mobile number 2 //// Mobile number 2
FormBuilderTextField( FormBuilderTextField(
keyboardType: const TextInputType.numberWithOptions(),
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
name: 'mobile2', name: 'mobile2',
decoration: decoration:
normalTextFieldStyle(mobile2, "09")), normalTextFieldStyle(mobile2, "+639000000000")),
const SizedBox(height: 30,), const SizedBox(height: 30,),
SizedBox( SizedBox(

View File

@ -1,4 +1,3 @@
import 'package:app_popup_menu/app_popup_menu.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
@ -11,7 +10,7 @@ import 'package:unit2/bloc/rbac/rbac_operations/agency/agency_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/object/object_bloc.dart'; import 'package:unit2/bloc/rbac/rbac_operations/object/object_bloc.dart';
import 'package:unit2/model/utils/agency.dart'; import 'package:unit2/model/utils/agency.dart';
import 'package:unit2/model/utils/category.dart'; import 'package:unit2/model/utils/category.dart';
import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart'; import 'package:unit2/utils/formatters.dart';
import 'package:unit2/utils/global_context.dart'; import 'package:unit2/utils/global_context.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../theme-data.dart/box_shadow.dart'; import '../../../theme-data.dart/box_shadow.dart';
@ -19,14 +18,12 @@ import '../../../theme-data.dart/btn-style.dart';
import '../../../theme-data.dart/colors.dart'; import '../../../theme-data.dart/colors.dart';
import '../../../theme-data.dart/form-style.dart'; import '../../../theme-data.dart/form-style.dart';
import '../../../utils/alerts.dart'; import '../../../utils/alerts.dart';
import '../../../utils/formatters.dart';
import '../../../utils/global.dart'; import '../../../utils/global.dart';
import '../../../widgets/Leadings/add_leading.dart'; import '../../../widgets/Leadings/add_leading.dart';
import '../../../widgets/empty_data.dart'; import '../../../widgets/empty_data.dart';
class RbacAgencyScreen extends StatelessWidget { class RbacAgencyScreen extends StatelessWidget {
const RbacAgencyScreen({super.key});
const RbacAgencyScreen();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -38,6 +35,7 @@ class RbacAgencyScreen extends StatelessWidget {
BuildContext parent; BuildContext parent;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: const Text("Agencies"), title: const Text("Agencies"),
actions: [ actions: [
@ -54,6 +52,7 @@ class RbacAgencyScreen extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
FormBuilderTextField( FormBuilderTextField(
inputFormatters: [UpperCaseTextFormatter()],
validator: FormBuilderValidators.required( validator: FormBuilderValidators.required(
errorText: "This field is required"), errorText: "This field is required"),
name: "name", name: "name",
@ -149,15 +148,14 @@ class RbacAgencyScreen extends StatelessWidget {
.saveAndValidate()) { .saveAndValidate()) {
String name = String name =
formKey.currentState!.value['name']; formKey.currentState!.value['name'];
Navigator.pop(context);
parent.read<AgencyBloc>().add(AddAgency( parent.read<AgencyBloc>().add(AddAgency(
agency: Agency( agency: Agency(
category: selectedAgencyCategory, category: selectedAgencyCategory,
id: null, id: null,
name: name, name: name,
privateEntity: isPrivate))); privateEntity: isPrivate)));
Navigator.pop(context);
} }
}, },
child: const Text("Add")), child: const Text("Add")),
) )
@ -174,6 +172,7 @@ class RbacAgencyScreen extends StatelessWidget {
indicatorWidget: const SpinKitFadingCircle(color: Colors.white), indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<AgencyBloc, AgencyState>( child: BlocConsumer<AgencyBloc, AgencyState>(
listener: (context, state) { listener: (context, state) {
print(state);
if (state is AgencyLoadingState) { if (state is AgencyLoadingState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait..."); progress!.showWithText("Please wait...");
@ -201,6 +200,23 @@ class RbacAgencyScreen extends StatelessWidget {
}); });
} }
} }
////ADDED STATE
if (state is AgencyAddesState) {
if (state.response['success']) {
successAlert(
context, "Adding Successfull!", state.response['message'],
() {
Navigator.of(context).pop();
context.read<AgencyBloc>().add(GetAgencies());
});
} else {
errorAlert(context, "Adding Failed",
"Something went wrong. Please try again.", () {
Navigator.of(context).pop();
context.read<AgencyBloc>().add(GetAgencies());
});
}
}
}, },
builder: (context, state) { builder: (context, state) {
final parent = context; final parent = context;
@ -255,7 +271,7 @@ class RbacAgencyScreen extends StatelessWidget {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, message: state.message,
onpressed: () { onpressed: () {
context.read<ObjectBloc>().add(GetObjects()); parent.read<AgencyBloc>().add(GetAgencies());
}); });
} }
return Container(); return Container();

View File

@ -25,6 +25,7 @@ class RbacModuleScreen extends StatelessWidget {
final formKey = GlobalKey<FormBuilderState>(); final formKey = GlobalKey<FormBuilderState>();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: const Text("Module Screen"), title: const Text("Module Screen"),
actions: [ actions: [

View File

@ -1,4 +1,4 @@
import 'package:app_popup_menu/app_popup_menu.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
@ -6,9 +6,7 @@ import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:group_list_view/group_list_view.dart'; import 'package:group_list_view/group_list_view.dart';
import 'package:multi_dropdown/models/value_item.dart';
import 'package:multi_dropdown/multiselect_dropdown.dart'; import 'package:multi_dropdown/multiselect_dropdown.dart';
import 'package:unit2/bloc/rbac/rbac_operations/module/module_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/module_objects/module_objects_bloc.dart'; import 'package:unit2/bloc/rbac/rbac_operations/module_objects/module_objects_bloc.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
@ -35,7 +33,10 @@ class RbacModuleObjectsScreen extends StatelessWidget {
List<ValueItem> selectedValueItemObjects = []; List<ValueItem> selectedValueItemObjects = [];
final formKey = GlobalKey<FormBuilderState>(); final formKey = GlobalKey<FormBuilderState>();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true,
elevation: 0,
backgroundColor: primary, backgroundColor: primary,
title: const Text("Module Object Screen"), title: const Text("Module Object Screen"),
actions: [ actions: [
@ -139,7 +140,7 @@ class RbacModuleObjectsScreen extends StatelessWidget {
indicatorWidget: const SpinKitFadingCircle(color: Colors.white), indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<ModuleObjectsBloc, ModuleObjectsState>( child: BlocConsumer<ModuleObjectsBloc, ModuleObjectsState>(
listener: (context, state) { listener: (context, state) {
print(state);
if (state is ModuleObjectLoadingState) { if (state is ModuleObjectLoadingState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait..."); progress!.showWithText("Please wait...");
@ -281,7 +282,9 @@ class RbacModuleObjectsScreen extends StatelessWidget {
} }
if (state is ModuleObjectsErrorState) { if (state is ModuleObjectsErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, onpressed: () {}); message: state.message, onpressed: () {
parent.read<ModuleObjectsBloc>().add(GetModuleObjects());
});
} }
return Container(); return Container();
}, },

View File

@ -26,6 +26,7 @@ class RbacObjectScreen extends StatelessWidget {
final formKey = GlobalKey<FormBuilderState>(); final formKey = GlobalKey<FormBuilderState>();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: const Text("Objects Screen"), title: const Text("Objects Screen"),
actions: [ actions: [

View File

@ -6,7 +6,6 @@ import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:unit2/bloc/rbac/rbac_operations/operation/operation_bloc.dart'; import 'package:unit2/bloc/rbac/rbac_operations/operation/operation_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role/role_bloc.dart';
import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart'; import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../theme-data.dart/box_shadow.dart'; import '../../../theme-data.dart/box_shadow.dart';
@ -361,7 +360,7 @@ class RbacOperationScreen extends StatelessWidget {
} }
if (state is OperationErrorState) { if (state is OperationErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
message: state.toString(), message: state.message.toString(),
onpressed: () { onpressed: () {
context.read<OperationBloc>().add(GetOperations()); context.read<OperationBloc>().add(GetOperations());
}); });

View File

@ -36,6 +36,7 @@ class RbacPermissionScreen extends StatelessWidget {
BuildContext? parent; BuildContext? parent;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: const Text("Permissions Screen"), title: const Text("Permissions Screen"),
actions: [ actions: [
@ -272,7 +273,9 @@ class RbacPermissionScreen extends StatelessWidget {
} }
if (state is PermissionErrorState) { if (state is PermissionErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, onpressed: () {}); message: state.message, onpressed: () {
parent!.read<PermissionBloc>().add(GetPermissions());
});
} }
return Container(); return Container();
}, },

View File

@ -5,27 +5,24 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:multi_dropdown/models/value_item.dart';
import 'package:multi_dropdown/multiselect_dropdown.dart'; import 'package:multi_dropdown/multiselect_dropdown.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role/role_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/role_assignment/role_assignment_bloc.dart'; import 'package:unit2/bloc/role_assignment/role_assignment_bloc.dart';
import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart'; import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../model/rbac/rbac.dart'; import '../../../model/rbac/rbac.dart';
import '../../../theme-data.dart/box_shadow.dart';
import '../../../theme-data.dart/btn-style.dart'; import '../../../theme-data.dart/btn-style.dart';
import '../../../theme-data.dart/colors.dart'; import '../../../theme-data.dart/colors.dart';
import '../../../theme-data.dart/form-style.dart';
import '../../../utils/alerts.dart'; import '../../../utils/alerts.dart';
import '../../../utils/global.dart'; import '../../../utils/global.dart';
import '../../../widgets/empty_data.dart'; import '../../../widgets/empty_data.dart';
class RbacRoleAssignment extends StatelessWidget { class RbacRoleAssignment extends StatelessWidget {
final int id; final int id;
const RbacRoleAssignment({super.key, required this.id}); final String name;
final String lname;
const RbacRoleAssignment({super.key, required this.id, required this.lname, required this.name});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -37,7 +34,7 @@ class RbacRoleAssignment extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: const Text("User Roles Screen"), title: const Text("User Roles Screenss"),
actions: [ actions: [
AddLeading(onPressed: () { AddLeading(onPressed: () {
BuildContext parent = context; BuildContext parent = context;
@ -272,7 +269,7 @@ class RbacRoleAssignment extends StatelessWidget {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, message: state.message,
onpressed: () { onpressed: () {
context.read<RoleBloc>().add(GetRoles()); context.read<RoleAssignmentBloc>().add(GetAssignedRoles(firstname: name,lastname: lname));
}); });
} }
if (state is UserNotExistError) { if (state is UserNotExistError) {

View File

@ -32,6 +32,7 @@ class RbacRoleExtendScreen extends StatelessWidget {
final formKey = GlobalKey<FormBuilderState>(); final formKey = GlobalKey<FormBuilderState>();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true,
elevation: 0, elevation: 0,
backgroundColor: primary, backgroundColor: primary,
title: const Text("Role Extend"), title: const Text("Role Extend"),
@ -151,13 +152,13 @@ class RbacRoleExtendScreen extends StatelessWidget {
if (state is RoleExtendDeletedState) { if (state is RoleExtendDeletedState) {
if (state.success) { if (state.success) {
successAlert(context, "Delete Successfull!", successAlert(context, "Delete Successfull!",
"Role Module Deleted Successfully", () { "Role Deleted Successfully", () {
Navigator.of(context).pop(); Navigator.of(context).pop();
context.read<RoleExtendBloc>().add(GetRoleExtend()); context.read<RoleExtendBloc>().add(GetRoleExtend());
}); });
} else { } else {
errorAlert( errorAlert(
context, "Delete Failed", "Role Module Delete Failed", () { context, "Delete Failed", "Role Delete Failed", () {
Navigator.of(context).pop(); Navigator.of(context).pop();
context.read<RoleExtendBloc>().add(GetRoleExtend()); context.read<RoleExtendBloc>().add(GetRoleExtend());
}); });
@ -279,7 +280,9 @@ class RbacRoleExtendScreen extends StatelessWidget {
} }
if (state is RoleExtendErrorState) { if (state is RoleExtendErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, onpressed: () {}); message: state.message, onpressed: () {
context.read<RoleExtendBloc>().add(GetRoleExtend());
});
} }
return Container(); return Container();
}, },

View File

@ -1,4 +1,3 @@
import 'package:app_popup_menu/app_popup_menu.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
@ -7,7 +6,6 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:group_list_view/group_list_view.dart'; import 'package:group_list_view/group_list_view.dart';
import 'package:multi_dropdown/multiselect_dropdown.dart'; import 'package:multi_dropdown/multiselect_dropdown.dart';
import 'package:unit2/bloc/rbac/rbac_operations/module_objects/module_objects_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role_module/role_module_bloc.dart'; import 'package:unit2/bloc/rbac/rbac_operations/role_module/role_module_bloc.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
@ -272,7 +270,9 @@ class RbacRoleModuleScreen extends StatelessWidget {
} }
if (state is RoleModuleErrorState) { if (state is RoleModuleErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, onpressed: () {}); message: state.message, onpressed: () {
context.read<RoleModuleBloc>().add(GetRoleModules());
});
} }
return Container(); return Container();
}, },

View File

@ -1,4 +1,4 @@
import 'package:app_popup_menu/app_popup_menu.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
@ -7,7 +7,6 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:group_list_view/group_list_view.dart'; import 'package:group_list_view/group_list_view.dart';
import 'package:multi_dropdown/multiselect_dropdown.dart'; import 'package:multi_dropdown/multiselect_dropdown.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role_module/role_module_bloc.dart';
import 'package:unit2/bloc/rbac/rbac_operations/roles_under/roles_under_bloc.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/Leadings/add_leading.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
@ -34,8 +33,9 @@ class RbacRoleUnderScreen extends StatelessWidget {
final formKey = GlobalKey<FormBuilderState>(); final formKey = GlobalKey<FormBuilderState>();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: const Text("Role Module"), title: const Text("Assignable Roles"),
actions: [ actions: [
AddLeading(onPressed: () { AddLeading(onPressed: () {
showDialog( showDialog(
@ -152,7 +152,7 @@ class RbacRoleUnderScreen extends StatelessWidget {
if (state is RoleUnderDeletedState) { if (state is RoleUnderDeletedState) {
if (state.success) { if (state.success) {
successAlert(context, "Delete Successfull!", successAlert(context, "Delete Successfull!",
"Role Module Deleted Successfully", () { "Role Deleted Successfully", () {
Navigator.of(context).pop(); Navigator.of(context).pop();
context.read<RolesUnderBloc>().add(GetRolesUnder()); context.read<RolesUnderBloc>().add(GetRolesUnder());
}); });
@ -277,7 +277,9 @@ tileColor: Colors.white,
} }
if (state is RoleUnderErrorState) { if (state is RoleUnderErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, onpressed: () {}); message: state.message, onpressed: () {
context.read<RolesUnderBloc>().add(GetRolesUnder());
});
} }
return Container(); return Container();
}, },

View File

@ -8,12 +8,10 @@ import 'package:searchfield/searchfield.dart';
import 'package:unit2/bloc/rbac/rbac_operations/role/role_bloc.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/bloc/rbac/rbac_operations/station/station_bloc.dart';
import 'package:unit2/model/rbac/rbac_station.dart'; import 'package:unit2/model/rbac/rbac_station.dart';
import 'package:unit2/model/roles/pass_check/station_assign_area.dart';
import 'package:unit2/model/utils/agency.dart'; import 'package:unit2/model/utils/agency.dart';
import 'package:unit2/model/utils/position.dart'; import 'package:unit2/model/utils/position.dart';
import 'package:unit2/widgets/Leadings/add_leading.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import '../../../../bloc/role/pass_check/est_point_person/est_point_person_station/est_point_person_station_bloc.dart';
import '../../../../model/rbac/station_type.dart'; import '../../../../model/rbac/station_type.dart';
import '../../../../theme-data.dart/box_shadow.dart'; import '../../../../theme-data.dart/box_shadow.dart';
import '../../../../theme-data.dart/btn-style.dart'; import '../../../../theme-data.dart/btn-style.dart';
@ -874,7 +872,7 @@ class _RbacStationScreenState extends State<RbacStationScreen> {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, message: state.message,
onpressed: () { onpressed: () {
context.read<RoleBloc>().add(GetRoles()); context.read<StationBloc>().add(GetStations(agencyId: selectedAgencyId));
}); });
} }

View File

@ -14,7 +14,7 @@ import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_as
import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_role_assignment/est_role_assignment_bloc.dart'; import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_role_assignment/est_role_assignment_bloc.dart';
import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_station/est_point_person_station_bloc.dart'; import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_station/est_point_person_station_bloc.dart';
import '../../../../../sevices/roles/est_point_person/est_point_person_role_assignment_services.dart'; import '../../../../../sevices/roles/est_point_person/est_point_person_role_assignment_services.dart';
import '../../../../superadmin/agency.dart/agency_screen.dart'; import '../../../../superadmin/agency/agency_screen.dart';
import '../../../roles/establishment_point_person/est_point_person_agecies.dart'; import '../../../roles/establishment_point_person/est_point_person_agecies.dart';
import '../../../roles/establishment_point_person/est_point_person_role_member_screen.dart'; import '../../../roles/establishment_point_person/est_point_person_role_member_screen.dart';
import '../../../roles/establishment_point_person/est_point_person_role_under_screen.dart'; import '../../../roles/establishment_point_person/est_point_person_role_under_screen.dart';

View File

@ -28,7 +28,7 @@ import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
import 'package:unit2/theme-data.dart/btn-style.dart'; import 'package:unit2/theme-data.dart/btn-style.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/theme-data.dart/form-style.dart';
import '../../../../superadmin/agency.dart/agency_screen.dart'; import '../../../../superadmin/agency/agency_screen.dart';
import '../../../../superadmin/module_objects/module_objects_screen.dart'; import '../../../../superadmin/module_objects/module_objects_screen.dart';
import '../../../../superadmin/role_module/role_module_scree.dart'; import '../../../../superadmin/role_module/role_module_scree.dart';
import './shared_card_label.dart'; import './shared_card_label.dart';
@ -210,6 +210,7 @@ class SuperAdminMenu extends StatelessWidget {
})); }));
} }
if (object.object.name == 'Role Member') { if (object.object.name == 'Role Member') {
Navigator.of(context).pop();
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
@ -279,7 +280,7 @@ class SuperAdminMenu extends StatelessWidget {
firstname: firstname:
fname, fname,
lastname: lastname:
lname),),child:RbacRoleAssignment(id:id) ,); lname),),child:RbacRoleAssignment(id:id,name: fname,lname: lname,) ,);
})); }));
} }
}, },

View File

@ -58,7 +58,7 @@ class AgencyServices {
Map data = jsonDecode(response.body); Map data = jsonDecode(response.body);
statusResponse = data; statusResponse = data;
}else{ }else{
Map data = jsonDecode(response.body); Map data = jsonDecode(response.body);
String message = data['message']; String message = data['message'];
statusResponse.addAll({'message': message}); statusResponse.addAll({'message': message});
statusResponse.addAll( statusResponse.addAll(

View File

@ -67,7 +67,7 @@ class RbacObjectServices {
} else { } else {
Map data = jsonDecode(response.body); Map data = jsonDecode(response.body);
String message = data['message']; String message = data['message'];
statusResponse.addAll({'message': message}); statusResponse.addAll({'message': "Error Adding Object"});
statusResponse.addAll( statusResponse.addAll(
{'success': false}, {'success': false},
); );
@ -111,7 +111,7 @@ class RbacObjectServices {
} else { } else {
Map data = jsonDecode(response.body); Map data = jsonDecode(response.body);
String message = data['message']; String message = data['message'];
statusResponse.addAll({'message': message}); statusResponse.addAll({'message': "Error Updating Object"});
statusResponse.addAll( statusResponse.addAll(
{'success': false}, {'success': false},
); );

View File

@ -19,7 +19,7 @@ class Request {
Map<String, String>? param}) async { Map<String, String>? param}) async {
Response response; Response response;
try { try {
response = await get(Uri.https(host, path!, param), headers: headers) response = await get(Uri.http(host, path!, param), headers: headers)
.timeout(Duration(seconds: requestTimeout)); .timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( Fluttertoast.showToast(
@ -61,7 +61,7 @@ class Request {
Map<String, String>? param}) async { Map<String, String>? param}) async {
Response response; Response response;
try { try {
response = await post(Uri.https(host, path!, param), response = await post(Uri.http(host, path!, param),
headers: headers, body: jsonEncode(body)) headers: headers, body: jsonEncode(body))
.timeout(Duration(seconds: requestTimeout)); .timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
@ -104,7 +104,7 @@ class Request {
required Map<String, dynamic>? param}) async { required Map<String, dynamic>? param}) async {
Response response; Response response;
try { try {
response =await put(Uri.https(host,path,param),headers: headers,body: jsonEncode(body)); response =await put(Uri.http(host,path,param),headers: headers,body: jsonEncode(body));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( Fluttertoast.showToast(
msg: timeoutError, msg: timeoutError,
@ -186,7 +186,7 @@ class Request {
required Map<String, dynamic>? param}) async { required Map<String, dynamic>? param}) async {
Response response; Response response;
try { try {
response = await delete(Uri.https(host, path, param), response = await delete(Uri.http(host, path, param),
headers: headers, body: jsonEncode(body)) headers: headers, body: jsonEncode(body))
.timeout(Duration(seconds: requestTimeout)); .timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {

View File

@ -5,8 +5,8 @@ class Url {
String host() { String host() {
// return '192.168.10.183:3000'; // return '192.168.10.183:3000';
return 'agusandelnorte.gov.ph'; // return 'agusandelnorte.gov.ph';
// return "192.168.10.219:3000"; return "192.168.10.219:3000";
// return "192.168.10.241"; // return "192.168.10.241";
// return "192.168.10.221:3004"; // return "192.168.10.221:3004";
// return "playweb.agusandelnorte.gov.ph"; // return "playweb.agusandelnorte.gov.ph";

View File

@ -104,7 +104,6 @@ dev_dependencies:
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0
build_runner: ^2.1.7 build_runner: ^2.1.7
hive_generator: ^1.1.2 hive_generator: ^1.1.2
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec