Merge pull request 'release/v1/beta/v1.0.1-beta' (#40) from release/v1/beta/v1.0.1-beta into master

Reviewed-on: http://git.agusandelnorte.gov.ph:3000/SoftwareDevelopmentSection/unit2-null-safety-repository/pulls/40
dev
rodolfobacuinjr 2023-09-06 09:44:39 +08:00
commit 4f48b9cba1
34 changed files with 417 additions and 288 deletions

View File

@ -219,8 +219,7 @@ class EducationBloc extends Bloc<EducationEvent, EducationState> {
} }
}); });
on<EducationViewAttachment>((event, emit) { on<EducationViewAttachment>((event, emit) {
String fileUrl = String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}/media/${event.source}';
'${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}';
emit(EducationAttachmentViewState( emit(EducationAttachmentViewState(
fileUrl: fileUrl, fileName: event.fileName)); fileUrl: fileUrl, fileName: event.fileName));
}); });

View File

@ -290,7 +290,7 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
} }
}); });
on<EligibiltyViewAttachmentEvent>((event,emit){ on<EligibiltyViewAttachmentEvent>((event,emit){
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}'; String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}/media/${event.source}';
emit(EligibilityAttachmentViewState(fileUrl: fileUrl,fileName: event.filename)); emit(EligibilityAttachmentViewState(fileUrl: fileUrl,fileName: event.filename));
}); });
on<ShareAttachment>((event, emit) async { on<ShareAttachment>((event, emit) async {

View File

@ -334,7 +334,7 @@ class LearningDevelopmentBloc
} }
}); });
on<LearningDevelopmentViewAttachmentEvent>((event,emit){ on<LearningDevelopmentViewAttachmentEvent>((event,emit){
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}'; String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}/media/${event.source}';
emit(LearningAndDevelopmentAttachmentViewState(fileUrl: fileUrl, filename: event.filename)); emit(LearningAndDevelopmentAttachmentViewState(fileUrl: fileUrl, filename: event.filename));
}); });
on<ShareAttachment>((event, emit) async { on<ShareAttachment>((event, emit) async {

View File

@ -29,7 +29,7 @@ class ReferencesBloc extends Bloc<ReferencesEvent, ReferencesState> {
references = refs; references = refs;
emit(ReferencesLoadedState(references: references)); emit(ReferencesLoadedState(references: references));
} }
emit(ReferencesLoadedState(references: references));
} catch (e) { } catch (e) {
emit( ReferencesErrorState(message: e.toString())); emit( ReferencesErrorState(message: e.toString()));
} }

View File

@ -5,6 +5,7 @@ import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:unit2/model/roles/pass_check/passer_info.dart'; import 'package:unit2/model/roles/pass_check/passer_info.dart';
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard.dart';
import 'package:unit2/sevices/roles/pass_check_services.dart'; import 'package:unit2/sevices/roles/pass_check_services.dart';
import '../../../utils/scanner.dart'; import '../../../utils/scanner.dart';
part 'pass_check_event.dart'; part 'pass_check_event.dart';
@ -12,7 +13,7 @@ part 'pass_check_state.dart';
class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> { class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
PassCheckBloc() : super(PassCheckInitial()) { PassCheckBloc() : super(PassCheckInitial()) {
int? roleId; RoleIdRoleName? roleIdRoleName;
String? uuid; String? uuid;
bool? otherInputs; bool? otherInputs;
String? io; String? io;
@ -25,9 +26,8 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
try { try {
emit(PassCheckLoadingState()); emit(PassCheckLoadingState());
List<dynamic> response = await PassCheckServices.instance List<dynamic> response = await PassCheckServices.instance
.getPassCheckArea(roleId: event.roleId, userId: event.userId); .getPassCheckArea(roleIdRoleName:RoleIdRoleName(roleId: event.roleIdRoleName.roleId, roleName: event.roleIdRoleName.roleName), userId: event.userId);
roleId = event.roleId; emit(AssignAreaLoaded(assignedArea: response, roleIdRoleName: RoleIdRoleName(roleId: event.roleIdRoleName.roleId, roleName: event.roleIdRoleName.roleName)));
emit(AssignAreaLoaded(assignedArea: response, roleId: roleId!));
} catch (e) { } catch (e) {
emit(PassCheckErrorState(message: e.toString())); emit(PassCheckErrorState(message: e.toString()));
} }
@ -37,14 +37,14 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
checkerId = event.checkerId; checkerId = event.checkerId;
io = event.entranceExit; io = event.entranceExit;
token = event.token; token = event.token;
roleId = event.roleId; roleIdRoleName = event.roleIdRoleName;
assignedArea = event.assignedArea; assignedArea = event.assignedArea;
emit(SettingSaved( emit(SettingSaved(
assignedArea: assignedArea, assignedArea: assignedArea,
checker: checkerId!, checker: checkerId!,
io: io!, io: io!,
otherInputs: otherInputs!, otherInputs: otherInputs!,
roleId: roleId!, roleIdRoleName: roleIdRoleName!,
token: token!)); token: token!));
}); });
on<ScanError>((event, emit) { on<ScanError>((event, emit) {
@ -53,7 +53,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
checker: checkerId!, checker: checkerId!,
io: io!, io: io!,
otherInputs: otherInputs!, otherInputs: otherInputs!,
roleId: roleId!, roleIdRoleName: roleIdRoleName!,
token: token!)); token: token!));
}); });
on<PerformIncomingPostLog>((event, emit) { on<PerformIncomingPostLog>((event, emit) {
@ -64,7 +64,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
io: io!.toLowerCase() == "incoming" ? "i" : "o", io: io!.toLowerCase() == "incoming" ? "i" : "o",
otherInputs: otherInputs!, otherInputs: otherInputs!,
passerId: uuid!, passerId: uuid!,
roleId: roleId!, roleId: roleIdRoleName!.roleId,
stationId: stationId, stationId: stationId,
temp: event.temp)); temp: event.temp));
}); });
@ -77,7 +77,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
io: io!.toLowerCase() == "incoming" ? "i" : "o", io: io!.toLowerCase() == "incoming" ? "i" : "o",
otherInputs: otherInputs!, otherInputs: otherInputs!,
passerId: uuid!, passerId: uuid!,
roleId: roleId!, roleId: roleIdRoleName!.roleId,
stationId: stationId, stationId: stationId,
temp: null)); temp: null));
}); });
@ -89,13 +89,13 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
try { try {
PasserInfo? passerInfo = await PassCheckServices.instance PasserInfo? passerInfo = await PassCheckServices.instance
.getPasserInfo(uuid: uuid!, token: event.token); .getPasserInfo(uuid: uuid!, token: event.token);
if (roleId == 41 || roleId == 13 || roleId == 17 || roleId == 22) { if (roleIdRoleName!.roleName.toLowerCase() == "41" || roleIdRoleName!.roleName.toLowerCase() == 'qr code scanner' || roleIdRoleName!.roleName.toLowerCase() == 'office/branch chief' || roleIdRoleName!.roleName.toLowerCase() == 'registration in-charge') {
stationId = assignedArea.id; stationId = assignedArea.id;
} else if (roleId == 7) { } else if (roleIdRoleName!.roleName.toLowerCase() == 'barangay chairperson') {
cpId = assignedArea.brgycode; cpId = assignedArea.brgycode;
} else if (roleId == 10) { } else if (roleIdRoleName!.roleName.toLowerCase() == 'purok pres') {
cpId = assignedArea.purokdesc; cpId = assignedArea.purokdesc;
} else if (roleId == 16) { } else if (roleIdRoleName!.roleName.toLowerCase() == 'establishment point-person') {
cpId = assignedArea.id; cpId = assignedArea.id;
} }
if (passerInfo == null) { if (passerInfo == null) {
@ -122,7 +122,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
io: io!.toLowerCase() == "incoming" ? "i" : "o", io: io!.toLowerCase() == "incoming" ? "i" : "o",
otherInputs: otherInputs!, otherInputs: otherInputs!,
passerId: uuid!, passerId: uuid!,
roleId: roleId!, roleId: roleIdRoleName!.roleId,
stationId: stationId, stationId: stationId,
temp: null)); temp: null));
} }
@ -136,7 +136,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
checker: checkerId!, checker: checkerId!,
io: io!, io: io!,
otherInputs: otherInputs!, otherInputs: otherInputs!,
roleId: roleId!, roleIdRoleName: roleIdRoleName!,
token: token!)); token: token!));
} }
}); });

View File

@ -8,13 +8,13 @@ abstract class PassCheckEvent extends Equatable {
} }
class GetPassCheckAreas extends PassCheckEvent { class GetPassCheckAreas extends PassCheckEvent {
final int roleId; final RoleIdRoleName roleIdRoleName;
final int userId; final int userId;
const GetPassCheckAreas({required this.roleId, required this.userId}); const GetPassCheckAreas({required this.roleIdRoleName, required this.userId});
} }
class SetScannerSettings extends PassCheckEvent { class SetScannerSettings extends PassCheckEvent {
final int roleId; final RoleIdRoleName roleIdRoleName;
final String token; final String token;
final dynamic assignedArea; final dynamic assignedArea;
final bool includeOtherInputs; final bool includeOtherInputs;
@ -25,7 +25,7 @@ class SetScannerSettings extends PassCheckEvent {
required this.checkerId, required this.checkerId,
required this.entranceExit, required this.entranceExit,
required this.includeOtherInputs, required this.includeOtherInputs,
required this.roleId, required this.roleIdRoleName,
required this.token}); required this.token});
} }

View File

@ -23,8 +23,8 @@ class PassCheckLoadingState extends PassCheckState {}
class AssignAreaLoaded extends PassCheckState { class AssignAreaLoaded extends PassCheckState {
final List<dynamic> assignedArea; final List<dynamic> assignedArea;
final int roleId; final RoleIdRoleName roleIdRoleName;
const AssignAreaLoaded({required this.assignedArea, required this.roleId}); const AssignAreaLoaded({required this.assignedArea, required this.roleIdRoleName});
} }
class SettingSaved extends PassCheckState { class SettingSaved extends PassCheckState {
@ -33,13 +33,13 @@ class SettingSaved extends PassCheckState {
final String io; final String io;
final int checker; final int checker;
final bool otherInputs; final bool otherInputs;
final int roleId; final RoleIdRoleName roleIdRoleName;
const SettingSaved( const SettingSaved(
{required this.assignedArea, {required this.assignedArea,
required this.checker, required this.checker,
required this.io, required this.io,
required this.otherInputs, required this.otherInputs,
required this.roleId, required this.roleIdRoleName,
required this.token}); required this.token});
} }

View File

@ -107,6 +107,8 @@ class UserBloc extends Bloc<UserEvent, UserState> {
emit(InternetTimeout(message: timeoutError)); emit(InternetTimeout(message: timeoutError));
} on Error catch (e) { } on Error catch (e) {
emit(LoginErrorState(message: e.toString())); emit(LoginErrorState(message: e.toString()));
}catch(e){
emit(LoginErrorState(message: e.toString()));
} }
}); });
on<UuidLogin>((event, emit) async { on<UuidLogin>((event, emit) async {

View File

@ -10,6 +10,8 @@ import 'package:unit2/model/passo/additional_items.dart';
import 'package:unit2/model/passo/class_components.dart'; import 'package:unit2/model/passo/class_components.dart';
import 'package:unit2/model/passo/unit_construct.dart'; import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddExtraItems extends StatefulWidget { class AddExtraItems extends StatefulWidget {
final List<UnitConstruct> unit; final List<UnitConstruct> unit;
@ -573,6 +575,14 @@ class _AddExtraItems extends State<AddExtraItems> {
), ),
))); )));
} }
if (state is AdditionalItemsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<AdditionalItemBloc>().add(LoadAdditionalItems());
},
);
}
return Container(); return Container();
}); });
} }

View File

@ -52,13 +52,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
if (state is LocationErrorState) { if (state is LocationErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
} }
}, },
builder: (context, state) { builder: (context, state) {
@ -77,13 +70,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
if (state is LandrefErrorState) { if (state is LandrefErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
} }
}, },
builder: (context, state) { builder: (context, state) {
@ -102,13 +88,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
if (state is MunicipalityErrorState) { if (state is MunicipalityErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
} }
}, builder: (context, state) { }, builder: (context, state) {
if (state is MunicipalityLoaded) { if (state is MunicipalityLoaded) {
@ -132,13 +111,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
if (state is BarangayErrorState) { if (state is BarangayErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
} }
}, builder: (context, state) { }, builder: (context, state) {
if (state is BarangayLoaded) { if (state is BarangayLoaded) {
@ -150,17 +122,15 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
return FormBuilder( return FormBuilder(
key: keys, key: keys,
initialValue: { initialValue: {
'street': bldgloc.street, 'street': bldgloc.street ?? "",
// 'brgy': bldgloc.barangay, 'province': bldgloc.province ?? "",
// 'municipality': bldgloc.municipality,
'province': bldgloc.province,
'l_owner': landRef.owner, 'l_owner': landRef.owner,
'oct_tct_cloa': landRef.cloaNo, 'oct_tct_cloa': landRef.cloaNo ?? "",
'survey_no': landRef.surveyNo, 'survey_no': landRef.surveyNo ?? "",
'lot_no': landRef.lotNo, 'lot_no': landRef.lotNo ?? "",
'blk_no': landRef.blkNo, 'blk_no': landRef.blkNo ?? "",
'l_td_arp': landRef.tdn, 'l_td_arp': landRef.tdn ?? "",
'area': landRef.area 'area': landRef.area ?? ""
}, },
enabled: true, enabled: true,
onChanged: () { onChanged: () {
@ -250,8 +220,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
flex: 1, flex: 1,
child: customDropDownField( child: customDropDownField(
bldgloc.barangay, bldgloc.barangay ?? "",
"", "Barangay",
'brgy', 'brgy',
brgyNAmes)) brgyNAmes))
]), ]),

View File

@ -43,13 +43,13 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
listener: (context, state) { listener: (context, state) {
if (state is StructuralMaterialsLoaded) { if (state is StructuralMaterialsLoaded) {
setState(() { setState(() {
foundation = state.structure.foundation!.split(','); foundation = state.structure.foundation!.split(',') ?? [];
column = state.structure.columns!.split(','); column = state.structure.columns!.split(',') ?? [];
beam = state.structure.beams!.split(','); beam = state.structure.beams!.split(',') ?? [];
truss_framing = state.structure.trussFraming!.split(','); truss_framing = state.structure.trussFraming!.split(',') ?? [];
roof = state.structure.roof!.split(','); roof = state.structure.roof!.split(',') ?? [];
flooring = state.structure.flooring!.split(','); flooring = state.structure.flooring!.split(',') ?? [];
walls = state.structure.walls!.split(','); walls = state.structure.walls!.split(',') ?? [];
// Update other local state variables here if needed // Update other local state variables here if needed
}); });
} }

View File

@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
class PropertyOwnerPage extends StatefulWidget {
@override
_PropertyOwnerPage createState() => _PropertyOwnerPage();
}
class _PropertyOwnerPage extends State<PropertyOwnerPage> {
@override
Widget build(BuildContext context) {
return Scaffold(body: Container());
}
}

View File

@ -19,6 +19,8 @@ import 'package:unit2/model/passo/land_subclassification.dart';
import 'package:unit2/model/passo/unit_construct.dart'; import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/screens/passo/Land/add_land.dart'; import 'package:unit2/screens/passo/Land/add_land.dart';
import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
class AddLandAppraisalModal extends StatefulWidget { class AddLandAppraisalModal extends StatefulWidget {
@ -392,22 +394,54 @@ class _AddLandAppraisalModal extends State<AddLandAppraisalModal> {
))); )));
} }
if (state is MunicipalityErrorState) { if (state is MunicipalityErrorState) {
return Text(state.error); return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<MunicipalityBloc>()
.add(LoadMunicipality());
},
);
} }
return Container(); return Container();
}, },
); );
} }
if (state is LandSubClassificationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandSubClassificationBloc>().add(
const LoadLandSubClassification(
cityCode: '1', classCode: 1));
},
);
}
return Container(); return Container();
}, },
); );
} }
if (state is LandClassificationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandClassificationBloc>()
.add(LoadLandClassification());
},
);
}
return Container(); return Container();
}, },
); );
} }
if (state is LandAppraisalErrorState) { if (state is LandAppraisalErrorState) {
return Text(state.error); return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
},
);
} }
return Container(); return Container();
}); });

View File

@ -9,6 +9,8 @@ import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc
import 'package:unit2/model/passo/other_improvements.dart'; import 'package:unit2/model/passo/other_improvements.dart';
import 'package:unit2/model/passo/trees_improvements.dart'; import 'package:unit2/model/passo/trees_improvements.dart';
import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddOtherImprovementModal extends StatefulWidget { class AddOtherImprovementModal extends StatefulWidget {
// final List<UnitConstruct> unit; // final List<UnitConstruct> unit;
@ -329,16 +331,28 @@ class _AddOtherImprovementModal extends State<AddOtherImprovementModal> {
), ),
)); ));
} }
if (state is LandTreesImprovementsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandTreesImprovementsBloc>()
.add(LoadLandTreesImprovements());
},
);
}
return Container(); return Container();
}); });
} }
if (state is OtherImprovementErrorState) { if (state is OtherImprovementErrorState) {
return Text(state.error); return SomethingWentWrong(
} message: onError,
return Container( onpressed: () {
child: Text("Other Improvement"), context.read<OtherImprovementsBloc>().add(LoadOtherImprovement());
},
); );
}
return Container();
}); });
} }
} }

View File

@ -8,6 +8,8 @@ import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustme
import 'package:unit2/model/passo/land_property_assessment.dart'; import 'package:unit2/model/passo/land_property_assessment.dart';
import 'package:unit2/model/passo/land_value_adjustment.dart'; import 'package:unit2/model/passo/land_value_adjustment.dart';
import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddPropertyAssessmentModal extends StatefulWidget { class AddPropertyAssessmentModal extends StatefulWidget {
// final List<UnitConstruct> unit; // final List<UnitConstruct> unit;
@ -327,16 +329,30 @@ class _AddPropertyAssessmentModal extends State<AddPropertyAssessmentModal> {
), ),
)); ));
} }
if (state is LandValueAdjustmentsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandValueAdjustmentsBloc>()
.add(LoadLandValueAdjustments());
},
);
}
return Container(); return Container();
}); });
} }
if (state is LandPropertyAssessmentErrorState) { if (state is LandPropertyAssessmentErrorState) {
return Text(state.error); return SomethingWentWrong(
} message: onError,
return Container( onpressed: () {
child: Text("Property Assessment"), context
.read<LandPropertyAssessmentBloc>()
.add(LoadLandPropertyAssessment());
},
); );
}
return Container();
}); });
} }
} }

View File

@ -68,7 +68,6 @@ class BuildingHome extends StatelessWidget {
Profile profile; Profile profile;
return Scaffold( return Scaffold(
body: ProgressHUD( body: ProgressHUD(
padding: const EdgeInsets.only(left: 24, right: 24),
backgroundColor: Colors.black87, backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white), indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) { child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
@ -96,7 +95,9 @@ class BuildingHome extends StatelessWidget {
List<PropertyInfo> propertyList = state.property_info; List<PropertyInfo> propertyList = state.property_info;
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: Expanded( child: Column(
children: [
Expanded(
child: ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
itemCount: propertyList.length, itemCount: propertyList.length,
@ -106,6 +107,8 @@ class BuildingHome extends StatelessWidget {
}, },
), ),
), ),
],
),
); );
} }
if (state is PropertyInfoErrorState) { if (state is PropertyInfoErrorState) {

View File

@ -96,7 +96,9 @@ class LandHome extends StatelessWidget {
List<LandPropertyOwner> propertyList = state.land; List<LandPropertyOwner> propertyList = state.land;
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: Expanded( child: Column(
children: [
Expanded(
child: ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
itemCount: propertyList.length, itemCount: propertyList.length,
@ -106,6 +108,8 @@ class LandHome extends StatelessWidget {
}, },
), ),
), ),
],
),
); );
} }
if (state is LandErrorState) { if (state is LandErrorState) {
@ -114,7 +118,7 @@ class LandHome extends StatelessWidget {
onpressed: () { onpressed: () {
context context
.read<LandPropertyOwnerInfoBloc>() .read<LandPropertyOwnerInfoBloc>()
.add(LoadLand()); .add(const LoadLand());
}, },
); );
} }

View File

@ -81,8 +81,8 @@ class _LearningDevelopmentViewAttachmentState
), ),
imageUrl: state.fileUrl, imageUrl: state.fileUrl,
width: double.infinity, width: double.infinity,
height: 220,
fit: BoxFit.cover, fit: BoxFit.fitHeight,
), ),
), ),
); );

View File

@ -1,11 +1,9 @@
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../model/profile/attachment.dart'; import '../../../model/profile/attachment.dart';
import '../../../theme-data.dart/box_shadow.dart'; import '../../../theme-data.dart/box_shadow.dart';
import '../../../theme-data.dart/colors.dart'; import '../../../theme-data.dart/colors.dart';
import '../../../utils/alerts.dart';
class SingleAttachment extends StatelessWidget { class SingleAttachment extends StatelessWidget {
final Function()? onpressed; final Function()? onpressed;
@ -36,9 +34,9 @@ class SingleAttachment extends StatelessWidget {
child: child:
GestureDetector( GestureDetector(
onTap: view, onTap: view,
child: AutoSizeText( child: Text(
attachment.filename!, attachment.filename!,
wrapWords: false,
maxLines: 1, maxLines: 1,
), ),
), ),

View File

@ -264,13 +264,13 @@ class RbacModuleObjectsScreen extends StatelessWidget {
}, },
groupHeaderBuilder: (BuildContext context, int section) { groupHeaderBuilder: (BuildContext context, int section) {
return ListTile( return ListTile(
tileColor: second, tileColor: Colors.white,
title: Text( title: Text(
moduleObjects.keys.toList()[section].toUpperCase(), moduleObjects.keys.toList()[section].toUpperCase(),
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.titleMedium! .titleMedium!
.copyWith(color: Colors.white), .copyWith(color: primary,fontWeight: FontWeight.bold),
), ),
); );
}, },

View File

@ -5,10 +5,12 @@ 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:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:search_page/search_page.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/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 '../../../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';
import '../../../theme-data.dart/colors.dart'; import '../../../theme-data.dart/colors.dart';
@ -24,12 +26,38 @@ class RbacRoleScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final formKey = GlobalKey<FormBuilderState>(); final formKey = GlobalKey<FormBuilderState>();
List<RBAC> roles = [];
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: const Text("Role Screen"), title: const Text("Role Screen"),
actions: [ 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: () { AddLeading(onPressed: () {
BuildContext parent = context; BuildContext parent = context;
showDialog( showDialog(
@ -174,6 +202,7 @@ class RbacRoleScreen extends StatelessWidget {
final parent = context; final parent = context;
if (state is RoleLoadedState) { if (state is RoleLoadedState) {
if (state.roles.isNotEmpty) { if (state.roles.isNotEmpty) {
roles = state.roles;
return ListView.builder( return ListView.builder(
padding: padding:
const EdgeInsets.symmetric(vertical: 8, horizontal: 10), const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
@ -191,8 +220,12 @@ class RbacRoleScreen extends StatelessWidget {
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
CircleAvatar(child: Text('${index+1}'),), CircleAvatar(
const SizedBox(width: 12,), child: Text('${index + 1}'),
),
const SizedBox(
width: 12,
),
Flexible( Flexible(
child: Text(state.roles[index].name!, child: Text(state.roles[index].name!,
style: Theme.of(context) style: Theme.of(context)
@ -360,7 +393,8 @@ class RbacRoleScreen extends StatelessWidget {
} }
if (state is RoleErrorState) { if (state is RoleErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, onpressed: () { message: state.message,
onpressed: () {
context.read<RoleBloc>().add(GetRoles()); context.read<RoleBloc>().add(GetRoles());
}); });
} }

View File

@ -35,7 +35,7 @@ class RbacRoleAssignment extends StatelessWidget {
elevation: 0, elevation: 0,
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: const Text("User Roles Screenss"), title: const Text("User Roles Screens"),
actions: [ actions: [
AddLeading(onPressed: () { AddLeading(onPressed: () {
BuildContext parent = context; BuildContext parent = context;

View File

@ -262,13 +262,13 @@ class RbacRoleExtendScreen extends StatelessWidget {
}, },
groupHeaderBuilder: (BuildContext context, int section) { groupHeaderBuilder: (BuildContext context, int section) {
return ListTile( return ListTile(
tileColor: second, tileColor: Colors.white,
title: Text( title: Text(
rolesExtend.keys.toList()[section].toUpperCase(), rolesExtend.keys.toList()[section].toUpperCase(),
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.titleMedium! .titleMedium!
.copyWith(color: Colors.white), .copyWith(color: primary,fontWeight: FontWeight.bold),
), ),
); );
}, },

View File

@ -252,13 +252,13 @@ class RbacRoleModuleScreen extends StatelessWidget {
}, },
groupHeaderBuilder: (BuildContext context, int section) { groupHeaderBuilder: (BuildContext context, int section) {
return ListTile( return ListTile(
tileColor: second, tileColor: Colors.white,
title: Text( title: Text(
roleModules.keys.toList()[section].toUpperCase(), roleModules.keys.toList()[section].toUpperCase(),
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.titleMedium! .titleMedium!
.copyWith(color: Colors.white), .copyWith(color: primary,fontWeight: FontWeight.bold),
), ),
); );
}, },

View File

@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.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_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
@ -13,6 +14,7 @@ import 'package:unit2/utils/global.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import '../../../bloc/user/user_bloc.dart'; import '../../../bloc/user/user_bloc.dart';
import '../../../theme-data.dart/colors.dart'; import '../../../theme-data.dart/colors.dart';
import '../../../utils/urls.dart';
import '../../../widgets/splash_screen.dart'; import '../../../widgets/splash_screen.dart';
import '../signature/signature_pad.dart'; import '../signature/signature_pad.dart';
import './components/cover-image.dart'; import './components/cover-image.dart';
@ -30,6 +32,8 @@ class BasicInfo extends StatelessWidget {
child: BlocBuilder<UserBloc, UserState>( child: BlocBuilder<UserBloc, UserState>(
builder: (context, state) { builder: (context, state) {
if (state is UserLoggedIn) { if (state is UserLoggedIn) {
String fileUrl =
'${Url.instance.prefixHost()}://${Url.instance.host()}/media/${state.userData?.employeeInfo?.profile?.photoPath}';
state.userData!.employeeInfo!.profile!.sex!.toUpperCase(); state.userData!.employeeInfo!.profile!.sex!.toUpperCase();
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
@ -47,17 +51,38 @@ class BasicInfo extends StatelessWidget {
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
const CircleAvatar( CachedNetworkImage(
radius: 72, imageUrl: fileUrl,
backgroundColor: Colors.white, 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,
), ),
CircleAvatar(
radius: 69,
backgroundColor: Colors.grey.shade800,
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/svgs/male.svg', 'assets/svgs/male.svg',
), ),
), ),
),
], ],
), ),
), ),

View File

@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:unit2/model/login_data/user_info/assigned_area.dart'; import 'package:unit2/model/login_data/user_info/assigned_area.dart';
import 'package:unit2/model/rbac/assigned_role.dart';
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard_icon_generator.dart'; import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard_icon_generator.dart';
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart'; import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart';
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart'; import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
@ -68,10 +69,6 @@ class _DashBoardState extends State<DashBoard> {
docSmsCards.add(e); docSmsCards.add(e);
} }
}); });
unit2Cards.forEach((element) {
print(
"${element.moduleName} - ${element.object.name!} - ${element.roleName} ");
});
if (superadminCards.length > 3) { if (superadminCards.length > 3) {
tempSuperAdminCards = superadminCards.sublist(0, 4); tempSuperAdminCards = superadminCards.sublist(0, 4);
} }
@ -79,6 +76,10 @@ class _DashBoardState extends State<DashBoard> {
tempUnit2Cards = unit2Cards.sublist(0, 4); tempUnit2Cards = unit2Cards.sublist(0, 4);
} }
superadminCards.forEach((el) {
print(el.object.name);
});
return Container( return Container(
padding: padding:
const EdgeInsetsDirectional.symmetric(vertical: 24, horizontal: 24), const EdgeInsetsDirectional.symmetric(vertical: 24, horizontal: 24),
@ -196,7 +197,7 @@ class _DashBoardState extends State<DashBoard> {
: e.object.name!, : e.object.name!,
ontap: () { ontap: () {
if (e.object.name!.toLowerCase() == 'pass check') { if (e.object.name!.toLowerCase() == 'pass check') {
PassCheckArguments passCheckArguments = PassCheckArguments(roleId: e.roleId, userId: widget.userId); PassCheckArguments passCheckArguments = PassCheckArguments(roleIdRoleName: RoleIdRoleName(roleId: e.roleId, roleName: e.roleName), userId: widget.userId);
Navigator.pushNamed(context, '/pass-check', arguments: passCheckArguments); Navigator.pushNamed(context, '/pass-check', arguments: passCheckArguments);
} }
if (e.object.name!.toLowerCase() == 'role based access control') { if (e.object.name!.toLowerCase() == 'role based access control') {
@ -312,7 +313,7 @@ class _DashBoardState extends State<DashBoard> {
PassCheckArguments PassCheckArguments
passCheckArguments = passCheckArguments =
PassCheckArguments( PassCheckArguments(
roleId: 10, roleIdRoleName: RoleIdRoleName(roleId: e.roleId, roleName: e.roleName),
userId: userId:
widget.userId); widget.userId);
Navigator.pushNamed( Navigator.pushNamed(
@ -386,7 +387,7 @@ class _DashBoardState extends State<DashBoard> {
PassCheckArguments PassCheckArguments
passCheckArguments = passCheckArguments =
PassCheckArguments( PassCheckArguments(
roleId: 10, roleIdRoleName: RoleIdRoleName(roleId: e.roleId,roleName: e.roleName),
userId: widget.userId); userId: widget.userId);
Navigator.pushNamed( Navigator.pushNamed(
context, '/pass-check', context, '/pass-check',
@ -647,7 +648,8 @@ class _DashBoardState extends State<DashBoard> {
? "Field Surveyor" ? "Field Surveyor"
: e.object.name!, : e.object.name!,
ontap: () { ontap: () {
Navigator.pushNamed(context, '/passo-home'); Navigator.pushNamed(
context, '/passo-home');
}) })
: Container( : Container(
color: Colors.black, color: Colors.black,
@ -706,7 +708,13 @@ class _DashBoardState extends State<DashBoard> {
} }
class PassCheckArguments { class PassCheckArguments {
final int roleId; final RoleIdRoleName roleIdRoleName;
final int userId; final int userId;
const PassCheckArguments({required this.roleId, required this.userId}); const PassCheckArguments({required this.roleIdRoleName, required this.userId});
}
class RoleIdRoleName{
final int roleId;
final String roleName;
const RoleIdRoleName({required this.roleId, required this.roleName});
} }

View File

@ -271,6 +271,7 @@ class SuperAdminMenu extends StatelessWidget {
roleAssignmentKey roleAssignmentKey
.currentState! .currentState!
.value['lastname']; .value['lastname'];
Navigator.of(context).pop();
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: MaterialPageRoute(builder:
(BuildContext (BuildContext

View File

@ -47,7 +47,7 @@ class _UniT2LoginState extends State<UniT2Login> {
indicatorWidget: const SpinKitFadingCircle(color: Colors.white), indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) { child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
print(state); print(state);
if (state is UserLoggedIn || state is UuidLoaded) { if (state is UserLoggedIn || state is UuidLoaded || state is LoginErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.dismiss(); progress!.dismiss();
} }
@ -94,6 +94,7 @@ class _UniT2LoginState extends State<UniT2Login> {
})); }));
} }
}, builder: (context, state) { }, builder: (context, state) {
print(state);
if (state is VersionLoaded) { if (state is VersionLoaded) {
return Builder(builder: (context) { return Builder(builder: (context) {
if (state.versionInfo!.version != state.apkVersion) { if (state.versionInfo!.version != state.apkVersion) {
@ -251,9 +252,7 @@ class _UniT2LoginState extends State<UniT2Login> {
onPressed: () { onPressed: () {
final progress = final progress =
ProgressHUD.of(context); ProgressHUD.of(context);
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
if (_formKey.currentState! if (_formKey.currentState!
.saveAndValidate()) { .saveAndValidate()) {
password = _formKey.currentState! password = _formKey.currentState!
@ -263,7 +262,6 @@ class _UniT2LoginState extends State<UniT2Login> {
progress?.showWithText( progress?.showWithText(
'Logging in...', 'Logging in...',
); );
BlocProvider.of<UserBloc>(context) BlocProvider.of<UserBloc>(context)
.add(UserLogin( .add(UserLogin(
username: username, username: username,

View File

@ -302,28 +302,28 @@ class _QRCodeScannerState extends State<QRCodeScanner> {
children: [ children: [
SelectedState( SelectedState(
//TODO add api data //TODO add api data
title: state.roleId == 41 || title: state.roleIdRoleName.roleName.toLowerCase() == "41" ||
state.roleId == 13 || state.roleIdRoleName.roleName.toLowerCase() == 'qr code scanner' ||
state.roleId == 17 || state.roleIdRoleName.roleName.toLowerCase() == 'office/branch chief' ||
state.roleId == 22 state.roleIdRoleName.roleName.toLowerCase() == 'registration in-charge'
? state.assignedArea.stationName ? state.assignedArea.stationName
: state.roleId == 7 : state.roleIdRoleName.roleName.toLowerCase() == 'barangay chairperson'
? state.assignedArea.brgydesc ? state.assignedArea.brgydesc
: state.roleId == 10 : state.roleIdRoleName.roleName.toLowerCase() == 'purok president'
? state.assignedArea.purokdesc ? state.assignedArea.purokdesc
: state.roleId == 16 : state.roleIdRoleName.roleName.toLowerCase() == 'establishment point-person'
? "Agency" ? "Agency"
: "", : "",
subtitle: state.roleId == 41 || subtitle: state.roleIdRoleName.roleName.toLowerCase() == "41" ||
state.roleId == 13 || state.roleIdRoleName.roleName.toLowerCase() == 'qr code scanner' ||
state.roleId == 17 || state.roleIdRoleName.roleName.toLowerCase() == 'office/branch chief' ||
state.roleId == 22 state.roleIdRoleName.roleName.toLowerCase() == 'registration in-charge'
? "Station" ? "Station"
: state.roleId == 7 : state.roleIdRoleName.roleName.toLowerCase() == 'barangay chairperson'
? "Barangay" ? "Barangay"
: state.roleId == 10 : state.roleIdRoleName.roleName.toLowerCase() == 'purok president'
? "Purok" ? "Purok"
: state.roleId == 16 : state.roleIdRoleName.roleName.toLowerCase() == 'establishment point-person'
? "Agency" ? "Agency"
: "", : "",
), ),

View File

@ -20,9 +20,9 @@ import '../../../../theme-data.dart/form-style.dart';
import '../../../../utils/global.dart'; import '../../../../utils/global.dart';
class QRCodeScannerSettings extends StatefulWidget { class QRCodeScannerSettings extends StatefulWidget {
final int roleId; final RoleIdRoleName roleIdRoleName;
final int userId; final int userId;
const QRCodeScannerSettings({super.key, required this.roleId, required this.userId}); const QRCodeScannerSettings({super.key, required this.roleIdRoleName, required this.userId});
@override @override
State<QRCodeScannerSettings> createState() => _QRCodeScannerSettingsState(); State<QRCodeScannerSettings> createState() => _QRCodeScannerSettingsState();
@ -172,7 +172,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
////STATION ////STATION
Container( Container(
child: state.roleId == 41 child: state.roleIdRoleName.roleName.toLowerCase() == "41"
? DropdownButtonFormField( ? DropdownButtonFormField(
isExpanded: true, isExpanded: true,
validator: FormBuilderValidators validator: FormBuilderValidators
@ -219,7 +219,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
}, },
////BARANGAY ////BARANGAY
) )
: state.roleId == 7 : state.roleIdRoleName.roleName.toLowerCase() == 'barangay nurse'
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment CrossAxisAlignment
@ -270,7 +270,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
) )
: :
////PUROK ////PUROK
state.roleId == 10 state.roleIdRoleName.roleName.toLowerCase() == 'checkpoint in-charge'
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment CrossAxisAlignment
@ -323,7 +323,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
) )
: :
////Registration InCharge ////Registration InCharge
state.roleId == 22 state.roleIdRoleName.roleName.toLowerCase() == 'registration in-charge'
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment CrossAxisAlignment
@ -398,7 +398,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
], ],
) )
: ////QR Code Scanner : ////QR Code Scanner
state.roleId == 13 state.roleIdRoleName.roleName.toLowerCase() == 'qr code scanner'
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment CrossAxisAlignment
@ -469,7 +469,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
) )
: :
////Establishment Point-Person ////Establishment Point-Person
state.roleId == 16 state.roleIdRoleName.roleName.toLowerCase() == 'establishment point-person'
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment CrossAxisAlignment
@ -516,8 +516,8 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
], ],
) )
: ////Office Branch Chief : ////Office Branch Chief
state.roleId == state.roleIdRoleName.roleName.toLowerCase() == 'office/branch chief'
17
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
@ -578,10 +578,6 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
onPressed: () { onPressed: () {
if (_formKey.currentState! if (_formKey.currentState!
.saveAndValidate()) { .saveAndValidate()) {
print(scanMode);
print(_includeOtherInputs);
print(checkerId);
print(assignedArea);
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: MaterialPageRoute(builder:
(BuildContext context) { (BuildContext context) {
@ -595,7 +591,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
entranceExit: scanMode, entranceExit: scanMode,
includeOtherInputs: includeOtherInputs:
_includeOtherInputs, _includeOtherInputs,
roleId: state.roleId)), roleIdRoleName: widget.roleIdRoleName)),
child: const QRCodeScanner(), child: const QRCodeScanner(),
); );
})); }));
@ -615,7 +611,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
return SomethingWentWrong( return SomethingWentWrong(
message: state.message, onpressed: () { message: state.message, onpressed: () {
context.read<PassCheckBloc>().add(GetPassCheckAreas(roleId: widget.roleId, userId: widget.userId)); context.read<PassCheckBloc>().add(GetPassCheckAreas(roleIdRoleName: widget.roleIdRoleName, userId: widget.userId));
}); });
} }
return Container(); return Container();

View File

@ -39,16 +39,16 @@ class AuthService {
Map<String, String> baseHeaders = {'Content-Type': 'application/json'}; Map<String, String> baseHeaders = {'Content-Type': 'application/json'};
Map<dynamic, dynamic> responseStatus = {}; Map<dynamic, dynamic> responseStatus = {};
String path = Url.instance.authentication(); String path = Url.instance.authentication();
// try { try {
http.Response response = await Request.instance http.Response response = await Request.instance
.postRequest(path: path, param: {}, headers: baseHeaders, body: body); .postRequest(path: path, param: {}, headers: baseHeaders, body: body);
Map data = jsonDecode(response.body); Map data = jsonDecode(response.body);
responseStatus = data; responseStatus = data;
return responseStatus; return responseStatus;
// } catch (e) { } catch (e) {
// throw (e.toString()); throw (e.toString());
// } }
} }
Future<Map<dynamic,dynamic>> qrLogin({String? uuid, String? password}) async { Future<Map<dynamic,dynamic>> qrLogin({String? uuid, String? password}) async {

View File

@ -8,6 +8,7 @@ import 'package:unit2/model/roles/pass_check/agency_area_type.dart';
import 'package:unit2/model/roles/pass_check/assign_role_area_type.dart'; import 'package:unit2/model/roles/pass_check/assign_role_area_type.dart';
import 'package:unit2/model/roles/pass_check/barangay_assign_area.dart'; import 'package:unit2/model/roles/pass_check/barangay_assign_area.dart';
import 'package:unit2/model/roles/pass_check/passer_info.dart'; import 'package:unit2/model/roles/pass_check/passer_info.dart';
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard.dart';
import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/global.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:unit2/utils/request.dart'; import 'package:unit2/utils/request.dart';
@ -20,10 +21,10 @@ class PassCheckServices {
static PassCheckServices get instance => _instance; static PassCheckServices get instance => _instance;
Future<List<dynamic>> getPassCheckArea( Future<List<dynamic>> getPassCheckArea(
{required int roleId, required int userId}) async { {required RoleIdRoleName roleIdRoleName, required int userId}) async {
String path = Url.instance.getAssignAreas(); String path = Url.instance.getAssignAreas();
Map<String, String> params = { Map<String, String> params = {
"assigned_role__role__id": roleId.toString(), "assigned_role__role__name__icontains": roleIdRoleName.roleName,
"assigned_role__user__id": userId.toString() "assigned_role__user__id": userId.toString()
}; };
List<dynamic>? statusResponse; List<dynamic>? statusResponse;

View File

@ -67,9 +67,12 @@ class AppRouter {
return BlocProvider( return BlocProvider(
create: (context) => PassCheckBloc() create: (context) => PassCheckBloc()
..add(GetPassCheckAreas( ..add(GetPassCheckAreas(
roleId: arguments.roleId, userId: arguments.userId)), roleIdRoleName: RoleIdRoleName(
roleId: arguments.roleIdRoleName.roleId,
roleName: arguments.roleIdRoleName.roleName),
userId: arguments.userId)),
child: QRCodeScannerSettings( child: QRCodeScannerSettings(
roleId: arguments.roleId, roleIdRoleName: arguments.roleIdRoleName,
userId: arguments.userId, userId: arguments.userId,
), ),
); );

View File

@ -22,20 +22,20 @@ class Request {
response = await get(Uri.https(host, path!, param), headers: headers) response = await get(Uri.https(host, path!, param), headers: headers)
.timeout(Duration(seconds: requestTimeout)); .timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on SocketException catch (_) { } on SocketException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on FormatException catch (_) { } on FormatException catch (_) {
throw const FormatException(formatError); throw const FormatException(formatError);
@ -43,12 +43,12 @@ class Request {
throw const HttpException(httpError); throw const HttpException(httpError);
} on Error catch (e) { } on Error catch (e) {
debugPrint("get request error: $e"); debugPrint("get request error: $e");
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: onError, // msg: onError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (onError); throw (onError);
} }
return response; return response;
@ -65,20 +65,20 @@ class Request {
headers: headers, body: jsonEncode(body)) headers: headers, body: jsonEncode(body))
.timeout(Duration(seconds: requestTimeout)); .timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on SocketException catch (_) { } on SocketException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on FormatException catch (_) { } on FormatException catch (_) {
throw const FormatException(formatError); throw const FormatException(formatError);
@ -86,12 +86,12 @@ class Request {
throw const HttpException(httpError); throw const HttpException(httpError);
} on Error catch (e) { } on Error catch (e) {
debugPrint("post request error: $e"); debugPrint("post request error: $e");
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: onError, // msg: onError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (e.toString()); throw (e.toString());
} }
return response; return response;
@ -107,20 +107,20 @@ class Request {
response = await put(Uri.https(host, path, param), response = await put(Uri.https(host, path, param),
headers: headers, body: jsonEncode(body)); headers: headers, body: jsonEncode(body));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on SocketException catch (_) { } on SocketException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on FormatException catch (_) { } on FormatException catch (_) {
throw const FormatException(formatError); throw const FormatException(formatError);
@ -128,12 +128,12 @@ class Request {
throw const HttpException(httpError); throw const HttpException(httpError);
} on Error catch (e) { } on Error catch (e) {
debugPrint("post request error: $e"); debugPrint("post request error: $e");
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: onError, // msg: onError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (e.toString()); throw (e.toString());
} }
return response; return response;
@ -149,20 +149,20 @@ class Request {
response = await patch( response = await patch(
path: host + path, headers: headers, body: body, param: param); path: host + path, headers: headers, body: body, param: param);
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on SocketException catch (_) { } on SocketException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on FormatException catch (_) { } on FormatException catch (_) {
throw const FormatException(formatError); throw const FormatException(formatError);
@ -170,12 +170,12 @@ class Request {
throw const HttpException(httpError); throw const HttpException(httpError);
} on Error catch (e) { } on Error catch (e) {
debugPrint("post request error: $e"); debugPrint("post request error: $e");
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: onError, // msg: onError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (e.toString()); throw (e.toString());
} }
return response; return response;
@ -192,32 +192,32 @@ class Request {
headers: headers, body: jsonEncode(body)) headers: headers, body: jsonEncode(body))
.timeout(Duration(seconds: requestTimeout)); .timeout(Duration(seconds: requestTimeout));
} on TimeoutException catch (_) { } on TimeoutException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on SocketException catch (_) { } on SocketException catch (_) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: timeoutError, // msg: timeoutError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (timeoutError); throw (timeoutError);
} on FormatException catch (_) { } on FormatException catch (_) {
throw const FormatException(formatError); throw const FormatException(formatError);
} on HttpException catch (_) { } on HttpException catch (_) {
throw const HttpException(httpError); throw const HttpException(httpError);
} on Error catch (e) { } on Error catch (e) {
Fluttertoast.showToast( // Fluttertoast.showToast(
msg: onError, // msg: onError,
toastLength: Toast.LENGTH_LONG, // toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM, // gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.black, // backgroundColor: Colors.black,
); // );
throw (e.toString()); throw (e.toString());
} }
return response; return response;