test superadmin operations
parent
7cc0ab1f56
commit
690af305d6
|
@ -8,7 +8,7 @@
|
|||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<application
|
||||
android:label="unit2"
|
||||
android:label="uniT App"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<provider
|
||||
|
|
|
@ -40,7 +40,7 @@ class AgencyBloc extends Bloc<AgencyEvent, AgencyState> {
|
|||
await AgencyServices.instance.add(agency: event.agency);
|
||||
if (statusResponse['success']) {
|
||||
Agency newAgency = Agency.fromJson(statusResponse['data']);
|
||||
agencies.add(newAgency);
|
||||
agencies.insert(0,newAgency);
|
||||
emit(AgencyAddesState(response: statusResponse));
|
||||
} else {
|
||||
emit(AgencyAddesState(response: statusResponse));
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:bloc/bloc.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/sevices/roles/rbac_operations/module_objects_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<RBAC> objects = [];
|
||||
List<RBAC> modules = [];
|
||||
List<int> ids = [];
|
||||
on<GetModuleObjects>((event, emit) async {
|
||||
emit(ModuleObjectLoadingState());
|
||||
try {
|
||||
|
@ -28,8 +28,12 @@ class ModuleObjectsBloc extends Bloc<ModuleObjectsEvent, ModuleObjectsState> {
|
|||
if (modules.isEmpty) {
|
||||
modules = await RbacModuleServices.instance.getRbacModule();
|
||||
}
|
||||
ids =[];
|
||||
for(var mo in moduleObjects){
|
||||
ids.add(mo.id);
|
||||
}
|
||||
emit(ModuleObjectLoadedState(
|
||||
moduleObjects: moduleObjects, objecs: objects, modules: modules));
|
||||
moduleObjects: moduleObjects, objecs: objects, modules: modules,ids: ids));
|
||||
} catch (e) {
|
||||
emit(ModuleObjectsErrorState(message: e.toString()));
|
||||
}
|
||||
|
@ -46,7 +50,9 @@ class ModuleObjectsBloc extends Bloc<ModuleObjectsEvent, ModuleObjectsState> {
|
|||
if (statusResponse['success']) {
|
||||
statusResponse['data'].forEach((var permission) {
|
||||
ModuleObjects newModuleObject = ModuleObjects.fromJson(permission);
|
||||
moduleObjects.add(newModuleObject);
|
||||
if(!ids.contains(newModuleObject.id)){
|
||||
moduleObjects.add(newModuleObject);
|
||||
}
|
||||
emit(ModuleObjectAddedState(response: statusResponse));
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -13,10 +13,11 @@ class ModuleObjectLoadedState extends ModuleObjectsState {
|
|||
final List<ModuleObjects> moduleObjects;
|
||||
final List<RBAC> objecs;
|
||||
final List<RBAC> modules;
|
||||
final List<int> ids;
|
||||
const ModuleObjectLoadedState(
|
||||
{required this.moduleObjects,
|
||||
required this.modules,
|
||||
required this.objecs});
|
||||
required this.objecs,required this.ids});
|
||||
}
|
||||
|
||||
class ModuleObjectsErrorState extends ModuleObjectsState {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/sevices/roles/rbac_services.dart';
|
||||
|
||||
import '../../model/profile/basic_information/primary-information.dart';
|
||||
import '../../model/rbac/assigned_role.dart';
|
||||
import '../../model/rbac/rbac.dart';
|
||||
|
|
|
@ -82,7 +82,7 @@ class AddMobile extends StatelessWidget {
|
|||
validator: mobileNumberValidator,
|
||||
maxLength: 11,
|
||||
decoration:
|
||||
normalTextFieldStyle(mobile1, "09000000000")),
|
||||
normalTextFieldStyle(mobile1, "sfdfsdfsd")),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.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/screens/sos/components/request_sos.dart';
|
||||
import 'package:unit2/theme-data.dart/text-styles.dart';
|
||||
|
@ -69,20 +70,23 @@ class AddMobile extends StatelessWidget {
|
|||
children: [
|
||||
//// Mobile number 1
|
||||
FormBuilderTextField(
|
||||
keyboardType: const TextInputType.numberWithOptions(),
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
name: 'mobile1',
|
||||
validator: mobileNumberValidator,
|
||||
maxLength: 11,
|
||||
decoration:
|
||||
normalTextFieldStyle(mobile1, "09")),
|
||||
normalTextFieldStyle(mobile1, "+639000000000")),
|
||||
|
||||
//// Mobile number 2
|
||||
FormBuilderTextField(
|
||||
|
||||
keyboardType: const TextInputType.numberWithOptions(),
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
name: 'mobile2',
|
||||
|
||||
decoration:
|
||||
normalTextFieldStyle(mobile2, "09")),
|
||||
normalTextFieldStyle(mobile2, "+639000000000")),
|
||||
|
||||
const SizedBox(height: 30,),
|
||||
SizedBox(
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:app_popup_menu/app_popup_menu.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
|
@ -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/model/utils/agency.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/widgets/error_state.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/form-style.dart';
|
||||
import '../../../utils/alerts.dart';
|
||||
import '../../../utils/formatters.dart';
|
||||
import '../../../utils/global.dart';
|
||||
import '../../../widgets/Leadings/add_leading.dart';
|
||||
import '../../../widgets/empty_data.dart';
|
||||
|
||||
class RbacAgencyScreen extends StatelessWidget {
|
||||
|
||||
const RbacAgencyScreen();
|
||||
const RbacAgencyScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -38,6 +35,7 @@ class RbacAgencyScreen extends StatelessWidget {
|
|||
BuildContext parent;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
title: const Text("Agencies"),
|
||||
actions: [
|
||||
|
@ -54,6 +52,7 @@ class RbacAgencyScreen extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
FormBuilderTextField(
|
||||
inputFormatters: [UpperCaseTextFormatter()],
|
||||
validator: FormBuilderValidators.required(
|
||||
errorText: "This field is required"),
|
||||
name: "name",
|
||||
|
@ -149,15 +148,14 @@ class RbacAgencyScreen extends StatelessWidget {
|
|||
.saveAndValidate()) {
|
||||
String name =
|
||||
formKey.currentState!.value['name'];
|
||||
Navigator.pop(context);
|
||||
parent.read<AgencyBloc>().add(AddAgency(
|
||||
agency: Agency(
|
||||
category: selectedAgencyCategory,
|
||||
id: null,
|
||||
name: name,
|
||||
privateEntity: isPrivate)));
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
},
|
||||
child: const Text("Add")),
|
||||
)
|
||||
|
@ -174,6 +172,7 @@ class RbacAgencyScreen extends StatelessWidget {
|
|||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocConsumer<AgencyBloc, AgencyState>(
|
||||
listener: (context, state) {
|
||||
print(state);
|
||||
if (state is AgencyLoadingState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
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) {
|
||||
final parent = context;
|
||||
|
@ -255,7 +271,7 @@ class RbacAgencyScreen extends StatelessWidget {
|
|||
return SomethingWentWrong(
|
||||
message: state.message,
|
||||
onpressed: () {
|
||||
context.read<ObjectBloc>().add(GetObjects());
|
||||
parent.read<AgencyBloc>().add(GetAgencies());
|
||||
});
|
||||
}
|
||||
return Container();
|
|
@ -25,6 +25,7 @@ class RbacModuleScreen extends StatelessWidget {
|
|||
final formKey = GlobalKey<FormBuilderState>();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
title: const Text("Module Screen"),
|
||||
actions: [
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:app_popup_menu/app_popup_menu.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
|
@ -6,9 +6,7 @@ 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/models/value_item.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/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/error_state.dart';
|
||||
|
@ -35,7 +33,10 @@ 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: [
|
||||
|
@ -139,7 +140,7 @@ class RbacModuleObjectsScreen extends StatelessWidget {
|
|||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocConsumer<ModuleObjectsBloc, ModuleObjectsState>(
|
||||
listener: (context, state) {
|
||||
print(state);
|
||||
|
||||
if (state is ModuleObjectLoadingState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Please wait...");
|
||||
|
@ -281,7 +282,9 @@ class RbacModuleObjectsScreen extends StatelessWidget {
|
|||
}
|
||||
if (state is ModuleObjectsErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: state.message, onpressed: () {});
|
||||
message: state.message, onpressed: () {
|
||||
parent.read<ModuleObjectsBloc>().add(GetModuleObjects());
|
||||
});
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
|
|
|
@ -26,6 +26,7 @@ class RbacObjectScreen extends StatelessWidget {
|
|||
final formKey = GlobalKey<FormBuilderState>();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
title: const Text("Objects Screen"),
|
||||
actions: [
|
||||
|
|
|
@ -6,7 +6,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: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/widgets/error_state.dart';
|
||||
import '../../../theme-data.dart/box_shadow.dart';
|
||||
|
@ -361,7 +360,7 @@ class RbacOperationScreen extends StatelessWidget {
|
|||
}
|
||||
if (state is OperationErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: state.toString(),
|
||||
message: state.message.toString(),
|
||||
onpressed: () {
|
||||
context.read<OperationBloc>().add(GetOperations());
|
||||
});
|
||||
|
|
|
@ -36,6 +36,7 @@ class RbacPermissionScreen extends StatelessWidget {
|
|||
BuildContext? parent;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
title: const Text("Permissions Screen"),
|
||||
actions: [
|
||||
|
@ -272,7 +273,9 @@ class RbacPermissionScreen extends StatelessWidget {
|
|||
}
|
||||
if (state is PermissionErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: state.message, onpressed: () {});
|
||||
message: state.message, onpressed: () {
|
||||
parent!.read<PermissionBloc>().add(GetPermissions());
|
||||
});
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
|
|
|
@ -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_spinkit/flutter_spinkit.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: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/screens/superadmin/role/shared_pop_up_menu.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/box_shadow.dart';
|
||||
import '../../../theme-data.dart/btn-style.dart';
|
||||
import '../../../theme-data.dart/colors.dart';
|
||||
import '../../../theme-data.dart/form-style.dart';
|
||||
import '../../../utils/alerts.dart';
|
||||
import '../../../utils/global.dart';
|
||||
import '../../../widgets/empty_data.dart';
|
||||
|
||||
class RbacRoleAssignment extends StatelessWidget {
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -37,7 +34,7 @@ class RbacRoleAssignment extends StatelessWidget {
|
|||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
title: const Text("User Roles Screen"),
|
||||
title: const Text("User Roles Screenss"),
|
||||
actions: [
|
||||
AddLeading(onPressed: () {
|
||||
BuildContext parent = context;
|
||||
|
@ -272,7 +269,7 @@ class RbacRoleAssignment extends StatelessWidget {
|
|||
return SomethingWentWrong(
|
||||
message: state.message,
|
||||
onpressed: () {
|
||||
context.read<RoleBloc>().add(GetRoles());
|
||||
context.read<RoleAssignmentBloc>().add(GetAssignedRoles(firstname: name,lastname: lname));
|
||||
});
|
||||
}
|
||||
if (state is UserNotExistError) {
|
||||
|
|
|
@ -32,6 +32,7 @@ class RbacRoleExtendScreen extends StatelessWidget {
|
|||
final formKey = GlobalKey<FormBuilderState>();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
elevation: 0,
|
||||
backgroundColor: primary,
|
||||
title: const Text("Role Extend"),
|
||||
|
@ -151,13 +152,13 @@ class RbacRoleExtendScreen extends StatelessWidget {
|
|||
if (state is RoleExtendDeletedState) {
|
||||
if (state.success) {
|
||||
successAlert(context, "Delete Successfull!",
|
||||
"Role Module Deleted Successfully", () {
|
||||
"Role Deleted Successfully", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<RoleExtendBloc>().add(GetRoleExtend());
|
||||
});
|
||||
} else {
|
||||
errorAlert(
|
||||
context, "Delete Failed", "Role Module Delete Failed", () {
|
||||
context, "Delete Failed", "Role Delete Failed", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<RoleExtendBloc>().add(GetRoleExtend());
|
||||
});
|
||||
|
@ -279,7 +280,9 @@ class RbacRoleExtendScreen extends StatelessWidget {
|
|||
}
|
||||
if (state is RoleExtendErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: state.message, onpressed: () {});
|
||||
message: state.message, onpressed: () {
|
||||
context.read<RoleExtendBloc>().add(GetRoleExtend());
|
||||
});
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:app_popup_menu/app_popup_menu.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
|
@ -7,7 +6,6 @@ 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/module_objects/module_objects_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/error_state.dart';
|
||||
|
@ -272,7 +270,9 @@ class RbacRoleModuleScreen extends StatelessWidget {
|
|||
}
|
||||
if (state is RoleModuleErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: state.message, onpressed: () {});
|
||||
message: state.message, onpressed: () {
|
||||
context.read<RoleModuleBloc>().add(GetRoleModules());
|
||||
});
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:app_popup_menu/app_popup_menu.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
|
@ -7,7 +7,6 @@ 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/role_module/role_module_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/error_state.dart';
|
||||
|
@ -34,8 +33,9 @@ class RbacRoleUnderScreen extends StatelessWidget {
|
|||
final formKey = GlobalKey<FormBuilderState>();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
title: const Text("Role Module"),
|
||||
title: const Text("Assignable Roles"),
|
||||
actions: [
|
||||
AddLeading(onPressed: () {
|
||||
showDialog(
|
||||
|
@ -152,7 +152,7 @@ class RbacRoleUnderScreen extends StatelessWidget {
|
|||
if (state is RoleUnderDeletedState) {
|
||||
if (state.success) {
|
||||
successAlert(context, "Delete Successfull!",
|
||||
"Role Module Deleted Successfully", () {
|
||||
"Role Deleted Successfully", () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<RolesUnderBloc>().add(GetRolesUnder());
|
||||
});
|
||||
|
@ -277,7 +277,9 @@ tileColor: Colors.white,
|
|||
}
|
||||
if (state is RoleUnderErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: state.message, onpressed: () {});
|
||||
message: state.message, onpressed: () {
|
||||
context.read<RolesUnderBloc>().add(GetRolesUnder());
|
||||
});
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
|
|
|
@ -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/station/station_bloc.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/position.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/error_state.dart';
|
||||
import '../../../../bloc/role/pass_check/est_point_person/est_point_person_station/est_point_person_station_bloc.dart';
|
||||
import '../../../../model/rbac/station_type.dart';
|
||||
import '../../../../theme-data.dart/box_shadow.dart';
|
||||
import '../../../../theme-data.dart/btn-style.dart';
|
||||
|
@ -874,7 +872,7 @@ class _RbacStationScreenState extends State<RbacStationScreen> {
|
|||
return SomethingWentWrong(
|
||||
message: state.message,
|
||||
onpressed: () {
|
||||
context.read<RoleBloc>().add(GetRoles());
|
||||
context.read<StationBloc>().add(GetStations(agencyId: selectedAgencyId));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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_station/est_point_person_station_bloc.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_role_member_screen.dart';
|
||||
import '../../../roles/establishment_point_person/est_point_person_role_under_screen.dart';
|
||||
|
|
|
@ -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/colors.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/role_module/role_module_scree.dart';
|
||||
import './shared_card_label.dart';
|
||||
|
@ -210,6 +210,7 @@ class SuperAdminMenu extends StatelessWidget {
|
|||
}));
|
||||
}
|
||||
if (object.object.name == 'Role Member') {
|
||||
Navigator.of(context).pop();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
@ -279,7 +280,7 @@ class SuperAdminMenu extends StatelessWidget {
|
|||
firstname:
|
||||
fname,
|
||||
lastname:
|
||||
lname),),child:RbacRoleAssignment(id:id) ,);
|
||||
lname),),child:RbacRoleAssignment(id:id,name: fname,lname: lname,) ,);
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -58,7 +58,7 @@ class AgencyServices {
|
|||
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(
|
||||
|
|
|
@ -67,7 +67,7 @@ class RbacObjectServices {
|
|||
} else {
|
||||
Map data = jsonDecode(response.body);
|
||||
String message = data['message'];
|
||||
statusResponse.addAll({'message': message});
|
||||
statusResponse.addAll({'message': "Error Adding Object"});
|
||||
statusResponse.addAll(
|
||||
{'success': false},
|
||||
);
|
||||
|
@ -111,7 +111,7 @@ class RbacObjectServices {
|
|||
} else {
|
||||
Map data = jsonDecode(response.body);
|
||||
String message = data['message'];
|
||||
statusResponse.addAll({'message': message});
|
||||
statusResponse.addAll({'message': "Error Updating Object"});
|
||||
statusResponse.addAll(
|
||||
{'success': false},
|
||||
);
|
||||
|
|
|
@ -19,7 +19,7 @@ class Request {
|
|||
Map<String, String>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await get(Uri.https(host, path!, param), headers: headers)
|
||||
response = await get(Uri.http(host, path!, param), headers: headers)
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
Fluttertoast.showToast(
|
||||
|
@ -61,7 +61,7 @@ class Request {
|
|||
Map<String, String>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await post(Uri.https(host, path!, param),
|
||||
response = await post(Uri.http(host, path!, param),
|
||||
headers: headers, body: jsonEncode(body))
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
|
@ -104,7 +104,7 @@ class Request {
|
|||
required Map<String, dynamic>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response =await put(Uri.https(host,path,param),headers: headers,body: jsonEncode(body));
|
||||
response =await put(Uri.http(host,path,param),headers: headers,body: jsonEncode(body));
|
||||
} on TimeoutException catch (_) {
|
||||
Fluttertoast.showToast(
|
||||
msg: timeoutError,
|
||||
|
@ -186,7 +186,7 @@ class Request {
|
|||
required Map<String, dynamic>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await delete(Uri.https(host, path, param),
|
||||
response = await delete(Uri.http(host, path, param),
|
||||
headers: headers, body: jsonEncode(body))
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
|
|
|
@ -5,8 +5,8 @@ class Url {
|
|||
|
||||
String host() {
|
||||
// return '192.168.10.183:3000';
|
||||
return 'agusandelnorte.gov.ph';
|
||||
// return "192.168.10.219:3000";
|
||||
// return 'agusandelnorte.gov.ph';
|
||||
return "192.168.10.219:3000";
|
||||
// return "192.168.10.241";
|
||||
// return "192.168.10.221:3004";
|
||||
// return "playweb.agusandelnorte.gov.ph";
|
||||
|
|
|
@ -104,7 +104,6 @@ dev_dependencies:
|
|||
flutter_lints: ^2.0.0
|
||||
build_runner: ^2.1.7
|
||||
hive_generator: ^1.1.2
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
|
|
Loading…
Reference in New Issue